[gnome-todo] gtd-plugin-dialog: always open in list panel.



commit dac9527ac2a20f39558dd423d8aa9b47e9dde889
Author: Kevin Lopez <kevin kevlopez com>
Date:   Mon Mar 6 01:10:44 2017 +0100

    gtd-plugin-dialog: always open in list panel.
    
    When we close the plugin dialog, instead of destroy it we hide
    it, so when we open another time the plugin dialog, it shows the last
    panel that was visible when we closed the dialog.
    
    The correct behavoir should be that when we click show extensions in
    the menu, always should appear the list of extensions.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=778588

 data/ui/plugin-dialog.ui |    3 +--
 src/gtd-plugin-dialog.c  |   16 ++++++++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/data/ui/plugin-dialog.ui b/data/ui/plugin-dialog.ui
index eadf71b..4319bd5 100644
--- a/data/ui/plugin-dialog.ui
+++ b/data/ui/plugin-dialog.ui
@@ -9,7 +9,7 @@
     <property name="width_request">600</property>
     <property name="height_request">450</property>
     <property name="border_width">0</property>
-    <signal name="delete-event" handler="gtk_widget_hide_on_delete" object="GtdPluginDialog" swapped="yes" />
+    <signal name="delete-event" handler="dialog_deleted" object="GtdPluginDialog"/>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
@@ -21,7 +21,6 @@
             <property name="can_focus">False</property>
             <property name="hexpand">True</property>
             <property name="vexpand">True</property>
-            <property name="transition_type">slide-left-right</property>
             <property name="interpolate_size">True</property>
             <child>
               <object class="GtkScrolledWindow">
diff --git a/src/gtd-plugin-dialog.c b/src/gtd-plugin-dialog.c
index d9a21b0..ac0800e 100644
--- a/src/gtd-plugin-dialog.c
+++ b/src/gtd-plugin-dialog.c
@@ -42,10 +42,24 @@ static void
 back_button_clicked (GtkWidget       *button,
                      GtdPluginDialog *self)
 {
+  gtk_stack_set_transition_type (GTK_STACK (self->stack), GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT);
   gtk_stack_set_visible_child_name (GTK_STACK (self->stack), "list");
   gtk_widget_hide (button);
 }
 
+static gboolean
+dialog_deleted (GtdPluginDialog *self,
+                GdkEvent        *event,
+                gpointer         data)
+{
+  gtk_stack_set_transition_type (GTK_STACK (self->stack), GTK_STACK_TRANSITION_TYPE_NONE);
+  gtk_stack_set_visible_child_name (GTK_STACK (self->stack), "list");
+  gtk_widget_hide (self->back_button);
+  gtk_widget_hide (GTK_WIDGET (self));
+
+  return GDK_EVENT_STOP;
+}
+
 static void
 show_preferences_cb (GtdPluginDialogRow *row,
                      PeasPluginInfo     *info,
@@ -76,6 +90,7 @@ show_preferences_cb (GtdPluginDialogRow *row,
     }
 
   /* Last, go to the preferences page */
+  gtk_stack_set_transition_type (GTK_STACK (self->stack), GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT);
   gtk_stack_set_visible_child_name (GTK_STACK (self->stack), "config");
   gtk_widget_show (self->back_button);
 }
@@ -187,6 +202,7 @@ gtd_plugin_dialog_class_init (GtdPluginDialogClass *klass)
   gtk_widget_class_bind_template_child (widget_class, GtdPluginDialog, stack);
 
   gtk_widget_class_bind_template_callback (widget_class, back_button_clicked);
+  gtk_widget_class_bind_template_callback (widget_class, dialog_deleted);
 }
 
 static void


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