[gtk+/composite-templates-new: 2/30] Deprecate gtk_widget_push_composite_child & friends



commit 7ac1fb365fbd08b53333390594e5fc423201d420
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Fri Mar 29 16:52:28 2013 +0900

    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

 gtk/gtkcolorbutton.c         |    4 ----
 gtk/gtkcoloreditor.c         |    4 ----
 gtk/gtkfilechooserbutton.c   |    4 ----
 gtk/gtkfilechooserwidget.c   |    4 ----
 gtk/gtkfontbutton.c          |    3 ---
 gtk/gtkpathbar.c             |    6 ------
 gtk/gtkrecentchooserdialog.c |    4 ----
 gtk/gtkscrolledwindow.c      |    6 ------
 gtk/gtktoolitemgroup.c       |    4 ----
 gtk/gtktreeviewcolumn.c      |    2 --
 gtk/gtkwidget.c              |    9 +++++++++
 gtk/gtkwidget.h              |    4 ++++
 12 files changed, 13 insertions(+), 41 deletions(-)
---
diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c
index 52c1ec5..f607bf5 100644
--- a/gtk/gtkcolorbutton.c
+++ b/gtk/gtkcolorbutton.c
@@ -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
diff --git a/gtk/gtkcoloreditor.c b/gtk/gtkcoloreditor.c
index 8cbbf21..de522c6 100644
--- a/gtk/gtkcoloreditor.c
+++ b/gtk/gtkcoloreditor.c
@@ -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
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index 05c6a8b..a2c37c8 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -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),
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 27ef3f6..011fe6a 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -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);
@@ -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 (priv->impl));
-  
-  gtk_widget_pop_composite_child ();
 
   return object;
 }
diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c
index 0f481ad..e4d908f 100644
--- a/gtk/gtkfontbutton.c
+++ b/gtk/gtkfontbutton.c
@@ -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;
 } 
 
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index 03ac4c9..b68be63 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -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);
diff --git a/gtk/gtkrecentchooserdialog.c b/gtk/gtkrecentchooserdialog.c
index 85cb899..657176f 100644
--- a/gtk/gtkrecentchooserdialog.c
+++ b/gtk/gtkrecentchooserdialog.c
@@ -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;
 }
 
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 99dab9e..19df070 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -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);
diff --git a/gtk/gtktoolitemgroup.c b/gtk/gtktoolitemgroup.c
index d6aa825..dbbe000 100644
--- a/gtk/gtktoolitemgroup.c
+++ b/gtk/gtktoolitemgroup.c
@@ -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);
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index af2317c..d1f02ae 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -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))
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index e571aec..382931f 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -10488,6 +10488,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,
@@ -10515,6 +10517,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)
@@ -10554,6 +10558,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)
@@ -10565,6 +10572,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)
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 962e4a6..b026499 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]