[gnome-system-monitor] Load a custom CSS and add a couple of borders



commit de65f4581e159aa5d1d32f89b0dd2b5f7900e00b
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Fri Aug 16 22:50:15 2013 +0200

    Load a custom CSS and add a couple of borders
    
    As per designer's request, we add a border to the
    process toolbar and to the header bar.

 data/interface.ui     |   57 ++++++++++++++++++++++++++++--------------------
 src/application.cpp   |   17 ++++++++++++++
 src/gsm.gresource.xml |    1 +
 3 files changed, 51 insertions(+), 24 deletions(-)
---
diff --git a/data/interface.ui b/data/interface.ui
index ab62207..5f90cf4 100644
--- a/data/interface.ui
+++ b/data/interface.ui
@@ -13,6 +13,7 @@
         <property name="show_close_button">True</property>
         <style>
           <class name="titlebar"/>
+          <class name="gsm-titlebar"/>
         </style>
         <child type="title">
           <object class="GtkStackSwitcher" id="stack_switcher">
@@ -127,38 +128,46 @@
                         <property name="visible">True</property>
                         <property name="transition_type">slide-up</property>
                         <child>
-                          <object class="GtkBox" id="proc_toolbar_box">
+                          <object class="GtkFrame" id="proc_toolbar_frame">
                             <property name="visible">True</property>
-                            <property name="orientation">horizontal</property>
-                            <property name="margin">6</property>
+                            <style>
+                              <class name="gsm-proc-toolbar"/>
+                            </style>
                             <child>
-                              <object class="GtkButton" id="end_process_button">
-                                <property name="label" translatable="yes">End _Process</property>
+                              <object class="GtkBox" id="proc_toolbar_box">
                                 <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">True</property>
-                                <property name="halign">start</property>
-                                <property name="use_underline">True</property>
-                                <property name="action_name">win.send-signal-end</property>
-                                <property name="action_target">@i 15</property>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="GtkButton" id="proc_properties_button">
-                                <property name="visible">True</property>
-                                <property name="tooltip_text" translatable="yes">Show process 
properties</property>
-                                <property name="action_name">win.process-properties</property>
+                                <property name="orientation">horizontal</property>
+                                <property name="margin">6</property>
                                 <child>
-                                  <object class="GtkImage" id="proc_properties_image">
+                                  <object class="GtkButton" id="end_process_button">
+                                    <property name="label" translatable="yes">End _Process</property>
                                     <property name="visible">True</property>
-                                    <property name="icon_size">1</property>
-                                    <property name="icon_name">document-properties-symbolic</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">True</property>
+                                    <property name="halign">start</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="action_name">win.send-signal-end</property>
+                                    <property name="action_target">@i 15</property>
                                   </object>
                                 </child>
+                                <child>
+                                  <object class="GtkButton" id="proc_properties_button">
+                                    <property name="visible">True</property>
+                                    <property name="tooltip_text" translatable="yes">Show process 
properties</property>
+                                    <property name="action_name">win.process-properties</property>
+                                    <child>
+                                      <object class="GtkImage" id="proc_properties_image">
+                                        <property name="visible">True</property>
+                                        <property name="icon_size">1</property>
+                                        <property name="icon_name">document-properties-symbolic</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                  <packing>
+                                    <property name="pack_type">end</property>
+                                  </packing>
+                                </child>
                               </object>
-                              <packing>
-                                <property name="pack_type">end</property>
-                              </packing>
                             </child>
                           </object>
                         </child>
diff --git a/src/application.cpp b/src/application.cpp
index 7b62f48..334978b 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -350,6 +350,21 @@ GsmApplication::shutdown()
     quit();
 }
 
+static void
+load_custom_css ()
+{
+    GFile *css_file = g_file_new_for_uri ("resource:///org/gnome/gnome-system-monitor/data/gsm.css");
+    GtkCssProvider *css_provider = gtk_css_provider_new ();
+
+    gtk_css_provider_load_from_file (css_provider, css_file, NULL);
+    gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
+                                               GTK_STYLE_PROVIDER (css_provider),
+                                               GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
+    g_object_unref (css_file);
+    g_object_unref (css_provider);
+}
+
 void GsmApplication::on_startup()
 {
     Gtk::Application::on_startup();
@@ -393,6 +408,8 @@ void GsmApplication::on_startup()
 
     load_settings ();
 
+    load_custom_css ();
+
     pretty_table = new PrettyTable();
     smooth_refresh = new SmoothRefresh(settings);
 
diff --git a/src/gsm.gresource.xml b/src/gsm.gresource.xml
index d6b4a8d..858c9a6 100644
--- a/src/gsm.gresource.xml
+++ b/src/gsm.gresource.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
   <gresource prefix="/org/gnome/gnome-system-monitor">
+    <file>data/gsm.css</file>
     <file preprocess="xml-stripblanks">data/interface.ui</file>
     <file preprocess="xml-stripblanks">data/lsof.ui</file>
     <file preprocess="xml-stripblanks">data/openfiles.ui</file>


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