ri Sep 27 16:23:49 2002 Owen Taylor <otaylor@redhat.com>

* gtk/gtklabel.c : Replaced instances where strlen (label->label) is
        used to get a byte code with strlen (label->text) as label->text
        contains the actual display text, while label->label contains
        markup / mnemonics. (#92683, Patch from Shivram U
        <shivaram.upadhyayula@wipro.com>, with some additions.)

        * gtk/gtklabel.c (gtk_label_set_uline_text_internal):
        Fix a leftover, now incorrect comment.
This commit is contained in:
Owen Taylor 2002-09-27 20:50:44 +00:00
parent 8be3514f74
commit f3f02c0e1e
7 changed files with 93 additions and 25 deletions

View File

@ -1,3 +1,14 @@
Fri Sep 27 16:23:49 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c : Replaced instances where strlen (label->label) is
used to get a byte code with strlen (label->text) as label->text
contains the actual display text, while label->label contains
markup / mnemonics. (#92683, Patch from Shivram U
<shivaram.upadhyayula@wipro.com>, with some additions.)
* gtk/gtklabel.c (gtk_label_set_uline_text_internal):
Fix a leftover, now incorrect comment.
Fri Sep 27 16:15:11 2002 Owen Taylor <otaylor@redhat.com> Fri Sep 27 16:15:11 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_get_event_window_position): * gtk/gtknotebook.c (gtk_notebook_get_event_window_position):

View File

@ -1,3 +1,14 @@
Fri Sep 27 16:23:49 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c : Replaced instances where strlen (label->label) is
used to get a byte code with strlen (label->text) as label->text
contains the actual display text, while label->label contains
markup / mnemonics. (#92683, Patch from Shivram U
<shivaram.upadhyayula@wipro.com>, with some additions.)
* gtk/gtklabel.c (gtk_label_set_uline_text_internal):
Fix a leftover, now incorrect comment.
Fri Sep 27 16:15:11 2002 Owen Taylor <otaylor@redhat.com> Fri Sep 27 16:15:11 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_get_event_window_position): * gtk/gtknotebook.c (gtk_notebook_get_event_window_position):

View File

@ -1,3 +1,14 @@
Fri Sep 27 16:23:49 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c : Replaced instances where strlen (label->label) is
used to get a byte code with strlen (label->text) as label->text
contains the actual display text, while label->label contains
markup / mnemonics. (#92683, Patch from Shivram U
<shivaram.upadhyayula@wipro.com>, with some additions.)
* gtk/gtklabel.c (gtk_label_set_uline_text_internal):
Fix a leftover, now incorrect comment.
Fri Sep 27 16:15:11 2002 Owen Taylor <otaylor@redhat.com> Fri Sep 27 16:15:11 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_get_event_window_position): * gtk/gtknotebook.c (gtk_notebook_get_event_window_position):

View File

@ -1,3 +1,14 @@
Fri Sep 27 16:23:49 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c : Replaced instances where strlen (label->label) is
used to get a byte code with strlen (label->text) as label->text
contains the actual display text, while label->label contains
markup / mnemonics. (#92683, Patch from Shivram U
<shivaram.upadhyayula@wipro.com>, with some additions.)
* gtk/gtklabel.c (gtk_label_set_uline_text_internal):
Fix a leftover, now incorrect comment.
Fri Sep 27 16:15:11 2002 Owen Taylor <otaylor@redhat.com> Fri Sep 27 16:15:11 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_get_event_window_position): * gtk/gtknotebook.c (gtk_notebook_get_event_window_position):

View File

@ -1,3 +1,14 @@
Fri Sep 27 16:23:49 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c : Replaced instances where strlen (label->label) is
used to get a byte code with strlen (label->text) as label->text
contains the actual display text, while label->label contains
markup / mnemonics. (#92683, Patch from Shivram U
<shivaram.upadhyayula@wipro.com>, with some additions.)
* gtk/gtklabel.c (gtk_label_set_uline_text_internal):
Fix a leftover, now incorrect comment.
Fri Sep 27 16:15:11 2002 Owen Taylor <otaylor@redhat.com> Fri Sep 27 16:15:11 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_get_event_window_position): * gtk/gtknotebook.c (gtk_notebook_get_event_window_position):

View File

