[gnome-todo] task-list-view: allow adding tasks on special views



commit 17eef5d903acf98f533f2236028704875c120550
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun Oct 2 08:48:54 2016 -0300

    task-list-view: allow adding tasks on special views

 data/ui/list-view.ui     |   28 ++--------------------------
 src/gtd-task-list-view.c |    6 +++---
 2 files changed, 5 insertions(+), 29 deletions(-)
---
diff --git a/data/ui/list-view.ui b/data/ui/list-view.ui
index 68caf1a..2c38d5a 100644
--- a/data/ui/list-view.ui
+++ b/data/ui/list-view.ui
@@ -12,10 +12,9 @@
         <property name="vexpand">True</property>
         <property name="orientation">vertical</property>
         <child>
-          <object class="GtkStack" id="stack">
+          <object class="GtkOverlay">
             <property name="visible">True</property>
             <property name="vexpand">True</property>
-            <property name="transition_type">crossfade</property>
             <style>
               <class name="view" />
             </style>
@@ -53,12 +52,8 @@
                   </object>
                 </child>
               </object>
-              <packing>
-                <property name="name">list</property>
-                <property name="position">0</property>
-              </packing>
             </child>
-            <child>
+            <child type="overlay">
               <object class="GtkBox" id="empty_box">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
@@ -79,11 +74,6 @@
                       <class name="dim-label" />
                     </style>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
                 </child>
                 <child>
                   <object class="GtkLabel" id="empty_view_title_label">
@@ -95,11 +85,6 @@
                       <attribute name="scale" value="1.44"/>
                     </attributes>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
                 </child>
                 <child>
                   <object class="GtkLabel" id="empty_view_subtitle_label">
@@ -111,17 +96,8 @@
                       <class name="dim-label" />
                     </style>
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">2</property>
-                  </packing>
                 </child>
               </object>
-              <packing>
-                <property name="name">empty</property>
-                <property name="position">1</property>
-              </packing>
             </child>
           </object>
           <packing>
diff --git a/src/gtd-task-list-view.c b/src/gtd-task-list-view.c
index bc1999a..13f1a32 100644
--- a/src/gtd-task-list-view.c
+++ b/src/gtd-task-list-view.c
@@ -35,13 +35,13 @@ typedef struct
   GtdArrowFrame         *arrow_frame;
   GtdEditPane           *edit_pane;
   GtkRevealer           *edit_revealer;
+  GtkWidget             *empty_box;
   GtkListBox            *listbox;
   GtdTaskRow            *new_task_row;
   GtkRevealer           *revealer;
   GtkImage              *done_image;
   GtkLabel              *done_label;
   GtkScrolledWindow     *viewport;
-  GtkStack              *stack;
 
   /* internal */
   gboolean               can_toggle;
@@ -296,7 +296,7 @@ gtd_task_list_view__update_empty_state (GtdTaskListView *view)
         }
     }
 
-  gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), is_empty ? "empty" : "list");
+  gtk_widget_set_visible (view->priv->empty_box, is_empty);
 
   g_list_free (tasks);
 }
@@ -864,13 +864,13 @@ gtd_task_list_view_class_init (GtdTaskListViewClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GtdTaskListView, arrow_frame);
   gtk_widget_class_bind_template_child_private (widget_class, GtdTaskListView, edit_pane);
   gtk_widget_class_bind_template_child_private (widget_class, GtdTaskListView, edit_revealer);
+  gtk_widget_class_bind_template_child_private (widget_class, GtdTaskListView, empty_box);
   gtk_widget_class_bind_template_child_private (widget_class, GtdTaskListView, listbox);
   gtk_widget_class_bind_template_child_private (widget_class, GtdTaskListView, revealer);
   gtk_widget_class_bind_template_child_private (widget_class, GtdTaskListView, done_image);
   gtk_widget_class_bind_template_child_private (widget_class, GtdTaskListView, done_label);
   gtk_widget_class_bind_template_child_private (widget_class, GtdTaskListView, new_task_row);
   gtk_widget_class_bind_template_child_private (widget_class, GtdTaskListView, viewport);
-  gtk_widget_class_bind_template_child_private (widget_class, GtdTaskListView, stack);
 
   gtk_widget_class_bind_template_callback (widget_class, gtd_task_list_view__create_task);
   gtk_widget_class_bind_template_callback (widget_class, gtd_task_list_view__done_button_clicked);


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