diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-05-08 11:22:16 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-05-11 22:38:21 -0400 |
commit | a0437628e3a776990bd35a455977f11da6a66c41 (patch) | |
tree | 7ed4d47587620bb7d937b8c812a17130cb56f037 /gtk/gtknotebook.c | |
parent | 0daa1f3daa81682c1d5b3318ae579c193fffd7b1 (diff) | |
download | gtk+-a0437628e3a776990bd35a455977f11da6a66c41.tar.gz |
notebook: Derive from GtkWidget
Diffstat (limited to 'gtk/gtknotebook.c')
-rw-r--r-- | gtk/gtknotebook.c | 66 |
1 files changed, 8 insertions, 58 deletions
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 62ff10a72e..89d3aa43ea 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -180,7 +180,7 @@ typedef struct _GtkNotebookClass GtkNotebookClass; struct _GtkNotebookClass { - GtkContainerClass parent_class; + GtkWidgetClass parent_class; void (* switch_page) (GtkNotebook *notebook, GtkWidget *page, @@ -223,7 +223,7 @@ struct _GtkNotebookClass struct _GtkNotebook { - GtkContainer container; + GtkWidget container; GtkNotebookDragOperation operation; GtkNotebookPage *cur_page; @@ -799,15 +799,8 @@ static gboolean gtk_notebook_drag_drop (GtkDropTarget *dest, double y, GtkNotebook *notebook); -/*** GtkContainer Methods ***/ -static void gtk_notebook_add (GtkContainer *container, +static void gtk_notebook_remove (GtkNotebook *notebook, GtkWidget *widget); -static void gtk_notebook_remove (GtkContainer *container, - GtkWidget *widget); -static GType gtk_notebook_child_type (GtkContainer *container); -static void gtk_notebook_forall (GtkContainer *container, - GtkCallback callback, - gpointer callback_data); /*** GtkNotebook Methods ***/ static gint gtk_notebook_real_insert_page (GtkNotebook *notebook, @@ -923,7 +916,7 @@ static void gtk_notebook_gesture_released (GtkGestureClick *gesture, static guint notebook_signals[LAST_SIGNAL] = { 0 }; -G_DEFINE_TYPE_WITH_CODE (GtkNotebook, gtk_notebook, GTK_TYPE_CONTAINER, +G_DEFINE_TYPE_WITH_CODE (GtkNotebook, gtk_notebook, GTK_TYPE_WIDGET, G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, gtk_notebook_buildable_init)) @@ -1030,7 +1023,6 @@ gtk_notebook_class_init (GtkNotebookClass *class) { GObjectClass *gobject_class = G_OBJECT_CLASS (class); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); - GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class); gobject_class->set_property = gtk_notebook_set_property; gobject_class->get_property = gtk_notebook_get_property; @@ -1046,11 +1038,6 @@ gtk_notebook_class_init (GtkNotebookClass *class) widget_class->set_focus_child = gtk_notebook_set_focus_child; widget_class->compute_expand = gtk_notebook_compute_expand; - container_class->add = gtk_notebook_add; - container_class->remove = gtk_notebook_remove; - container_class->forall = gtk_notebook_forall; - container_class->child_type = gtk_notebook_child_type; - class->switch_page = gtk_notebook_real_switch_page; class->insert_page = gtk_notebook_real_insert_page; @@ -1924,7 +1911,7 @@ gtk_notebook_dispose (GObject *object) GtkNotebookPage *page = l->data; l = l->next; - gtk_notebook_remove (GTK_CONTAINER (notebook), page->child); + gtk_notebook_remove (notebook, page->child); } G_OBJECT_CLASS (gtk_notebook_parent_class)->dispose (object); @@ -3400,26 +3387,14 @@ do_detach_tab (GtkNotebook *from, /* Private GtkContainer Methods : * - * gtk_notebook_add * gtk_notebook_remove * gtk_notebook_focus * gtk_notebook_set_focus_child - * gtk_notebook_child_type - * gtk_notebook_forall */ static void -gtk_notebook_add (GtkContainer *container, - GtkWidget *widget) -{ - gtk_notebook_insert_page_menu (GTK_NOTEBOOK (container), widget, - NULL, NULL, -1); -} - -static void -gtk_notebook_remove (GtkContainer *container, - GtkWidget *widget) +gtk_notebook_remove (GtkNotebook *notebook, + GtkWidget *widget) { - GtkNotebook *notebook = GTK_NOTEBOOK (container); GtkNotebookPage *page; GList *children, *list; gint page_num = 0; @@ -3782,31 +3757,6 @@ gtk_notebook_set_focus_child (GtkWidget *widget, GTK_WIDGET_CLASS (gtk_notebook_parent_class)->set_focus_child (widget, child); } -static void -gtk_notebook_forall (GtkContainer *container, - GtkCallback callback, - gpointer callback_data) -{ - GtkNotebook *notebook = GTK_NOTEBOOK (container); - GList *children; - - children = notebook->children; - while (children) - { - GtkNotebookPage *page; - - page = children->data; - children = children->next; - (* callback) (page->child, callback_data); - } -} - -static GType -gtk_notebook_child_type (GtkContainer *container) -{ - return GTK_TYPE_WIDGET; -} - /* Private GtkNotebook Methods: * * gtk_notebook_real_insert_page @@ -6626,7 +6576,7 @@ gtk_notebook_set_menu_label (GtkNotebook *notebook, if (page->menu_label) { if (notebook->menu) - gtk_widget_destroy (gtk_widget_get_parent (page->menu_label)); + gtk_widget_unparent (gtk_widget_get_parent (page->menu_label)); g_clear_object (&page->menu_label); } |