aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-05-24 17:47:02 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-05-24 18:31:00 +0800
commitd62ff957e10bdfb92b99608310ae9b96676ea4fa (patch)
tree76abd1d5ee59939df26fdbe77ff6b48771c0162f
parentdd56cdf3f64b50ada5db0ef6960519bc19815327 (diff)
downloadgsoc2013-empathy-d62ff957e10bdfb92b99608310ae9b96676ea4fa.tar
gsoc2013-empathy-d62ff957e10bdfb92b99608310ae9b96676ea4fa.tar.gz
gsoc2013-empathy-d62ff957e10bdfb92b99608310ae9b96676ea4fa.tar.bz2
gsoc2013-empathy-d62ff957e10bdfb92b99608310ae9b96676ea4fa.tar.lz
gsoc2013-empathy-d62ff957e10bdfb92b99608310ae9b96676ea4fa.tar.xz
gsoc2013-empathy-d62ff957e10bdfb92b99608310ae9b96676ea4fa.tar.zst
gsoc2013-empathy-d62ff957e10bdfb92b99608310ae9b96676ea4fa.zip
Add empathy.css and helper code to use it
https://bugzilla.gnome.org/show_bug.cgi?id=669473
-rw-r--r--data/Makefile.am5
-rw-r--r--data/empathy.css0
-rw-r--r--libempathy-gtk/empathy-ui-utils.c33
-rw-r--r--libempathy-gtk/empathy-ui-utils.h2
4 files changed, 40 insertions, 0 deletions
diff --git a/data/Makefile.am b/data/Makefile.am
index ffef27bf1..8a61b5eab 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -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
index 000000000..e69de29bb
--- /dev/null
+++ b/data/empathy.css
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index 23cff24f8..507f92336 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -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);
+}
diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h
index 2ffbf2cd8..093890e6c 100644
--- a/libempathy-gtk/empathy-ui-utils.h
+++ b/libempathy-gtk/empathy-ui-utils.h
@@ -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__ */