]> git.0d.be Git - empathy.git/commitdiff
Add empathy.css and helper code to use it
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 24 May 2012 09:47:02 +0000 (11:47 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 24 May 2012 10:31:00 +0000 (12:31 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=669473

data/Makefile.am
data/empathy.css [new file with mode: 0644]
libempathy-gtk/empathy-ui-utils.c
libempathy-gtk/empathy-ui-utils.h

index ffef27bf132cd919f6500b3e4674b6acb97b1512..8a61b5eab7fd12f6cfa134e7e8b49f7fc1e64265 100644 (file)
@@ -56,6 +56,11 @@ html_DATA = \
        empathy-log-window.html \
        $(NULL)
 
+cssdir = $(datadir)/empathy
+css_DATA = \
+       empathy.css \
+       $(NULL)
+
 EXTRA_DIST =                           \
        $(convert_DATA)                 \
        $(desktop_in_files)             \
diff --git a/data/empathy.css b/data/empathy.css
new file mode 100644 (file)
index 0000000..e69de29
index 23cff24f8bde15c9d68f4b698eaa04f81a72ac39..507f9233686cbfdd269e5e4ec1d4b110628be7cd 100644 (file)
@@ -2307,3 +2307,36 @@ empathy_move_to_window_desktop (GtkWindow *window,
 out:
   gtk_window_present_with_time (window, timestamp);
 }
+
+void
+empathy_set_css_provider (GtkWidget *widget)
+{
+  GtkCssProvider *provider;
+  gchar *filename;
+  GError *error = NULL;
+  GdkScreen *screen;
+
+  filename = empathy_file_lookup ("empathy.css", "data");
+
+  provider = gtk_css_provider_new ();
+
+  if (!gtk_css_provider_load_from_path (provider, filename, &error))
+    {
+      g_warning ("Failed to load css file '%s': %s", filename, error->message);
+      g_error_free (error);
+      goto out;
+    }
+
+  if (widget != NULL)
+    screen = gtk_widget_get_screen (widget);
+  else
+    screen = gdk_screen_get_default ();
+
+  gtk_style_context_add_provider_for_screen (screen,
+      GTK_STYLE_PROVIDER (provider),
+      GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
+out:
+  g_free (filename);
+  g_object_unref (provider);
+}
index 2ffbf2cd8a932706d141b60972afb0a4b3031c59..093890e6cc764dcdb54e6e894d74b565f9d360d7 100644 (file)
@@ -161,6 +161,8 @@ void empathy_launch_program (const gchar *dir,
     const gchar *name,
     const gchar *args);
 
+void empathy_set_css_provider (GtkWidget *widget);
+
 G_END_DECLS
 
 #endif /*  __EMPATHY_UI_UTILS_H__ */