aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog31
-rw-r--r--shell/e-shell-folder-creation-dialog.c54
-rw-r--r--shell/e-shell-folder-creation-dialog.h20
-rw-r--r--shell/e-shell-folder-selection-dialog.c25
-rw-r--r--shell/e-shell-view-menu.c8
-rw-r--r--shell/e-storage-set-view.c1
6 files changed, 116 insertions, 23 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index a0fff636b5..81eeead46f 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,34 @@
+2001-02-08 Ettore Perazzoli <ettore@ximian.com>
+
+ * e-shell-folder-creation-dialog.c (dialog_clicked_cb): Destroy
+ the dialog instead of using `gnome_dialog_close()'.
+ (dialog_clicked_cb): Likewise.
+ (dialog_close_cb): Removed.
+ (e_shell_show_folder_creation_dialog): Don't connect to the
+ "close" signal anymore.
+
+ * e-shell-folder-selection-dialog.c
+ (folder_creation_dialog_result_cb): New callback. Set the default
+ folder to be the newly created one.
+ (impl_clicked): Use it.
+
+ * e-shell-folder-creation-dialog.c: Add members `folder_path',
+ `result_callback' and `result_callback_data' to `struct
+ _DialogData'.
+ (e_shell_show_folder_creation_dialog): New args @result_callback
+ and @result_callback_data.
+ (async_create_cb): Notify the result through the specified
+ callback.
+ (dialog_clicked_cb): Likewise. Set the `folder_path' in the
+ DialogData so that we can pass it over when we get the async
+ notification of the result of the operation.
+
+ * e-shell-folder-creation-dialog.h: New type
+ `EShellFolderCreationDialogCallback'.
+
+ * e-storage-set-view.c (e_storage_set_view_set_current_folder):
+ Show the node too, using `e_tree_model_show_node()'.
+
2001-02-05 Ettore Perazzoli <ettore@ximian.com>
* e-setup.c (copy_default_stuff): s/first time you run/first time
diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c
index 9778974614..9cdb8068fc 100644
--- a/shell/e-shell-folder-creation-dialog.c
+++ b/shell/e-shell-folder-creation-dialog.c
@@ -47,10 +47,17 @@
struct _DialogData {
GtkWidget *dialog;
EShell *shell;
+
GtkWidget *folder_name_entry;
GtkWidget *storage_set_view;
GtkWidget *folder_type_option_menu;
+
GList *folder_types;
+
+ char *folder_path;
+
+ EShellFolderCreationDialogCallback result_callback;
+ void *result_callback_data;
};
typedef struct _DialogData DialogData;
@@ -58,6 +65,8 @@ static void
dialog_data_destroy (DialogData *dialog_data)
{
e_free_string_list (dialog_data->folder_types);
+ g_free (dialog_data->folder_path);
+
g_free (dialog_data);
}
@@ -74,6 +83,11 @@ async_create_cb (EStorage *storage,
dialog_data = (DialogData *) data;
if (result == E_STORAGE_OK) {
+ if (dialog_data->result_callback != NULL)
+ (* dialog_data->result_callback) (dialog_data->shell,
+ E_SHELL_FOLDER_CREATION_DIALOG_RESULT_SUCCESS,
+ dialog_data->folder_path,
+ dialog_data->result_callback_data);
gtk_widget_destroy (dialog_data->dialog);
return;
}
@@ -121,13 +135,18 @@ dialog_clicked_cb (GnomeDialog *dialog,
char *folder_name;
char *path;
+ dialog_data = (DialogData *) data;
+
if (button_number != 0) {
- gnome_dialog_close (dialog);
+ if (dialog_data->result_callback != NULL)
+ (* dialog_data->result_callback) (dialog_data->shell,
+ E_SHELL_FOLDER_CREATION_DIALOG_RESULT_CANCEL,
+ NULL,
+ dialog_data->result_callback_data);
+ gtk_widget_destroy (GTK_WIDGET (dialog));
return;
}
- dialog_data = (DialogData *) data;
-
if (! entry_name_is_valid (GTK_ENTRY (dialog_data->folder_name_entry))) {
/* FIXME: Explain better. */
e_notice (GTK_WINDOW (dialog), GNOME_MESSAGE_BOX_ERROR,
@@ -136,9 +155,14 @@ dialog_clicked_cb (GnomeDialog *dialog,
}
parent_path = e_storage_set_view_get_current_folder
- (E_STORAGE_SET_VIEW (dialog_data->storage_set_view));
+ (E_STORAGE_SET_VIEW (dialog_data->storage_set_view));
if (parent_path == NULL) {
- gnome_dialog_close (dialog);
+ if (dialog_data->result_callback != NULL)
+ (* dialog_data->result_callback) (dialog_data->shell,
+ E_SHELL_FOLDER_CREATION_DIALOG_RESULT_CANCEL,
+ NULL,
+ dialog_data->result_callback_data);
+ gtk_widget_destroy (GTK_WIDGET (dialog));
return;
}
@@ -156,6 +180,9 @@ dialog_clicked_cb (GnomeDialog *dialog,
return;
}
+ g_free (dialog_data->folder_path);
+ dialog_data->folder_path = g_strdup (path);
+
e_storage_set_async_create_folder (storage_set,
path,
folder_type,
@@ -164,13 +191,6 @@ dialog_clicked_cb (GnomeDialog *dialog,
}
static void
-dialog_close_cb (GnomeDialog *dialog,
- void *data)
-{
- gtk_widget_destroy (GTK_WIDGET (dialog));
-}
-
-static void
dialog_destroy_cb (GtkObject *object,
void *data)
{
@@ -352,7 +372,9 @@ add_folder_types (GtkWidget *dialog,
void
e_shell_show_folder_creation_dialog (EShell *shell,
GtkWindow *parent_window,
- const char *default_parent_folder)
+ const char *default_parent_folder,
+ EShellFolderCreationDialogCallback result_callback,
+ void *result_callback_data)
{
GladeXML *gui;
GtkWidget *dialog;
@@ -385,12 +407,12 @@ e_shell_show_folder_creation_dialog (EShell *shell,
dialog_data->storage_set_view = storage_set_view;
dialog_data->folder_type_option_menu = glade_xml_get_widget (gui, "folder_type_option_menu");
dialog_data->folder_types = folder_types;
-
+ dialog_data->folder_path = NULL;
+ dialog_data->result_callback = result_callback;
+ dialog_data->result_callback_data = result_callback_data;
gtk_signal_connect (GTK_OBJECT (dialog), "clicked",
GTK_SIGNAL_FUNC (dialog_clicked_cb), dialog_data);
- gtk_signal_connect (GTK_OBJECT (dialog), "close",
- GTK_SIGNAL_FUNC (dialog_close_cb), dialog_data);
gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
GTK_SIGNAL_FUNC (dialog_destroy_cb), dialog_data);
diff --git a/shell/e-shell-folder-creation-dialog.h b/shell/e-shell-folder-creation-dialog.h
index ac7518f986..63b6b1179a 100644
--- a/shell/e-shell-folder-creation-dialog.h
+++ b/shell/e-shell-folder-creation-dialog.h
@@ -28,8 +28,22 @@
#include "e-shell.h"
-void e_shell_show_folder_creation_dialog (EShell *shell,
- GtkWindow *parent,
- const char *default_parent_folder);
+enum _EShellFolderCreationDialogResult {
+ E_SHELL_FOLDER_CREATION_DIALOG_RESULT_SUCCESS,
+ E_SHELL_FOLDER_CREATION_DIALOG_RESULT_FAIL,
+ E_SHELL_FOLDER_CREATION_DIALOG_RESULT_CANCEL
+};
+typedef enum _EShellFolderCreationDialogResult EShellFolderCreationDialogResult;
+
+typedef void (* EShellFolderCreationDialogCallback) (EShell *shell,
+ EShellFolderCreationDialogResult result,
+ const char *path,
+ void *data);
+
+void e_shell_show_folder_creation_dialog (EShell *shell,
+ GtkWindow *parent,
+ const char *default_parent_folder,
+ EShellFolderCreationDialogCallback result_callback,
+ void *result_callback_data);
#endif /* E_SHELL_FOLDER_CREATION_DIALOG_H */
diff --git a/shell/e-shell-folder-selection-dialog.c b/shell/e-shell-folder-selection-dialog.c
index be530ef59c..c76e956131 100644
--- a/shell/e-shell-folder-selection-dialog.c
+++ b/shell/e-shell-folder-selection-dialog.c
@@ -93,12 +93,31 @@ check_folder_type (EShellFolderSelectionDialog *folder_selection_dialog)
}
e_notice (GTK_WINDOW (folder_selection_dialog), GNOME_MESSAGE_BOX_ERROR,
- _("The type of the selected folder is not valid for\nthe requested operation."));
+ _("The type of the selected folder is not valid for\n"
+ "the requested operation."));
return FALSE;
}
+/* Folder creation dialog callback. */
+
+static void
+folder_creation_dialog_result_cb (EShell *shell,
+ EShellFolderCreationDialogResult result,
+ const char *path,
+ void *data)
+{
+ EShellFolderSelectionDialog *dialog;
+ EShellFolderSelectionDialogPrivate *priv;
+
+ dialog = E_SHELL_FOLDER_SELECTION_DIALOG (data);
+ priv = dialog->priv;
+
+ e_storage_set_view_set_current_folder (E_STORAGE_SET_VIEW (priv->storage_set_view), path);
+}
+
+
/* GtkObject methods. */
static void
@@ -175,7 +194,9 @@ impl_clicked (GnomeDialog *dialog,
default_parent_folder = e_storage_set_view_get_current_folder (storage_set_view);
e_shell_show_folder_creation_dialog (priv->shell, GTK_WINDOW (dialog),
- default_parent_folder);
+ default_parent_folder,
+ folder_creation_dialog_result_cb,
+ dialog);
break;
}
diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c
index 42b7753197..30b184b2ae 100644
--- a/shell/e-shell-view-menu.c
+++ b/shell/e-shell-view-menu.c
@@ -278,7 +278,9 @@ command_new_folder (BonoboUIComponent *uih,
default_parent_folder = NULL;
e_shell_show_folder_creation_dialog (shell, GTK_WINDOW (shell_view),
- default_parent_folder);
+ default_parent_folder,
+ NULL /* result_callback */,
+ NULL /* result_callback_data */);
}
static void
@@ -378,7 +380,9 @@ command_create_folder (BonoboUIComponent *uih,
else
default_folder = NULL;
- e_shell_show_folder_creation_dialog (shell, GTK_WINDOW (shell_view), default_folder);
+ e_shell_show_folder_creation_dialog (shell, GTK_WINDOW (shell_view), default_folder,
+ NULL /* result_callback */,
+ NULL /* result_callback_data */);
}
static void
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c
index b2e9d14b34..da8669d075 100644
--- a/shell/e-storage-set-view.c
+++ b/shell/e-storage-set-view.c
@@ -1180,6 +1180,7 @@ e_storage_set_view_set_current_folder (EStorageSetView *storage_set_view,
return;
}
+ e_tree_model_show_node (priv->etree_model, node);
e_table_set_cursor_row (E_TABLE (storage_set_view),
e_tree_model_row_of_node (priv->etree_model, node));