[gedit] tools: add custom css styling for manager



commit 4e333377ebc74788dbcae56d85c01962ca391144
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Thu Feb 20 08:38:27 2014 +0100

    tools: add custom css styling for manager

 plugins/externaltools/tools/appactivatable.py |   39 ++++++++++++++++++++++++-
 plugins/externaltools/tools/tools.ui          |    9 ++++++
 2 files changed, 47 insertions(+), 1 deletions(-)
---
diff --git a/plugins/externaltools/tools/appactivatable.py b/plugins/externaltools/tools/appactivatable.py
index 0e931e7..cbf77af 100644
--- a/plugins/externaltools/tools/appactivatable.py
+++ b/plugins/externaltools/tools/appactivatable.py
@@ -16,7 +16,7 @@
 #    along with this program; if not, write to the Free Software
 #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-from gi.repository import GLib, Gio, GObject, Gtk, Gedit
+from gi.repository import GLib, Gio, GObject, Gtk, Gdk, Gedit
 from .library import ToolLibrary
 import os
 
@@ -78,6 +78,41 @@ class AppActivatable(GObject.Object, Gedit.AppActivatable):
         self._library = ToolLibrary()
         self._library.set_locations(os.path.join(self.plugin_info.get_data_dir(), 'tools'))
 
+        self.css = Gtk.CssProvider()
+        self.css.load_from_data("""
+.gedit-tool-manager-paned {
+  border-style: solid;
+  border-color: @borders;
+}
+
+.gedit-tool-manager-paned:dir(ltr) {
+  border-width: 0 1px 0 0;
+}
+
+.gedit-tool-manager-paned:dir(rtl) {
+  border-width: 0 0 0 1px;
+}
+
+.gedit-tool-manager-view {
+  border-width: 0 0 1px 0;
+}
+
+.gedit-tool-manager-treeview {
+  border-top-width: 0;
+}
+
+.gedit-tool-manager-treeview:dir(ltr) {
+  border-left-width: 0;
+}
+
+.gedit-tool-manager-treeview:dir(rtl) {
+  border-right-width: 0;
+}
+""".encode('utf-8'))
+
+        Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),
+                                                 self.css, 600)
+
         self.menu_ext = self.extend_menu("preferences-section")
         item = Gio.MenuItem.new(_("Manage _External Tools..."), "win.manage-tools")
         self.menu_ext.append_menu_item(item)
@@ -95,5 +130,7 @@ class AppActivatable(GObject.Object, Gedit.AppActivatable):
         self.menu.deactivate()
         self.menu_ext = None
         self.submenu_ext = None
+        Gtk.StyleContext.remove_for_screen(Gdk.Screen.get_default(),
+                                           self.css)
 
 # ex:ts=4:et:
diff --git a/plugins/externaltools/tools/tools.ui b/plugins/externaltools/tools/tools.ui
index 407bfda..5719cb1 100644
--- a/plugins/externaltools/tools/tools.ui
+++ b/plugins/externaltools/tools/tools.ui
@@ -173,6 +173,9 @@
         <property name="vexpand">True</property>
         <property name="position">275</property>
         <property name="position_set">True</property>
+        <style>
+          <class name="gedit-tool-manager-paned"/>
+        </style>
         <child>
           <object class="GtkBox" id="vbox2">
             <property name="visible">True</property>
@@ -183,6 +186,9 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="shadow_type">in</property>
+                <style>
+                  <class name="gedit-tool-manager-treeview"/>
+                </style>
                 <child>
                   <object class="GtkTreeView" id="view">
                     <property name="visible">True</property>
@@ -518,6 +524,9 @@
                         <property name="hexpand">True</property>
                         <property name="vexpand">True</property>
                         <property name="shadow_type">in</property>
+                        <style>
+                          <class name="gedit-tool-manager-view"/>
+                        </style>
                         <child>
                           <object class="GeditView" id="commands">
                             <property name="buffer">commands_buffer</property>


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