[gnome-calendar/calendar-management] sources-dialog: change visible stack child on row selection
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/calendar-management] sources-dialog: change visible stack child on row selection
- Date: Thu, 15 Jan 2015 20:40:36 +0000 (UTC)
commit 1dd23b6650fa264e84c6ce311b78a5dfbf267a89
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Jan 15 07:20:29 2015 -0200
sources-dialog: change visible stack child on row selection
data/ui/source-manager-dialog.ui | 5 +++--
src/gcal-source-manager-dialog.c | 28 ++++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/data/ui/source-manager-dialog.ui b/data/ui/source-manager-dialog.ui
index c1d9004..4b21e92 100644
--- a/data/ui/source-manager-dialog.ui
+++ b/data/ui/source-manager-dialog.ui
@@ -65,6 +65,7 @@
<object class="GtkListBox" id="sources_listbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <signal name="row-selected" handler="row_selected_cb"
object="GcalSourceManagerDialog" swapped="no" />
</object>
</child>
</object>
@@ -261,8 +262,8 @@
</child>
</object>
<packing>
- <property name="name">page1</property>
- <property name="title" translatable="yes">page1</property>
+ <property name="name">edit_page</property>
+ <property name="title" translatable="yes">Edit</property>
<property name="position">1</property>
</packing>
</child>
diff --git a/src/gcal-source-manager-dialog.c b/src/gcal-source-manager-dialog.c
index 7d7b95d..3741391 100644
--- a/src/gcal-source-manager-dialog.c
+++ b/src/gcal-source-manager-dialog.c
@@ -23,6 +23,7 @@
struct _GcalSourceManagerDialogPrivate
{
GtkWidget *add_button;
+ GtkWidget *edit_stack;
GtkWidget *headerbar;
GtkWidget *sources_listbox;
@@ -46,6 +47,10 @@ static void display_header_func (GtkListBoxRow
GtkListBoxRow *before,
gpointer user_data);
+static void row_selected_cb (GtkListBox *listbox,
+ GtkListBoxRow *row,
+ gpointer user_data);
+
static void source_added_cb (GcalManager *manager,
ESource *source,
gboolean enabled,
@@ -97,6 +102,26 @@ display_header_func (GtkListBoxRow *row,
}
/**
+ * row_selected_cb:
+ *
+ * Updates the edit stack properties,
+ * according to the row selected.
+ *
+ * Returns:
+ */
+static void
+row_selected_cb (GtkListBox *listbox,
+ GtkListBoxRow *row,
+ gpointer user_data)
+{
+ GcalSourceManagerDialogPrivate *priv;
+ priv = gcal_source_manager_dialog_get_instance_private (GCAL_SOURCE_MANAGER_DIALOG (user_data));
+
+ if (row != NULL)
+ gtk_stack_set_visible_child_name (GTK_STACK (priv->edit_stack), "edit_page");
+}
+
+/**
* source_added_cb:
*
* Callback for when an #ESource is added
@@ -259,8 +284,11 @@ gcal_source_manager_dialog_class_init (GcalSourceManagerDialogClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/source-manager-dialog.ui");
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceManagerDialog, add_button);
+ gtk_widget_class_bind_template_child_private (widget_class, GcalSourceManagerDialog, edit_stack);
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceManagerDialog, headerbar);
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceManagerDialog, sources_listbox);
+
+ gtk_widget_class_bind_template_callback (widget_class, row_selected_cb);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]