1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 2007 Imendio AB
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
23 #include <gtk/gtktexttag.h>
25 #include "empathy-theme-utils.h"
28 empathy_theme_utils_ensure_tag_by_name (GtkTextBuffer *buffer, const gchar *name)
30 GtkTextTagTable *table;
33 table = gtk_text_buffer_get_tag_table (buffer);
34 tag = gtk_text_tag_table_lookup (table, name);
37 gtk_text_buffer_create_tag (buffer,
44 empathy_theme_utils_init_tag_by_name (GtkTextTagTable *table, const gchar *name)
48 tag = gtk_text_tag_table_lookup (table, name);
51 return gtk_text_tag_new (name);
54 /* Clear the old values so that we don't affect the new theme. */
56 "background-set", FALSE,
57 "foreground-set", FALSE,
58 "invisible-set", FALSE,
59 "justification-set", FALSE,
60 "paragraph-background-set", FALSE,
61 "pixels-above-lines-set", FALSE,
62 "pixels-below-lines-set", FALSE,
74 empathy_theme_utils_add_tag (GtkTextTagTable *table, GtkTextTag *tag)
77 GtkTextTag *check_tag;
79 g_object_get (tag, "name", &name, NULL);
80 check_tag = gtk_text_tag_table_lookup (table, name);
86 gtk_text_tag_table_add (table, tag);