[gnome-chat] main-window: Add CSS file for customizing the app



commit 1d7274676f011e4fbb11b6d686f8509b05d58e5a
Author: Yosef Or Boczko <yoseforb gmail com>
Date:   Tue Sep 10 17:05:12 2013 +0300

    main-window: Add CSS file for customizing the app

 src/Makefile.am        |    1 +
 src/chat-main-window.c |   17 +++++++++++++++++
 src/chat.css           |    9 +++++++++
 src/chat.gresource.xml |    1 +
 4 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index ce4317a..a255d4a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -53,6 +53,7 @@ EXTRA_DIST = \
        chat-embed.ui \
        chat-main-toolbar.ui \
        chat-main-window.ui \
+       chat.css \
        chat-marshalers.list \
        $(NULL)
 
diff --git a/src/chat-main-window.c b/src/chat-main-window.c
index 7b82509..3baae90 100644
--- a/src/chat-main-window.c
+++ b/src/chat-main-window.c
@@ -163,12 +163,15 @@ static void
 chat_main_window_init (ChatMainWindow *self)
 {
   ChatMainWindowPrivate *priv;
+  GtkCssProvider *css_provider;
   GSimpleAction *action;
   GVariant *variant;
   gboolean maximized;
   const gint32 *position;
   const gint32 *size;
   gsize n_elements;
+  GFile *file;
+  GError *error = NULL;
 
   self->priv = chat_main_window_get_instance_private (self);
   priv = self->priv;
@@ -180,6 +183,20 @@ chat_main_window_init (ChatMainWindow *self)
   g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (action));
   g_object_unref (action);
 
+  css_provider = gtk_css_provider_new ();
+  file = g_file_new_for_uri ("resource:///org/gnome/chat/chat.css");
+  if (!gtk_css_provider_load_from_file (css_provider, file, &error))
+    {
+      g_warning ("Failed to add window style %s\n", error->message);
+      g_error_free (error);
+    }
+  else
+    {
+      gtk_style_context_add_provider_for_screen (gtk_window_get_screen (GTK_WINDOW (self)),
+                                                 (GtkStyleProvider *) css_provider,
+                                                 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+    }
+
   priv->settings = chat_settings_dup_singleton ();
 
   variant = g_settings_get_value (priv->settings, "window-size");
diff --git a/src/chat.css b/src/chat.css
new file mode 100644
index 0000000..db5de4a
--- /dev/null
+++ b/src/chat.css
@@ -0,0 +1,9 @@
+.chat-left-header-bar:dir(ltr),
+.chat-right-header-bar:dir(rtl) {
+  border-top-right-radius: 0;
+}
+
+.chat-right-header-bar:dir(ltr),
+.chat-left-header-bar:dir(rtl) {
+  border-top-left-radius: 0;
+}
diff --git a/src/chat.gresource.xml b/src/chat.gresource.xml
index f058342..5e2892a 100644
--- a/src/chat.gresource.xml
+++ b/src/chat.gresource.xml
@@ -6,5 +6,6 @@
     <file alias="contacts-list-dialog.ui" preprocess="xml-stripblanks" 
compressed="true">chat-contacts-list-dialog.ui</file>
     <file alias="main-toolbar.ui" preprocess="xml-stripblanks" compressed="true">chat-main-toolbar.ui</file>
     <file alias="main-window.ui" preprocess="xml-stripblanks" compressed="true">chat-main-window.ui</file>
+    <file>chat.css</file>
   </gresource>
 </gresources>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]