From f093b333fbee67da990d50b513333272418276e7 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Sat, 19 May 2001 16:11:47 +0000 Subject: Add a caption to the folder selection dialog widget, and get the existing dialogs in the shell to use it. svn path=/trunk/; revision=9894 --- shell/ChangeLog | 17 +++++++++++++++++ shell/e-shell-folder-selection-dialog.c | 26 +++++++++++++++++++++++--- shell/e-shell-folder-selection-dialog.h | 6 ++++-- shell/e-shell-importer.c | 6 ++---- shell/e-shell-view-menu.c | 16 ++++++++++++++++ shell/e-shell.c | 6 +++++- 6 files changed, 67 insertions(+), 10 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index 58b481bc35..be1472609a 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,20 @@ +2001-05-19 Ettore Perazzoli + + * e-shell.c (impl_Shell_selectUserFolder): Pass a NULL @caption to + `e_shell_folder_selection_dialog_new()'. + + * e-shell-importer.c (import_druid_finish): Add a caption to the + folder selection dialog. Constify local variable `foldername', + and avoid g_strdupping/g_freeing it, as it's useless. + + * e-shell-view-menu.c (command_goto_folder): Add a caption to + the folder selection dialog. + + * e-shell-folder-selection-dialog.c + (e_shell_folder_selection_dialog_new): New arg @caption. + (e_shell_folder_selection_dialog_construct): Likewise. Also + cleaned up a bit. + 2001-05-19 Ettore Perazzoli * e-shell-view-menu.c: Removed "NewView" verb. Added diff --git a/shell/e-shell-folder-selection-dialog.c b/shell/e-shell-folder-selection-dialog.c index 14ceab70b7..aa42d153ca 100644 --- a/shell/e-shell-folder-selection-dialog.c +++ b/shell/e-shell-folder-selection-dialog.c @@ -289,6 +289,7 @@ set_default_folder (EShellFolderSelectionDialog *shell_folder_selection_dialog, * @folder_selection_dialog: A folder selection dialog widget * @shell: The this folder selection dialog is for * @title: Title of the window + * @caption: A brief text to be put on top of the storage view * @default_uri: The URI of the folder to be selected by default * @allowed_types: List of the names of the allowed types * @@ -298,11 +299,13 @@ void e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_selection_dialog, EShell *shell, const char *title, + const char *caption, const char *default_uri, const char *allowed_types[]) { EShellFolderSelectionDialogPrivate *priv; GtkWidget *scroll_frame; + GtkWidget *caption_label; int i; g_return_if_fail (folder_selection_dialog != NULL); @@ -312,6 +315,10 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s priv = folder_selection_dialog->priv; + /* Basic dialog setup. */ + + gtk_window_set_policy (GTK_WINDOW (folder_selection_dialog), TRUE, TRUE, FALSE); + gtk_window_set_default_size (GTK_WINDOW (folder_selection_dialog), 350, 300); gtk_window_set_modal (GTK_WINDOW (folder_selection_dialog), TRUE); gtk_window_set_title (GTK_WINDOW (folder_selection_dialog), title); @@ -322,14 +329,25 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s NULL); gnome_dialog_set_default (GNOME_DIALOG (folder_selection_dialog), 0); - gtk_window_set_policy (GTK_WINDOW (folder_selection_dialog), TRUE, TRUE, FALSE); - gtk_window_set_default_size (GTK_WINDOW (folder_selection_dialog), 350, 300); + /* Make sure we get destroyed if the shell gets destroyed. */ priv->shell = shell; gtk_signal_connect_object_while_alive (GTK_OBJECT (shell), "destroy", GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (folder_selection_dialog)); + /* Set up the label. */ + + if (caption != NULL) { + caption_label = gtk_label_new (caption); + gtk_widget_show (caption_label); + + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (folder_selection_dialog)->vbox), + caption_label, FALSE, TRUE, 2); + } + + /* Set up the storage set and its view. */ + priv->storage_set = e_shell_get_storage_set (shell); gtk_object_ref (GTK_OBJECT (priv->storage_set)); @@ -367,6 +385,7 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s * e_shell_folder_selection_dialog_new: * @shell: The this folder selection dialog is for * @title: Title of the window + * @caption: A brief text to be put on top of the storage view * @default_uri: The URI of the folder to be selected by default * @allowed_types: List of the names of the allowed types * @@ -379,6 +398,7 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s GtkWidget * e_shell_folder_selection_dialog_new (EShell *shell, const char *title, + const char *caption, const char *default_uri, const char *allowed_types[]) { @@ -389,7 +409,7 @@ e_shell_folder_selection_dialog_new (EShell *shell, folder_selection_dialog = gtk_type_new (e_shell_folder_selection_dialog_get_type ()); e_shell_folder_selection_dialog_construct (folder_selection_dialog, shell, - title, default_uri, allowed_types); + title, caption, default_uri, allowed_types); return GTK_WIDGET (folder_selection_dialog); } diff --git a/shell/e-shell-folder-selection-dialog.h b/shell/e-shell-folder-selection-dialog.h index 2ddb98bafe..8aed7197dd 100644 --- a/shell/e-shell-folder-selection-dialog.h +++ b/shell/e-shell-folder-selection-dialog.h @@ -63,11 +63,13 @@ GtkType e_shell_folder_selection_dialog_get_type (void); void e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_selection_dialog, EShell *shell, const char *title, - const char *default_path, + const char *caption, + const char *default_uri, const char *allowed_types[]); GtkWidget *e_shell_folder_selection_dialog_new (EShell *shell, const char *title, - const char *default_path, + const char *caption, + const char *default_uri, const char *allowed_types[]); const char *e_shell_folder_selection_dialog_get_selected_path (EShellFolderSelectionDialog *folder_selection_dialog); diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index 0e66270a66..c8ab15aadf 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -590,15 +590,16 @@ import_druid_finish (GnomeDruidPage *page, ImportData *data) { GtkWidget *folder; + const char *foldername; char *filename; char *iid; - char *foldername; filename = g_strdup (gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (data->filepage->filename))))); iid = g_strdup (data->choosen_iid); folder = e_shell_folder_selection_dialog_new (data->shell, _("Select folder"), + _("Select a destination folder for importing this data"), e_shell_view_get_current_uri (data->view), NULL); gtk_widget_destroy (data->dialog); @@ -607,10 +608,7 @@ import_druid_finish (GnomeDruidPage *page, switch (gnome_dialog_run (GNOME_DIALOG (folder))) { case 0: foldername = e_shell_folder_selection_dialog_get_selected_path (E_SHELL_FOLDER_SELECTION_DIALOG (folder)); - foldername = g_strdup (foldername); - start_import (foldername, filename, iid); - g_free (foldername); break; default: diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c index 3f07b171bb..187348ae85 100644 --- a/shell/e-shell-view-menu.c +++ b/shell/e-shell-view-menu.c @@ -346,6 +346,20 @@ command_open_folder_in_new_window (BonoboUIComponent *uih, e_shell_new_view (shell, current_uri); } + +/* Folder operations. */ + +static void +command_move_folder (BonoboUIComponent *uih, + void *data, + const char *path) +{ + EShellView *shell_view; + + shell_view = E_SHELL_VIEW (data); + e_shell_command_move_folder (e_shell_view_get_shell (shell_view), shell_view); +} + /* Going to a folder. */ @@ -394,6 +408,7 @@ command_goto_folder (BonoboUIComponent *uih, folder_selection_dialog = e_shell_folder_selection_dialog_new (shell, _("Go to folder..."), + _("Select the folder that you want to open"), current_uri, NULL); @@ -516,6 +531,7 @@ BonoboUIVerb file_verbs [] = { BonoboUIVerb folder_verbs [] = { BONOBO_UI_VERB ("OpenFolderInNewWindow", command_open_folder_in_new_window), + BONOBO_UI_VERB ("MoveFolder", command_move_folder), BONOBO_UI_VERB_END }; diff --git a/shell/e-shell.c b/shell/e-shell.c index 4dc33de06d..d09ceca1ad 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -275,7 +275,11 @@ impl_Shell_selectUserFolder (PortableServer_Servant servant, /* CORBA doesn't allow you to pass a NULL pointer. */ if (!*default_folder) default_folder = NULL; - folder_selection_dialog = e_shell_folder_selection_dialog_new (shell, title, default_folder, allowed_type_names); + folder_selection_dialog = e_shell_folder_selection_dialog_new (shell, + title, + NULL, + default_folder, + allowed_type_names); listener_duplicate = CORBA_Object_duplicate (listener, ev); gtk_object_set_data_full (GTK_OBJECT (folder_selection_dialog), "corba_listener", -- cgit v1.2.3