[gnome-calendar/calendar-management] source-selector: update editor with source data
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/calendar-management] source-selector: update editor with source data
- Date: Fri, 30 Jan 2015 15:49:11 +0000 (UTC)
commit da7ac317cb99d398b3905f4368ff31ef07f81478
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun Jan 18 10:41:14 2015 -0200
source-selector: update editor with source data
data/ui/source-manager-dialog.ui | 2 +-
src/gcal-source-manager-dialog.c | 24 +++++++++++++++++++++++-
2 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/data/ui/source-manager-dialog.ui b/data/ui/source-manager-dialog.ui
index 4b21e92..8405efc 100644
--- a/data/ui/source-manager-dialog.ui
+++ b/data/ui/source-manager-dialog.ui
@@ -251,7 +251,7 @@
</packing>
</child>
<child>
- <object class="GtkSwitch" id="switch1">
+ <object class="GtkSwitch" id="default_source_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
diff --git a/src/gcal-source-manager-dialog.c b/src/gcal-source-manager-dialog.c
index 3741391..99c7438 100644
--- a/src/gcal-source-manager-dialog.c
+++ b/src/gcal-source-manager-dialog.c
@@ -23,6 +23,8 @@
struct _GcalSourceManagerDialogPrivate
{
GtkWidget *add_button;
+ GtkWidget *default_source_switch;
+ GtkWidget *edit_color_button;
GtkWidget *edit_stack;
GtkWidget *headerbar;
GtkWidget *sources_listbox;
@@ -118,7 +120,23 @@ row_selected_cb (GtkListBox *listbox,
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");
+ {
+ ESource *source;
+ ESourceSelectable *extension;
+ GdkRGBA color;
+
+ source = g_hash_table_lookup (priv->row_to_source, row);
+ extension = E_SOURCE_SELECTABLE (e_source_get_extension (source, E_SOURCE_EXTENSION_CALENDAR));
+
+ gtk_stack_set_visible_child_name (GTK_STACK (priv->edit_stack), "edit_page");
+
+ /* default source switch */
+ gtk_switch_set_active (GTK_SWITCH (priv->default_source_switch),
+ source == gcal_manager_get_default_source (priv->manager));
+ /* source color */
+ gdk_rgba_parse (&color, e_source_selectable_get_color (E_SOURCE_SELECTABLE (extension)));
+ gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (priv->edit_color_button), &color);
+ }
}
/**
@@ -141,6 +159,8 @@ source_added_cb (GcalManager *manager,
priv = gcal_source_manager_dialog_get_instance_private (GCAL_SOURCE_MANAGER_DIALOG (user_data));
row = make_row_for_source (GCAL_SOURCE_MANAGER_DIALOG (user_data), source);
+ g_hash_table_insert (priv->row_to_source, row, source);
+
gtk_container_add (GTK_CONTAINER (priv->sources_listbox), row);
}
@@ -284,6 +304,8 @@ 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,
default_source_switch);
+ gtk_widget_class_bind_template_child_private (widget_class, GcalSourceManagerDialog, edit_color_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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]