diff options
-rw-r--r-- | plugins/publish-calendar/publish-calendar.c | 42 | ||||
-rw-r--r-- | plugins/publish-calendar/url-editor-dialog.c | 4 | ||||
-rw-r--r-- | plugins/publish-calendar/url-editor-dialog.h | 2 |
3 files changed, 27 insertions, 21 deletions
diff --git a/plugins/publish-calendar/publish-calendar.c b/plugins/publish-calendar/publish-calendar.c index 27ab11ce3c..e63f4bca4c 100644 --- a/plugins/publish-calendar/publish-calendar.c +++ b/plugins/publish-calendar/publish-calendar.c @@ -540,21 +540,22 @@ url_add_clicked (GtkButton *button, PublishUIData *ui) model = gtk_tree_view_get_model (GTK_TREE_VIEW (ui->treeview)); url_editor = url_editor_dialog_new (model, NULL); - url_editor_dialog_run ((UrlEditorDialog *) url_editor); - uri = URL_EDITOR_DIALOG (url_editor)->uri; - if (uri->location) { - gtk_list_store_append (GTK_LIST_STORE (model), &iter); - gtk_list_store_set (GTK_LIST_STORE (model), &iter, + if (url_editor_dialog_run ((UrlEditorDialog *) url_editor)) { + uri = URL_EDITOR_DIALOG (url_editor)->uri; + if (uri->location) { + gtk_list_store_append (GTK_LIST_STORE (model), &iter); + gtk_list_store_set (GTK_LIST_STORE (model), &iter, URL_LIST_ENABLED_COLUMN, uri->enabled, URL_LIST_LOCATION_COLUMN, uri->location, URL_LIST_URL_COLUMN, uri, -1); - url_list_changed (ui); - publish_uris = g_slist_prepend (publish_uris, uri); - add_timeout (uri); - publish_uri_async (uri); - } else { - g_free (uri); + url_list_changed (ui); + publish_uris = g_slist_prepend (publish_uris, uri); + add_timeout (uri); + publish_uri_async (uri); + } else { + g_free (uri); + } } gtk_widget_destroy (url_editor); } @@ -574,19 +575,22 @@ url_edit_clicked (GtkButton *button, PublishUIData *ui) gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, 2, &uri, -1); url_editor = url_editor_dialog_new (model, uri); - url_editor_dialog_run ((UrlEditorDialog *) url_editor); - gtk_list_store_set (GTK_LIST_STORE (model), &iter, + if (url_editor_dialog_run ((UrlEditorDialog *) url_editor)) { + gtk_list_store_set (GTK_LIST_STORE (model), &iter, URL_LIST_ENABLED_COLUMN, uri->enabled, URL_LIST_LOCATION_COLUMN, uri->location, URL_LIST_URL_COLUMN, uri, -1); - id = GPOINTER_TO_UINT (g_hash_table_lookup (uri_timeouts, uri)); - if (id) - g_source_remove (id); - add_timeout (uri); - url_list_changed (ui); - publish_uri_async (uri); + id = GPOINTER_TO_UINT (g_hash_table_lookup (uri_timeouts, uri)); + if (id) + g_source_remove (id); + add_timeout (uri); + url_list_changed (ui); + publish_uri_async (uri); + } + + gtk_widget_destroy (url_editor); } } diff --git a/plugins/publish-calendar/url-editor-dialog.c b/plugins/publish-calendar/url-editor-dialog.c index 7456d4b193..ee1f33932d 100644 --- a/plugins/publish-calendar/url-editor-dialog.c +++ b/plugins/publish-calendar/url-editor-dialog.c @@ -544,7 +544,7 @@ url_editor_dialog_get_type (void) return type; } -void +gboolean url_editor_dialog_run (UrlEditorDialog *dialog) { gint response; @@ -576,4 +576,6 @@ url_editor_dialog_run (UrlEditorDialog *dialog) dialog->uri->events = g_slist_append (dialog->uri->events, g_strdup (e_source_peek_uid (p->data))); } gtk_widget_hide_all (GTK_WIDGET (dialog)); + + return response == GTK_RESPONSE_OK; } diff --git a/plugins/publish-calendar/url-editor-dialog.h b/plugins/publish-calendar/url-editor-dialog.h index 8f45807bd8..2fd7c19a4e 100644 --- a/plugins/publish-calendar/url-editor-dialog.h +++ b/plugins/publish-calendar/url-editor-dialog.h @@ -108,7 +108,7 @@ struct _UrlEditorDialogClass { GtkWidget *url_editor_dialog_new (GtkTreeModel *url_list_model, EPublishUri *uri); GType url_editor_dialog_get_type (void); -void url_editor_dialog_run (UrlEditorDialog *dialog); +gboolean url_editor_dialog_run (UrlEditorDialog *dialog); G_END_DECLS |