[dconf-editor] More fun with popovers.



commit 5241816dea2dfe96ff86c16334f2028c3547121a
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Tue Nov 21 14:52:18 2017 +0100

    More fun with popovers.

 editor/bookmarks.ui              |   34 ++++------------------------------
 editor/dconf-editor.css          |    4 ++++
 editor/registry-placeholder.ui   |    6 ++----
 editor/registry-placeholder.vala |   12 ++++++++++++
 editor/registry-view.ui          |    3 ++-
 5 files changed, 24 insertions(+), 35 deletions(-)
---
diff --git a/editor/bookmarks.ui b/editor/bookmarks.ui
index 2fd0327..f75153c 100644
--- a/editor/bookmarks.ui
+++ b/editor/bookmarks.ui
@@ -57,37 +57,11 @@
                 <property name="activate-on-single-click">True</property>
                 <signal name="row-activated" handler="bookmark_activated_cb"/>
                 <child type="placeholder">
-                  <object class="GtkGrid">
-                    <property name="visible">True</property>
-                    <property name="row-spacing">12</property>
-                    <property name="expand">True</property>
-                    <property name="halign">center</property>
-                    <property name="valign">center</property>
-                    <property name="orientation">vertical</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                    <child>
-                      <object class="GtkImage">
-                        <property name="visible">True</property>
-                        <property name="icon-name">starred-symbolic</property> <!-- or starred-symbolic? or 
dconf-editor-symbolic? -->
-                        <property name="pixel-size">36</property>
-                        <style>
-                          <class name="dim-label"/>
-                        </style>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkLabel">
-                        <property name="visible">True</property>
-                        <property name="justify">center</property>
-                        <property name="label" translatable="yes">Bookmarks will
+                  <object class="RegistryPlaceholder">
+                    <property name="label" translatable="yes">Bookmarks will
 be added here</property> <!-- line wrap wanted -->
-                        <attributes>
-                          <attribute name="weight" value="bold"/>
-                        </attributes>
-                      </object>
-                    </child>
+                    <property name="icon-name">starred-symbolic</property> <!-- or starred-symbolic? or 
dconf-editor-symbolic? -->
+                    <property name="big">False</property>
                   </object>
                 </child>
               </object>
diff --git a/editor/dconf-editor.css b/editor/dconf-editor.css
index 777887b..62dc9a7 100644
--- a/editor/dconf-editor.css
+++ b/editor/dconf-editor.css
@@ -265,3 +265,7 @@
 .greyed-label:disabled:backdrop {
   color:@unfocused_insensitive_color;
 }
+
+.big-popover {
+  font-size:144%;
+}
diff --git a/editor/registry-placeholder.ui b/editor/registry-placeholder.ui
index 73cd8d3..d6494b4 100644
--- a/editor/registry-placeholder.ui
+++ b/editor/registry-placeholder.ui
@@ -12,10 +12,8 @@
       <class name="dim-label"/>
     </style>
     <child>
-      <object class="GtkImage">
+      <object class="GtkImage" id="placeholder_image">
         <property name="visible">True</property>
-        <property name="icon-name">ca.desrt.dconf-editor-symbolic</property>
-        <property name="pixel-size">72</property>
         <style>
           <class name="dim-label"/>
         </style>
@@ -24,9 +22,9 @@
     <child>
       <object class="GtkLabel" id="placeholder_label">
         <property name="visible">True</property>
+        <property name="justify">center</property>
         <attributes>
           <attribute name="weight" value="bold"/>
-          <attribute name="scale" value="1.44"/>
         </attributes>
       </object>
     </child>
diff --git a/editor/registry-placeholder.vala b/editor/registry-placeholder.vala
index 376706b..b6a9f29 100644
--- a/editor/registry-placeholder.vala
+++ b/editor/registry-placeholder.vala
@@ -21,11 +21,23 @@ using Gtk;
 class RegistryPlaceholder : Grid
 {
     [GtkChild] private Label placeholder_label;
+    [GtkChild] private Image placeholder_image;
 
     public string label { private get; construct; }
+    public string icon_name { private get; construct; }
+    public bool big { private get; construct; default = false; }
 
     construct
     {
+        if (big)
+        {
+            placeholder_image.pixel_size = 72;
+            get_style_context ().add_class ("big-popover");
+        }
+        else
+            placeholder_image.pixel_size = 36;
+
         placeholder_label.label = label;
+        placeholder_image.icon_name = icon_name;
     }
 }
diff --git a/editor/registry-view.ui b/editor/registry-view.ui
index a391ec9..91e385c 100644
--- a/editor/registry-view.ui
+++ b/editor/registry-view.ui
@@ -136,8 +136,9 @@
                 <signal name="row-activated" handler="row_activated_cb"/>
                 <child type="placeholder">
                   <object class="RegistryPlaceholder">
-                    <property name="visible">True</property>
                     <property name="label" translatable="yes">No keys in this path</property>
+                    <property name="icon-name">ca.desrt.dconf-editor-symbolic</property>
+                    <property name="big">True</property>
                   </object>
                 </child>
               </object>


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