From 193eb5b0dda6edb49fb81dbdd95d09c3a0787b6c Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 21 Jan 2020 03:05:38 +0100 Subject: [PATCH] widget: Remove gtk_widget_get_path() --- docs/reference/gtk/gtk4-sections.txt | 1 - gtk/gtkwidget.c | 95 ---------------------------- gtk/gtkwidget.h | 3 - gtk/gtkwidgetprivate.h | 2 - 4 files changed, 101 deletions(-) diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index c36a4a2b54..7e5cf04421 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -4411,7 +4411,6 @@ gtk_widget_get_layout_manager gtk_widget_should_layout -gtk_widget_get_path gtk_widget_get_style_context gtk_widget_reset_style gtk_widget_class_get_css_name diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 9f37c854f2..fb3cbec94a 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -592,7 +592,6 @@ static void gtk_widget_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void gtk_widget_constructed (GObject *object); static void gtk_widget_dispose (GObject *object); static void gtk_widget_real_destroy (GtkWidget *object); static void gtk_widget_finalize (GObject *object); @@ -718,7 +717,6 @@ static GQuark quark_mnemonic_labels = 0; static GQuark quark_tooltip_markup = 0; static GQuark quark_size_groups = 0; static GQuark quark_auto_children = 0; -static GQuark quark_widget_path = 0; static GQuark quark_action_muxer = 0; static GQuark quark_font_options = 0; static GQuark quark_font_map = 0; @@ -876,12 +874,10 @@ gtk_widget_class_init (GtkWidgetClass *klass) quark_tooltip_markup = g_quark_from_static_string ("gtk-tooltip-markup"); quark_size_groups = g_quark_from_static_string ("gtk-widget-size-groups"); quark_auto_children = g_quark_from_static_string ("gtk-widget-auto-children"); - quark_widget_path = g_quark_from_static_string ("gtk-widget-path"); quark_action_muxer = g_quark_from_static_string ("gtk-widget-action-muxer"); quark_font_options = g_quark_from_static_string ("gtk-widget-font-options"); quark_font_map = g_quark_from_static_string ("gtk-widget-font-map"); - gobject_class->constructed = gtk_widget_constructed; gobject_class->dispose = gtk_widget_dispose; gobject_class->finalize = gtk_widget_finalize; gobject_class->set_property = gtk_widget_set_property; @@ -7461,24 +7457,6 @@ gtk_widget_get_default_direction (void) return gtk_default_direction; } -static void -gtk_widget_constructed (GObject *object) -{ - GtkWidget *widget = GTK_WIDGET (object); - GtkWidgetPath *path; - - /* As strange as it may seem, this may happen on object construction. - * init() implementations of parent types may eventually call this function, - * each with its corresponding GType, which could leave a child - * implementation with a wrong widget type in the widget path - */ - path = (GtkWidgetPath*)g_object_get_qdata (object, quark_widget_path); - if (path && G_OBJECT_TYPE (widget) != gtk_widget_path_get_object_type (path)) - g_object_set_qdata (object, quark_widget_path, NULL); - - G_OBJECT_CLASS (gtk_widget_parent_class)->constructed (object); -} - static void gtk_widget_dispose (GObject *object) { @@ -7700,8 +7678,6 @@ gtk_widget_finalize (GObject *object) g_clear_pointer (&priv->transform, gsk_transform_unref); g_clear_pointer (&priv->allocated_transform, gsk_transform_unref); - gtk_widget_clear_path (widget); - gtk_css_widget_node_widget_destroyed (GTK_CSS_WIDGET_NODE (priv->cssnode)); g_object_unref (priv->cssnode); @@ -11242,77 +11218,6 @@ gtk_widget_path_append_for_widget (GtkWidgetPath *path, return pos; } -GtkWidgetPath * -_gtk_widget_create_path (GtkWidget *widget) -{ - GtkWidget *parent = _gtk_widget_get_parent (widget); - - if (parent) - { - GtkWidgetPath *path = _gtk_widget_create_path (parent); - gtk_widget_path_append_for_widget (path, widget); - return path; - } - else - { - /* Widget is either toplevel or unparented, treat both - * as toplevels style wise, since there are situations - * where style properties might be retrieved on that - * situation. - */ - GtkWidget *attach_widget = NULL; - GtkWidgetPath *result; - - if (GTK_IS_WINDOW (widget)) - attach_widget = gtk_window_get_attached_to (GTK_WINDOW (widget)); - - if (attach_widget != NULL) - result = gtk_widget_path_copy (gtk_widget_get_path (attach_widget)); - else - result = gtk_widget_path_new (); - - gtk_widget_path_append_for_widget (result, widget); - - return result; - } -} - -/** - * gtk_widget_get_path: - * @widget: a #GtkWidget - * - * Returns the #GtkWidgetPath representing @widget, if the widget - * is not connected to a toplevel widget, a partial path will be - * created. - * - * Returns: (transfer none): The #GtkWidgetPath representing @widget - **/ -GtkWidgetPath * -gtk_widget_get_path (GtkWidget *widget) -{ - GtkWidgetPath *path; - - g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); - - path = (GtkWidgetPath*)g_object_get_qdata (G_OBJECT (widget), quark_widget_path); - if (!path) - { - path = _gtk_widget_create_path (widget); - g_object_set_qdata_full (G_OBJECT (widget), - quark_widget_path, - path, - (GDestroyNotify)gtk_widget_path_free); - } - - return path; -} - -void -gtk_widget_clear_path (GtkWidget *widget) -{ - g_object_set_qdata (G_OBJECT (widget), quark_widget_path, NULL); -} - /** * gtk_widget_class_set_css_name: * @widget_class: class to set the name on diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index fc1221fc81..1719f59487 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -764,9 +764,6 @@ gboolean gtk_widget_in_destruction (GtkWidget *widget); GDK_AVAILABLE_IN_ALL GtkStyleContext * gtk_widget_get_style_context (GtkWidget *widget); -GDK_AVAILABLE_IN_ALL -GtkWidgetPath * gtk_widget_get_path (GtkWidget *widget); - GDK_AVAILABLE_IN_ALL void gtk_widget_class_set_css_name (GtkWidgetClass *widget_class, const char *name); diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h index a9c2233169..415b75e7f5 100644 --- a/gtk/gtkwidgetprivate.h +++ b/gtk/gtkwidgetprivate.h @@ -278,8 +278,6 @@ GtkStyleContext * _gtk_widget_peek_style_context (GtkWidget *widget); gboolean _gtk_widget_captured_event (GtkWidget *widget, GdkEvent *event); -GtkWidgetPath * _gtk_widget_create_path (GtkWidget *widget); -void gtk_widget_clear_path (GtkWidget *widget); void _gtk_widget_style_context_invalidated (GtkWidget *widget); void _gtk_widget_update_parent_muxer (GtkWidget *widget);