[california] Improve icons and popover buttons: Bug #735202



commit 488b150b1899e2e7d9f28c92fc6713c485ae65b7
Author: Jim Nelson <jim yorba org>
Date:   Fri Aug 22 15:32:58 2014 -0700

    Improve icons and popover buttons: Bug #735202

 data/Makefile.am                            |    8 +++
 data/icons/edit-symbolic.svg                |   76 +++++++++++++++++++++++++++
 src/application/california-application.vala |   18 ++++++
 src/application/california-resource.vala    |   24 ++++++++-
 src/host/host-quick-create-event.vala       |    6 --
 src/host/host-show-event.vala               |   10 ++--
 src/rc/calendar-manager-list.ui             |    2 +-
 src/rc/quick-create-event.ui                |    9 ++--
 8 files changed, 133 insertions(+), 20 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 4ed6d66..5775e13 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -20,9 +20,17 @@ data/gschemas.compiled: data/org.yorba.california.gschema.xml
 
 BUILT_SOURCES += data/gschemas.compiled
 
+ICON_FILES = \
+       data/icons/edit-symbolic.svg \
+       $(NULL)
+
+data_iconsdir = $(datadir)/california/icons/Adwaita/scalable/actions
+data_icons_DATA = $(ICON_FILES)
+
 EXTRA_DIST += \
        $(data_desktop_in_files) \
        $(appdata_in_files) \
+       $(ICON_FILES) \
        data/org.yorba.california.gschema.xml \
        $(NULL)
 
diff --git a/data/icons/edit-symbolic.svg b/data/icons/edit-symbolic.svg
new file mode 100644
index 0000000..294ca0b
--- /dev/null
+++ b/data/icons/edit-symbolic.svg
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   version="1.1"
+   width="16"
+   height="16"
+   id="svg7384"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="list-add-symbolic.svg">
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1360"
+     inkscape:window-height="724"
+     id="namedview3045"
+     showgrid="false"
+     showborder="false"
+     inkscape:showpageshadow="false"
+     inkscape:zoom="1"
+     inkscape:cx="10.018511"
+     inkscape:cy="10.058708"
+     inkscape:window-x="0"
+     inkscape:window-y="22"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="svg7384">
+    <inkscape:grid
+       type="xygrid"
+       id="grid3047"
+       empspacing="5"
+       visible="true"
+       enabled="true"
+       snapvisiblegridlinesonly="true" />
+  </sodipodi:namedview>
+  <title
+     id="title9167">Gnome Symbolic Icon Theme</title>
+  <defs
+     id="defs9" />
+  <metadata
+     id="metadata90">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title>Gnome Symbolic Icon Theme</dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <path
+     style="fill:#bebebe;fill-opacity:1;stroke:none"
+     d="M 1,15 4,14 13,5 C 12.728018,3.8509406 12.021543,3.2329291 11,3 l -9,9 z"
+     id="path3049"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cccccc" />
+  <path
+     style="fill:#bebebe;fill-opacity:1;stroke:none"
+     d="m 12,2 1,-1 c 1.048085,0.2307602 1.775924,0.827515 2,2 L 14,4 C 13.745812,2.9503172 
13.079146,2.2836505 12,2 z"
+     id="path3819"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="ccccc" />
+</svg>
diff --git a/src/application/california-application.vala b/src/application/california-application.vala
index bae0c14..c9fcbd5 100644
--- a/src/application/california-application.vala
+++ b/src/application/california-application.vala
@@ -105,6 +105,18 @@ public class Application : Gtk.Application {
         }
     }
     
