Use accessor functions to access GtkLabel variables

This commit is contained in:
Javier Jardón 2010-03-27 06:19:10 +01:00
parent 901105766e
commit 0de8601327
2 changed files with 14 additions and 10 deletions

View File

@ -3749,7 +3749,7 @@ gtk_notebook_get_child_property (GtkContainer *container,
label = gtk_notebook_get_tab_label (notebook, child); label = gtk_notebook_get_tab_label (notebook, child);
if (GTK_IS_LABEL (label)) if (GTK_IS_LABEL (label))
g_value_set_string (value, GTK_LABEL (label)->label); g_value_set_string (value, gtk_label_get_label (GTK_LABEL (label)));
else else
g_value_set_string (value, NULL); g_value_set_string (value, NULL);
break; break;
@ -3757,7 +3757,7 @@ gtk_notebook_get_child_property (GtkContainer *container,
label = gtk_notebook_get_menu_label (notebook, child); label = gtk_notebook_get_menu_label (notebook, child);
if (GTK_IS_LABEL (label)) if (GTK_IS_LABEL (label))
g_value_set_string (value, GTK_LABEL (label)->label); g_value_set_string (value, gtk_label_get_label (GTK_LABEL (label)));
else else
g_value_set_string (value, NULL); g_value_set_string (value, NULL);
break; break;
@ -4643,7 +4643,7 @@ gtk_notebook_update_labels (GtkNotebook *notebook)
{ {
if (GTK_IS_LABEL (page->tab_label)) if (GTK_IS_LABEL (page->tab_label))
gtk_label_set_text (GTK_LABEL (page->menu_label), gtk_label_set_text (GTK_LABEL (page->menu_label),
GTK_LABEL (page->tab_label)->label); gtk_label_get_label (GTK_LABEL (page->tab_label)));
else else
gtk_label_set_text (GTK_LABEL (page->menu_label), string); gtk_label_set_text (GTK_LABEL (page->menu_label), string);
} }
@ -6189,7 +6189,7 @@ gtk_notebook_menu_item_create (GtkNotebook *notebook,
if (page->default_menu) if (page->default_menu)
{ {
if (GTK_IS_LABEL (page->tab_label)) if (GTK_IS_LABEL (page->tab_label))
page->menu_label = gtk_label_new (GTK_LABEL (page->tab_label)->label); page->menu_label = gtk_label_new (gtk_label_get_label (GTK_LABEL (page->tab_label)));
else else
page->menu_label = gtk_label_new (""); page->menu_label = gtk_label_new ("");
gtk_misc_set_alignment (GTK_MISC (page->menu_label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (page->menu_label), 0.0, 0.5);

View File

@ -457,7 +457,7 @@ gail_label_ref_relation_set (AtkObject *obj)
* *
* The relation set is not updated if the mnemonic widget is changed * The relation set is not updated if the mnemonic widget is changed
*/ */
GtkWidget *mnemonic_widget = GTK_LABEL (widget)->mnemonic_widget; GtkWidget *mnemonic_widget = gtk_label_get_mnemonic_widget (GTK_LABEL (widget));
if (mnemonic_widget) if (mnemonic_widget)
{ {
@ -726,7 +726,7 @@ gail_label_set_caret_offset (AtkText *text,
if (gtk_label_get_selectable (label) && if (gtk_label_get_selectable (label) &&
offset >= 0 && offset >= 0 &&
offset <= g_utf8_strlen (label->text, -1)) offset <= g_utf8_strlen (gtk_label_get_text (label), -1))
{ {
gtk_label_select_region (label, offset, offset); gtk_label_select_region (label, offset, offset);
return TRUE; return TRUE;
@ -896,6 +896,7 @@ gail_label_get_character_extents (AtkText *text,
GtkWidget *widget; GtkWidget *widget;
GtkLabel *label; GtkLabel *label;
PangoRectangle char_rect; PangoRectangle char_rect;
const gchar *label_text;
gint index, x_layout, y_layout; gint index, x_layout, y_layout;
widget = GTK_ACCESSIBLE (text)->widget; widget = GTK_ACCESSIBLE (text)->widget;
@ -907,7 +908,8 @@ gail_label_get_character_extents (AtkText *text,
label = GTK_LABEL (widget); label = GTK_LABEL (widget);
gtk_label_get_layout_offsets (label, &x_layout, &y_layout); gtk_label_get_layout_offsets (label, &x_layout, &y_layout);
index = g_utf8_offset_to_pointer (label->text, offset) - label->text; label_text = gtk_label_get_text (label);
index = g_utf8_offset_to_pointer (label_text, offset) - label_text;
pango_layout_index_to_pos (gtk_label_get_layout (label), index, &char_rect); pango_layout_index_to_pos (gtk_label_get_layout (label), index, &char_rect);
gail_misc_get_extents_from_pango_rectangle (widget, &char_rect, gail_misc_get_extents_from_pango_rectangle (widget, &char_rect,
@ -922,6 +924,7 @@ gail_label_get_offset_at_point (AtkText *text,
{ {
GtkWidget *widget; GtkWidget *widget;
GtkLabel *label; GtkLabel *label;
const gchar *label_text;
gint index, x_layout, y_layout; gint index, x_layout, y_layout;
widget = GTK_ACCESSIBLE (text)->widget; widget = GTK_ACCESSIBLE (text)->widget;
@ -935,15 +938,16 @@ gail_label_get_offset_at_point (AtkText *text,
index = gail_misc_get_index_at_point_in_layout (widget, index = gail_misc_get_index_at_point_in_layout (widget,
gtk_label_get_layout (label), gtk_label_get_layout (label),
x_layout, y_layout, x, y, coords); x_layout, y_layout, x, y, coords);
label_text = gtk_label_get_text (label);
if (index == -1) if (index == -1)
{ {
if (coords == ATK_XY_WINDOW || coords == ATK_XY_SCREEN) if (coords == ATK_XY_WINDOW || coords == ATK_XY_SCREEN)
return g_utf8_strlen (label->text, -1); return g_utf8_strlen (label_text, -1);
return index; return index;
} }
else else
return g_utf8_pointer_to_offset (label->text, label->text + index); return g_utf8_pointer_to_offset (label_text, label_text + index);
} }
static AtkAttributeSet* static AtkAttributeSet*
@ -983,7 +987,7 @@ gail_label_get_run_attributes (AtkText *text,
at_set = gail_misc_layout_get_run_attributes (at_set, at_set = gail_misc_layout_get_run_attributes (at_set,
gtk_label_get_layout (label), gtk_label_get_layout (label),
label->text, gtk_label_get_text (label),
offset, offset,
start_offset, start_offset,
end_offset); end_offset);