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)
GTK_TYPE_COLOR_BUTTON,
GtkColorButtonPrivate);
gtk_widget_push_composite_child ();
button->priv->draw_area = gtk_drawing_area_new ();
layout = gtk_widget_create_pango_layout (GTK_WIDGET (button), "Black");
pango_layout_get_pixel_extents (layout, NULL, &rect);
......@@ -470,8 +468,6 @@ gtk_color_button_init (GtkColorButton *button)
G_CALLBACK (gtk_color_button_drag_data_received), button);
g_signal_connect (button, "drag-data-get",
G_CALLBACK (gtk_color_button_drag_data_get), button);
gtk_widget_pop_composite_child ();
}
static void
......
......@@ -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 (a_adj, "value-changed", G_CALLBACK (hsv_changed), editor);
gtk_widget_push_composite_child ();
/* Construct the main UI */
editor->priv->swatch = swatch = gtk_color_swatch_new ();
gtk_color_swatch_set_selectable (GTK_COLOR_SWATCH (editor->priv->swatch), FALSE);
......@@ -511,8 +509,6 @@ gtk_color_editor_init (GtkColorEditor *editor)
gtk_widget_show_all (editor->priv->overlay);
gtk_container_add (GTK_CONTAINER (editor), editor->priv->overlay);
gtk_widget_pop_composite_child ();
}
static void
......
......@@ -482,8 +482,6 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button)
priv->icon_size = FALLBACK_ICON_SIZE;
priv->focus_on_click = TRUE;
gtk_widget_push_composite_child ();
/* Button */
priv->button = gtk_button_new ();
g_signal_connect (priv->button, "clicked",
......@@ -552,8 +550,6 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button)
priv->name_cell, name_cell_data_func,
NULL, NULL);
gtk_widget_pop_composite_child ();
/* DnD */
gtk_drag_dest_set (GTK_WIDGET (button),
(GTK_DEST_DEFAULT_ALL),
......
......@@ -117,8 +117,6 @@ gtk_file_chooser_widget_constructor (GType type,
construct_params);
priv = GTK_FILE_CHOOSER_WIDGET_GET_PRIVATE (object);
gtk_widget_push_composite_child ();
priv->impl = _gtk_file_chooser_default_new ();
gtk_box_pack_start (GTK_BOX (object), priv->impl, TRUE, TRUE, 0);
......@@ -130,8 +128,6 @@ gtk_file_chooser_widget_constructor (GType type,
_gtk_file_chooser_embed_set_delegate (GTK_FILE_CHOOSER_EMBED (object),
GTK_FILE_CHOOSER_EMBED (priv->impl));
gtk_widget_pop_composite_child ();
return object;
}
......
......@@ -1114,7 +1114,6 @@ gtk_font_button_create_inside (GtkFontButton *font_button)
{
GtkWidget *widget;
gtk_widget_push_composite_child ();
widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
......@@ -1132,8 +1131,6 @@ gtk_font_button_create_inside (GtkFontButton *font_button)
gtk_widget_show_all (widget);
gtk_widget_pop_composite_child ();
return widget;
}
......
......@@ -151,8 +151,6 @@ get_slider_button (GtkPathBar *path_bar,
GtkWidget *button;
AtkObject *atk_obj;
gtk_widget_push_composite_child ();
button = gtk_button_new ();
atk_obj = gtk_widget_get_accessible (button);
if (arrow_type == GTK_ARROW_LEFT)
......@@ -170,8 +168,6 @@ get_slider_button (GtkPathBar *path_bar,
g_signal_connect (G_OBJECT (button), "unmap",
G_CALLBACK (on_slider_unmap), path_bar);
gtk_widget_pop_composite_child ();
return button;
}
......@@ -1835,11 +1831,9 @@ gtk_path_bar_get_info_callback (GCancellable *cancellable,
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);
gtk_widget_push_composite_child ();
button_data = make_directory_button (file_info->path_bar, display_name,
file_info->file,
file_info->first_directory, is_hidden);
gtk_widget_pop_composite_child ();
g_object_unref (file_info->file);
file_info->new_buttons = g_list_prepend (file_info->new_buttons, button_data);
......
......@@ -199,8 +199,6 @@ gtk_recent_chooser_dialog_constructor (GType type,
construct_params);
priv = GTK_RECENT_CHOOSER_DIALOG_GET_PRIVATE (object);
gtk_widget_push_composite_child ();
if (priv->manager)
priv->chooser = g_object_new (GTK_TYPE_RECENT_CHOOSER_WIDGET,
"recent-manager", priv->manager,
......@@ -222,8 +220,6 @@ gtk_recent_chooser_dialog_constructor (GType type,
_gtk_recent_chooser_set_delegate (GTK_RECENT_CHOOSER (object),
GTK_RECENT_CHOOSER (priv->chooser));
gtk_widget_pop_composite_child ();
return object;
}
......
......@@ -660,10 +660,7 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
if (!priv->hscrollbar)
{
gtk_widget_push_composite_child ();
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));
g_object_ref (priv->hscrollbar);
......@@ -728,10 +725,7 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
if (!priv->vscrollbar)
{
gtk_widget_push_composite_child ();
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));
g_object_ref (priv->vscrollbar);
......
......@@ -396,11 +396,7 @@ gtk_tool_item_group_init (GtkToolItemGroup *group)
gtk_container_add (GTK_CONTAINER (alignment), priv->label_widget);
gtk_widget_show_all (alignment);
gtk_widget_push_composite_child ();
priv->header = gtk_button_new ();
gtk_widget_set_composite_name (priv->header, "header");
gtk_widget_pop_composite_child ();
g_object_ref_sink (priv->header);
gtk_button_set_focus_on_click (GTK_BUTTON (priv->header), FALSE);
gtk_container_add (GTK_CONTAINER (priv->header), alignment);
......
......@@ -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 (priv->button == NULL);
gtk_widget_push_composite_child ();
priv->button = gtk_button_new ();
if (priv->visible)
gtk_widget_show (priv->button);
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. */
if (_gtk_tree_view_get_header_window (tree_view))
......
......@@ -10500,6 +10500,8 @@ static GQuark quark_composite_name = 0;
*
* Sets a widgets composite name. The widget must be
* 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
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
* a composite child. The string should be freed when it is no
* longer needed.
*
* Deprecated: 3.10: Use gtk_widget_class_set_template(), or don't use this API at all.
**/
gchar*
gtk_widget_get_composite_name (GtkWidget *widget)
......@@ -10566,6 +10570,9 @@ gtk_widget_get_composite_name (GtkWidget *widget)
* GTK_WIDGET (scrolled_window));
* 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
gtk_widget_push_composite_child (void)
......@@ -10577,6 +10584,8 @@ gtk_widget_push_composite_child (void)
* gtk_widget_pop_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
gtk_widget_pop_composite_child (void)
......
......@@ -830,15 +830,19 @@ GdkPixbuf *gtk_widget_render_icon_pixbuf (GtkWidget *widget,
/* handle composite names for GTK_COMPOSITE_CHILD widgets,
* 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,
const gchar *name);
GDK_DEPRECATED_IN_3_10_FOR(gtk_widget_class_set_template)
gchar* gtk_widget_get_composite_name (GtkWidget *widget);
/* Push/pop pairs, to change default values upon a widget's creation.
* This will override the values that got set by the
* gtk_widget_set_default_* () functions.
*/
GDK_DEPRECATED_IN_3_10_FOR(gtk_widget_class_set_template)
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);
/* 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