62a63 > GdkColor signature_color; 71a73 > 119d120 < 178a180 > gboolean is_sig = FALSE; 205a208,214 > > if (!is_sig) > { > int is = pan_is_signature_delimitor (line, line_len); > /*support both standard and non standard sigs when highlighting*/ > is_sig = (is==SIG_STANDARD)||(is==SIG_NON_STANDARD); > } 206a216,220 > > if (strcmp (quote_tag, "quote_0")) > is_sig = FALSE; > > quote_tag = is_sig?"signature":quote_tag; 895a910,914 > if (url_tag == NULL) > { > g_assert (url_tag != NULL ); > return NULL; > } 896a916,918 > > /* ASSERTION FAILED */ > g_assert( GTK_IS_TEXT_TAG(url_tag)); 1011a1034,1166 > /* > * The following code was "stolen" from the gtk-devel archives > */ > static void > gtk_text_tag_copy_values (GtkTextTag *dest, GtkTextTag *src) > { > g_return_if_fail (dest); > g_return_if_fail (src); > g_return_if_fail (GTK_IS_TEXT_TAG (dest)); > g_return_if_fail (GTK_IS_TEXT_TAG (src)); > > gtk_text_attributes_copy_values (src->values, dest->values); > > #define _COPY_FLAG(flag) dest->flag = src->flag > _COPY_FLAG (bg_color_set); > _COPY_FLAG (bg_color_set); > _COPY_FLAG (bg_stipple_set); > _COPY_FLAG (fg_color_set); > // _COPY_FLAG (family_set); > // _COPY_FLAG (style_set); > // _COPY_FLAG (variant_set); > // _COPY_FLAG (weight_set); > // _COPY_FLAG (stretch_set); > // _COPY_FLAG (size_set); > _COPY_FLAG (fg_stipple_set); > _COPY_FLAG (justification_set); > _COPY_FLAG (left_margin_set); > _COPY_FLAG (indent_set); > _COPY_FLAG (rise_set); > _COPY_FLAG (strikethrough_set); > _COPY_FLAG (right_margin_set); > _COPY_FLAG (pixels_above_lines_set); > _COPY_FLAG (pixels_below_lines_set); > _COPY_FLAG (pixels_inside_wrap_set); > _COPY_FLAG (tabs_set); > _COPY_FLAG (underline_set); > _COPY_FLAG (wrap_mode_set); > _COPY_FLAG (bg_full_height_set); > _COPY_FLAG (invisible_set); > _COPY_FLAG (editable_set); > _COPY_FLAG (language_set); > #undef _COPY_FLAG > } > > > /** > ** gtk_text_tag_copy: -duplicate a tag > ** @tag: the #GtkTextTag to duplicate > ** > ** Create a new #GtkTextTag with same values as @tag. The returned > ** #GtkTextTag doesn't belong to any $GtkTextTagTable. > ** > ** Return value: the newly created #GtkTextTag > ***/ > GtkTextTag* gtk_text_tag_copy (GtkTextTag *tag) > { > GtkTextTag *ntag; > > g_return_val_if_fail (tag, NULL); > g_return_val_if_fail (GTK_IS_TEXT_TAG (tag), NULL); > > ntag = gtk_text_tag_new (tag->name); > gtk_text_tag_copy_values (ntag, tag); > return ntag; > } > > > /** > ** gtk_text_tag_table_install: > ** @table: a #GtkTextTagTable > ** @tag: a #GtkTextTag > ** > ** Add @tag to the tag table @table or, if a tag with the same name > ** already exists in @table, update the existing tag in the table with > ** the values in @tag. If the tag is anonymous, it is simply added to > ** the table. > ***/ > void gtk_text_tag_table_install (GtkTextTagTable *table, GtkTextTag *tag) > { > GtkTextTag *existing_tag; > g_return_if_fail (table); > g_return_if_fail (GTK_IS_TEXT_TAG_TABLE (table)); > g_return_if_fail (tag); > g_return_if_fail (GTK_IS_TEXT_TAG (tag)); > > if (!tag->name) > gtk_text_tag_table_add(table, tag); > else { > existing_tag = gtk_text_tag_table_lookup(table, tag->name); > if (existing_tag) > gtk_text_tag_copy_values(existing_tag, tag); > else > gtk_text_tag_table_add(table, tag); > } > } > /* setup the buffer tags */ > void > text_set_text_buffer_tags (GtkTextBuffer * buffer) > { > GtkTextTag * tag; > GtkTextTagTable * table = gtk_text_buffer_get_tag_table (buffer); > > tag = gtk_text_tag_new ("center"); > g_object_set (tag, "justification", GTK_JUSTIFY_CENTER, NULL); > gtk_text_tag_table_install (table, tag); > > tag = gtk_text_tag_new ("url"); > g_object_set (tag, "underline", PANGO_UNDERLINE_SINGLE, "foreground_gdk", &text_url_color, NULL); > gtk_text_tag_table_install (table, tag); > > tag = gtk_text_tag_new ("quote_0"); > g_object_set (tag, NULL); > gtk_text_tag_table_install (table, tag); > > tag = gtk_text_tag_new ("quote_1"); > g_object_set (tag, "foreground_gdk", &text_quoted_color[0], NULL); > gtk_text_tag_table_install (table, tag); > > tag = gtk_text_tag_new ("quote_2"); > g_object_set (tag, "foreground_gdk", &text_quoted_color[1], NULL); > gtk_text_tag_table_install (table, tag); > > tag = gtk_text_tag_new ("quote_3"); > g_object_set (tag, "foreground_gdk", &text_quoted_color[2], NULL); > gtk_text_tag_table_install (table, tag); > > tag = gtk_text_tag_new ("signature"); > g_object_set (tag, "foreground_gdk", &signature_color, NULL); > gtk_text_tag_table_install (table, tag); > > } > > 1016c1171 < --- > 1018c1173 < text_view = gtk_text_view_new (); --- > text_view = gtk_text_view_new (); 1033,1041c1188 < gtk_text_buffer_create_tag (_text_buffer, "center", < "justification", GTK_JUSTIFY_CENTER, < NULL); < /* add the new tags */ < gtk_text_buffer_create_tag (_text_buffer, "url", < "underline", PANGO_UNDERLINE_SINGLE, < "foreground_gdk", &text_url_color, < NULL); < --- > text_set_text_buffer_tags (_text_buffer); 1049,1054d1195 < /* set the quote colors */ < gtk_text_buffer_create_tag (_text_buffer, "quote_0", NULL); < gtk_text_buffer_create_tag (_text_buffer, "quote_1", "foreground_gdk", &text_quoted_color[0], NULL); < gtk_text_buffer_create_tag (_text_buffer, "quote_2", "foreground_gdk", &text_quoted_color[1], NULL); < gtk_text_buffer_create_tag (_text_buffer, "quote_3", "foreground_gdk", &text_quoted_color[2], NULL); < /* FIXME need some way to refresh these tags when user changes text color via prefs */ 1121,1123c1262 < gchar * pch = pan_strstr (body, "\n-- \n"); < if (pch != NULL) < pch[1] = '\0'; --- > pan_remove_signature (body); 1125c1264,1265 < --- > >