source-dialog: save the source when 'Add' button is clicked

This commit is contained in:
Georges Basile Stavracas Neto
2015-05-25 12:35:32 -04:00
committed by Erick Pérez Castellanos
parent b91f732fba
commit d4899eaa39
2 changed files with 23 additions and 1 deletions
+1 -1
View File
@@ -818,7 +818,7 @@
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="action_widget_activated" object="GcalSourceDialog" swapped="no"/>
<signal name="clicked" handler="add_button_clicked" object="GcalSourceDialog" swapped="no"/>
<style>
<class name="suggested-action"/>
</style>
+22
View File
@@ -81,6 +81,9 @@ struct _GcalSourceDialog
#define ENTRY_PROGRESS_TIMEOUT 100
static void add_button_clicked (GtkWidget *button,
gpointer user_data);
static void add_source (GcalManager *manager,
ESource *source,
gboolean enabled,
@@ -180,6 +183,24 @@ GActionEntry actions[] = {
{"web", NULL, NULL, NULL, NULL}
};
static void
add_button_clicked (GtkWidget *button,
gpointer user_data)
{
GcalSourceDialogPrivate *priv = GCAL_SOURCE_DIALOG (user_data)->priv;
if (priv->source != NULL)
{
// Commit the new source
gcal_manager_save_source (priv->manager, priv->source);
priv->source = NULL;
gcal_source_dialog_set_mode (GCAL_SOURCE_DIALOG (user_data), GCAL_SOURCE_DIALOG_MODE_NORMAL);
}
}
static void
add_source (GcalManager *manager,
ESource *source,
@@ -1352,6 +1373,7 @@ gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
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);
gtk_widget_class_bind_template_callback (widget_class, add_button_clicked);
gtk_widget_class_bind_template_callback (widget_class, action_widget_activated);
gtk_widget_class_bind_template_callback (widget_class, back_button_clicked);
gtk_widget_class_bind_template_callback (widget_class, calendar_file_selected);