diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-03-11 23:55:50 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-03-11 23:55:50 (GMT) |
commit | 491e9837f33831f94747a6063f709ba2c5d2703e (patch) | |
tree | 5878c875e308307849d75e85140ef1e71c94b7d4 /src/gtkext/gtkdockstation.c | |
parent | dc8a2b19dbb32bfe49b1ff6640cc609238b392ca (diff) |
Handled user actions on the dock station buttons.
Diffstat (limited to 'src/gtkext/gtkdockstation.c')
-rw-r--r-- | src/gtkext/gtkdockstation.c | 65 |
1 files changed, 63 insertions, 2 deletions
diff --git a/src/gtkext/gtkdockstation.c b/src/gtkext/gtkdockstation.c index 35006ef..1672d5e 100644 --- a/src/gtkext/gtkdockstation.c +++ b/src/gtkext/gtkdockstation.c @@ -50,6 +50,11 @@ static gboolean gtk_dock_station_switch_panel(GtkNotebook *, gpointer *, guint, /* Révèle ou cache la zone de recherches. */ static void on_toggle_revealer(GtkToggleButton *, GtkDockStation *); +/* Demande l'apparition d'un menu pour inclure des composants. */ +static void on_click_for_menu(GtkButton *, GtkDockStation *); + +/* Demande la disparition du composant courant. */ +static void on_click_for_close(GtkButton *, GtkDockStation *); @@ -98,6 +103,22 @@ static void gtk_dock_station_class_init(GtkDockStationClass *class) g_cclosure_user_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GTK_TYPE_WIDGET); + g_signal_new("menu-requested", + GTK_TYPE_DOCK_STATION, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(GtkDockStationClass, menu_requested), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, GTK_TYPE_WIDGET); + + g_signal_new("close-requested", + GTK_TYPE_DOCK_STATION, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(GtkDockStationClass, close_requested), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, GTK_TYPE_WIDGET); + } @@ -139,13 +160,13 @@ static void gtk_dock_station_init(GtkDockStation *station) button = qck_create_button_with_named_img(G_OBJECT(station), "menu", "go-down-symbolic", GTK_ICON_SIZE_MENU, NULL, - G_CALLBACK(NULL), station); + G_CALLBACK(on_click_for_menu), station); gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); button = qck_create_button_with_named_img(G_OBJECT(station), "close", "window-close-symbolic", GTK_ICON_SIZE_MENU, NULL, - G_CALLBACK(NULL), station); + G_CALLBACK(on_click_for_close), station); gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); @@ -470,3 +491,43 @@ static void on_toggle_revealer(GtkToggleButton *button, GtkDockStation *station) gtk_dockable_toggle_revealer(dockable, widget, gtk_toggle_button_get_active(button)); } + + +/****************************************************************************** +* * +* Paramètres : button = bouton à l'origine de la procédure. * +* station = station d'accueil pour différents composants. * +* * +* Description : Demande l'apparition d'un menu pour inclure des composants. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void on_click_for_menu(GtkButton *button, GtkDockStation *station) +{ + g_signal_emit_by_name(station, "menu-requested", button); + +} + + +/****************************************************************************** +* * +* Paramètres : button = bouton à l'origine de la procédure. * +* station = station d'accueil pour différents composants. * +* * +* Description : Demande la disparition du composant courant. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void on_click_for_close(GtkButton *button, GtkDockStation *station) +{ + g_signal_emit_by_name(station, "close-requested", button); + +} |