8 static int sortfn(const void *_a, const void *_b)
10 const struct dive *a = *(void **)_a;
11 const struct dive *b = *(void **)_b;
13 if (a->when < b->when)
15 if (a->when > b->when)
21 * This doesn't really report anything at all. We just sort the
22 * dives, the GUI does the reporting
24 static void report_dives(void)
26 qsort(dive_table.dives, dive_table.nr, sizeof(struct dive *), sortfn);
29 static void parse_argument(const char *arg)
31 const char *p = arg+1;
39 fprintf(stderr, "Bad argument '%s'\n", arg);
45 static void on_destroy(GtkWidget* w, gpointer data)
50 int main(int argc, char **argv)
60 gtk_init(&argc, &argv);
62 for (i = 1; i < argc; i++) {
63 const char *a = argv[i];
74 win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
75 g_signal_connect(G_OBJECT(win), "destroy", G_CALLBACK(on_destroy), NULL);
77 /* HBOX for the list of dives and cairo window */
78 vbox=gtk_hbox_new(FALSE, 5);
79 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
80 gtk_container_add(GTK_CONTAINER(win), vbox);
81 gtk_widget_show(vbox);
83 /* Create the atual divelist */
84 divelist = create_dive_list();
85 gtk_container_add(GTK_CONTAINER(vbox), divelist);
87 /* Frame for dive profile */
88 frame = dive_profile_frame();
89 gtk_container_add(GTK_CONTAINER(vbox), frame);
91 gtk_widget_set_app_paintable(win, TRUE);
92 gtk_widget_show_all(win);