diff options
Diffstat (limited to 'src/gtkext')
-rw-r--r-- | src/gtkext/gtkdockstation.c | 25 | ||||
-rw-r--r-- | src/gtkext/gtkdockstation.h | 3 |
2 files changed, 27 insertions, 1 deletions
diff --git a/src/gtkext/gtkdockstation.c b/src/gtkext/gtkdockstation.c index 68c8e1d..e087377 100644 --- a/src/gtkext/gtkdockstation.c +++ b/src/gtkext/gtkdockstation.c @@ -64,6 +64,22 @@ G_DEFINE_TYPE(GtkDockStation, gtk_dock_station, GTK_TYPE_VBOX) static void gtk_dock_station_class_init(GtkDockStationClass *class) { + g_signal_new("dock-widget", + GTK_TYPE_DOCK_STATION, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(GtkDockStationClass, dock_widget), + NULL, NULL, + g_cclosure_user_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, GTK_TYPE_WIDGET); + + g_signal_new("undock-widget", + GTK_TYPE_DOCK_STATION, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(GtkDockStationClass, undock_widget), + NULL, NULL, + g_cclosure_user_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, GTK_TYPE_WIDGET); + g_signal_new("switch-widget", GTK_TYPE_DOCK_STATION, G_SIGNAL_RUN_LAST, @@ -238,6 +254,8 @@ void gtk_dock_panel_add_widget(GtkDockStation *station, GtkWidget *widget, const gtk_notebook_set_current_page(station->notebook, -1); + g_signal_emit_by_name(station, "dock-widget", widget); + } @@ -303,12 +321,17 @@ void gtk_dock_panel_change_active_widget(GtkDockStation *station, GtkWidget *wid void gtk_dock_panel_remove_widget(GtkDockStation *station, GtkWidget *widget) { gint index; /* Indice de l'onglet visé */ + gint count; /* Nombre d'onglets en place */ index = gtk_notebook_page_num(station->notebook, widget); gtk_notebook_remove_page(station->notebook, index); - if (gtk_notebook_get_n_pages(station->notebook) == 0) + count = gtk_notebook_get_n_pages(station->notebook); + + gtk_notebook_set_show_tabs(station->notebook, count > 1); + + if (count == 0) gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(GTK_WIDGET(station))), GTK_WIDGET(station)); diff --git a/src/gtkext/gtkdockstation.h b/src/gtkext/gtkdockstation.h index c285dc7..192fdf2 100644 --- a/src/gtkext/gtkdockstation.h +++ b/src/gtkext/gtkdockstation.h @@ -61,6 +61,9 @@ struct _GtkDockStationClass /* Signaux */ + void (* dock_widget) (GtkDockStation *, GtkWidget *); + void (* undock_widget) (GtkDockStation *, GtkWidget *); + void (* switch_widget) (GtkDockStation *, GtkWidget *); }; |