[gtk+/gtk-2-90: 82/161] Remove deprecated code: GtkLabel



commit 692796c5b3628507808e338548921a2fe56af448
Author: Javier Jardón <javierjc1982 gmail com>
Date:   Sat Oct 10 06:45:03 2009 +0200

    Remove deprecated code: GtkLabel

 docs/faq/gtk-faq.sgml                 |   12 +++++-----
 docs/reference/gtk/gtk-sections.txt   |    1 -
 docs/reference/gtk/tmpl/gtklabel.sgml |   15 ------------
 examples/list/list.c                  |    4 +-
 examples/tree/tree.c                  |   12 +++++-----
 gtk/gtklabel.c                        |   41 ---------------------------------
 gtk/gtklabel.h                        |   14 -----------
 7 files changed, 14 insertions(+), 85 deletions(-)
---
diff --git a/docs/faq/gtk-faq.sgml b/docs/faq/gtk-faq.sgml
index b03f904..c940b09 100644
--- a/docs/faq/gtk-faq.sgml
+++ b/docs/faq/gtk-faq.sgml
@@ -2629,8 +2629,8 @@ underlined, and the relevant accelerators are created.</para>
   gtk_box_pack_start (GTK_BOX (vbox1), menubar1, FALSE, FALSE, 0);
 
   file1 = gtk_menu_item_new_with_label ("");
-  tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (file1)->child),
-                                   _("_File"));
+  gtk_label_set_use_underline (GTK_LABEL (gtk_bin_get_child (GTK_BIN (file1))),
+                               TRUE);
   gtk_widget_add_accelerator (file1, "activate_item", accel_group,
                               tmp_key, GDK_MOD1_MASK, 0);
   gtk_object_set_data (GTK_OBJECT (window1), "file1", file1);
@@ -2643,8 +2643,8 @@ underlined, and the relevant accelerators are created.</para>
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (file1), file1_menu);
 
   new1 = gtk_menu_item_new_with_label ("");
-  tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (new1)->child),
-                                   _("_New"));
+  gtk_label_set_use_underline (GTK_LABEL (gtk_bin_get_child (GTK_BIN (new1))),
+                               TRUE);
   gtk_widget_add_accelerator (new1, "activate_item", file1_menu_accels,
                               tmp_key, 0, 0);
   gtk_object_set_data (GTK_OBJECT (window1), "new1", new1);
@@ -2670,9 +2670,9 @@ GtkMenuItem with:</para>
       /* do stuff with child */
       if (GTK_IS_LABEL (child))
       {
-        gchar *text;
+        const gchar *text;
     
-        gtk_label_get (GTK_LABEL (child), &amp;text);
+        text = gtk_label_get_text (GTK_LABEL (child));
         g_print ("menu item text: %s\n", text);
       }
     }
diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt
index 556e4f1..91424e8 100644
--- a/docs/reference/gtk/gtk-sections.txt
+++ b/docs/reference/gtk/gtk-sections.txt
@@ -2275,7 +2275,6 @@ gtk_label_set_ellipsize
 gtk_label_set_width_chars
 gtk_label_set_max_width_chars
 gtk_label_get
-gtk_label_parse_uline
 gtk_label_set_line_wrap
 gtk_label_set_line_wrap_mode
 gtk_label_set
diff --git a/docs/reference/gtk/tmpl/gtklabel.sgml b/docs/reference/gtk/tmpl/gtklabel.sgml
index 96168bf..be3b013 100644
--- a/docs/reference/gtk/tmpl/gtklabel.sgml
+++ b/docs/reference/gtk/tmpl/gtklabel.sgml
@@ -436,21 +436,6 @@ must not write to it.
 @Deprecated: Use gtk_label_get_text() instead.
 
 
