[recipes/todoist-3] Notification after Shopping List is successfully exported to Todoist



commit 44b2ca2c3e6bb4c8caa047c751c9662e2c5b86c6
Author: Ekta Nandwani <mailnandwaniekta gmail com>
Date:   Tue Aug 22 08:21:38 2017 +0530

    Notification after Shopping List is successfully exported to Todoist

 src/gr-shopping-list-exporter.c |    2 +
 src/gr-window.c                 |   17 +++++++++++++
 src/gr-window.h                 |    1 +
 src/gr-window.ui                |   50 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 70 insertions(+), 0 deletions(-)
---
diff --git a/src/gr-shopping-list-exporter.c b/src/gr-shopping-list-exporter.c
index 1d9198c..a9065d6 100644
--- a/src/gr-shopping-list-exporter.c
+++ b/src/gr-shopping-list-exporter.c
@@ -33,6 +33,7 @@
 #include "gr-shopping-page.h"
 #include "gr-shopping-list-formatter.h"
 #include "gr-mail.h"
+#include "gr-window.h"
 
 #define TODOIST_URL "https://todoist.com/API/v7/sync";
 
@@ -323,6 +324,7 @@ export_shopping_list_callback (RestProxyCall *call,
          g_object_unref (parser);
          if (exporter->dialog)
                close_dialog (exporter);
+         notify_export_done (GR_WINDOW (exporter->window));
 }
 
 static void
diff --git a/src/gr-window.c b/src/gr-window.c
index 584c27b..a16150d 100644
--- a/src/gr-window.c
+++ b/src/gr-window.c
@@ -100,6 +100,8 @@ struct _GrWindow
         GList *shopping_done_list;
         char **removed_ingredients;
 
+        GtkWidget *export_done_revealer;
+
         GObject *file_chooser;
         GrRecipeImporter *importer;
         GrRecipeExporter *exporter;
@@ -876,6 +878,19 @@ done_shopping (GrWindow *window)
         }
 }
 
+void
+notify_export_done (GrWindow *window)
+{
+    gtk_revealer_set_reveal_child (GTK_REVEALER (window->export_done_revealer), TRUE);
+}
+
+static void
+close_export_done (GrWindow *window)
+{
+    gtk_revealer_set_reveal_child (GTK_REVEALER (window->export_done_revealer), FALSE);
+}
+
+
 static void
 make_save_sensitive (GrEditPage *edit_page,
                      GParamSpec *pspec,
@@ -960,6 +975,7 @@ gr_window_class_init (GrWindowClass *klass)
         gtk_widget_class_bind_template_child (widget_class, GrWindow, remind_label);
         gtk_widget_class_bind_template_child (widget_class, GrWindow, shopping_added_revealer);
         gtk_widget_class_bind_template_child (widget_class, GrWindow, shopping_done_revealer);
+        gtk_widget_class_bind_template_child (widget_class, GrWindow, export_done_revealer);
         gtk_widget_class_bind_template_child (widget_class, GrWindow, sort_by_label);
         gtk_widget_class_bind_template_child (widget_class, GrWindow, sort_by_name_button);
         gtk_widget_class_bind_template_child (widget_class, GrWindow, sort_by_recency_button);
@@ -990,6 +1006,7 @@ gr_window_class_init (GrWindowClass *klass)
         gtk_widget_class_bind_template_callback (widget_class, back_to_shopping);
         gtk_widget_class_bind_template_callback (widget_class, make_save_sensitive);
         gtk_widget_class_bind_template_callback (widget_class, sort_clicked);
+        gtk_widget_class_bind_template_callback (widget_class, close_export_done);
 }
 
 static GtkClipboard *
diff --git a/src/gr-window.h b/src/gr-window.h
index 8120fae..b0117fb 100644
--- a/src/gr-window.h
+++ b/src/gr-window.h
@@ -84,5 +84,6 @@ void            gr_window_save_all                   (GrWindow   *window);
 void            gr_window_timer_expired              (GrWindow   *window,
                                                       GrRecipe   *recipe,
                                                       int         step);
+void            notify_export_done                   (GrWindow *window);
 
 G_END_DECLS
diff --git a/src/gr-window.ui b/src/gr-window.ui
index 0bac3f7..3c51deb 100644
--- a/src/gr-window.ui
+++ b/src/gr-window.ui
@@ -468,6 +468,56 @@
                 </child>
               </object>
             </child>
+            <child type="overlay">
+              <object class="GtkRevealer" id="export_done_revealer">
+                <property name="visible">1</property>
+                <property name="halign">center</property>
+                <property name="valign">start</property>
+                <child>
+                  <object class="GtkFrame">
+                    <property name="visible">1</property>
+                    <style>
+                      <class name="app-notification"/>
+                    </style>
+                    <child>
+                      <object class="GtkBox">
+                        <property name="visible">1</property>
+                        <property name="spacing">10</property>
+                        <child>
+                          <object class="GtkLabel">
+                            <property name="visible">1</property>
+                            <property name="hexpand">1</property>
+                            <property name="halign">center</property>
+                            <property name="label" translatable="yes">Shopping List has been exported to 
Todoist</property>
+                            <style>
+                              <class name="notification-label"/>
+                            </style>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkButton">
+                            <property name="visible">1</property>
+                            <property name="focus-on-click">0</property>
+                            <property name="relief">none</property>
+                            <signal name="clicked" handler="close_export_done" swapped="yes"/>
+                            <style>
+                              <class name="image-button"/>
+                            </style>
+                            <child>
+                              <object class="GtkImage">
+                                <property name="visible">1</property>
+                                <property name="icon-name">window-close-symbolic</property>
+                                <property name="icon-size">1</property>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
             <child>
               <object class="GtkStack" id="main_stack">
                 <property name="visible">1</property>


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