[gtk+] Deprecate the gtk stock functions



commit d741b7b87352db52eee4493cea8d45c9f9ee7342
Author: William Jon McCann <william jon mccann gmail com>
Date:   Thu Jun 27 17:51:38 2013 -0400

    Deprecate the gtk stock functions

 gtk/gtkaction.c           |   16 ++++++++++++----
 gtk/gtkactiongroup.c      |    4 ++++
 gtk/gtkdialog.c           |    4 ++++
 gtk/gtkimagemenuitem.c    |    5 +++++
 gtk/gtkinfobar.c          |    4 ++++
 gtk/gtkstock.c            |   24 ++++++++++++++++++------
 gtk/gtkstock.h            |   16 +++++++++-------
 gtk/gtktoggletoolbutton.c |    5 +++--
 gtk/gtktoolbutton.c       |   12 ++++++++++--
 9 files changed, 69 insertions(+), 21 deletions(-)
---
diff --git a/gtk/gtkaction.c b/gtk/gtkaction.c
index 71413bc..73f71a9 100644
--- a/gtk/gtkaction.c
+++ b/gtk/gtkaction.c
@@ -1274,9 +1274,13 @@ gtk_action_set_label (GtkAction    *action,
   if (!action->private_data->label_set && action->private_data->stock_id)
     {
       GtkStockItem stock_item;
-      
+
+      G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
       if (gtk_stock_lookup (action->private_data->stock_id, &stock_item))
        action->private_data->label = g_strdup (stock_item.label);
+
+      G_GNUC_END_IGNORE_DEPRECATIONS;
     }
 
   g_object_notify (G_OBJECT (action), "label");
@@ -1514,13 +1518,17 @@ gtk_action_set_stock_id (GtkAction   *action,
   if (!action->private_data->label_set)
     {
       GtkStockItem stock_item;
-      
+
+      G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
       if (action->private_data->stock_id &&
          gtk_stock_lookup (action->private_data->stock_id, &stock_item))
        gtk_action_set_label (action, stock_item.label);
-      else 
+      else
        gtk_action_set_label (action, NULL);
-      
+
+      G_GNUC_END_IGNORE_DEPRECATIONS;
+
       action->private_data->label_set = FALSE;
     }
 }
diff --git a/gtk/gtkactiongroup.c b/gtk/gtkactiongroup.c
index 6121ca1..9da4504 100644
--- a/gtk/gtkactiongroup.c
+++ b/gtk/gtkactiongroup.c
@@ -999,12 +999,16 @@ gtk_action_group_add_action_with_accel (GtkActionGroup *action_group,
 
       g_object_get (action, "stock-id", &stock_id, NULL);
 
+      G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
       if (stock_id && gtk_stock_lookup (stock_id, &stock_item))
         {
           accel_key = stock_item.keyval;
           accel_mods = stock_item.modifier;
        }
 
+      G_GNUC_END_IGNORE_DEPRECATIONS;
+
       g_free (stock_id);
     }
 
diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c
index 8aeb8dc..cd20b8d 100644
--- a/gtk/gtkdialog.c
+++ b/gtk/gtkdialog.c
@@ -744,6 +744,8 @@ gtk_dialog_add_button (GtkDialog   *dialog,
   button = gtk_button_new_with_label (button_text);
   gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
 
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
   if (button_text)
     {
       GtkStockItem item;
@@ -751,6 +753,8 @@ gtk_dialog_add_button (GtkDialog   *dialog,
         g_object_set (button, "use-stock", TRUE, NULL);
     }
 
+  G_GNUC_END_IGNORE_DEPRECATIONS;
+
   gtk_widget_set_can_default (button, TRUE);
   gtk_widget_set_valign (button, GTK_ALIGN_BASELINE);
 
diff --git a/gtk/gtkimagemenuitem.c b/gtk/gtkimagemenuitem.c
index 7ae442e..d942984 100644
--- a/gtk/gtkimagemenuitem.c
+++ b/gtk/gtkimagemenuitem.c
@@ -1002,6 +1002,8 @@ gtk_image_menu_item_set_accel_group (GtkImageMenuItem *image_menu_item,
 
   priv = image_menu_item->priv;
 
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
   if (priv->use_stock && priv->label && gtk_stock_lookup (priv->label, &stock_item))
     if (stock_item.keyval)
       {
@@ -1014,6 +1016,9 @@ gtk_image_menu_item_set_accel_group (GtkImageMenuItem *image_menu_item,
 
         g_object_notify (G_OBJECT (image_menu_item), "accel-group");
       }
+
+  G_GNUC_END_IGNORE_DEPRECATIONS;
+
 }
 
 /**
diff --git a/gtk/gtkinfobar.c b/gtk/gtkinfobar.c
index b550c23..15d71ce 100644
--- a/gtk/gtkinfobar.c
+++ b/gtk/gtkinfobar.c
@@ -704,6 +704,8 @@ gtk_info_bar_add_button (GtkInfoBar  *info_bar,
   button = gtk_button_new_with_label (button_text);
   gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
 
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
   if (button_text)
     {
       GtkStockItem item;
@@ -711,6 +713,8 @@ gtk_info_bar_add_button (GtkInfoBar  *info_bar,
         g_object_set (button, "use-stock", TRUE, NULL);
     }
 
+  G_GNUC_END_IGNORE_DEPRECATIONS;
+
   gtk_widget_set_can_default (button, TRUE);
 
   gtk_widget_show (button);
diff --git a/gtk/gtkstock.c b/gtk/gtkstock.c
index 7f5155f..c6bb3dc 100644
--- a/gtk/gtkstock.c
+++ b/gtk/gtkstock.c
@@ -24,6 +24,8 @@
 
 #include "config.h"
 
+#define GDK_DISABLE_DEPRECATION_WARNINGS
+
 #include <string.h>
 
 #include "gtkprivate.h"
@@ -142,7 +144,8 @@ real_add (const GtkStockItem *items,
  * any pointer into @items and @items can be freed. Use
  * gtk_stock_add_static() if @items is persistent and GTK+ need not
  * copy the array.
- * 
+ *
+ * Deprecated: 3.10
  **/
 void
 gtk_stock_add (const GtkStockItem *items,
@@ -160,7 +163,8 @@ gtk_stock_add (const GtkStockItem *items,
  *
  * Same as gtk_stock_add(), but doesn't copy @items, so
  * @items must persist until application exit.
- * 
+ *
+ * Deprecated: 3.10
  **/
 void
 gtk_stock_add_static (const GtkStockItem *items,
@@ -175,12 +179,13 @@ gtk_stock_add_static (const GtkStockItem *items,
  * gtk_stock_lookup:
  * @stock_id: a stock item name
  * @item: (out): stock item to initialize with values
- * 
+ *
  * Fills @item with the registered values for @stock_id, returning %TRUE
  * if @stock_id was known.
- * 
- * 
+ *
  * Return value: %TRUE if @item was initialized
+ *
+ * Deprecated: 3.10
  **/
 gboolean
 gtk_stock_lookup (const gchar  *stock_id,
@@ -227,6 +232,8 @@ gtk_stock_lookup (const gchar  *stock_id,
  * and each string in the list must be freed with g_free().
  *
  * Return value: (element-type utf8) (transfer full): a list of known stock IDs
+ *
+ * Deprecated: 3.10
  **/
 GSList*
 gtk_stock_list_ids (void)
@@ -277,6 +284,8 @@ gtk_stock_list_ids (void)
  * Copies a stock item, mostly useful for language bindings and not in applications.
  * 
  * Return value: a new #GtkStockItem
+ *
+ * Deprecated: 3.10
  **/
 GtkStockItem *
 gtk_stock_item_copy (const GtkStockItem *item)
@@ -303,7 +312,8 @@ gtk_stock_item_copy (const GtkStockItem *item)
  * Frees a stock item allocated on the heap, such as one returned by
  * gtk_stock_item_copy(). Also frees the fields inside the stock item,
  * if they are not %NULL.
- * 
+ *
+ * Deprecated: 3.10
  **/
 void
 gtk_stock_item_free (GtkStockItem *item)
@@ -496,6 +506,8 @@ static const GtkStockItem builtin_items [] =
  * ]|
  * 
  * Since: 2.8
+ *
+ * Deprecated: 3.10
  */
 void
 gtk_stock_set_translate_func (const gchar      *domain,
diff --git a/gtk/gtkstock.h b/gtk/gtkstock.h
index 6cb4628..9547f89 100644
--- a/gtk/gtkstock.h
+++ b/gtk/gtkstock.h
@@ -44,6 +44,8 @@ G_BEGIN_DECLS
  * and #GtkActionGroup.
  *
  * Returns: the translated message
+ *
+ * Deprecated: 3.10
  */
 typedef gchar * (*GtkTranslateFunc) (const gchar  *path,
                                      gpointer      func_data);
@@ -59,28 +61,28 @@ struct _GtkStockItem
   gchar *translation_domain;
 };
 
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_10
 void     gtk_stock_add        (const GtkStockItem  *items,
                                guint                n_items);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_10
 void     gtk_stock_add_static (const GtkStockItem  *items,
                                guint                n_items);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_10
 gboolean gtk_stock_lookup     (const gchar         *stock_id,
                                GtkStockItem        *item);
 
 /* Should free the list (and free each string in it also).
  * This function is only useful for GUI builders and such.
  */
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_10
 GSList*  gtk_stock_list_ids  (void);
 
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_10
 GtkStockItem *gtk_stock_item_copy (const GtkStockItem *item);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_10
 void          gtk_stock_item_free (GtkStockItem       *item);
 
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_10
 void          gtk_stock_set_translate_func (const gchar      *domain,
                                            GtkTranslateFunc  func,
                                            gpointer          data,
diff --git a/gtk/gtktoggletoolbutton.c b/gtk/gtktoggletoolbutton.c
index 8b2f084..7dd756a 100644
--- a/gtk/gtktoggletoolbutton.c
+++ b/gtk/gtktoggletoolbutton.c
@@ -224,7 +224,6 @@ gtk_toggle_tool_button_create_menu_proxy (GtkToolItem *item)
   label_text = gtk_tool_button_get_label (tool_button);
   G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
   stock_id = gtk_tool_button_get_stock_id (tool_button);
-  G_GNUC_END_IGNORE_DEPRECATIONS;
 
   if (GTK_IS_LABEL (label_widget))
     {
@@ -244,7 +243,9 @@ gtk_toggle_tool_button_create_menu_proxy (GtkToolItem *item)
     {
       label = "";
     }
-  
+
+  G_GNUC_END_IGNORE_DEPRECATIONS;
+
   if (use_mnemonic)
     menu_item = gtk_check_menu_item_new_with_mnemonic (label);
   else
diff --git a/gtk/gtktoolbutton.c b/gtk/gtktoolbutton.c
index 126c8e6..7999ef8 100644
--- a/gtk/gtktoolbutton.c
+++ b/gtk/gtktoolbutton.c
@@ -447,6 +447,8 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
          gboolean elide;
          gchar *label_text;
 
+          G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
          if (button->priv->label_text)
            {
              label_text = button->priv->label_text;
@@ -463,6 +465,8 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
              elide = FALSE;
            }
 
+          G_GNUC_END_IGNORE_DEPRECATIONS;
+
          if (elide)
            label_text = _gtk_toolbar_elide_underscores (label_text);
          else
@@ -837,7 +841,9 @@ gtk_tool_button_create_menu_proxy (GtkToolItem *item)
 
   if (_gtk_tool_item_create_menu_proxy (item))
     return TRUE;
- 
+
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
   if (GTK_IS_LABEL (button->priv->label_widget))
     {
       label = gtk_label_get_label (GTK_LABEL (button->priv->label_widget));
@@ -856,7 +862,9 @@ gtk_tool_button_create_menu_proxy (GtkToolItem *item)
     {
       label = "";
     }
-  
+
+  G_GNUC_END_IGNORE_DEPRECATIONS;
+
   if (use_mnemonic)
     menu_item = gtk_image_menu_item_new_with_mnemonic (label);
   else


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