[gnome-calendar] app-menu: add a Calendars... item in the app menu



commit 46deb620e7b607004a7e042906eeb90be34a1abc
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri May 20 22:33:35 2016 -0300

    app-menu: add a Calendars... item in the app menu
    
    I won't hurt to have 2 ways to access this dialog and,
    appearently, the current behavior happens to bother
    some users.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762705

 data/ui/menus.ui  |    6 ++++++
 data/ui/window.ui |    2 +-
 src/gcal-window.c |   36 +++++++++++++++++++-----------------
 3 files changed, 26 insertions(+), 18 deletions(-)
---
diff --git a/data/ui/menus.ui b/data/ui/menus.ui
index a677c66..f04a0fa 100644
--- a/data/ui/menus.ui
+++ b/data/ui/menus.ui
@@ -15,6 +15,12 @@
     </section>
     <section>
       <item>
+        <attribute name="label" translatable="yes">_Calendars…</attribute>
+        <attribute name="action">win.show-calendars</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
         <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
         <attribute name="action">win.show-help-overlay</attribute>
       </item>
diff --git a/data/ui/window.ui b/data/ui/window.ui
index 8c19113..41a4b81 100644
--- a/data/ui/window.ui
+++ b/data/ui/window.ui
@@ -315,7 +315,7 @@
             <property name="can_focus">True</property>
             <property name="relief">none</property>
             <property name="receives_default">True</property>
-            <signal name="clicked" handler="show_source_dialog" object="GcalWindow" swapped="no"/>
+            <property name="action_name">win.show-calendars</property>
             <child>
               <object class="GtkLabel" id="calendar_settings_label">
                 <property name="visible">True</property>
diff --git a/src/gcal-window.c b/src/gcal-window.c
index 12333c6..03ebc36 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -137,6 +137,10 @@ enum
 }
 
 
+static void           on_show_calendars_action_activated (GSimpleAction       *action,
+                                                          GVariant            *param,
+                                                          gpointer             user_data);
+
 static void           on_date_action_activated           (GSimpleAction       *action,
                                                           GVariant            *param,
                                                           gpointer             user_data);
@@ -204,9 +208,6 @@ static void           remove_source                      (GcalManager         *m
                                                           ESource             *source,
                                                           gpointer             user_data);
 
-static void           show_source_dialog                 (GtkButton           *button,
-                                                          gpointer             user_data);
-
 static void           source_row_activated               (GtkListBox          *listbox,
                                                           GtkListBoxRow       *row,
                                                           gpointer             user_data);
@@ -280,9 +281,24 @@ static const GActionEntry actions[] = {
   {"previous", on_date_action_activated },
   {"today",    on_date_action_activated },
   {"change-view", on_view_action_activated, "i" },
+  {"show-calendars", on_show_calendars_action_activated },
 };
 
 static void
+on_show_calendars_action_activated (GSimpleAction *action,
+                                    GVariant      *param,
+                                    gpointer       user_data)
+{
+  GcalWindow *window = GCAL_WINDOW (user_data);
+
+  gcal_source_dialog_set_mode (GCAL_SOURCE_DIALOG (window->source_dialog), GCAL_SOURCE_DIALOG_MODE_NORMAL);
+
+  gtk_widget_hide (window->calendar_popover);
+
+  gtk_widget_show (window->source_dialog);
+}
+
+static void
 on_date_action_activated (GSimpleAction *action,
                           GVariant      *param,
                           gpointer       user_data)
@@ -887,19 +903,6 @@ remove_source (GcalManager *manager,
 }
 
 static void
-show_source_dialog (GtkButton *button,
-                    gpointer   user_data)
-{
-  GcalWindow *window = GCAL_WINDOW (user_data);
-
-  gcal_source_dialog_set_mode (GCAL_SOURCE_DIALOG (window->source_dialog), GCAL_SOURCE_DIALOG_MODE_NORMAL);
-
-  gtk_widget_hide (window->calendar_popover);
-
-  gtk_widget_show (window->source_dialog);
-}
-
-static void
 source_row_activated (GtkListBox    *listbox,
                       GtkListBoxRow *row,
                       gpointer       user_data)
@@ -1324,7 +1327,6 @@ gcal_window_class_init(GcalWindowClass *klass)
   gtk_widget_class_bind_template_child (widget_class, GcalWindow, notification_action_button);
   gtk_widget_class_bind_template_child (widget_class, GcalWindow, notification_close_button);
 
-  gtk_widget_class_bind_template_callback (widget_class, show_source_dialog);
   gtk_widget_class_bind_template_callback (widget_class, source_row_activated);
 
   gtk_widget_class_bind_template_callback (widget_class, key_pressed);


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