[gtk+/gtk-2-90: 82/127] Remove deprecated code: GtkLabel
- From: Javier Jardón <jjardon src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-90: 82/127] Remove deprecated code: GtkLabel
- Date: Tue, 17 Nov 2009 19:31:40 +0000 (UTC)
commit 07ced2380bbecad04a1a82f8a68d6e2744af01e8
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 ------------
docs/tutorial/gtk_tut.sgml | 38 ++++++++++++++----------------
docs/tutorial/gtk_tut_12.es.sgml | 26 +++++++++-----------
docs/tutorial/gtk_tut_fr.sgml | 11 ++++-----
docs/tutorial/gtk_tut_it.sgml | 11 ++++-----
examples/list/list.c | 4 +-
examples/tree/tree.c | 12 +++++-----
gtk/gtklabel.c | 41 ---------------------------------
gtk/gtklabel.h | 14 -----------
11 files changed, 54 insertions(+), 131 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), &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 b9af6f6..3bb09f9 100644
--- a/docs/reference/gtk/gtk-sections.txt
+++ b/docs/reference/gtk/gtk-sections.txt
@@ -2271,7 +2271,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.
-"_File" would return the keyval for "f". 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/docs/tutorial/gtk_tut.sgml b/docs/tutorial/gtk_tut.sgml
index c45a08c..b5a8f83 100644
--- a/docs/tutorial/gtk_tut.sgml
+++ b/docs/tutorial/gtk_tut.sgml
@@ -3135,13 +3135,11 @@ the label string.
To retrieve the current string, use:
<tscreen><verb>
-void gtk_label_get( GtkLabel *label,
- char **str );
+const *gchar void gtk_label_get_text (GtkLabel *label);
</verb></tscreen>
-The first argument is the label you've created, and the second,
-the return for the string. Do not free the return string, as it is
-used internally by GTK.
+The argument is the label you've created. The function returns the string.
+Do not free the return string.
The label text can be justified using:
@@ -5799,14 +5797,14 @@ void calendar_date_to_string( CalendarData *data,
void calendar_set_signal_strings( char *sig_str,
CalendarData *data)
{
- gchar *prev_sig;
+ const gchar *prev_sig;
- gtk_label_get (GTK_LABEL (data->prev_sig), &prev_sig);
- gtk_label_set (GTK_LABEL (data->prev2_sig), prev_sig);
+ prev_sig = gtk_label_get_text (GTK_LABEL (data->prev_sig));
+ gtk_label_set_text (GTK_LABEL (data->prev2_sig), prev_sig);
- gtk_label_get (GTK_LABEL (data->last_sig), &prev_sig);
- gtk_label_set (GTK_LABEL (data->prev_sig), prev_sig);
- gtk_label_set (GTK_LABEL (data->last_sig), sig_str);
+ prev_sig = gtk_label_get_text (GTK_LABEL (data->last_sig));
+ gtk_label_set_text (GTK_LABEL (data->prev_sig), prev_sig);
+ gtk_label_set_text (GTK_LABEL (data->last_sig), sig_str);
}
void calendar_month_changed( GtkWidget *widget,
@@ -9735,14 +9733,14 @@ can see when they are emitted.
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);
@@ -9775,14 +9773,14 @@ static void cb_selection_changed( GtkWidget *tree )
i = GTK_TREE_SELECTION(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;
@@ -17304,7 +17302,7 @@ void value_changed( GtkAdjustment *adjustment,
char buffer[16];
sprintf(buffer,"%4.2f",adjustment->value);
- gtk_label_set (GTK_LABEL (label), buffer);
+ gtk_label_set_text (GTK_LABEL (label), buffer);
}
int main( int argc,
@@ -18189,7 +18187,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);
@@ -18198,7 +18196,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));
gtk_object_set_data(GTK_OBJECT(list_item),
list_item_data_key,
string);
diff --git a/docs/tutorial/gtk_tut_12.es.sgml b/docs/tutorial/gtk_tut_12.es.sgml
index 290e346..a51d0ac 100755
--- a/docs/tutorial/gtk_tut_12.es.sgml
+++ b/docs/tutorial/gtk_tut_12.es.sgml
@@ -3046,8 +3046,8 @@ El
Para cambiarla después de que haya sido creada se usa:
<tscreen><verb>
-void gtk_label_set( GtkLabel *etiqueta,
- char *str );
+void gtk_label_set_text( GtkLabel *etiqueta,
+ char *str );
</verb></tscreen>
En este caso el primer argumento es la etiqueta ya creada (cambiado su
@@ -3059,12 +3059,10 @@ Para obtener el estado de la cadena en un momento dado existe la
función:
<tscreen><verb>
-void gtk_label_get( GtkLabel *etiqueta,
- char **str );
+const *gchar gtk_label_get_text ( GtkLabel *etiqueta );
</verb></tscreen>
-El primer argumento es la etiqueta, mientras que el segundo es el
-valor devuelto para la cadena. No libere la memoria de la cadena
-devuelta, ya que se utiliza internamente por GTK.
+El argumento es la etiqueta, mientras que la funcion devuelve
+la cadena. No libere la memoria de la cadena devuelta.
El texto de la etiqueta se puede justificar utilizando:
@@ -9177,14 +9175,14 @@ de los objetos relevantes, con lo que podr
/* para todas las señales GtkItem:: y GtkTreeItem:: */
static void cb_itemsignal (GtkWidget *item, gchar *signame)
{
- gchar *name;
+ const gchar *name;
GtkLabel *etiqueta;
/* Es un GtkBin, por lo que tiene un hijo, que sabemos que es una
* etiqueta, por lo que la cogemos */
- etiqueta = GTK_LABEL (GTK_BIN (item)->child);
+ etiqueta = GTK_LABEL (gtk_bin_get_child (GTK_BIN (item)));
/* Conseguimos el texto de la etiqueta */
- gtk_label_get (etiqueta, &name);
+ name = gtk_label_get_text (etiqueta);
/* Conseguimos el nivel del árbol en el que se encuentra el elemento */
g_print ("%s called for item %s->%p, level %d\n", signame, name,
item, GTK_TREE (item->parent)->level);
@@ -9223,8 +9221,8 @@ static void cb_selection_changed (GtkWidget *arbol)
/* Get a GtkWidget pointer from the list node */
item = GTK_WIDGET (i->data);
- etiqueta = GTK_LABEL (GTK_BIN (item)->child);
- gtk_label_get (etiqueta, &name);
+ etiqueta = GTK_LABEL (gtk_bin_get_child (GTK_BIN (item)));
+ name = gtk_label_get_text (etiqueta);
g_print ("\t%s on level %d\n", name, GTK_TREE
(item->parent)->level);
i = i->next;
@@ -17378,7 +17376,7 @@ gint main (int argc, gchar *argv[])
*/
for (i=0; i<5; i++) {
GtkWidget *etiqueta;
- gchar *string;
+ const gchar *string;
sprintf(buffer, "ListItemContainer with Label #%d", i);
etiqueta=gtk_label_new(buffer);
@@ -17387,7 +17385,7 @@ gint main (int argc, gchar *argv[])
gtk_widget_show(etiqueta);
gtk_container_add(GTK_CONTAINER(gtklist), list_item);
gtk_widget_show(list_item);
- gtk_label_get(GTK_LABEL(etiqueta), &string);
+ string = gtk_label_get_text(GTK_LABEL(etiqueta));
gtk_object_set_data(GTK_OBJECT(list_item),
list_item_data_key,
string);
diff --git a/docs/tutorial/gtk_tut_fr.sgml b/docs/tutorial/gtk_tut_fr.sgml
index 51be48f..1ddd613 100644
--- a/docs/tutorial/gtk_tut_fr.sgml
+++ b/docs/tutorial/gtk_tut_fr.sgml
@@ -1952,8 +1952,8 @@ label affiche.
Pour changer le texte d'un label après sa création, on utilise la fonction :
<tscreen><verb>
-void gtk_label_set (GtkLabel *label,
- char *str);
+void gtk_label_set_text (GtkLabel *label,
+ char *str);
</verb></tscreen>
<p>
où le premier paramètre est le label que l'on veut modifier, que l'on
@@ -1966,8 +1966,7 @@ si n
Pour récupérer la chaîne courante, on utilise la fonction :
<tscreen><verb>
-void gtk_label_get (GtkLabel *label,
- char **str);
+const *gchar void gtk_label_get_text (GtkLabel *label);
</verb></tscreen>
où le premier paramètre est le label dont on veut récupérer la chaîne
@@ -3539,7 +3538,7 @@ gint main (int argc, gchar *argv[])
for (i=0; i<5; i++) {
GtkWidget *label;
- gchar *string;
+ const gchar *string;
sprintf(buffer, "ListItemContainer avec Label #%d", i);
label=gtk_label_new(buffer);
@@ -3548,7 +3547,7 @@ gint main (int argc, gchar *argv[])
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));
gtk_object_set_data(GTK_OBJECT(list_item),
list_item_data_key,
string);
diff --git a/docs/tutorial/gtk_tut_it.sgml b/docs/tutorial/gtk_tut_it.sgml
index 440bf17..994185d 100644
--- a/docs/tutorial/gtk_tut_it.sgml
+++ b/docs/tutorial/gtk_tut_it.sgml
@@ -2027,8 +2027,8 @@ Per cambiare il testo dell'etichetta dopo che è stata creata, si usa
la funzione:
<tscreen><verb>
-void gtk_label_set (GtkLabel *label,
- char *str);
+void gtk_label_set_text (GtkLabel *label,
+ char *str);
</verb></tscreen>
<p>
in cui il primo argomento è l'etichetta creata in precedenza (di cui si
@@ -2040,8 +2040,7 @@ Nel caso, lo spazio necessario per la nuova stringa verrà regolato automa
Per ottenere la stringa corrente si usa:
<tscreen><verb>
-void gtk_label_get (GtkLabel *label,
- char **str);
+const *gchar gtk_label_get_text (GtkLabel *label);
</verb></tscreen>
in cui il primo argomento è l'etichetta che avete creato, e il secondo
@@ -4694,7 +4693,7 @@ gint main (int argc, gchar *argv[])
*/
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);
@@ -4703,7 +4702,7 @@ gint main (int argc, gchar *argv[])
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));
gtk_object_set_data(GTK_OBJECT(list_item),
list_item_data_key,
string);
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 acf7f53..0a9ac6d 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -2746,17 +2746,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)
{
@@ -3667,36 +3656,6 @@ gtk_label_set_uline_text_internal (GtkLabel *label,
label->mnemonic_keyval = accel_key;
}
-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 d44b142..359c956 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 */
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]