@ -1,3 +1,14 @@
Fri Sep 27 16:23:49 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtklabel.c : Replaced instances where strlen (label->label) is
used to get a byte code with strlen (label->text) as label->text
contains the actual display text, while label->label contains
markup / mnemonics. (#92683, Patch from Shivram U
<shivaram.upadhyayula@wipro.com>, with some additions.)
* gtk/gtklabel.c (gtk_label_set_uline_text_internal):
Fix a leftover, now incorrect comment.
Fri Sep 27 16:15:11 2002 Owen Taylor <otaylor@redhat.com> Fri Sep 27 16:15:11 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_get_event_window_position): * gtk/gtknotebook.c (gtk_notebook_get_event_window_position):

View File

@ -539,8 +539,8 @@ gtk_label_get_property (GObject *object,
case PROP_CURSOR_POSITION: case PROP_CURSOR_POSITION:
if (label->select_info) if (label->select_info)
{ {
gint offset = g_utf8_pointer_to_offset (label->label, gint offset = g_utf8_pointer_to_offset (label->text,
label->label + label->select_info->selection_end); label->text + label->select_info->selection_end);
g_value_set_int (value, offset); g_value_set_int (value, offset);
} }
else else
@ -549,8 +549,8 @@ gtk_label_get_property (GObject *object,
case PROP_SELECTION_BOUND: case PROP_SELECTION_BOUND:
if (label->select_info) if (label->select_info)
{ {
gint offset = g_utf8_pointer_to_offset (label->label, gint offset = g_utf8_pointer_to_offset (label->text,
label->label + label->select_info->selection_anchor); label->text + label->select_info->selection_anchor);
g_value_set_int (value, offset); g_value_set_int (value, offset);
} }
else else
@ -1851,8 +1851,10 @@ gtk_label_set_uline_text_internal (GtkLabel *label,
g_return_if_fail (GTK_IS_LABEL (label)); g_return_if_fail (GTK_IS_LABEL (label));
g_return_if_fail (str != NULL); g_return_if_fail (str != NULL);
/* Convert text to wide characters */ /* Split text into the base text and a separate pattern
* of underscores.
*/
new_str = g_new (gchar, strlen (str) + 1); new_str = g_new (gchar, strlen (str) + 1);
pattern = g_new (gchar, g_utf8_strlen (str, -1) + 1); pattern = g_new (gchar, g_utf8_strlen (str, -1) + 1);
@ -2167,7 +2169,7 @@ gtk_label_button_press (GtkWidget *widget,
if (event->type == GDK_3BUTTON_PRESS) if (event->type == GDK_3BUTTON_PRESS)
{ {
gtk_label_select_region_index (label, 0, strlen (label->label)); gtk_label_select_region_index (label, 0, strlen (label->text));
return TRUE; return TRUE;
} }
@ -2207,7 +2209,7 @@ gtk_label_button_press (GtkWidget *widget,
else else
{ {
if (event->type == GDK_3BUTTON_PRESS) if (event->type == GDK_3BUTTON_PRESS)
gtk_label_select_region_index (label, 0, strlen (label->label)); gtk_label_select_region_index (label, 0, strlen (label->text));
else if (event->type == GDK_2BUTTON_PRESS) else if (event->type == GDK_2BUTTON_PRESS)
gtk_label_select_word (label); gtk_label_select_word (label);
else else
@ -2799,10 +2801,10 @@ gtk_label_move_logically (GtkLabel *label,
gint start, gint start,
gint count) gint count)
{ {
gint offset = g_utf8_pointer_to_offset (label->label, gint offset = g_utf8_pointer_to_offset (label->text,
label->label + start); label->text + start);
if (label->label) if (label->text)
{ {
PangoLogAttr *log_attrs; PangoLogAttr *log_attrs;
gint n_attrs; gint n_attrs;
@ -2810,7 +2812,7 @@ gtk_label_move_logically (GtkLabel *label,
gtk_label_ensure_layout (label); gtk_label_ensure_layout (label);
length = g_utf8_strlen (label->label, -1); length = g_utf8_strlen (label->text, -1);
pango_layout_get_log_attrs (label->layout, &log_attrs, &n_attrs); pango_layout_get_log_attrs (label->layout, &log_attrs, &n_attrs);
@ -2834,7 +2836,7 @@ gtk_label_move_logically (GtkLabel *label,
g_free (log_attrs); g_free (log_attrs);
} }
return g_utf8_offset_to_pointer (label->label, offset) - label->label; return g_utf8_offset_to_pointer (label->text, offset) - label->text;
} }
static gint static gint
@ -2887,7 +2889,7 @@ gtk_label_move_visually (GtkLabel *label,
index = new_index; index = new_index;
while (new_trailing--) while (new_trailing--)
index = g_utf8_next_char (label->label + new_index) - label->label; index = g_utf8_next_char (label->text + new_index) - label->text;
} }
return index; return index;
@ -2897,11 +2899,11 @@ static gint
gtk_label_move_forward_word (GtkLabel *label, gtk_label_move_forward_word (GtkLabel *label,
gint start) gint start)
{ {
gint new_pos = g_utf8_pointer_to_offset (label->label, gint new_pos = g_utf8_pointer_to_offset (label->text,
label->label + start); label->text + start);
gint length; gint length;
length = g_utf8_strlen (label->label, -1); length = g_utf8_strlen (label->text, -1);
if (new_pos < length) if (new_pos < length)
{ {
PangoLogAttr *log_attrs; PangoLogAttr *log_attrs;
@ -2919,7 +2921,7 @@ gtk_label_move_forward_word (GtkLabel *label,
g_free (log_attrs); g_free (log_attrs);
} }
return g_utf8_offset_to_pointer (label->label, new_pos) - label->label; return g_utf8_offset_to_pointer (label->text, new_pos) - label->text;
} }
@ -2927,11 +2929,11 @@ static gint
gtk_label_move_backward_word (GtkLabel *label, gtk_label_move_backward_word (GtkLabel *label,
gint start) gint start)
{ {
gint new_pos = g_utf8_pointer_to_offset (label->label, gint new_pos = g_utf8_pointer_to_offset (label->text,
label->label + start); label->text + start);
gint length; gint length;
length = g_utf8_strlen (label->label, -1); length = g_utf8_strlen (label->text, -1);
if (new_pos > 0) if (new_pos > 0)
{ {
@ -2951,7 +2953,7 @@ gtk_label_move_backward_word (GtkLabel *label,
g_free (log_attrs); g_free (log_attrs);
} }
return g_utf8_offset_to_pointer (label->label, new_pos) - label->label; return g_utf8_offset_to_pointer (label->text, new_pos) - label->text;
} }
static void static void
@ -3004,7 +3006,7 @@ gtk_label_move_cursor (GtkLabel *label,
case GTK_MOVEMENT_PARAGRAPH_ENDS: case GTK_MOVEMENT_PARAGRAPH_ENDS:
case GTK_MOVEMENT_BUFFER_ENDS: case GTK_MOVEMENT_BUFFER_ENDS:
/* FIXME: Can do better here */ /* FIXME: Can do better here */
new_pos = count < 0 ? 0 : strlen (label->label); new_pos = count < 0 ? 0 : strlen (label->text);
break; break;
case GTK_MOVEMENT_DISPLAY_LINES: case GTK_MOVEMENT_DISPLAY_LINES:
case GTK_MOVEMENT_PARAGRAPHS: case GTK_MOVEMENT_PARAGRAPHS:
@ -3038,7 +3040,7 @@ gtk_label_move_cursor (GtkLabel *label,
case GTK_MOVEMENT_PARAGRAPH_ENDS: case GTK_MOVEMENT_PARAGRAPH_ENDS:
case GTK_MOVEMENT_BUFFER_ENDS: case GTK_MOVEMENT_BUFFER_ENDS:
/* FIXME: Can do better here */ /* FIXME: Can do better here */
new_pos = count < 0 ? 0 : strlen (label->label); new_pos = count < 0 ? 0 : strlen (label->text);
break; break;
case GTK_MOVEMENT_DISPLAY_LINES: case GTK_MOVEMENT_DISPLAY_LINES:
case GTK_MOVEMENT_PARAGRAPHS: case GTK_MOVEMENT_PARAGRAPHS:
@ -3086,7 +3088,7 @@ gtk_label_copy_clipboard (GtkLabel *label)
static void static void
gtk_label_select_all (GtkLabel *label) gtk_label_select_all (GtkLabel *label)
{ {
gtk_label_select_region_index (label, 0, strlen (label->label)); gtk_label_select_region_index (label, 0, strlen (label->text));
} }
/* Quick hack of a popup menu /* Quick hack of a popup menu