diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 20 | ||||
-rw-r--r-- | shell/e-shell-folder-commands.c | 4 | ||||
-rw-r--r-- | shell/e-shell-folder-selection-dialog.c | 119 | ||||
-rw-r--r-- | shell/e-shell-folder-selection-dialog.h | 16 | ||||
-rw-r--r-- | shell/e-shell-startup-wizard.c | 2 | ||||
-rw-r--r-- | shell/e-shell-view-menu.c | 6 | ||||
-rw-r--r-- | shell/e-shell.c | 5 |
7 files changed, 74 insertions, 98 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 2f23a2bca9..57328b9bdb 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,5 +1,25 @@ 2002-11-04 Ettore Perazzoli <ettore@ximian.com> + * e-shell-folder-commands.c (e_shell_command_copy_folder): Pass + TRUE for arg allow_creation to + e_shell_folder_selection_dialog_new(). + (e_shell_command_move_folder): Likewise. + * e-shell-view-menu.c (command_goto_folder): Likewise. + (command_new_shortcut): Likewise. + * e-shell.c (impl_Shell_selectUserFolder): Likewise. + + * e-shell-folder-selection-dialog.c + (e_shell_folder_selection_dialog_set_allow_creation): Removed. + (e_shell_folder_selection_dialog_get_allow_creation): Removed. + (e_shell_folder_selection_dialog_new): New arg allow_creation. + (e_shell_folder_selection_dialog_construct): Likewise. Also, do + set priv->shell. + + * e-shell-folder-selection-dialog.h, + e-shell-folder-selection-dialog.c: Port to GtkDialog. + +2002-11-04 Ettore Perazzoli <ettore@ximian.com> + * e-folder-type-registry.c (e_folder_type_registry_get_handler_for_type): Remove warning for when the type is unknown. diff --git a/shell/e-shell-folder-commands.c b/shell/e-shell-folder-commands.c index fd6cf2b522..b5eefa4b77 100644 --- a/shell/e-shell-folder-commands.c +++ b/shell/e-shell-folder-commands.c @@ -324,7 +324,7 @@ e_shell_command_copy_folder (EShell *shell, uri = g_strconcat (E_SHELL_URI_PREFIX, folder_path, NULL); folder_selection_dialog = e_shell_folder_selection_dialog_new (shell, _("Copy folder"), - caption, uri, NULL); + caption, uri, NULL, TRUE); g_free (caption); g_free (uri); @@ -368,7 +368,7 @@ e_shell_command_move_folder (EShell *shell, uri = g_strconcat (E_SHELL_URI_PREFIX, folder_path, NULL); folder_selection_dialog = e_shell_folder_selection_dialog_new (shell, _("Move folder"), - caption, uri, NULL); + caption, uri, NULL, TRUE); g_free (caption); g_free (uri); diff --git a/shell/e-shell-folder-selection-dialog.c b/shell/e-shell-folder-selection-dialog.c index e23cbec95c..66a4b60066 100644 --- a/shell/e-shell-folder-selection-dialog.c +++ b/shell/e-shell-folder-selection-dialog.c @@ -32,7 +32,6 @@ #include "e-shell-folder-creation-dialog.h" -#include <libgnomeui/gnome-dialog.h> #include <libgnome/gnome-i18n.h> #include <gal/util/e-util.h> @@ -45,8 +44,8 @@ #include <string.h> -#define PARENT_TYPE (gnome_dialog_get_type ()) -static GnomeDialogClass *parent_class = NULL; +#define PARENT_TYPE (gtk_dialog_get_type ()) +static GtkDialogClass *parent_class = NULL; struct _EShellFolderSelectionDialogPrivate { EShell *shell; @@ -197,11 +196,11 @@ impl_destroy (GtkObject *object) } -/* GnomeDialog methods. */ +/* GtkDialog methods. */ static void -impl_clicked (GnomeDialog *dialog, - int button_number) +impl_response (GtkDialog *dialog, + int response) { EShellFolderSelectionDialog *folder_selection_dialog; EShellFolderSelectionDialogPrivate *priv; @@ -213,19 +212,19 @@ impl_clicked (GnomeDialog *dialog, folder_selection_dialog = E_SHELL_FOLDER_SELECTION_DIALOG (dialog); priv = folder_selection_dialog->priv; - switch (button_number) { - case 0: /* OK */ + switch (response) { + case GTK_RESPONSE_OK: if (check_folder_type_valid (folder_selection_dialog)) { g_signal_emit (folder_selection_dialog, signals[FOLDER_SELECTED], 0, e_shell_folder_selection_dialog_get_selected_path (folder_selection_dialog)); - gnome_dialog_close (GNOME_DIALOG (dialog)); + gtk_widget_destroy (GTK_WIDGET (dialog)); } break; - case 1: /* Cancel */ + case GTK_RESPONSE_CANCEL: g_signal_emit (folder_selection_dialog, signals[CANCELLED], 0); - gnome_dialog_close (GNOME_DIALOG (dialog)); + gtk_widget_destroy (GTK_WIDGET (dialog)); break; - case 2: /* Add */ + default: /* New... */ storage_set_view = E_STORAGE_SET_VIEW (priv->storage_set_view); default_parent_folder = e_storage_set_view_get_current_folder (storage_set_view); @@ -258,15 +257,15 @@ static void class_init (EShellFolderSelectionDialogClass *klass) { GtkObjectClass *object_class; - GnomeDialogClass *dialog_class; + GtkDialogClass *dialog_class; parent_class = gtk_type_class (PARENT_TYPE); object_class = GTK_OBJECT_CLASS (klass); - dialog_class = GNOME_DIALOG_CLASS (klass); + dialog_class = GTK_DIALOG_CLASS (klass); object_class->destroy = impl_destroy; - dialog_class->clicked = impl_clicked; + dialog_class->response = impl_response; signals[FOLDER_SELECTED] = gtk_signal_new ("folder_selected", @@ -314,9 +313,9 @@ folder_selected_cb (EStorageSetView *storage_set_view, dialog = E_SHELL_FOLDER_SELECTION_DIALOG (data); if (check_folder_type_valid (dialog)) - gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 0, TRUE); + gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE); else - gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 0, FALSE); + gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE); } static gint @@ -342,7 +341,7 @@ double_click_cb (EStorageSetView *essv, if (check_folder_type_valid (folder_selection_dialog)) { g_signal_emit (folder_selection_dialog, signals[FOLDER_SELECTED], 0, e_shell_folder_selection_dialog_get_selected_path (folder_selection_dialog)); - gnome_dialog_close (GNOME_DIALOG (folder_selection_dialog)); + gtk_widget_destroy (GTK_WIDGET (folder_selection_dialog)); } } @@ -364,7 +363,8 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s const char *title, const char *caption, const char *default_uri, - const char *allowed_types[]) + const char *allowed_types[], + gboolean allow_creation) { EShellFolderSelectionDialogPrivate *priv; GtkWidget *scroll_frame; @@ -385,21 +385,26 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s 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); + g_signal_connect (folder_selection_dialog, "delete_event", G_CALLBACK (delete_event_cb), folder_selection_dialog); - gnome_dialog_append_buttons (GNOME_DIALOG (folder_selection_dialog), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, - _("New..."), - NULL); - gnome_dialog_set_default (GNOME_DIALOG (folder_selection_dialog), 0); - gnome_dialog_set_sensitive (GNOME_DIALOG (folder_selection_dialog), 0, FALSE); + gtk_dialog_add_buttons (GTK_DIALOG (folder_selection_dialog), + GTK_STOCK_OK, GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + NULL); + + if (allow_creation) + gtk_dialog_add_buttons (GTK_DIALOG (folder_selection_dialog), + GTK_STOCK_NEW, 1, + NULL); + + gtk_dialog_set_response_sensitive (GTK_DIALOG (folder_selection_dialog), GTK_RESPONSE_OK, FALSE); /* Make sure we get destroyed if the shell gets destroyed. */ -#if 0 priv->shell = shell; +#if 0 gtk_signal_connect_object_while_alive (GTK_OBJECT (shell), "destroy", G_CALLBACK (gtk_widget_destroy), GTK_OBJECT (folder_selection_dialog)); @@ -411,7 +416,7 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s caption_label = gtk_label_new (caption); gtk_widget_show (caption_label); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (folder_selection_dialog)->vbox), + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (folder_selection_dialog)->vbox), caption_label, FALSE, TRUE, 2); } @@ -458,7 +463,7 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s gtk_container_add (GTK_CONTAINER (scroll_frame), priv->storage_set_view); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (folder_selection_dialog)->vbox), + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (folder_selection_dialog)->vbox), scroll_frame, TRUE, TRUE, 2); gtk_widget_show (priv->storage_set_view); @@ -487,7 +492,8 @@ e_shell_folder_selection_dialog_new (EShell *shell, const char *title, const char *caption, const char *default_uri, - const char *allowed_types[]) + const char *allowed_types[], + gboolean allow_creation) { EShellFolderSelectionDialog *folder_selection_dialog; @@ -496,62 +502,13 @@ 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, caption, default_uri, allowed_types); + title, caption, default_uri, allowed_types, + allow_creation); return GTK_WIDGET (folder_selection_dialog); } -/** - * e_shell_folder_selection_dialog_set_allow_creation: - * @folder_selection_dialog: An EShellFolderSelectionDialog widget - * @allow_creation: Boolean specifying whether the "New..." button should be - * displayed - * - * Specify whether @folder_selection_dialog should have a "New..." button to - * create a new folder or not. - **/ -void -e_shell_folder_selection_dialog_set_allow_creation (EShellFolderSelectionDialog *folder_selection_dialog, - gboolean allow_creation) -{ - GList *button_list_item; - GtkWidget *button; - - g_return_if_fail (folder_selection_dialog != NULL); - g_return_if_fail (E_IS_SHELL_FOLDER_SELECTION_DIALOG (folder_selection_dialog)); - - folder_selection_dialog->priv->allow_creation = !! allow_creation; - - button_list_item = g_list_nth (GNOME_DIALOG (folder_selection_dialog)->buttons, 2); - g_assert (button_list_item != NULL); - - button = GTK_WIDGET (button_list_item->data); - - if (allow_creation) - gtk_widget_show (button); - else - gtk_widget_hide (button); -} - -/** - * e_shell_folder_selection_dialog_get_allow_creation: - * @folder_selection_dialog: An EShellFolderSelectionDialog widget - * - * Get whether the "New..." button is displayed. - * - * Return value: %TRUE if the "New..." button is displayed, %FALSE otherwise. - **/ -gboolean -e_shell_folder_selection_dialog_get_allow_creation (EShellFolderSelectionDialog *folder_selection_dialog) -{ - g_return_val_if_fail (folder_selection_dialog != NULL, FALSE); - g_return_val_if_fail (E_IS_SHELL_FOLDER_SELECTION_DIALOG (folder_selection_dialog), FALSE); - - return folder_selection_dialog->priv->allow_creation; -} - - const char * e_shell_folder_selection_dialog_get_selected_path (EShellFolderSelectionDialog *folder_selection_dialog) { diff --git a/shell/e-shell-folder-selection-dialog.h b/shell/e-shell-folder-selection-dialog.h index 30575d12cd..05b1e46281 100644 --- a/shell/e-shell-folder-selection-dialog.h +++ b/shell/e-shell-folder-selection-dialog.h @@ -23,7 +23,7 @@ #ifndef E_SHELL_FOLDER_SELECTION_DIALOG_H #define E_SHELL_FOLDER_SELECTION_DIALOG_H -#include <libgnomeui/gnome-dialog.h> +#include <gtk/gtkdialog.h> #include "e-shell.h" @@ -44,13 +44,13 @@ typedef struct _EShellFolderSelectionDialogPrivate EShellFolderSelectionDialogPr typedef struct _EShellFolderSelectionDialogClass EShellFolderSelectionDialogClass; struct _EShellFolderSelectionDialog { - GnomeDialog parent; + GtkDialog parent; EShellFolderSelectionDialogPrivate *priv; }; struct _EShellFolderSelectionDialogClass { - GnomeDialogClass parent_class; + GtkDialogClass parent_class; void (* folder_selected) (EShellFolderSelectionDialog *folder_selection_dialog, const char *path); @@ -64,16 +64,14 @@ void e_shell_folder_selection_dialog_construct (EShellFolderSele const char *title, const char *caption, const char *default_uri, - const char *allowed_types[]); + const char *allowed_types[], + gboolean allow_creation); GtkWidget *e_shell_folder_selection_dialog_new (EShell *shell, const char *title, const char *caption, const char *default_uri, - const char *allowed_types[]); - -void e_shell_folder_selection_dialog_set_allow_creation (EShellFolderSelectionDialog *folder_selection_dialog, - gboolean allow_creation); -gboolean e_shell_folder_selection_dialog_get_allow_creation (EShellFolderSelectionDialog *folder_selection_dialog); + const char *allowed_types[], + gboolean allow_creation); const char *e_shell_folder_selection_dialog_get_selected_path (EShellFolderSelectionDialog *folder_selection_dialog); diff --git a/shell/e-shell-startup-wizard.c b/shell/e-shell-startup-wizard.c index 04b36e2a4f..36d96ef083 100644 --- a/shell/e-shell-startup-wizard.c +++ b/shell/e-shell-startup-wizard.c @@ -154,8 +154,10 @@ make_mail_dialog_pages (SWData *data) CORBA_exception_init (&ev); data->mailer = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_Mail_Wizard", 0, NULL, &ev); if (BONOBO_EX (&ev)) { +#if 0 e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("Could not start the Evolution Mailer Assistant interface\n(%s)"), CORBA_exception_id (&ev)); +#endif g_warning ("Could not start mailer (%s)", CORBA_exception_id (&ev)); CORBA_exception_free (&ev); data->mailer = CORBA_OBJECT_NIL; diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c index 208fd1c581..768d11dbf1 100644 --- a/shell/e-shell-view-menu.c +++ b/shell/e-shell-view-menu.c @@ -500,7 +500,7 @@ command_goto_folder (BonoboUIComponent *uih, _("Go to folder..."), _("Select the folder that you want to open"), current_uri, - NULL); + NULL, TRUE); gtk_window_set_transient_for (GTK_WINDOW (folder_selection_dialog), GTK_WINDOW (shell_view)); @@ -615,9 +615,7 @@ command_new_shortcut (BonoboUIComponent *uih, _("Create New Shortcut"), _("Select the folder you want the shortcut to point to:"), e_shell_view_get_current_uri (shell_view), - NULL); - e_shell_folder_selection_dialog_set_allow_creation (E_SHELL_FOLDER_SELECTION_DIALOG (folder_selection_dialog), - FALSE); + NULL, TRUE); g_signal_connect (folder_selection_dialog, "cancelled", G_CALLBACK (new_shortcut_dialog_cancelled_cb), shell_view); diff --git a/shell/e-shell.c b/shell/e-shell.c index 252b7f3300..5556e585f3 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -531,7 +531,8 @@ impl_Shell_selectUserFolder (PortableServer_Servant servant, title, NULL, default_folder, - allowed_type_names); + allowed_type_names, + TRUE); listener_duplicate = CORBA_Object_duplicate (listener, ev); @@ -2264,7 +2265,7 @@ parse_default_uri (EShell *shell, /* We expect an evolution: URI here, if we don't get it then something is messed up. */ - if (strncmp (path, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) != 0 || is_default) { + if (path == NULL || strncmp (path, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) != 0 || is_default) { g_free (path); if (path_return != NULL) *path_return = NULL; |