/* * Author: Chris Lord * * Copyright (c) 2007 OpenedHand Ltd - http://www.openedhand.com/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include #include #include #include #include "dates.h" static void delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data) { DatesData *data = (DatesData *)user_data; while (data->gtk_stores) { g_object_unref (G_OBJECT (data->gtk_stores->data)); data->gtk_stores = g_list_delete_link (data->gtk_stores, data->gtk_stores); } while (data->views) { g_object_unref (G_OBJECT (data->views->data)); data->views = g_list_delete_link (data->views, data->views); } while (data->stores) { g_object_unref (G_OBJECT (data->stores->data)); data->stores = g_list_delete_link (data->stores, data->stores); } if (data->start) { g_object_unref (data->start); data->start = NULL; } if (data->end) { g_object_unref (data->end); data->end = NULL; } gtk_main_quit (); } int main (int argc, char **argv) { DatesData data; GtkWidget *window; gtk_init (&argc, &argv); data.gtk_stores = NULL; data.views = NULL; data.stores = NULL; data.start = NULL; data.end = NULL; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (G_OBJECT (window), "delete-event", G_CALLBACK (delete_event_cb), &data); gtk_widget_show_all (window); gtk_main (); return 0; }