[gnome-calendar] source-dialog: show edit page when a calendar is selected
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] source-dialog: show edit page when a calendar is selected
- Date: Mon, 25 May 2015 16:55:10 +0000 (UTC)
commit e11c57f0a773b03806a69a82b592703735c5a298
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Apr 8 15:31:11 2015 -0300
source-dialog: show edit page when a calendar is selected
data/ui/source-dialog.ui | 3 ++-
src/gcal-source-dialog.c | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/data/ui/source-dialog.ui b/data/ui/source-dialog.ui
index e0bb7d4..ab70128 100644
--- a/data/ui/source-dialog.ui
+++ b/data/ui/source-dialog.ui
@@ -268,6 +268,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="selection_mode">none</property>
+ <signal name="row-activated" handler="calendar_listbox_row_activated"
object="GcalSourceDialog" swapped="no" />
</object>
</child>
</object>
@@ -785,7 +786,7 @@
<property name="show_close_button">True</property>
<child>
<object class="GtkButton" id="back_button">
- <property name="visible">True</property>
+ <property name="visible">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<child>
diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c
index 7dca8fd..3df2dca 100644
--- a/src/gcal-source-dialog.c
+++ b/src/gcal-source-dialog.c
@@ -120,6 +120,10 @@ static void response_signal (GtkDialog *di
static void calendar_file_selected (GtkFileChooserButton *button,
gpointer user_data);
+static void calendar_listbox_row_activated (GtkListBox *box,
+ GtkListBoxRow *row,
+ gpointer user_data);
+
static void setup_source_details (GcalSourceDialog *dialog,
ESource *source);
@@ -497,6 +501,38 @@ calendar_file_selected (GtkFileChooserButton *button,
}
/**
+ * calendar_listbox_row_activated:
+ *
+ * Edits the selected calendar for the
+ * 'Calendars' listbox or goes to the
+ * calendar selection for the Online
+ * Accounts listbox.
+ *
+ * Returns:
+ */
+static void
+calendar_listbox_row_activated (GtkListBox *box,
+ GtkListBoxRow *row,
+ gpointer user_data)
+{
+ GcalSourceDialogPrivate *priv = GCAL_SOURCE_DIALOG (user_data)->priv;
+
+ g_assert (row != NULL);
+
+ /*
+ * For non-GOA calendars, show the edit page
+ * directly.
+ */
+ if (GTK_WIDGET (box) == priv->calendars_listbox)
+ {
+ ESource *source = g_object_get_data (G_OBJECT (row), "source");
+
+ gcal_source_dialog_set_source (GCAL_SOURCE_DIALOG (user_data), source);
+ gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), "edit");
+ }
+}
+
+/**
* setup_source_details:
*
* Setup the details frame of a given
@@ -1037,6 +1073,7 @@ gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
gtk_widget_class_bind_template_callback (widget_class, action_widget_activated);
gtk_widget_class_bind_template_callback (widget_class, calendar_file_selected);
+ gtk_widget_class_bind_template_callback (widget_class, calendar_listbox_row_activated);
gtk_widget_class_bind_template_callback (widget_class, color_set);
gtk_widget_class_bind_template_callback (widget_class, default_check_toggled);
gtk_widget_class_bind_template_callback (widget_class, description_label_link_activated);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]