]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-ui-utils.c
Try to load dtd and glade files from the srcdir first to aboid having to install...
[empathy.git] / libempathy-gtk / empathy-ui-utils.c
index 6f1b5a857716db32ade22564657bd381eb38ce54..22a5fc2f739ac04eaef2abd8db6cf6f66bb66e2b 100644 (file)
@@ -28,6 +28,8 @@
  *          Jeroen Zwartepoorte
  */
 
+#include <config.h>
+
 #include <string.h>
 #include <X11/Xatom.h>
 #include <gdk/gdkx.h>
@@ -63,7 +65,13 @@ get_glade_file (const gchar *filename,
        const char *name;
        GtkWidget **widget_ptr;
 
-       path = g_build_filename (DATADIR, "empathy", filename, NULL);
+       path = g_build_filename (UNINSTALLED_GLADE_DIR, filename, NULL);
+       if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+               g_free (path);
+               path = g_build_filename (DATADIR, "empathy", filename, NULL);
+       }
+       empathy_debug (DEBUG_DOMAIN, "Loading glade file %s", path);
+
        gui = glade_xml_new (path, root, domain);
        g_free (path);
 
@@ -1376,3 +1384,51 @@ empathy_toggle_button_set_state_quietly (GtkWidget *widget,
        g_signal_handlers_unblock_by_func (widget, callback, user_data);
 }
 
+GtkTextTag *
+empathy_text_buffer_tag_set (GtkTextBuffer *buffer,
+                            const gchar   *tag_name,
+                            const gchar   *first_property_name,
+                            ...)
+{
+       GtkTextTagTable *table;
+       GtkTextTag      *tag;
+
+       g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), NULL);
+       g_return_val_if_fail (tag_name != NULL, NULL);
+
+       table = gtk_text_buffer_get_tag_table (buffer);
+       tag = gtk_text_tag_table_lookup (table, tag_name);
+
+       if (!tag) {
+               tag = gtk_text_tag_new (tag_name);
+               gtk_text_tag_table_add (table, tag);
+               g_object_unref (tag);
+       } else {
+               /* Clear the old values so that we don't affect the new theme. */
+               g_object_set (tag,
+                             "background-set", FALSE,
+                             "foreground-set", FALSE,
+                             "invisible-set", FALSE,
+                             "justification-set", FALSE,
+                             "paragraph-background-set", FALSE,
+                             "pixels-above-lines-set", FALSE,
+                             "pixels-below-lines-set", FALSE,
+                             "rise-set", FALSE,
+                             "scale-set", FALSE,
+                             "size-set", FALSE,
+                             "style-set", FALSE,
+                             "weight-set", FALSE,
+                             NULL);
+       }
+
+       if (first_property_name) {
+               va_list list;
+
+               va_start (list, first_property_name);
+               g_object_set_valist (G_OBJECT (tag), first_property_name, list);
+               va_end (list);
+       }
+
+       return tag;
+}
+