pass app instance to signal handlers

This commit is contained in:
Brandon Lewis 2010-07-20 17:59:59 +02:00 committed by Edward Hervey
parent 789859cbc4
commit c74b51f9b2

View file

@ -13,36 +13,36 @@ App *app_new (void);
void app_dispose (App * app); void app_dispose (App * app);
void window_destroy_cb (GtkObject * window, gpointer user); void window_destroy_cb (GtkObject * window, App * app);
void quit_item_activate_cb (GtkMenuItem * item, gpointer user); void quit_item_activate_cb (GtkMenuItem * item, App * app);
void delete_item_activate_cb (GtkMenuItem * item, gpointer user); void delete_item_activate_cb (GtkMenuItem * item, App * app);
void add_file_item_activate_cb (GtkMenuItem * item, gpointer user); void add_file_item_activate_cb (GtkMenuItem * item, App * app);
GtkWidget *create_ui (App * app); GtkWidget *create_ui (App * app);
void void
window_destroy_cb (GtkObject * window, gpointer user) window_destroy_cb (GtkObject * window, App * app)
{ {
gtk_main_quit (); gtk_main_quit ();
} }
void void
quit_item_activate_cb (GtkMenuItem * item, gpointer user) quit_item_activate_cb (GtkMenuItem * item, App * app)
{ {
gtk_main_quit (); gtk_main_quit ();
} }
void void
delete_item_activate_cb (GtkMenuItem * item, gpointer user) delete_item_activate_cb (GtkMenuItem * item, App * app)
{ {
g_print ("beleted!"); g_print ("beleted!");
} }
void void
add_file_item_activate_cb (GtkMenuItem * item, gpointer user) add_file_item_activate_cb (GtkMenuItem * item, App * app)
{ {
g_print ("add file"); g_print ("add file");
} }
@ -93,7 +93,7 @@ app_dispose (App * app)
} }
GtkWidget * GtkWidget *
create_ui (App * data) create_ui (App * app)
{ {
GtkBuilder *builder; GtkBuilder *builder;
GtkWidget *window; GtkWidget *window;
@ -101,7 +101,7 @@ create_ui (App * data)
builder = gtk_builder_new (); builder = gtk_builder_new ();
gtk_builder_add_from_file (builder, "ges-ui.glade", NULL); gtk_builder_add_from_file (builder, "ges-ui.glade", NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window")); window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_builder_connect_signals (builder, NULL); gtk_builder_connect_signals (builder, app);
g_object_unref (G_OBJECT (builder)); g_object_unref (G_OBJECT (builder));
gtk_widget_show (window); gtk_widget_show (window);