+    /**
+     * Returns the path to the icon directory.
+     */
+    public File icon_dir {
+        owned get {
+            return !is_installed
+                ? build_root_dir.get_child("data").get_child("icons")
+                : prefix_dir.get_child("share").get_child("california").get_child("icons")
+                    .get_child("Adwaita").get_child("scalable").get_child("actions");
+        }
+    }
+    
     private Host.MainWindow? main_window = null;
     
     private Application() {
@@ -155,6 +167,9 @@ public class Application : Gtk.Application {
     public override void startup() {
         base.startup();
         
+        // Sub-unit initialization
+        Resource.init();
+        
         // unit initialization
         try {
             Util.init();
@@ -181,6 +196,9 @@ public class Application : Gtk.Application {
         Host.terminate();
         Util.terminate();
         
+        // sub-unit termination
+        Resource.terminate();
+        
         base.shutdown();
     }
     
diff --git a/src/application/california-resource.vala b/src/application/california-resource.vala
index fa73b1e..7ba802d 100644
--- a/src/application/california-resource.vala
+++ b/src/application/california-resource.vala
@@ -13,13 +13,33 @@ namespace California.Resource {
 public const string DEFAULT_PATH = "/org/yorba/california/rc";
 
 /**
- * Loads the resource and returns it as a casted object.
+ * Only to be called by California.Application
+ */
+public void init() {
+    // Alas, symbolic icons cannot be added via Gtk.IconTheme.add_builtin_icon(), so they must be
+    // installed on the file system and their directory added to the search path.  See
+    // https://bugzilla.gnome.org/show_bug.cgi?id=735247
+    Gtk.IconTheme.get_default().prepend_search_path(Application.instance.icon_dir.get_path());
+}
+
+/**
+ * Only to be called by California.Application
+ */
+public void terminate() {
+}
+
+private string to_fullpath(string path, string resource) {
+    return "%s%s%s".printf(path, path.has_suffix("/") ? "" : "/", resource);
+}
+
+/**
+ * Loads the resource, builds it, and returns it as a casted object.
  *
  * Any load error will cause the application to panic.  This generally indicates the resource
  * was not compiled in or that the path is malformed.
  */
 public T load<T>(string resource, string object_name, string path = DEFAULT_PATH) {
-    string fullpath = "%s%s%s".printf(path, path.has_suffix("/") ? "" : "/", resource);
+    string fullpath = to_fullpath(path, resource);
     
     Gtk.Builder builder = new Gtk.Builder();
     try {
diff --git a/src/host/host-quick-create-event.vala b/src/host/host-quick-create-event.vala
index eec35e9..8913969 100644
--- a/src/host/host-quick-create-event.vala
+++ b/src/host/host-quick-create-event.vala
@@ -38,9 +38,6 @@ public class QuickCreateEvent : Gtk.Grid, Toolkit.Card {
     private Gtk.ComboBoxText calendar_combo_box;
     
     [GtkChild]
-    private Gtk.Box action_button_box;
-    
-    [GtkChild]
     private Gtk.Button create_button;
     
     private Toolkit.ComboBoxTextModel<Backing.CalendarSource> model;
@@ -52,9 +49,6 @@ public class QuickCreateEvent : Gtk.Grid, Toolkit.Card {
         clear_text_connector.connect_to(details_entry);
         details_entry.bind_property("text", create_button, "sensitive", BindingFlags.SYNC_CREATE,
             transform_text_to_sensitivity);
-        
-        action_button_box.get_style_context().add_class(Gtk.STYLE_CLASS_LINKED);
-        action_button_box.get_style_context().add_class(Gtk.STYLE_CLASS_RAISED);
     }
     
     private bool transform_text_to_sensitivity(Binding binding, Value source_value, ref Value target_value) {
diff --git a/src/host/host-show-event.vala b/src/host/host-show-event.vala
index 399fe49..5d40370 100644
--- a/src/host/host-show-event.vala
+++ b/src/host/host-show-event.vala
@@ -61,10 +61,10 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
     
     private Toolkit.RotatingButtonBox rotating_button_box = new Toolkit.RotatingButtonBox();
     
-    private Gtk.Box action_box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0);
-    private Gtk.Button update_button = new Gtk.Button.from_icon_name("accessories-text-editor-symbolic",
+    private Gtk.Box action_box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 2);
+    private Gtk.Button update_button = new Gtk.Button.from_icon_name("edit-symbolic",
         Gtk.IconSize.BUTTON);
-    private Gtk.Button remove_button = new Gtk.Button.from_icon_name("list-remove-symbolic",
+    private Gtk.Button remove_button = new Gtk.Button.from_icon_name("user-trash-symbolic",
         Gtk.IconSize.BUTTON);
     
     private Gtk.Label delete_label = new Gtk.Label(_("Delete"));
@@ -80,13 +80,11 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
         
         update_button.tooltip_text = _("Edit event");
         remove_button.tooltip_text = _("Delete event");
+        update_button.relief = remove_button.relief = Gtk.ReliefStyle.NONE;
         
         action_box.pack_end(update_button, false, false);
         action_box.pack_end(remove_button, false, false);
-        action_box.get_style_context().add_class(Gtk.STYLE_CLASS_LINKED);
-        action_box.get_style_context().add_class(Gtk.STYLE_CLASS_RAISED);
         
-        remove_button.get_style_context().add_class("destructive-action");
         remove_this_button.get_style_context().add_class("destructive-action");
         remove_this_future_button.get_style_context().add_class("destructive-action");
         remove_all_button.get_style_context().add_class("destructive-action");
diff --git a/src/rc/calendar-manager-list.ui b/src/rc/calendar-manager-list.ui
index 617c703..3f76e72 100644
--- a/src/rc/calendar-manager-list.ui
+++ b/src/rc/calendar-manager-list.ui
@@ -107,7 +107,7 @@
             <property name="valign">center</property>
             <property name="hexpand">False</property>
             <property name="vexpand">False</property>
-            <property name="icon_name">accessories-text-editor-symbolic</property>
+            <property name="icon_name">edit-symbolic</property>
             <signal name="clicked" handler="on_edit_button_clicked" object="CaliforniaManagerCalendarList" 
swapped="no"/>
           </object>
           <packing>
diff --git a/src/rc/quick-create-event.ui b/src/rc/quick-create-event.ui
index 24cd1b3..e86fab3 100644
--- a/src/rc/quick-create-event.ui
+++ b/src/rc/quick-create-event.ui
@@ -179,6 +179,7 @@
           <object class="GtkBox" id="action_button_box">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="spacing">2</property>
             <child>
               <object class="GtkButton" id="edit_button">
                 <property name="visible">True</property>
@@ -186,6 +187,7 @@
                 <property name="receives_default">True</property>
                 <property name="tooltip_text" translatable="yes">Edit event details</property>
                 <property name="halign">end</property>
+                <property name="relief">none</property>
                 <property name="use_underline">True</property>
                 <signal name="clicked" handler="on_edit_button_clicked" 
object="CaliforniaHostQuickCreateEvent" swapped="no"/>
                 <child>
@@ -194,7 +196,7 @@
                     <property name="can_focus">False</property>
                     <property name="halign">center</property>
                     <property name="valign">center</property>
-                    <property name="icon_name">accessories-text-editor-symbolic</property>
+                    <property name="icon_name">edit-symbolic</property>
                   </object>
                 </child>
               </object>
@@ -213,7 +215,7 @@
                 <property name="receives_default">True</property>
                 <property name="tooltip_text" translatable="yes">Create event</property>
                 <property name="halign">end</property>
-                <property name="hexpand">False</property>
+                <property name="relief">none</property>
                 <property name="use_underline">True</property>
                 <signal name="clicked" handler="on_create_button_clicked" 
object="CaliforniaHostQuickCreateEvent" swapped="no"/>
                 <child>
@@ -225,9 +227,6 @@
                     <property name="icon_name">list-add-symbolic</property>
                   </object>
                 </child>
-                <style>
-                  <class name="suggested-action"/>
-                </style>
               </object>
               <packing>
                 <property name="expand">False</property>


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