int main(int argc, char *argv[]) { int c; unsigned int iseed = (unsigned int)time(NULL); srand(iseed); if(argc == 1){ list_all(); return 0; } while (1) { static struct option long_options[] = { {"help", no_argument, NULL, 'h'}, {"add", required_argument, NULL, 'a'}, {"show", required_argument, NULL, 's'}, {"done", required_argument, NULL, 'd'}, {"list", required_argument, NULL, 'l'}, {0, 0, 0, 0} }; int option_index = 0; c = getopt_long(argc, argv, "ha:s:d:l:", long_options, &option_index); if(c == -1) break; switch(c) { case 'h': help(); break; case 'a': add_todo(optarg); break; case 's': list_id(optarg); //todo: fix better casting break; case 'd': remove_todo(optarg); // todo: fix better casting break; case 'l': search(optarg); break; } } return 0; }
static gboolean edit_todo_shortcuts (GtkWidget *widget, GdkEventKey *event, MaintainrProjectbox *item) { if (event->keyval == GDK_KEY_plus) { add_todo (item); return TRUE; } else if (event->keyval == GDK_KEY_minus) { remove_todo (item); return TRUE; } return FALSE; }