diff options
-rw-r--r-- | mail/em-account-editor.c | 24 | ||||
-rw-r--r-- | mail/em-filter-folder-element.c | 4 | ||||
-rw-r--r-- | mail/em-folder-selection-button.c | 59 | ||||
-rw-r--r-- | mail/em-folder-selection-button.h | 6 | ||||
-rw-r--r-- | mail/importers/evolution-mbox-importer.c | 4 | ||||
-rw-r--r-- | plugins/dbx-import/dbx-importer.c | 4 | ||||
-rw-r--r-- | plugins/pst-import/pst-importer.c | 4 |
7 files changed, 66 insertions, 39 deletions
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index 8e3b596551..c689ca61b7 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -622,11 +622,11 @@ default_folders_clicked (GtkButton *button, gpointer user_data) const gchar *uri; uri = e_mail_local_get_folder_uri (E_MAIL_LOCAL_FOLDER_DRAFTS); - em_folder_selection_button_set_selection ((EMFolderSelectionButton *) emae->priv->drafts_folder_button, uri); + em_folder_selection_button_set_folder_uri ((EMFolderSelectionButton *) emae->priv->drafts_folder_button, uri); emae_account_folder_changed ((EMFolderSelectionButton *) emae->priv->drafts_folder_button, emae); uri = e_mail_local_get_folder_uri (E_MAIL_LOCAL_FOLDER_SENT); - em_folder_selection_button_set_selection ((EMFolderSelectionButton *) emae->priv->sent_folder_button, uri); + em_folder_selection_button_set_folder_uri ((EMFolderSelectionButton *) emae->priv->sent_folder_button, uri); emae_account_folder_changed ((EMFolderSelectionButton *) emae->priv->sent_folder_button, emae); gtk_toggle_button_set_active (emae->priv->trash_folder_check, FALSE); @@ -1100,7 +1100,7 @@ emae_account_folder_changed (EMFolderSelectionButton *folder, EMAccountEditor *e account = em_account_editor_get_modified_account (emae); data = g_object_get_data (G_OBJECT (folder), "account-item"); - selection = em_folder_selection_button_get_selection (folder); + selection = em_folder_selection_button_get_folder_uri (folder); e_account_set_string (account, GPOINTER_TO_INT (data), selection); } @@ -1121,10 +1121,10 @@ emae_account_folder (EMAccountEditor *emae, const gchar *name, gint item, gint d uri = e_account_get_string (account, item); if (uri != NULL) { - em_folder_selection_button_set_selection (folder, uri); + em_folder_selection_button_set_folder_uri (folder, uri); } else { uri = e_mail_local_get_folder_uri (deffolder); - em_folder_selection_button_set_selection (folder, uri); + em_folder_selection_button_set_folder_uri (folder, uri); } g_object_set_data ((GObject *)folder, "account-item", GINT_TO_POINTER(item)); @@ -3051,7 +3051,7 @@ emae_real_url_toggled (GtkToggleButton *check, EMAccountEditor *emae) camel_url_free (url); /* clear the previous selection */ - em_folder_selection_button_set_selection ((EMFolderSelectionButton *)butt, ""); + em_folder_selection_button_set_folder_uri ((EMFolderSelectionButton *)butt, ""); } } @@ -3080,7 +3080,7 @@ emae_real_url_folder_changed (EMFolderSelectionButton *folder, EMAccountEditor * url = emae_account_url (emae, emae_service_info[emae->priv->source.type].account_uri_key); - curi_selected = em_folder_selection_button_get_selection (folder); + curi_selected = em_folder_selection_button_get_folder_uri (folder); if (!curi_selected || !*curi_selected) { camel_url_set_param (url, param_key, NULL); changed = TRUE; @@ -3101,7 +3101,7 @@ emae_real_url_folder_changed (EMFolderSelectionButton *folder, EMAccountEditor * changed = TRUE; } else { e_notice (NULL, GTK_MESSAGE_ERROR, "%s", _("Please select a folder from the current account.")); - em_folder_selection_button_set_selection (folder, ""); + em_folder_selection_button_set_folder_uri (folder, ""); } g_free (selected_folder_name); @@ -3146,7 +3146,7 @@ setup_checkable_folder (EMAccountEditor *emae, if (value && *value) { gchar *url_string = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); if (!url_string) { - em_folder_selection_button_set_selection (folderbutt, ""); + em_folder_selection_button_set_folder_uri (folderbutt, ""); } else { CamelURL *copy = camel_url_new (url_string, NULL); @@ -3156,14 +3156,14 @@ setup_checkable_folder (EMAccountEditor *emae, g_free (url_string); url_string = camel_url_to_string (copy, CAMEL_URL_HIDE_ALL); - em_folder_selection_button_set_selection (folderbutt, url_string ? url_string : ""); + em_folder_selection_button_set_folder_uri (folderbutt, url_string ? url_string : ""); g_free (url_string); } } else { - em_folder_selection_button_set_selection (folderbutt, ""); + em_folder_selection_button_set_folder_uri (folderbutt, ""); } - value = em_folder_selection_button_get_selection (folderbutt); + value = em_folder_selection_button_get_folder_uri (folderbutt); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), value && *value); gtk_widget_set_sensitive (button, available && value && *value); diff --git a/mail/em-filter-folder-element.c b/mail/em-filter-folder-element.c index 502ec5d45f..74f386481e 100644 --- a/mail/em-filter-folder-element.c +++ b/mail/em-filter-folder-element.c @@ -65,7 +65,7 @@ filter_folder_element_selected_cb (EMFolderSelectionButton *button, GtkWidget *toplevel; const gchar *uri; - uri = em_folder_selection_button_get_selection (button); + uri = em_folder_selection_button_get_folder_uri (button); g_free (ff->priv->uri); ff->priv->uri = g_strdup (uri); @@ -239,7 +239,7 @@ filter_folder_element_get_widget (EFilterElement *fe) button = em_folder_selection_button_new ( backend, _("Select Folder"), NULL); - em_folder_selection_button_set_selection ( + em_folder_selection_button_set_folder_uri ( EM_FOLDER_SELECTION_BUTTON (button), ff->priv->uri); gtk_widget_show (button); diff --git a/mail/em-folder-selection-button.c b/mail/em-folder-selection-button.c index d4ff9a1127..ec0479dfea 100644 --- a/mail/em-folder-selection-button.c +++ b/mail/em-folder-selection-button.c @@ -45,15 +45,16 @@ struct _EMFolderSelectionButtonPrivate { GtkWidget *icon; GtkWidget *label; - gchar *uri; gchar *title; gchar *caption; + gchar *folder_uri; }; enum { PROP_0, PROP_BACKEND, PROP_CAPTION, + PROP_FOLDER_URI, PROP_TITLE }; @@ -92,12 +93,13 @@ folder_selection_button_set_contents (EMFolderSelectionButton *button) label = GTK_LABEL (button->priv->label); backend = em_folder_selection_button_get_backend (button); - if (backend != NULL && button->priv->uri != NULL) { + if (backend != NULL && button->priv->folder_uri != NULL) { EMailSession *session; session = e_mail_backend_get_session (backend); e_mail_folder_uri_parse ( - CAMEL_SESSION (session), button->priv->uri, + CAMEL_SESSION (session), + button->priv->folder_uri, &store, &folder_name, NULL); } @@ -143,6 +145,12 @@ folder_selection_button_set_property (GObject *object, g_value_get_string (value)); return; + case PROP_FOLDER_URI: + em_folder_selection_button_set_folder_uri ( + EM_FOLDER_SELECTION_BUTTON (object), + g_value_get_string (value)); + return; + case PROP_TITLE: em_folder_selection_button_set_title ( EM_FOLDER_SELECTION_BUTTON (object), @@ -174,6 +182,13 @@ folder_selection_button_get_property (GObject *object, EM_FOLDER_SELECTION_BUTTON (object))); return; + case PROP_FOLDER_URI: + g_value_set_string ( + value, + em_folder_selection_button_get_folder_uri ( + EM_FOLDER_SELECTION_BUTTON (object))); + return; + case PROP_TITLE: g_value_set_string ( value, @@ -209,9 +224,9 @@ folder_selection_button_finalize (GObject *object) priv = EM_FOLDER_SELECTION_BUTTON_GET_PRIVATE (object); - g_free (priv->uri); g_free (priv->title); g_free (priv->caption); + g_free (priv->folder_uri); /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (em_folder_selection_button_parent_class)-> @@ -249,13 +264,13 @@ folder_selection_button_clicked (GtkButton *button) EMFT_EXCLUDE_VIRTUAL | EMFT_EXCLUDE_VTRASH); - em_folder_tree_set_selected (folder_tree, priv->uri, FALSE); + em_folder_tree_set_selected (folder_tree, priv->folder_uri, FALSE); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { const gchar *uri; uri = em_folder_selector_get_selected_uri (selector); - em_folder_selection_button_set_selection ( + em_folder_selection_button_set_folder_uri ( EM_FOLDER_SELECTION_BUTTON (button), uri); g_signal_emit (button, signals[SELECTED], 0); @@ -305,6 +320,17 @@ em_folder_selection_button_class_init (EMFolderSelectionButtonClass *class) g_object_class_install_property ( object_class, + PROP_FOLDER_URI, + g_param_spec_string ( + "folder-uri", + NULL, + NULL, + NULL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT)); + + g_object_class_install_property ( + object_class, PROP_TITLE, g_param_spec_string ( "title", @@ -344,8 +370,6 @@ em_folder_selection_button_init (EMFolderSelectionButton *emfsb) gtk_misc_set_alignment (GTK_MISC (emfsb->priv->label), 0.0, 0.5); gtk_box_pack_start (GTK_BOX (box), emfsb->priv->label, TRUE, TRUE, 0); gtk_widget_show (emfsb->priv->label); - - folder_selection_button_set_contents (emfsb); } GtkWidget * @@ -382,26 +406,29 @@ em_folder_selection_button_set_caption (EMFolderSelectionButton *button, } const gchar * -em_folder_selection_button_get_selection (EMFolderSelectionButton *button) +em_folder_selection_button_get_folder_uri (EMFolderSelectionButton *button) { g_return_val_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button), NULL); - return button->priv->uri; + return button->priv->folder_uri; } void -em_folder_selection_button_set_selection (EMFolderSelectionButton *button, - const gchar *uri) +em_folder_selection_button_set_folder_uri (EMFolderSelectionButton *button, + const gchar *folder_uri) { g_return_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button)); - if (g_strcmp0 (button->priv->uri, uri) == 0) - return; + /* An empty string is equivalent to NULL. */ + if (folder_uri != NULL && *folder_uri == '\0') + folder_uri = NULL; - g_free (button->priv->uri); - button->priv->uri = g_strdup (uri); + g_free (button->priv->folder_uri); + button->priv->folder_uri = g_strdup (folder_uri); folder_selection_button_set_contents (button); + + g_object_notify (G_OBJECT (button), "folder-uri"); } EMailBackend * diff --git a/mail/em-folder-selection-button.h b/mail/em-folder-selection-button.h index 8b31100e84..91c5e3ae78 100644 --- a/mail/em-folder-selection-button.h +++ b/mail/em-folder-selection-button.h @@ -75,11 +75,11 @@ const gchar * em_folder_selection_button_get_caption void em_folder_selection_button_set_caption (EMFolderSelectionButton *button, const gchar *caption); -const gchar * em_folder_selection_button_get_selection +const gchar * em_folder_selection_button_get_folder_uri (EMFolderSelectionButton *button); -void em_folder_selection_button_set_selection +void em_folder_selection_button_set_folder_uri (EMFolderSelectionButton *button, - const gchar *uri); + const gchar *folder_uri); void em_folder_selection_button_set_backend (EMFolderSelectionButton *button, EMailBackend *backend); diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c index d0697b1850..4b3a258e18 100644 --- a/mail/importers/evolution-mbox-importer.c +++ b/mail/importers/evolution-mbox-importer.c @@ -74,7 +74,7 @@ static void folder_selected (EMFolderSelectionButton *button, EImportTargetURI *target) { g_free (target->uri_dest); - target->uri_dest = g_strdup (em_folder_selection_button_get_selection (button)); + target->uri_dest = g_strdup (em_folder_selection_button_get_folder_uri (button)); } static GtkWidget * @@ -142,7 +142,7 @@ mbox_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im) _("Select folder"), _("Select folder to import into")); gtk_label_set_mnemonic_widget (label, w); - em_folder_selection_button_set_selection ( + em_folder_selection_button_set_folder_uri ( EM_FOLDER_SELECTION_BUTTON (w), select_uri); folder_selected ( EM_FOLDER_SELECTION_BUTTON (w), (EImportTargetURI *) target); diff --git a/plugins/dbx-import/dbx-importer.c b/plugins/dbx-import/dbx-importer.c index 3bc70030db..0a25169189 100644 --- a/plugins/dbx-import/dbx-importer.c +++ b/plugins/dbx-import/dbx-importer.c @@ -192,7 +192,7 @@ static void folder_selected (EMFolderSelectionButton *button, EImportTargetURI *target) { g_free (target->uri_dest); - target->uri_dest = g_strdup (em_folder_selection_button_get_selection (button)); + target->uri_dest = g_strdup (em_folder_selection_button_get_folder_uri (button)); } GtkWidget * @@ -260,7 +260,7 @@ org_gnome_evolution_readdbx_getwidget (EImport *ei, _("Select folder to import into")); gtk_label_set_mnemonic_widget (label, w); - em_folder_selection_button_set_selection ( + em_folder_selection_button_set_folder_uri ( EM_FOLDER_SELECTION_BUTTON (w), select_uri); folder_selected ( EM_FOLDER_SELECTION_BUTTON (w), (EImportTargetURI *) target); diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c index bdf5c27fe9..b7e2684458 100644 --- a/plugins/pst-import/pst-importer.c +++ b/plugins/pst-import/pst-importer.c @@ -206,7 +206,7 @@ static void folder_selected (EMFolderSelectionButton *button, EImportTargetURI *target) { g_free (target->uri_dest); - target->uri_dest = g_strdup (em_folder_selection_button_get_selection (button)); + target->uri_dest = g_strdup (em_folder_selection_button_get_folder_uri (button)); } /** @@ -443,7 +443,7 @@ org_credativ_evolution_readpst_getwidget (EImport *ei, EImportTarget *target, EI _("Select folder to import into")); foldername = get_suggested_foldername ((EImportTargetURI *) target); ((EImportTargetURI *) target)->uri_dest = g_strdup (foldername); - em_folder_selection_button_set_selection ((EMFolderSelectionButton *) w, foldername); + em_folder_selection_button_set_folder_uri ((EMFolderSelectionButton *) w, foldername); g_signal_connect (w, "selected", G_CALLBACK (folder_selected), target); gtk_box_pack_end ((GtkBox *) hbox, w, FALSE, FALSE, 0); g_signal_connect (check, "toggled", G_CALLBACK (widget_sanitizer_cb), w); |