-<!-- ##### FUNCTION gtk_label_parse_uline ##### -->
-<para>
-Parses the given string for underscores and converts the next
-character to an underlined character.  The last character that
-was underlined will have its lower-cased accelerator keyval returned  (i.e.
-&quot;_File&quot; would return the keyval for &quot;f&quot;.  This is
-probably only used within the GTK+ library itself for menu items and such.
-</para>
-
- label: The #GtkLabel you want to affect.
- string: The string you want to parse for underlines.
- Returns: The lowercase keyval of the last character underlined.
- Deprecated: Use gtk_label_set_use_underline() instead.
-
-
 <!-- ##### FUNCTION gtk_label_set_line_wrap ##### -->
 <para>
 
diff --git a/examples/list/list.c b/examples/list/list.c
index 966e31e..8d0d97b 100644
--- a/examples/list/list.c
+++ b/examples/list/list.c
@@ -117,7 +117,7 @@ gint main( int    argc,
      */
     for (i = 0; i < 5; i++) {
 	GtkWidget       *label;
-	gchar           *string;
+	const gchar     *string;
 
 	sprintf(buffer, "ListItemContainer with Label #%d", i);
 	label=gtk_label_new (buffer);
@@ -126,7 +126,7 @@ gint main( int    argc,
 	gtk_widget_show (label);
 	gtk_container_add (GTK_CONTAINER (gtklist), list_item);
 	gtk_widget_show (list_item);
-	gtk_label_get (GTK_LABEL (label), &string);
+	string = gtk_label_get_text (GTK_LABEL (label));
 	g_object_set_data (G_OBJECT (list_item), list_item_data_key, string);
     }
     /* Here, we are creating another 5 labels, this time
diff --git a/examples/tree/tree.c b/examples/tree/tree.c
index 9c3962e..01064f4 100644
--- a/examples/tree/tree.c
+++ b/examples/tree/tree.c
@@ -7,14 +7,14 @@
 static void cb_itemsignal( GtkWidget *item,
                            gchar     *signame )
 {
-  gchar *name;
+  const gchar *name;
   GtkLabel *label;
 
   /* It's a Bin, so it has one child, which we know to be a
      label, so get that */
-  label = GTK_LABEL (GTK_BIN (item)->child);
+  label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (item)));
   /* Get the text of the label */
-  gtk_label_get (label, &name);
+  name = gtk_label_get_text (label);
   /* Get the level of the tree which the item is in */
   g_print ("%s called for item %s->%p, level %d\n", signame, name,
 	   item, GTK_TREE (item->parent)->level);
@@ -47,14 +47,14 @@ static void cb_selection_changed( GtkWidget *tree )
 
   i = GTK_TREE_SELECTION_OLD (tree);
   while (i) {
-    gchar *name;
+    const gchar *name;
     GtkLabel *label;
     GtkWidget *item;
 
     /* Get a GtkWidget pointer from the list node */
     item = GTK_WIDGET (i->data);
-    label = GTK_LABEL (GTK_BIN (item)->child);
-    gtk_label_get (label, &name);
+    label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (item)));
+    name = gtk_label_get_text (label);
     g_print ("\t%s on level %d\n", name, GTK_TREE
 	     (item->parent)->level);
     i = i->next;
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 10e5850..e2a06ae 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -2856,17 +2856,6 @@ gtk_label_get_line_wrap_mode (GtkLabel *label)
   return label->wrap_mode;
 }
 
-
-void
-gtk_label_get (GtkLabel *label,
-	       gchar   **str)
-{
-  g_return_if_fail (GTK_IS_LABEL (label));
-  g_return_if_fail (str != NULL);
-  
-  *str = label->text;
-}
-
 static void
 gtk_label_destroy (GtkObject *object)
 {
@@ -3794,36 +3783,6 @@ gtk_label_set_uline_text_internal (GtkLabel    *label,
   g_free (pattern);
 }
 
-guint
-gtk_label_parse_uline (GtkLabel    *label,
-		       const gchar *str)
-{
-  guint keyval;
-  
-  g_return_val_if_fail (GTK_IS_LABEL (label), GDK_VoidSymbol);
-  g_return_val_if_fail (str != NULL, GDK_VoidSymbol);
-
-  g_object_freeze_notify (G_OBJECT (label));
-  
-  gtk_label_set_label_internal (label, g_strdup (str ? str : ""));
-  gtk_label_set_use_markup_internal (label, FALSE);
-  gtk_label_set_use_underline_internal (label, TRUE);
-  
-  gtk_label_recalculate (label);
-
-  keyval = label->mnemonic_keyval;
-  if (keyval != GDK_VoidSymbol)
-    {
-      label->mnemonic_keyval = GDK_VoidSymbol;
-      gtk_label_setup_mnemonic (label, keyval);
-      g_object_notify (G_OBJECT (label), "mnemonic-keyval");
-    }
-  
-  g_object_thaw_notify (G_OBJECT (label));
-
-  return keyval;
-}
-
 /**
  * gtk_label_set_text_with_mnemonic:
  * @label: a #GtkLabel
diff --git a/gtk/gtklabel.h b/gtk/gtklabel.h
index 88a9db7..c1c5b68 100644
--- a/gtk/gtklabel.h
+++ b/gtk/gtklabel.h
@@ -182,20 +182,6 @@ void         gtk_label_set_track_visited_links  (GtkLabel *label,
                                                  gboolean  track_links);
 gboolean     gtk_label_get_track_visited_links  (GtkLabel *label);
 
-#ifndef GTK_DISABLE_DEPRECATED
-
-#define  gtk_label_set           gtk_label_set_text
-void       gtk_label_get           (GtkLabel          *label,
-                                    gchar            **str);
-
-/* Convenience function to set the name and pattern by parsing
- * a string with embedded underscores, and return the appropriate
- * key symbol for the accelerator.
- */
-guint gtk_label_parse_uline            (GtkLabel    *label,
-					const gchar *string);
-
-#endif /* GTK_DISABLE_DEPRECATED */
 
 /* private */
 



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