Commit c6ab5157 authored by Tristan Van Berkom's avatar Tristan Van Berkom

Deprecate gtk_widget_push_composite_child & friends

Deprecate gtk_widget_push_composite_child, gtk_widget_pop_composite_child,
gtk_widget_set_composite_name, gtk_widget_get_composite_name.

This API is just bloat and was never useful, this patch deprecates
it and removes all internal calls to the composite child APIs
parent 38dc4733
...@@ -431,8 +431,6 @@ gtk_color_button_init (GtkColorButton *button) ...@@ -431,8 +431,6 @@ gtk_color_button_init (GtkColorButton *button)
GTK_TYPE_COLOR_BUTTON, GTK_TYPE_COLOR_BUTTON,
GtkColorButtonPrivate); GtkColorButtonPrivate);
gtk_widget_push_composite_child ();
button->priv->draw_area = gtk_drawing_area_new (); button->priv->draw_area = gtk_drawing_area_new ();
layout = gtk_widget_create_pango_layout (GTK_WIDGET (button), "Black"); layout = gtk_widget_create_pango_layout (GTK_WIDGET (button), "Black");
pango_layout_get_pixel_extents (layout, NULL, &rect); pango_layout_get_pixel_extents (layout, NULL, &rect);
...@@ -470,8 +468,6 @@ gtk_color_button_init (GtkColorButton *button) ...@@ -470,8 +468,6 @@ gtk_color_button_init (GtkColorButton *button)
G_CALLBACK (gtk_color_button_drag_data_received), button); G_CALLBACK (gtk_color_button_drag_data_received), button);
g_signal_connect (button, "drag-data-get", g_signal_connect (button, "drag-data-get",
G_CALLBACK (gtk_color_button_drag_data_get), button); G_CALLBACK (gtk_color_button_drag_data_get), button);
gtk_widget_pop_composite_child ();
} }
static void static void
......
...@@ -394,8 +394,6 @@ gtk_color_editor_init (GtkColorEditor *editor) ...@@ -394,8 +394,6 @@ gtk_color_editor_init (GtkColorEditor *editor)
g_signal_connect_swapped (v_adj, "value-changed", G_CALLBACK (hsv_changed), editor); g_signal_connect_swapped (v_adj, "value-changed", G_CALLBACK (hsv_changed), editor);
g_signal_connect_swapped (a_adj, "value-changed", G_CALLBACK (hsv_changed), editor); g_signal_connect_swapped (a_adj, "value-changed", G_CALLBACK (hsv_changed), editor);
gtk_widget_push_composite_child ();
/* Construct the main UI */ /* Construct the main UI */
editor->priv->swatch = swatch = gtk_color_swatch_new (); editor->priv->swatch = swatch = gtk_color_swatch_new ();
gtk_color_swatch_set_selectable (GTK_COLOR_SWATCH (editor->priv->swatch), FALSE); gtk_color_swatch_set_selectable (GTK_COLOR_SWATCH (editor->priv->swatch), FALSE);
...@@ -511,8 +509,6 @@ gtk_color_editor_init (GtkColorEditor *editor) ...@@ -511,8 +509,6 @@ gtk_color_editor_init (GtkColorEditor *editor)
gtk_widget_show_all (editor->priv->overlay); gtk_widget_show_all (editor->priv->overlay);
gtk_container_add (GTK_CONTAINER (editor), editor->priv->overlay); gtk_container_add (GTK_CONTAINER (editor), editor->priv->overlay);
gtk_widget_pop_composite_child ();
} }
static void static void
......
...@@ -482,8 +482,6 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button) ...@@ -482,8 +482,6 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button)
priv->icon_size = FALLBACK_ICON_SIZE; priv->icon_size = FALLBACK_ICON_SIZE;
priv->focus_on_click = TRUE; priv->focus_on_click = TRUE;
gtk_widget_push_composite_child ();
/* Button */ /* Button */
priv->button = gtk_button_new (); priv->button = gtk_button_new ();
g_signal_connect (priv->button, "clicked", g_signal_connect (priv->button, "clicked",
...@@ -552,8 +550,6 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button) ...@@ -552,8 +550,6 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button)
priv->name_cell, name_cell_data_func, priv->name_cell, name_cell_data_func,
NULL, NULL); NULL, NULL);
gtk_widget_pop_composite_child ();
/* DnD */ /* DnD */
gtk_drag_dest_set (GTK_WIDGET (button), gtk_drag_dest_set (GTK_WIDGET (button),
(GTK_DEST_DEFAULT_ALL), (GTK_DEST_DEFAULT_ALL),
......
...@@ -117,8 +117,6 @@ gtk_file_chooser_widget_constructor (GType type, ...@@ -117,8 +117,6 @@ gtk_file_chooser_widget_constructor (GType type,
construct_params); construct_params);
priv = GTK_FILE_CHOOSER_WIDGET_GET_PRIVATE (object); priv = GTK_FILE_CHOOSER_WIDGET_GET_PRIVATE (object);
gtk_widget_push_composite_child ();
priv->impl = _gtk_file_chooser_default_new (); priv->impl = _gtk_file_chooser_default_new ();
gtk_box_pack_start (GTK_BOX (object), priv->impl, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (object), priv->impl, TRUE, TRUE, 0);
...@@ -129,8 +127,6 @@ gtk_file_chooser_widget_constructor (GType type, ...@@ -129,8 +127,6 @@ gtk_file_chooser_widget_constructor (GType type,
_gtk_file_chooser_embed_set_delegate (GTK_FILE_CHOOSER_EMBED (object), _gtk_file_chooser_embed_set_delegate (GTK_FILE_CHOOSER_EMBED (object),
GTK_FILE_CHOOSER_EMBED (priv->impl)); GTK_FILE_CHOOSER_EMBED (priv->impl));
gtk_widget_pop_composite_child ();
return object; return object;
} }
......
...@@ -1114,7 +1114,6 @@ gtk_font_button_create_inside (GtkFontButton *font_button) ...@@ -1114,7 +1114,6 @@ gtk_font_button_create_inside (GtkFontButton *font_button)
{ {
GtkWidget *widget; GtkWidget *widget;
gtk_widget_push_composite_child ();
widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
...@@ -1132,8 +1131,6 @@ gtk_font_button_create_inside (GtkFontButton *font_button) ...@@ -1132,8 +1131,6 @@ gtk_font_button_create_inside (GtkFontButton *font_button)
gtk_widget_show_all (widget); gtk_widget_show_all (widget);
gtk_widget_pop_composite_child ();
return widget; return widget;
} }
......
...@@ -151,8 +151,6 @@ get_slider_button (GtkPathBar *path_bar, ...@@ -151,8 +151,6 @@ get_slider_button (GtkPathBar *path_bar,
GtkWidget *button; GtkWidget *button;
AtkObject *atk_obj; AtkObject *atk_obj;
gtk_widget_push_composite_child ();
button = gtk_button_new (); button = gtk_button_new ();
atk_obj = gtk_widget_get_accessible (button); atk_obj = gtk_widget_get_accessible (button);
if (arrow_type == GTK_ARROW_LEFT) if (arrow_type == GTK_ARROW_LEFT)
...@@ -170,8 +168,6 @@ get_slider_button (GtkPathBar *path_bar, ...@@ -170,8 +168,6 @@ get_slider_button (GtkPathBar *path_bar,
g_signal_connect (G_OBJECT (button), "unmap", g_signal_connect (G_OBJECT (button), "unmap",
G_CALLBACK (on_slider_unmap), path_bar); G_CALLBACK (on_slider_unmap), path_bar);
gtk_widget_pop_composite_child ();
return button; return button;
} }
...@@ -1835,11 +1831,9 @@ gtk_path_bar_get_info_callback (GCancellable *cancellable, ...@@ -1835,11 +1831,9 @@ gtk_path_bar_get_info_callback (GCancellable *cancellable,
display_name = g_file_info_get_display_name (info); display_name = g_file_info_get_display_name (info);
is_hidden = g_file_info_get_is_hidden (info) || g_file_info_get_is_backup (info); is_hidden = g_file_info_get_is_hidden (info) || g_file_info_get_is_backup (info);
gtk_widget_push_composite_child ();
button_data = make_directory_button (file_info->path_bar, display_name, button_data = make_directory_button (file_info->path_bar, display_name,
file_info->file, file_info->file,
file_info->first_directory, is_hidden); file_info->first_directory, is_hidden);
gtk_widget_pop_composite_child ();
g_object_unref (file_info->file); g_object_unref (file_info->file);
file_info->new_buttons = g_list_prepend (file_info->new_buttons, button_data); file_info->new_buttons = g_list_prepend (file_info->new_buttons, button_data);
......
...@@ -199,8 +199,6 @@ gtk_recent_chooser_dialog_constructor (GType type, ...@@ -199,8 +199,6 @@ gtk_recent_chooser_dialog_constructor (GType type,
construct_params); construct_params);
priv = GTK_RECENT_CHOOSER_DIALOG_GET_PRIVATE (object); priv = GTK_RECENT_CHOOSER_DIALOG_GET_PRIVATE (object);
gtk_widget_push_composite_child ();
if (priv->manager) if (priv->manager)
priv->chooser = g_object_new (GTK_TYPE_RECENT_CHOOSER_WIDGET, priv->chooser = g_object_new (GTK_TYPE_RECENT_CHOOSER_WIDGET,
"recent-manager", priv->manager, "recent-manager", priv->manager,
...@@ -222,8 +220,6 @@ gtk_recent_chooser_dialog_constructor (GType type, ...@@ -222,8 +220,6 @@ gtk_recent_chooser_dialog_constructor (GType type,
_gtk_recent_chooser_set_delegate (GTK_RECENT_CHOOSER (object), _gtk_recent_chooser_set_delegate (GTK_RECENT_CHOOSER (object),
GTK_RECENT_CHOOSER (priv->chooser)); GTK_RECENT_CHOOSER (priv->chooser));
gtk_widget_pop_composite_child ();
return object; return object;
} }
......
...@@ -660,10 +660,7 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window, ...@@ -660,10 +660,7 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
if (!priv->hscrollbar) if (!priv->hscrollbar)
{ {
gtk_widget_push_composite_child ();
priv->hscrollbar = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, hadjustment); priv->hscrollbar = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, hadjustment);
gtk_widget_set_composite_name (priv->hscrollbar, "hscrollbar");
gtk_widget_pop_composite_child ();
gtk_widget_set_parent (priv->hscrollbar, GTK_WIDGET (scrolled_window)); gtk_widget_set_parent (priv->hscrollbar, GTK_WIDGET (scrolled_window));
g_object_ref (priv->hscrollbar); g_object_ref (priv->hscrollbar);
...@@ -728,10 +725,7 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window, ...@@ -728,10 +725,7 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
if (!priv->vscrollbar) if (!priv->vscrollbar)
{ {
gtk_widget_push_composite_child ();
priv->vscrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, vadjustment); priv->vscrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, vadjustment);
gtk_widget_set_composite_name (priv->vscrollbar, "vscrollbar");
gtk_widget_pop_composite_child ();
gtk_widget_set_parent (priv->vscrollbar, GTK_WIDGET (scrolled_window)); gtk_widget_set_parent (priv->vscrollbar, GTK_WIDGET (scrolled_window));
g_object_ref (priv->vscrollbar); g_object_ref (priv->vscrollbar);
......
...@@ -396,11 +396,7 @@ gtk_tool_item_group_init (GtkToolItemGroup *group) ...@@ -396,11 +396,7 @@ gtk_tool_item_group_init (GtkToolItemGroup *group)
gtk_container_add (GTK_CONTAINER (alignment), priv->label_widget); gtk_container_add (GTK_CONTAINER (alignment), priv->label_widget);
gtk_widget_show_all (alignment); gtk_widget_show_all (alignment);
gtk_widget_push_composite_child ();
priv->header = gtk_button_new (); priv->header = gtk_button_new ();
gtk_widget_set_composite_name (priv->header, "header");
gtk_widget_pop_composite_child ();
g_object_ref_sink (priv->header); g_object_ref_sink (priv->header);
gtk_button_set_focus_on_click (GTK_BUTTON (priv->header), FALSE); gtk_button_set_focus_on_click (GTK_BUTTON (priv->header), FALSE);
gtk_container_add (GTK_CONTAINER (priv->header), alignment); gtk_container_add (GTK_CONTAINER (priv->header), alignment);
......
...@@ -853,12 +853,10 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column) ...@@ -853,12 +853,10 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column)
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view)); g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (priv->button == NULL); g_return_if_fail (priv->button == NULL);
gtk_widget_push_composite_child ();
priv->button = gtk_button_new (); priv->button = gtk_button_new ();
if (priv->visible) if (priv->visible)
gtk_widget_show (priv->button); gtk_widget_show (priv->button);
gtk_widget_add_events (priv->button, GDK_POINTER_MOTION_MASK); gtk_widget_add_events (priv->button, GDK_POINTER_MOTION_MASK);
gtk_widget_pop_composite_child ();
/* make sure we own a reference to it as well. */ /* make sure we own a reference to it as well. */
if (_gtk_tree_view_get_header_window (tree_view)) if (_gtk_tree_view_get_header_window (tree_view))
......
...@@ -10500,6 +10500,8 @@ static GQuark quark_composite_name = 0; ...@@ -10500,6 +10500,8 @@ static GQuark quark_composite_name = 0;
* *
* Sets a widgets composite name. The widget must be * Sets a widgets composite name. The widget must be
* a composite child of its parent; see gtk_widget_push_composite_child(). * a composite child of its parent; see gtk_widget_push_composite_child().
*
* Deprecated: 3.10: Use gtk_widget_class_set_template(), or don't use this API at all.
**/ **/
void void
gtk_widget_set_composite_name (GtkWidget *widget, gtk_widget_set_composite_name (GtkWidget *widget,
...@@ -10527,6 +10529,8 @@ gtk_widget_set_composite_name (GtkWidget *widget, ...@@ -10527,6 +10529,8 @@ gtk_widget_set_composite_name (GtkWidget *widget,
* Returns: the composite name of @widget, or %NULL if @widget is not * Returns: the composite name of @widget, or %NULL if @widget is not
* a composite child. The string should be freed when it is no * a composite child. The string should be freed when it is no
* longer needed. * longer needed.
*
* Deprecated: 3.10: Use gtk_widget_class_set_template(), or don't use this API at all.
**/ **/
gchar* gchar*
gtk_widget_get_composite_name (GtkWidget *widget) gtk_widget_get_composite_name (GtkWidget *widget)
...@@ -10566,6 +10570,9 @@ gtk_widget_get_composite_name (GtkWidget *widget) ...@@ -10566,6 +10570,9 @@ gtk_widget_get_composite_name (GtkWidget *widget)
* GTK_WIDGET (scrolled_window)); * GTK_WIDGET (scrolled_window));
* g_object_ref (scrolled_window->hscrollbar); * g_object_ref (scrolled_window->hscrollbar);
* ]| * ]|
*
* Deprecated: 3.10: This API never really worked well and was mostly unused, now
* we have a more complete mechanism for composite children, see gtk_widget_class_set_template().
**/ **/
void void
gtk_widget_push_composite_child (void) gtk_widget_push_composite_child (void)
...@@ -10577,6 +10584,8 @@ gtk_widget_push_composite_child (void) ...@@ -10577,6 +10584,8 @@ gtk_widget_push_composite_child (void)
* gtk_widget_pop_composite_child: * gtk_widget_pop_composite_child:
* *
* Cancels the effect of a previous call to gtk_widget_push_composite_child(). * Cancels the effect of a previous call to gtk_widget_push_composite_child().
*
* Deprecated: 3.10: Use gtk_widget_class_set_template(), or don't use this API at all.
**/ **/
void void
gtk_widget_pop_composite_child (void) gtk_widget_pop_composite_child (void)
......
...@@ -830,15 +830,19 @@ GdkPixbuf *gtk_widget_render_icon_pixbuf (GtkWidget *widget, ...@@ -830,15 +830,19 @@ GdkPixbuf *gtk_widget_render_icon_pixbuf (GtkWidget *widget,
/* handle composite names for GTK_COMPOSITE_CHILD widgets, /* handle composite names for GTK_COMPOSITE_CHILD widgets,
* the returned name is newly allocated. * the returned name is newly allocated.
*/ */
GDK_DEPRECATED_IN_3_10_FOR(gtk_widget_class_set_template)
void gtk_widget_set_composite_name (GtkWidget *widget, void gtk_widget_set_composite_name (GtkWidget *widget,
const gchar *name); const gchar *name);
GDK_DEPRECATED_IN_3_10_FOR(gtk_widget_class_set_template)
gchar* gtk_widget_get_composite_name (GtkWidget *widget); gchar* gtk_widget_get_composite_name (GtkWidget *widget);
/* Push/pop pairs, to change default values upon a widget's creation. /* Push/pop pairs, to change default values upon a widget's creation.
* This will override the values that got set by the * This will override the values that got set by the
* gtk_widget_set_default_* () functions. * gtk_widget_set_default_* () functions.
*/ */
GDK_DEPRECATED_IN_3_10_FOR(gtk_widget_class_set_template)
void gtk_widget_push_composite_child (void); void gtk_widget_push_composite_child (void);
GDK_DEPRECATED_IN_3_10_FOR(gtk_widget_class_set_template)
void gtk_widget_pop_composite_child (void); void gtk_widget_pop_composite_child (void);
/* widget style properties /* widget style properties
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment