[shotwell/wip/phako/nicer-screen: 2/2] wip: nicer messages



commit 84385fff5ac41071ee510cdb00f3410dc4a19368
Author: Jens Georg <mail jensge org>
Date:   Mon Jan 28 16:00:58 2019 +0100

    wip: nicer messages

 data/org.gnome.Shotwell.gresource.xml |  1 +
 data/ui/message_pane.ui               | 47 +++++++++++++++++++++++++++++++++++
 src/Page.vala                         | 38 +++++++++++++++++++++++-----
 3 files changed, 80 insertions(+), 6 deletions(-)
---
diff --git a/data/org.gnome.Shotwell.gresource.xml b/data/org.gnome.Shotwell.gresource.xml
index f17928c4..07074b1c 100644
--- a/data/org.gnome.Shotwell.gresource.xml
+++ b/data/org.gnome.Shotwell.gresource.xml
@@ -12,6 +12,7 @@
       <file preprocess="xml-stripblanks">ui/import_queue.ui</file>
       <file preprocess="xml-stripblanks">ui/import.ui</file>
       <file preprocess="xml-stripblanks">ui/media.ui</file>
+      <file preprocess="xml-stripblanks">ui/message_pane.ui</file>
       <file preprocess="xml-stripblanks">ui/multitextentrydialog.ui</file>
       <file preprocess="xml-stripblanks">ui/manifest_widget.ui</file>
       <file preprocess="xml-stripblanks">ui/offline.ui</file>
diff --git a/data/ui/message_pane.ui b/data/ui/message_pane.ui
new file mode 100644
index 00000000..8dc1c046
--- /dev/null
+++ b/data/ui/message_pane.ui
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.0 -->
+<interface>
+  <requires lib="gtk+" version="3.22"/>
+  <template class="PageMessagePane" parent="GtkBox">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="valign">center</property>
+    <property name="margin_top">12</property>
+    <property name="margin_bottom">12</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkImage" id="icon_image">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="halign">center</property>
+        <property name="margin_bottom">12</property>
+        <property name="pixel_size">128</property>
+        <property name="icon_name">x-office-document-symbolic</property>
+        <property name="icon_size">0</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">label</property>
+        <attributes>
+          <attribute name="scale" value="1.3999999999999999"/>
+        </attributes>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <style>
+      <class name="dim-label"/>
+    </style>
+  </template>
+</interface>
diff --git a/src/Page.vala b/src/Page.vala
index 7b787935..0f8e5935 100644
--- a/src/Page.vala
+++ b/src/Page.vala
@@ -1213,11 +1213,26 @@ public abstract class Page : Gtk.ScrolledWindow {
 
 }
 
+[GtkTemplate (ui = "/org/gnome/Shotwell/ui/message_pane.ui")]
+private class PageMessagePane : Gtk.Box {
+    [GtkChild]
+    public Gtk.Label label;
+
+ /*   [GtkChild]
+    public Gtk.Image icon_image; */
+
+    public PageMessagePane() {
+        Object();
+    }
+}
+
 public abstract class CheckerboardPage : Page {
     private const int AUTOSCROLL_PIXELS = 50;
     private const int AUTOSCROLL_TICKS_MSEC = 50;
     
     private CheckerboardLayout layout;
+    private Gtk.Stack stack;
+    private PageMessagePane message_pane;
     private string item_context_menu_path = null;
     private string page_context_menu_path = null;
     private Gtk.Viewport viewport = new Gtk.Viewport(null, null);
@@ -1249,9 +1264,15 @@ public abstract class CheckerboardPage : Page {
 
     public CheckerboardPage(string page_name) {
         base (page_name);
+
+        stack = new Gtk.Stack();
+        message_pane = new PageMessagePane();
         
         layout = new CheckerboardLayout(get_view());
         layout.set_name(page_name);
+        stack.add_named (layout, "layout");
+        stack.add_named (message_pane, "message");
+        stack.set_visible_child(layout);
         
         set_event_source(layout);
 
@@ -1261,7 +1282,7 @@ public abstract class CheckerboardPage : Page {
         viewport.set_border_width(0);
         viewport.set_shadow_type(Gtk.ShadowType.NONE);
         
-        viewport.add(layout);
+        viewport.add(stack);
         
         // want to set_adjustments before adding to ScrolledWindow to let our signal handlers
         // run first ... otherwise, the thumbnails draw late
@@ -1416,15 +1437,20 @@ public abstract class CheckerboardPage : Page {
     }
     
     public void set_page_message(string message) {
-        layout.set_message(message);
+//        layout.set_message(message);
+        critical("Setting message %s", message);
+        message_pane.label.label = message;
         if (is_in_view())
-            layout.queue_draw();
+            stack.set_visible_child_name ("message");
+//            layout.queue_draw();
     }
     
     public void unset_page_message() {
-        layout.unset_message();
-        if (is_in_view())
-            layout.queue_draw();
+//        layout.unset_message();
+        if (is_in_view()) {
+            stack.set_visible_child (layout);
+//            layout.queue_draw();
+        }
     }
     
     public override void set_page_name(string name) {


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