aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2000-07-02 12:46:36 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2000-07-02 12:46:36 +0800
commitfbc6a557a6d394fb9749cac6e739b6de63752b74 (patch)
tree48a6c2d982c2075019ecc024864b72a97a829c10 /shell/e-shell.c
parenta84feecf5bb608d4b05f43f353d83041670f8f41 (diff)
downloadgsoc2013-evolution-fbc6a557a6d394fb9749cac6e739b6de63752b74.tar
gsoc2013-evolution-fbc6a557a6d394fb9749cac6e739b6de63752b74.tar.gz
gsoc2013-evolution-fbc6a557a6d394fb9749cac6e739b6de63752b74.tar.bz2
gsoc2013-evolution-fbc6a557a6d394fb9749cac6e739b6de63752b74.tar.lz
gsoc2013-evolution-fbc6a557a6d394fb9749cac6e739b6de63752b74.tar.xz
gsoc2013-evolution-fbc6a557a6d394fb9749cac6e739b6de63752b74.tar.zst
gsoc2013-evolution-fbc6a557a6d394fb9749cac6e739b6de63752b74.zip
Added an extra @allowed_types parameter to the shell's folder
selection dialog, and update the code that uses it accordingly. svn path=/trunk/; revision=3854
Diffstat (limited to 'shell/e-shell.c')
-rw-r--r--shell/e-shell.c95
1 files changed, 63 insertions, 32 deletions
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 64eec8c9a2..f5ba300e3d 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -29,6 +29,7 @@
#include "Evolution.h"
+#include "e-util/e-gui-utils.h"
#include "e-util/e-util.h"
#include "e-component-registry.h"
@@ -91,51 +92,57 @@ static guint signals[LAST_SIGNAL] = { 0 };
/* Callback for the folder selection dialog. */
static void
-folder_selection_dialog_clicked_cb (GnomeDialog *dialog,
- int button_number,
- void *data)
+folder_selection_dialog_cancelled_cb (EShellFolderSelectionDialog *folder_selection_dialog,
+ void *data)
{
- EShellFolderSelectionDialog *folder_selection_dialog;
Evolution_FolderSelectionListener listener;
+ CORBA_Environment ev;
+
+ listener = gtk_object_get_data (GTK_OBJECT (folder_selection_dialog), "corba_listener");
+
+ CORBA_exception_init (&ev);
+
+ Evolution_FolderSelectionListener_cancel (listener, &ev);
+
+ CORBA_exception_free (&ev);
+
+ gtk_widget_destroy (GTK_WIDGET (folder_selection_dialog));
+}
+
+static void
+folder_selection_dialog_folder_selected_cb (EShellFolderSelectionDialog *folder_selection_dialog,
+ const char *path,
+ void *data)
+{
+ CORBA_Environment ev;
EShell *shell;
+ Evolution_FolderSelectionListener listener;
EStorageSet *storage_set;
EFolder *folder;
- CORBA_Environment ev;
- const char *path;
char *uri;
- const char *physical_uri;
-
- if (button_number == 2)
- return;
+ char *physical_uri;
- folder_selection_dialog = E_SHELL_FOLDER_SELECTION_DIALOG (dialog);
shell = E_SHELL (data);
- listener = gtk_object_get_data (GTK_OBJECT (dialog), "corba_listener");
+ listener = gtk_object_get_data (GTK_OBJECT (folder_selection_dialog), "corba_listener");
CORBA_exception_init (&ev);
- if (button_number == 0) {
- storage_set = e_shell_get_storage_set (shell);
- path = e_shell_folder_selection_dialog_get_selected_path (folder_selection_dialog),
- folder = e_storage_set_get_folder (storage_set, path);
+ storage_set = e_shell_get_storage_set (shell);
+ folder = e_storage_set_get_folder (storage_set, path);
- uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL);
+ uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL);
- if (folder == NULL || button_number == 1) /* Uh? */
- physical_uri = "";
- else
- physical_uri = e_folder_get_physical_uri (folder);
+ if (folder == NULL)
+ physical_uri = "";
+ else
+ physical_uri = e_folder_get_physical_uri (folder);
- Evolution_FolderSelectionListener_selected (listener, uri, physical_uri, &ev);
- g_free (uri);
- } else
- Evolution_FolderSelectionListener_cancel (listener, &ev);
+ Evolution_FolderSelectionListener_selected (listener, uri, physical_uri, &ev);
+ g_free (uri);
- CORBA_Object_release (listener, &ev);
CORBA_exception_free (&ev);
- if (button_number != -1)
- gnome_dialog_close(dialog);
+ gtk_widget_destroy (GTK_WIDGET (folder_selection_dialog));
}
@@ -195,27 +202,51 @@ impl_Shell_get_component_for_type (PortableServer_Servant servant,
}
static void
+corba_listener_destroy_notify (void *data)
+{
+ CORBA_Environment ev;
+ Evolution_FolderSelectionListener listener_interface;
+
+ listener_interface = (Evolution_FolderSelectionListener) data;
+
+ CORBA_exception_init (&ev);
+ CORBA_Object_release (listener_interface, &ev);
+ CORBA_exception_free (&ev);
+}
+
+static void
impl_Shell_user_select_folder (PortableServer_Servant servant,
const Evolution_FolderSelectionListener listener,
const CORBA_char *title,
const CORBA_char *default_folder,
+ const Evolution_Shell_FolderTypeList *corba_allowed_types,
CORBA_Environment *ev)
{
GtkWidget *folder_selection_dialog;
BonoboObject *bonobo_object;
Evolution_FolderSelectionListener listener_duplicate;
EShell *shell;
+ const char **allowed_types;
+ int i;
bonobo_object = bonobo_object_from_servant (servant);
shell = E_SHELL (bonobo_object);
- folder_selection_dialog = e_shell_folder_selection_dialog_new (shell, title, default_folder);
+ allowed_types = alloca (sizeof (allowed_types[0]) * (corba_allowed_types->_length + 1));
+ for (i = 0; i < corba_allowed_types->_length; i++)
+ allowed_types[i] = corba_allowed_types->_buffer[i];
+ allowed_types[corba_allowed_types->_length] = NULL;
+
+ folder_selection_dialog = e_shell_folder_selection_dialog_new (shell, title, default_folder, allowed_types);
listener_duplicate = CORBA_Object_duplicate (listener, ev);
- gtk_object_set_data (GTK_OBJECT (folder_selection_dialog), "corba_listener", listener_duplicate);
+ gtk_object_set_data_full (GTK_OBJECT (folder_selection_dialog), "corba_listener",
+ listener_duplicate, corba_listener_destroy_notify);
- gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "clicked",
- GTK_SIGNAL_FUNC (folder_selection_dialog_clicked_cb), shell);
+ gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "folder_selected",
+ GTK_SIGNAL_FUNC (folder_selection_dialog_folder_selected_cb), shell);
+ gtk_signal_connect (GTK_OBJECT (folder_selection_dialog), "cancelled",
+ GTK_SIGNAL_FUNC (folder_selection_dialog_cancelled_cb), shell);
gtk_widget_show (folder_selection_dialog);
}