[gnome-calendar/calendar-editor] source-dialog: use different detail frames
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/calendar-editor] source-dialog: use different detail frames
- Date: Tue, 31 Mar 2015 03:30:35 +0000 (UTC)
commit e873c09fe5dbe0f3b54dfc8f7c9f0a1ef7e79cea
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Mar 31 00:30:25 2015 -0300
source-dialog: use different detail frames
data/ui/source-dialog.ui | 353 +++++++++++++++++++++++++++++++---------------
src/gcal-source-dialog.c | 50 ++++---
2 files changed, 268 insertions(+), 135 deletions(-)
---
diff --git a/data/ui/source-dialog.ui b/data/ui/source-dialog.ui
index f889091..2dfbf61 100644
--- a/data/ui/source-dialog.ui
+++ b/data/ui/source-dialog.ui
@@ -204,6 +204,126 @@
<property name="width">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkFrame" id="web_details_frame">
+ <property name="visible">False</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkGrid" id="web_details_grid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_bottom">18</property>
+ <property name="row_spacing">12</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="web_title_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_bottom">6</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes">Calendar Details</property>
+ <property name="xalign">0</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="web_name_dim_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Name</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="web_new_calendar_name_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="web_author_dim_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Author</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="web_author_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="web_events_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="web_last_edited_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <style>
+ <class name="details-frame"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
</object>
</child>
<child type="tab">
@@ -238,6 +358,126 @@
<property name="top_attach">0</property>
</packing>
</child>
+ <child>
+ <object class="GtkFrame" id="local_details_frame">
+ <property name="visible">False</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkGrid" id="details_grid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_bottom">18</property>
+ <property name="row_spacing">12</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="title_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_bottom">6</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes">Calendar Details</property>
+ <property name="xalign">0</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="name_dim_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Name</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="new_calendar_name_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="author_dim_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Author</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="author_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="events_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="last_edited_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <style>
+ <class name="details-frame"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="position">1</property>
@@ -301,117 +541,4 @@
</object>
</child>
</template>
- <object class="GtkFrame" id="details_frame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkGrid" id="details_grid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_bottom">18</property>
- <property name="row_spacing">12</property>
- <property name="column_spacing">12</property>
- <child>
- <object class="GtkLabel" id="title_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_bottom">6</property>
- <property name="hexpand">True</property>
- <property name="label" translatable="yes">Calendar Details</property>
- <property name="xalign">0</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="name_dim_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Name</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="new_calendar_name_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="author_dim_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Author</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="author_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="events_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="last_edited_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">4</property>
- </packing>
- </child>
- </object>
- </child>
- <style>
- <class name="details-frame"/>
- </style>
- </object>
</interface>
diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c
index 6d503be..e559ab4 100644
--- a/src/gcal-source-dialog.c
+++ b/src/gcal-source-dialog.c
@@ -41,9 +41,12 @@ typedef struct
/* new source details */
GtkWidget *author_label;
GtkWidget *calendar_address_entry;
- GtkWidget *details_frame;
+ GtkWidget *local_details_frame;
GtkWidget *local_source_grid;
GtkWidget *new_calendar_name_entry;
+ GtkWidget *web_author_label;
+ GtkWidget *web_details_frame;
+ GtkWidget *web_new_calendar_name_entry;
GtkWidget *web_source_grid;
GtkWidget *web_sources_listbox;
GtkWidget *web_sources_revealer;
@@ -173,11 +176,8 @@ clear_pages (GcalSourceDialog *dialog)
gtk_revealer_set_reveal_child (GTK_REVEALER (priv->web_sources_revealer), FALSE);
- /* details frame */
- if (gtk_widget_get_parent (priv->details_frame) != NULL)
- gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (priv->details_frame)), priv->details_frame);
-
- gtk_widget_hide (priv->details_frame);
+ gtk_widget_hide (priv->web_details_frame);
+ gtk_widget_hide (priv->local_details_frame);
}
static void
@@ -404,40 +404,41 @@ setup_source_details (GcalSourceDialog *dialog,
ESource *source)
{
GcalSourceDialogPrivate *priv = dialog->priv;
+ GtkWidget *name_entry, *author_label, *frame;
gchar *email;
- GtkWidget *parent_grid;
if (gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->notebook)) == 0)
- parent_grid = priv->web_source_grid;
+ {
+ frame = priv->web_details_frame;
+ name_entry = priv->web_new_calendar_name_entry;
+ author_label = priv->web_author_label;
+ }
else
- parent_grid = priv->local_source_grid;
-
- /* If it's inside any grid, remove it */
- if (gtk_widget_get_parent (priv->details_frame) != NULL)
- gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (priv->details_frame)), priv->details_frame);
-
- /* Add it to the current grid */
- gtk_grid_attach (GTK_GRID (parent_grid), priv->details_frame, 0, 2, 2, 2);
+ {
+ frame = priv->local_details_frame;
+ name_entry = priv->new_calendar_name_entry;
+ author_label = priv->author_label;
+ }
/* Calendar name */
- gtk_entry_set_text (GTK_ENTRY (priv->new_calendar_name_entry), e_source_get_display_name (source));
+ gtk_entry_set_text (GTK_ENTRY (name_entry), e_source_get_display_name (source));
/* Email field */
email = gcal_manager_query_client_data (priv->manager, source, CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS);
if (email != NULL)
{
- gtk_label_set_markup (GTK_LABEL (priv->author_label), email);
+ gtk_label_set_markup (GTK_LABEL (author_label), email);
}
else
{
gchar *text = g_strdup_printf ("<i><small>%s</small></i>", _("No author"));
- gtk_label_set_markup (GTK_LABEL (priv->author_label), text);
+ gtk_label_set_markup (GTK_LABEL (author_label), text);
g_free (text);
}
- gtk_widget_show_all (priv->details_frame);
+ gtk_widget_show_all (frame);
}
/**
@@ -507,7 +508,10 @@ url_entry_text_changed (GObject *object,
priv->validate_url_resource_id = g_timeout_add (500, (GSourceFunc) validate_url_cb, user_data);
}
else
- gtk_entry_set_progress_fraction (GTK_ENTRY (priv->calendar_address_entry), 0);
+ {
+ gtk_entry_set_progress_fraction (GTK_ENTRY (priv->calendar_address_entry), 0);
+ gtk_revealer_set_reveal_child (GTK_REVEALER (priv->web_sources_revealer), FALSE);
+ }
}
/**
@@ -923,9 +927,9 @@ gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, calendar_color_button);
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, cancel_button);
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, default_check);
- gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, details_frame);
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, edit_grid);
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, headerbar);
+ gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, local_details_frame);
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, local_source_grid);
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, name_entry);
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, new_calendar_name_entry);
@@ -933,6 +937,8 @@ gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, remove_button);
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, select_file_button);
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, stack);
+ gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, web_details_frame);
+ gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, web_new_calendar_name_entry);
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, web_source_grid);
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, web_sources_listbox);
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, web_sources_revealer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]