diff options
author | António Fernandes <antoniof@gnome.org> | 2022-02-11 19:01:36 +0000 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-02-11 19:01:36 +0000 |
commit | da37eeeff2d67fb825350b6ecc2a3dfee13a97af (patch) | |
tree | 77020cd2d9f565c6d90f16af1cdfe7378a35b314 | |
parent | 957810578ed4ffbaa5b2b2c7acc07150345fd91e (diff) | |
download | nautilus-da37eeeff2d67fb825350b6ecc2a3dfee13a97af.tar.gz |
Revert "notebook: Dont override .insert-page()"
This reverts commit 5d5b49a39ae5fff81924b01bc4f1b917a1785527.
-rw-r--r-- | src/nautilus-notebook.c | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/src/nautilus-notebook.c b/src/nautilus-notebook.c index ef75425f2..256c82a58 100644 --- a/src/nautilus-notebook.c +++ b/src/nautilus-notebook.c @@ -37,6 +37,12 @@ #define AFTER_ALL_TABS -1 +static int nautilus_notebook_insert_page (GtkNotebook *notebook, + GtkWidget *child, + GtkWidget *tab_label, + GtkWidget *menu_label, + int position); + struct _NautilusNotebook { GtkNotebook parent_instance; @@ -54,8 +60,11 @@ static void nautilus_notebook_class_init (NautilusNotebookClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkNotebookClass *notebook_class = GTK_NOTEBOOK_CLASS (klass); object_class->dispose = nautilus_notebook_dispose; + + notebook_class->insert_page = nautilus_notebook_insert_page; } static gint @@ -108,18 +117,6 @@ on_page_removed (GtkNotebook *notebook, } static void -on_page_added (GtkNotebook *notebook, - GtkWidget *child, - guint page_num, - gpointer user_data) -{ - gtk_notebook_set_show_tabs (notebook, - gtk_notebook_get_n_pages (notebook) > 1); - gtk_notebook_set_tab_reorderable (notebook, child, TRUE); - gtk_notebook_set_tab_detachable (notebook, child, TRUE); -} - -static void nautilus_notebook_init (NautilusNotebook *notebook) { gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE); @@ -127,7 +124,6 @@ nautilus_notebook_init (NautilusNotebook *notebook) gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE); g_signal_connect (notebook, "page-removed", G_CALLBACK (on_page_removed), NULL); - g_signal_connect (notebook, "page-added", G_CALLBACK (on_page_added), NULL); } gboolean @@ -316,6 +312,29 @@ build_tab_label (NautilusNotebook *notebook, return box; } +static int +nautilus_notebook_insert_page (GtkNotebook *gnotebook, + GtkWidget *tab_widget, + GtkWidget *tab_label, + GtkWidget *menu_label, + int position) +{ + g_assert (GTK_IS_WIDGET (tab_widget)); + + position = GTK_NOTEBOOK_CLASS (nautilus_notebook_parent_class)->insert_page (gnotebook, + tab_widget, + tab_label, + menu_label, + position); + + gtk_notebook_set_show_tabs (gnotebook, + gtk_notebook_get_n_pages (gnotebook) > 1); + gtk_notebook_set_tab_reorderable (gnotebook, tab_widget, TRUE); + gtk_notebook_set_tab_detachable (gnotebook, tab_widget, TRUE); + + return position; +} + int nautilus_notebook_add_tab (NautilusNotebook *notebook, NautilusWindowSlot *slot, |