[gnome-calendar/calendar-editor] window: show source dialog when a calendar is activated



commit da41287fab0219046c9a928811cc6837b39613bc
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Feb 9 12:48:06 2015 -0200

    window: show source dialog when a calendar is activated

 data/ui/window.ui |    1 +
 src/gcal-window.c |   18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/data/ui/window.ui b/data/ui/window.ui
index 241feb4..bd2989a 100644
--- a/data/ui/window.ui
+++ b/data/ui/window.ui
@@ -347,6 +347,7 @@
             <property name="hexpand">True</property>
             <property name="vexpand">True</property>
             <property name="selection_mode">none</property>
+            <signal name="row-activated" handler="source_row_activated" object="GcalWindow" swapped="no" />
             <style>
               <class name="calendar-list" />
             </style>
diff --git a/src/gcal-window.c b/src/gcal-window.c
index 49f4e06..0864825 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -184,6 +184,7 @@ static void           add_source                         (GcalManager         *m
                                                           gboolean             enabled,
                                                           gpointer             user_data);
 
+
 static GtkWidget*     make_row_for_source                (GcalWindow          *window,
                                                           ESource             *source);
 
@@ -194,6 +195,10 @@ static void           remove_source                      (GcalManager         *m
 static void           show_source_dialog                 (GtkButton           *button,
                                                           gpointer             user_data);
 
+static void           source_row_activated               (GtkListBox          *listbox,
+                                                          GtkListBoxRow       *row,
+                                                          gpointer             user_data);
+
 static void           on_calendar_toggled                (GObject             *object,
                                                           GParamSpec          *pspec,
                                                           gpointer             user_data);
@@ -824,6 +829,18 @@ show_source_dialog (GtkButton *button,
 }
 
 static void
+source_row_activated (GtkListBox    *listbox,
+                      GtkListBoxRow *row,
+                      gpointer       user_data)
+{
+  GcalWindowPrivate *priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
+
+  gcal_source_dialog_set_mode (GCAL_SOURCE_DIALOG (priv->source_dialog), GCAL_SOURCE_DIALOG_MODE_EDIT);
+
+  gtk_window_present (GTK_WINDOW (priv->source_dialog));
+}
+
+static void
 on_calendar_toggled (GObject    *object,
                      GParamSpec *pspec,
                      gpointer    user_data)
@@ -1280,6 +1297,7 @@ gcal_window_class_init(GcalWindowClass *klass)
   gtk_widget_class_bind_template_child_private (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);
   gtk_widget_class_bind_template_callback (widget_class, search_toggled);


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