diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2002-07-19 03:31:37 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2002-07-19 03:31:37 +0800 |
commit | 8905d10a63d1007a57688021f7bb09f85a8d4ea0 (patch) | |
tree | e81f83a4007a81e32b89be950b83e0f27ef0aa84 | |
parent | 5334b3ed1b2ee458885713f11687f35ab5c839e3 (diff) | |
download | gsoc2013-evolution-8905d10a63d1007a57688021f7bb09f85a8d4ea0.tar gsoc2013-evolution-8905d10a63d1007a57688021f7bb09f85a8d4ea0.tar.gz gsoc2013-evolution-8905d10a63d1007a57688021f7bb09f85a8d4ea0.tar.bz2 gsoc2013-evolution-8905d10a63d1007a57688021f7bb09f85a8d4ea0.tar.lz gsoc2013-evolution-8905d10a63d1007a57688021f7bb09f85a8d4ea0.tar.xz gsoc2013-evolution-8905d10a63d1007a57688021f7bb09f85a8d4ea0.tar.zst gsoc2013-evolution-8905d10a63d1007a57688021f7bb09f85a8d4ea0.zip |
(double_click_cb): Renamed
from `dbl_click_cb'.
(check_folder_type): Don't pop up an error dialog anymore.
(check_folder_type_valid): Renamed from check_folder_type().
(folder_selected_cb): Make the OK button sensitive only if the
type of the selected folder is in the list of valid types;
otherwise, make it insensitive. [#848]
svn path=/trunk/; revision=17513
-rw-r--r-- | shell/ChangeLog | 10 | ||||
-rw-r--r-- | shell/e-shell-folder-selection-dialog.c | 116 |
2 files changed, 69 insertions, 57 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 34a6dd85cd..29c61274e3 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,13 @@ +2002-07-18 Ettore Perazzoli <ettore@ximian.com> + + * e-shell-folder-selection-dialog.c (double_click_cb): Renamed + from `dbl_click_cb'. + (check_folder_type): Don't pop up an error dialog anymore. + (check_folder_type_valid): Renamed from check_folder_type(). + (folder_selected_cb): Make the OK button sensitive only if the + type of the selected folder is in the list of valid types; + otherwise, make it insensitive. [#848] + 2002-07-18 Rodrigo Moya <rodrigo@ximian.com> * e-shell-importer.c (start_import): removed check for local folders, diff --git a/shell/e-shell-folder-selection-dialog.c b/shell/e-shell-folder-selection-dialog.c index e767ffd743..11d6493d0d 100644 --- a/shell/e-shell-folder-selection-dialog.c +++ b/shell/e-shell-folder-selection-dialog.c @@ -62,8 +62,10 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; +/* Utility functions. */ + static gboolean -check_folder_type (EShellFolderSelectionDialog *folder_selection_dialog) +check_folder_type_valid (EShellFolderSelectionDialog *folder_selection_dialog) { EShellFolderSelectionDialogPrivate *priv; const char *selected_path; @@ -93,13 +95,35 @@ check_folder_type (EShellFolderSelectionDialog *folder_selection_dialog) return TRUE; } - e_notice (GTK_WINDOW (folder_selection_dialog), GNOME_MESSAGE_BOX_ERROR, - _("The type of the selected folder is not valid for\n" - "the requested operation.")); - return FALSE; } +static void +set_default_folder (EShellFolderSelectionDialog *shell_folder_selection_dialog, + const char *default_uri) +{ + EShellFolderSelectionDialogPrivate *priv; + char *default_path; + + g_assert (default_uri != NULL); + + priv = shell_folder_selection_dialog->priv; + + if (strncmp (default_uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0) { + /* `evolution:' URI. */ + default_path = g_strdup (default_uri + E_SHELL_URI_PREFIX_LEN); + } else { + /* Physical URI. */ + default_path = e_storage_set_get_path_for_physical_uri (priv->storage_set, + default_uri); + } + + e_storage_set_view_set_current_folder (E_STORAGE_SET_VIEW (priv->storage_set_view), + default_path); + + g_free (default_path); +} + /* Folder creation dialog callback. */ @@ -165,30 +189,6 @@ impl_destroy (GtkObject *object) } -/* ETable callback */ -static void -dbl_click_cb (EStorageSetView *essv, - int row, - ETreePath path, - int col, - GdkEvent *event, - EShellFolderSelectionDialog *folder_selection_dialog) -{ - EShellFolderSelectionDialogPrivate *priv; - - g_return_if_fail (folder_selection_dialog != NULL); - - priv = folder_selection_dialog->priv; - if (check_folder_type (folder_selection_dialog)) { - gtk_signal_emit (GTK_OBJECT (folder_selection_dialog), - signals[FOLDER_SELECTED], - e_shell_folder_selection_dialog_get_selected_path (folder_selection_dialog)); - } - - gnome_dialog_close (GNOME_DIALOG (folder_selection_dialog)); -} - - /* GnomeDialog methods. */ static void @@ -206,7 +206,7 @@ impl_clicked (GnomeDialog *dialog, switch (button_number) { case 0: /* OK */ - if (check_folder_type (folder_selection_dialog)) { + if (check_folder_type_valid (folder_selection_dialog)) { gtk_signal_emit (GTK_OBJECT (folder_selection_dialog), signals[FOLDER_SELECTED], e_shell_folder_selection_dialog_get_selected_path (folder_selection_dialog)); gnome_dialog_close (GNOME_DIALOG (dialog)); @@ -291,44 +291,46 @@ init (EShellFolderSelectionDialog *shell_folder_selection_dialog) } +/* ETable callbacks. */ + static void -set_default_folder (EShellFolderSelectionDialog *shell_folder_selection_dialog, - const char *default_uri) +folder_selected_cb (EStorageSetView *storage_set_view, + const char *path, + void *data) { - EShellFolderSelectionDialogPrivate *priv; - char *default_path; - - g_assert (default_uri != NULL); - - priv = shell_folder_selection_dialog->priv; - - if (strncmp (default_uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0) { - /* `evolution:' URI. */ - default_path = g_strdup (default_uri + E_SHELL_URI_PREFIX_LEN); - } else { - /* Physical URI. */ - default_path = e_storage_set_get_path_for_physical_uri (priv->storage_set, - default_uri); - } + EShellFolderSelectionDialog *dialog; - e_storage_set_view_set_current_folder (E_STORAGE_SET_VIEW (priv->storage_set_view), - default_path); + dialog = E_SHELL_FOLDER_SELECTION_DIALOG (data); - g_free (default_path); + if (check_folder_type_valid (dialog)) + gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 0, TRUE); + else + gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 0, FALSE); } static void -folder_selected_cb (EStorageSetView *storage_set_view, - const char *path, - void *data) +double_click_cb (EStorageSetView *essv, + int row, + ETreePath path, + int col, + GdkEvent *event, + EShellFolderSelectionDialog *folder_selection_dialog) { - GnomeDialog *dialog; + EShellFolderSelectionDialogPrivate *priv; + + g_return_if_fail (folder_selection_dialog != NULL); - dialog = GNOME_DIALOG (data); + priv = folder_selection_dialog->priv; + if (check_folder_type_valid (folder_selection_dialog)) { + gtk_signal_emit (GTK_OBJECT (folder_selection_dialog), + signals[FOLDER_SELECTED], + e_shell_folder_selection_dialog_get_selected_path (folder_selection_dialog)); + } - gnome_dialog_set_sensitive (dialog, 0, TRUE); + gnome_dialog_close (GNOME_DIALOG (folder_selection_dialog)); } + /** * e_shell_folder_selection_dialog_construct: * @folder_selection_dialog: A folder selection dialog widget @@ -411,7 +413,7 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s g_free (filename); gtk_signal_connect (GTK_OBJECT (priv->storage_set_view), "double_click", - GTK_SIGNAL_FUNC (dbl_click_cb), + GTK_SIGNAL_FUNC (double_click_cb), folder_selection_dialog); gtk_signal_connect (GTK_OBJECT (priv->storage_set_view), "folder_selected", GTK_SIGNAL_FUNC (folder_selected_cb), |