Use gtk_entry_xxx functions rather than using GtkEntry structure directly.

See bug #576801

svn path=/trunk/; revision=22589
This commit is contained in:
Stefan Walter 2009-03-27 05:22:23 +00:00
parent e5110c50b6
commit de60fd8cfd
4 changed files with 43 additions and 22 deletions

View File

@ -1,3 +1,19 @@
2009-03-26 Stef Walter <stef@memberwebs.com>
* gtk/gtkfilechooserentry.c
(char_after_cursor_is_directory_separator)
(gtk_file_chooser_entry_do_insert_text)
(gtk_file_chooser_entry_focus)
(commit_completion_and_refresh)
(refresh_current_folder_and_file_part) (autocomplete):
* gtk/gtkspinbutton.c (gtk_spin_button_insert_text):
* modules/other/gail/gailentry.c (gail_entry_real_initialize)
(text_setup) (gail_entry_get_run_attributes)
(gail_entry_get_character_extents)
(gail_entry_get_offset_at_point): Use gtk_entry_xxx functions
rather than using GtkEntry structure directly.
See bug #576801
2009-03-25 Christian Dywan <christian@twotoasts.de>
* gtk/gtkselection.c: Typo correction, s/hilding/holding

View File

@ -641,7 +641,7 @@ char_after_cursor_is_directory_separator (GtkFileChooserEntry *chooser_entry)
result = FALSE;
cursor_pos = gtk_editable_get_position (GTK_EDITABLE (chooser_entry));
if (cursor_pos < GTK_ENTRY (chooser_entry)->text_length)
if (cursor_pos < gtk_entry_get_text_length (GTK_ENTRY (chooser_entry)))
{
char *next_char_str;
@ -800,7 +800,7 @@ gtk_file_chooser_entry_do_insert_text (GtkEditable *editable,
gint old_text_len;
gint insert_pos;
old_text_len = GTK_ENTRY (chooser_entry)->text_length;
old_text_len = gtk_entry_get_text_length (GTK_ENTRY (chooser_entry));
insert_pos = *position;
parent_editable_iface->do_insert_text (editable, new_text, new_text_length, position);
@ -1248,7 +1248,7 @@ gtk_file_chooser_entry_focus (GtkWidget *widget,
(! control_pressed))
{
if (chooser_entry->has_completion)
gtk_editable_set_position (editable, entry->text_length);
gtk_editable_set_position (editable, gtk_entry_get_text_length (entry));
else
start_explicit_completion (chooser_entry);
@ -1275,7 +1275,7 @@ commit_completion_and_refresh (GtkFileChooserEntry *chooser_entry)
if (chooser_entry->has_completion)
{
gtk_editable_set_position (GTK_EDITABLE (chooser_entry),
GTK_ENTRY (chooser_entry)->text_length);
gtk_entry_get_text_length (GTK_ENTRY (chooser_entry)));
}
/* Here we ignore the result of refresh_current_folder_and_file_part(); there is nothing we can do with it */
@ -1541,7 +1541,7 @@ refresh_current_folder_and_file_part (GtkFileChooserEntry *chooser_entry,
break;
case REFRESH_WHOLE_TEXT:
end_pos = GTK_ENTRY (chooser_entry)->text_length;
end_pos = gtk_entry_get_text_length (GTK_ENTRY (chooser_entry));
break;
default:
@ -1632,7 +1632,7 @@ autocomplete (GtkFileChooserEntry *chooser_entry)
{
if (!(chooser_entry->current_folder != NULL
&& _gtk_folder_is_finished_loading (chooser_entry->current_folder)
&& gtk_editable_get_position (GTK_EDITABLE (chooser_entry)) == GTK_ENTRY (chooser_entry)->text_length))
&& gtk_editable_get_position (GTK_EDITABLE (chooser_entry)) == gtk_entry_get_text_length (GTK_ENTRY (chooser_entry))))
return;
append_common_prefix (chooser_entry, TRUE, FALSE);

View File

@ -1427,8 +1427,10 @@ gtk_spin_button_insert_text (GtkEditable *editable,
GdkWChar pos_sign;
GdkWChar neg_sign;
gint entry_length;
const gchar *entry_text;
entry_length = entry->text_length;
entry_length = gtk_entry_get_text_length (entry);
entry_text = gtk_entry_get_text (entry);
lc = localeconv ();
@ -1463,8 +1465,8 @@ gtk_spin_button_insert_text (GtkEditable *editable,
#endif
for (sign=0, i=0; i<entry_length; i++)
if ((entry->text[i] == neg_sign) ||
(entry->text[i] == pos_sign))
if ((entry_text[i] == neg_sign) ||
(entry_text[i] == pos_sign))
{
sign = 1;
break;
@ -1474,7 +1476,7 @@ gtk_spin_button_insert_text (GtkEditable *editable,
return;
for (dotpos=-1, i=0; i<entry_length; i++)
if (entry->text[i] == *(lc->decimal_point))
if (entry_text[i] == *(lc->decimal_point))
{
dotpos = i;
break;

View File

@ -231,7 +231,7 @@ gail_entry_real_initialize (AtkObject *obj,
g_signal_connect (data, "changed",
G_CALLBACK (_gail_entry_changed_cb), NULL);
if (entry->visible)
if (gtk_entry_get_visibility (entry))
obj->role = ATK_ROLE_TEXT;
else
obj->role = ATK_ROLE_PASSWORD_TEXT;
@ -312,6 +312,7 @@ text_setup (GailEntry *entry,
GString *tmp_string = g_string_new (NULL);
gint ch_len;
gchar buf[7];
guint length;
gint i;
invisible_char = gtk_entry_get_invisible_char (gtk_entry);
@ -319,7 +320,8 @@ text_setup (GailEntry *entry,
invisible_char = ' ';
ch_len = g_unichar_to_utf8 (invisible_char, buf);
for (i = 0; i < gtk_entry->text_length; i++)
length = gtk_entry_get_text_length (gtk_entry);
for (i = 0; i < length; i++)
{
g_string_append_len (tmp_string, buf, ch_len);
}
@ -576,7 +578,7 @@ gail_entry_get_run_attributes (AtkText *text,
at_set = gail_misc_layout_get_run_attributes (at_set,
gtk_entry_get_layout (entry),
entry->text,
(gchar*)gtk_entry_get_text (entry),
offset,
start_offset,
end_offset);
@ -616,6 +618,7 @@ gail_entry_get_character_extents (AtkText *text,
GtkEntry *entry;
PangoRectangle char_rect;
gint index, cursor_index, x_layout, y_layout;
const gchar *entry_text;
widget = GTK_ACCESSIBLE (text)->widget;
if (widget == NULL)
@ -625,9 +628,9 @@ gail_entry_get_character_extents (AtkText *text,
entry = GTK_ENTRY (widget);
gtk_entry_get_layout_offsets (entry, &x_layout, &y_layout);
index = g_utf8_offset_to_pointer (entry->text, offset) - entry->text;
cursor_index = g_utf8_offset_to_pointer (entry->text, entry->current_pos) -
entry->text;
entry_text = gtk_entry_get_text (entry);
index = g_utf8_offset_to_pointer (entry_text, offset) - entry_text;
cursor_index = g_utf8_offset_to_pointer (entry_text, entry->current_pos) - entry_text;
if (index > cursor_index)
index += entry->preedit_length;
pango_layout_index_to_pos (gtk_entry_get_layout(entry), index, &char_rect);
@ -645,7 +648,8 @@ gail_entry_get_offset_at_point (AtkText *text,
GtkWidget *widget;
GtkEntry *entry;
gint index, cursor_index, x_layout, y_layout;
const gchar *entry_text;
widget = GTK_ACCESSIBLE (text)->widget;
if (widget == NULL)
/* State is defunct */
@ -654,21 +658,20 @@ gail_entry_get_offset_at_point (AtkText *text,
entry = GTK_ENTRY (widget);
gtk_entry_get_layout_offsets (entry, &x_layout, &y_layout);
entry_text = gtk_entry_get_text (entry);
index = gail_misc_get_index_at_point_in_layout (widget,
gtk_entry_get_layout(entry), x_layout, y_layout, x, y, coords);
if (index == -1)
{
if (coords == ATK_XY_SCREEN || coords == ATK_XY_WINDOW)
return g_utf8_strlen (entry->text, -1);
return g_utf8_strlen (entry_text, -1);
return index;
}
else
{
cursor_index = g_utf8_offset_to_pointer (entry->text,
entry->current_pos) -
entry->text;
cursor_index = g_utf8_offset_to_pointer (entry_text, entry->current_pos) - entry_text;
if (index >= cursor_index && entry->preedit_length)
{
if (index >= cursor_index + entry->preedit_length)
@ -676,7 +679,7 @@ gail_entry_get_offset_at_point (AtkText *text,
else
index = cursor_index;
}
return g_utf8_pointer_to_offset (entry->text, entry->text + index);
return g_utf8_pointer_to_offset (entry_text, entry_text + index);
}
}