aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog41
-rw-r--r--shell/Evolution-StorageSetView.idl11
-rw-r--r--shell/Evolution-common.idl32
-rw-r--r--shell/e-folder.c23
-rw-r--r--shell/e-folder.h8
-rw-r--r--shell/e-shell.c6
-rw-r--r--shell/e-storage-set-view.c31
-rw-r--r--shell/e-storage-set-view.h13
-rw-r--r--shell/evolution-storage-set-view-factory.c19
-rw-r--r--shell/evolution-storage-set-view.c118
-rw-r--r--shell/evolution-test-component.c131
11 files changed, 374 insertions, 59 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 32f49c3c42..16a8070978 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,44 @@
+2002-05-07 Ettore Perazzoli <ettore@ximian.com>
+
+ * evolution-storage-set-view-factory.c
+ (evolution_storage_set_view_factory_new_view): Put the
+ EStorageSetView in an EScrollFrame.
+
+ * e-shell.c (impl_Shell_createStorageSetView):
+ CORBA_Object_duplicate the object before returning.
+
+ * evolution-test-component.c
+ (create_new_folder_selector): New function to create a simple test
+ environment for the new checkbox-enabled StorageSetView.
+ (register_component): Add user-creatable type FolderSelector.
+ (user_create_new_item_callback): Handle FolderSelector.
+ (dialog_clicked_callback): Print out the checked items in the
+ folder selector.
+ (main): Print out a message before going into bonobo_main().
+
+ * evolution-storage-set-view.c
+ (impl_StorageSetView__get_showFolders): Renamed from
+ impl_StorageSetView__get_show_folders.
+ (impl_StorageSetView__set_showFolders): Renamed from
+ impl_StorageSetView__set_show_folders.
+ (impl_StorageSetView__set_showCheckboxes): New, write the
+ showCheckboxes CORBA attribute.
+ (impl_StorageSetView__get_showCheckboxes): New, read the
+ showCheckboxes CORBA attribute.
+ (impl_StorageSetView__get_checkedFolders): New, read the
+ checkedFolders CORBA attribute.
+ (corba_class_init): Install the new CORBA methods methods.
+
+ * e-storage-set-view.c (essv_add_to_list): strdup() the path.
+ (e_storage_set_view_get_storage_set): New.
+
+ * e-folder.c (e_folder_to_corba): New.
+
+ * Evolution-StorageSetView.idl: Add showCheckboxes and
+ checkedFolders attributes.
+
+ * Evolution-common.idl: Add typedef for FolderList.
+
2002-05-03 Christopher James Lahey <clahey@ximian.com>
* e-folder-list.c: Use bonobo_object_client_(un)?ref instead of
diff --git a/shell/Evolution-StorageSetView.idl b/shell/Evolution-StorageSetView.idl
index cdf2cbe61c..7ed45a3358 100644
--- a/shell/Evolution-StorageSetView.idl
+++ b/shell/Evolution-StorageSetView.idl
@@ -5,15 +5,15 @@
* Authors:
* Ettore Perazzoli <ettore@ximian.com>
*
- * Copyright (C) 2000, 2001 Ximian, Inc.
+ * Copyright (C) 2000, 2001, 2002 Ximian, Inc.
*/
-#include <Bonoob.idl>
+#include <Bonobo.idl>
module GNOME {
module Evolution {
interface StorageSetViewListener {
- void notifyFolderSelected (in string uri);
+ void notifyFolderSelected (in string uri);
};
/* FIXME: Maybe we should have a generic Bonobo::Listener interface. */
@@ -22,8 +22,11 @@ module Evolution {
exception NotFound {};
attribute boolean showFolders;
+ attribute boolean showCheckboxes;
- void addListener (in StorageSetViewListener listener)
+ readonly attribute FolderList checkedFolders;
+
+ void addListener (in StorageSetViewListener listener)
raises (AlreadyListening);
void removeListener (in StorageSetViewListener listener)
diff --git a/shell/Evolution-common.idl b/shell/Evolution-common.idl
index 85c3bfc4f7..127521bdef 100644
--- a/shell/Evolution-common.idl
+++ b/shell/Evolution-common.idl
@@ -5,28 +5,28 @@
* Authors:
* Ettore Perazzoli <ettore@ximian.com>
*
- * Copyright (C) 2000, 2001 Ximian, Inc.
+ * Copyright (C) 2000, 2001, 2002 Ximian, Inc.
*/
module GNOME {
module Evolution {
+ struct Folder {
+ string type;
+ string description;
+ string displayName;
+ string physicalUri;
+ string evolutionUri;
+ long unreadCount;
+ };
+ typedef sequence <Folder> FolderList;
-struct Folder {
- string type;
- string description;
- string displayName;
- string physicalUri;
- string evolutionUri;
- long unreadCount;
-};
-
-struct Icon {
- short width, height;
- boolean hasAlpha;
- sequence <octet> rgbaData; // Row-by-row, left-to-right, top-to-bottom RGBA bytes
-};
+ struct Icon {
+ short width, height;
+ boolean hasAlpha;
+ sequence <octet> rgbaData; // Row-by-row, left-to-right, top-to-bottom RGBA bytes
+ };
-typedef sequence <Icon> AnimatedIcon;
+ typedef sequence <Icon> AnimatedIcon;
};
};
diff --git a/shell/e-folder.c b/shell/e-folder.c
index 01177f3cc7..0de3160a74 100644
--- a/shell/e-folder.c
+++ b/shell/e-folder.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-folder.c
*
- * Copyright (C) 2000 Ximian, Inc.
+ * Copyright (C) 2000, 2001, 2002 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
@@ -26,6 +26,8 @@
#include "e-folder.h"
+#include "e-util/e-corba-utils.h"
+
#include <glib.h>
#include <gtk/gtksignal.h>
@@ -360,4 +362,23 @@ e_folder_set_is_stock (EFolder *folder,
}
+/* Gotta love CORBA. */
+
+void
+e_folder_to_corba (EFolder *folder,
+ const char *evolution_uri,
+ GNOME_Evolution_Folder *folder_return)
+{
+ g_return_if_fail (E_IS_FOLDER (folder));
+ g_return_if_fail (folder_return != NULL);
+
+ folder_return->type = e_safe_corba_string_dup (e_folder_get_type_string (folder));
+ folder_return->description = e_safe_corba_string_dup (e_folder_get_description (folder));
+ folder_return->displayName = e_safe_corba_string_dup (e_folder_get_name (folder));
+ folder_return->physicalUri = e_safe_corba_string_dup (e_folder_get_physical_uri (folder));
+ folder_return->evolutionUri = e_safe_corba_string_dup (evolution_uri);
+ folder_return->unreadCount = e_folder_get_unread_count (folder);
+}
+
+
E_MAKE_TYPE (e_folder, "EFolder", EFolder, class_init, init, PARENT_TYPE)
diff --git a/shell/e-folder.h b/shell/e-folder.h
index eb7ac516f3..48fa5b4789 100644
--- a/shell/e-folder.h
+++ b/shell/e-folder.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-folder.h
*
- * Copyright (C) 2000 Ximian, Inc.
+ * Copyright (C) 2000, 2001, 2002 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
@@ -23,6 +23,8 @@
#ifndef _E_FOLDER_H_
#define _E_FOLDER_H_
+#include "Evolution.h"
+
#include <gtk/gtkobject.h>
#ifdef __cplusplus
@@ -86,6 +88,10 @@ void e_folder_set_unread_count (EFolder *folder, int unread_count);
void e_folder_set_child_highlight (EFolder *folder, gboolean highlighted);
void e_folder_set_is_stock (EFolder *folder, gboolean is_stock);
+void e_folder_to_corba (EFolder *folder,
+ const char *evolution_uri,
+ GNOME_Evolution_Folder *folder_return);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 4b561078c6..73734c346d 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -648,8 +648,9 @@ impl_Shell_createStorageSetView (PortableServer_Servant servant,
CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
- EShell *shell;
BonoboControl *control;
+ CORBA_Object dup_objref;
+ EShell *shell;
if (raise_exception_if_not_ready (servant, ev))
return CORBA_OBJECT_NIL;
@@ -658,8 +659,9 @@ impl_Shell_createStorageSetView (PortableServer_Servant servant,
shell = E_SHELL (bonobo_object);
control = evolution_storage_set_view_factory_new_view (shell);
+ dup_objref = CORBA_Object_duplicate (bonobo_object_corba_objref (BONOBO_OBJECT (control)), ev);
- return bonobo_object_corba_objref (BONOBO_OBJECT (control));
+ return dup_objref;
}
static void
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c
index f924c19cc4..3938d48d1a 100644
--- a/shell/e-storage-set-view.c
+++ b/shell/e-storage-set-view.c
@@ -1864,6 +1864,17 @@ e_storage_set_view_new (EStorageSet *storage_set,
}
+EStorageSet *
+e_storage_set_view_get_storage_set (EStorageSetView *storage_set_view)
+{
+ EStorageSetViewPrivate *priv;
+
+ g_return_val_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view), NULL);
+
+ priv = storage_set_view->priv;
+ return priv->storage_set;
+}
+
void
e_storage_set_view_set_current_folder (EStorageSetView *storage_set_view,
const char *path)
@@ -2022,19 +2033,23 @@ e_storage_set_view_set_checkboxes_list (EStorageSetView *storage_set_view,
static void
essv_add_to_list (ETreePath tree_path, void **temp)
{
- EStorageSetView *storage_set_view = temp[0];
- EStorageSetViewPrivate *priv = storage_set_view->priv;
- GList **list = temp[1];
+ EStorageSetView *storage_set_view;
+ EStorageSetViewPrivate *priv;
+ GList **list;
+
+ storage_set_view = temp[0];
+ list = temp[1];
+ priv = storage_set_view->priv;
if (priv->checkboxes) {
- char *path = (char*)e_tree_memory_node_get_data(E_TREE_MEMORY(priv->etree_model), tree_path);
- if (path && g_hash_table_lookup (priv->checkboxes, path)) {
- *list = g_list_prepend (*list, path);
- }
+ const char *path;
+
+ path = (const char *) e_tree_memory_node_get_data (E_TREE_MEMORY (priv->etree_model), tree_path);
+ if (path != NULL && g_hash_table_lookup (priv->checkboxes, path))
+ *list = g_list_prepend (*list, g_strdup (path));
}
}
-/* g_list_free this list, but don't free the strings within. */
GList *
e_storage_set_view_get_checkboxes_list (EStorageSetView *storage_set_view)
{
diff --git a/shell/e-storage-set-view.h b/shell/e-storage-set-view.h
index 04f08f4b03..ff620ea5de 100644
--- a/shell/e-storage-set-view.h
+++ b/shell/e-storage-set-view.h
@@ -74,11 +74,13 @@ struct _EStorageSetViewClass {
GtkType e_storage_set_view_get_type (void);
/* DON'T USE THIS. Use e_storage_set_new_view() instead. */
-GtkWidget *e_storage_set_view_new (EStorageSet *storage_set,
- BonoboUIContainer *container);
-void e_storage_set_view_construct (EStorageSetView *storage_set_view,
- EStorageSet *storage_set,
- BonoboUIContainer *container);
+GtkWidget *e_storage_set_view_new (EStorageSet *storage_set,
+ BonoboUIContainer *container);
+void e_storage_set_view_construct (EStorageSetView *storage_set_view,
+ EStorageSet *storage_set,
+ BonoboUIContainer *container);
+
+EStorageSet *e_storage_set_view_get_storage_set (EStorageSetView *storage_set_view);
void e_storage_set_view_set_current_folder (EStorageSetView *storage_set_view,
const char *path);
@@ -94,7 +96,6 @@ gboolean e_storage_set_view_get_show_checkboxes (EStorageSetView *storage_set
void e_storage_set_view_set_checkboxes_list (EStorageSetView *storage_set_view,
GList *checkboxes);
-/* g_list_free this list, but don't free the strings within. */
GList *e_storage_set_view_get_checkboxes_list (EStorageSetView *storage_set_view);
void e_storage_set_view_set_allow_dnd (EStorageSetView *storage_set_view,
diff --git a/shell/evolution-storage-set-view-factory.c b/shell/evolution-storage-set-view-factory.c
index 5449033491..8712536f70 100644
--- a/shell/evolution-storage-set-view-factory.c
+++ b/shell/evolution-storage-set-view-factory.c
@@ -30,6 +30,8 @@
#include "evolution-storage-set-view-factory.h"
+#include <gal/widgets/e-scroll-frame.h>
+
BonoboControl *
evolution_storage_set_view_factory_new_view (EShell *shell)
@@ -38,14 +40,13 @@ evolution_storage_set_view_factory_new_view (EShell *shell)
GtkWidget *storage_set_view;
BonoboControl *control;
EvolutionStorageSetView *storage_set_view_interface;
+ GtkWidget *scroll_frame;
g_return_val_if_fail (shell != NULL, NULL);
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
storage_set = e_shell_get_storage_set (shell);
storage_set_view = e_storage_set_new_view (storage_set, NULL /*XXX*/);
- gtk_widget_show (storage_set_view);
-
e_storage_set_view_set_allow_dnd (E_STORAGE_SET_VIEW (storage_set_view), FALSE);
storage_set_view_interface = evolution_storage_set_view_new (E_STORAGE_SET_VIEW (storage_set_view));
@@ -54,7 +55,19 @@ evolution_storage_set_view_factory_new_view (EShell *shell)
return NULL;
}
- control = bonobo_control_new (storage_set_view);
+ scroll_frame = e_scroll_frame_new (NULL, NULL);
+ e_scroll_frame_set_policy (E_SCROLL_FRAME (scroll_frame),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+ e_scroll_frame_set_shadow_type (E_SCROLL_FRAME (scroll_frame),
+ GTK_SHADOW_IN);
+
+ gtk_container_add (GTK_CONTAINER (scroll_frame), storage_set_view);
+
+ gtk_widget_show (scroll_frame);
+ gtk_widget_show (storage_set_view);
+
+ control = bonobo_control_new (scroll_frame);
bonobo_object_add_interface (BONOBO_OBJECT (control), BONOBO_OBJECT (storage_set_view_interface));
return control;
diff --git a/shell/evolution-storage-set-view.c b/shell/evolution-storage-set-view.c
index ae644df7cd..242897c3e8 100644
--- a/shell/evolution-storage-set-view.c
+++ b/shell/evolution-storage-set-view.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* evolution-storage-set-view.c
*
- * Copyright (C) 2000 Ximian, Inc.
+ * Copyright (C) 2000, 2001, 2002 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
@@ -25,6 +25,8 @@
#endif
#include "evolution-storage-set-view.h"
+#include "e-shell-constants.h"
+
#include <gal/util/e-util.h>
@@ -207,8 +209,8 @@ impl_StorageSetView_remove_listener (PortableServer_Servant servant,
}
static CORBA_boolean
-impl_StorageSetView__get_show_folders (PortableServer_Servant servant,
- CORBA_Environment * ev)
+impl_StorageSetView__get_showFolders (PortableServer_Servant servant,
+ CORBA_Environment * ev)
{
BonoboObject *bonobo_object;
EvolutionStorageSetView *storage_set_view;
@@ -218,14 +220,44 @@ impl_StorageSetView__get_show_folders (PortableServer_Servant servant,
storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object);
priv = storage_set_view->priv;
- return (CORBA_boolean)e_storage_set_view_get_show_folders (
- E_STORAGE_SET_VIEW(priv->storage_set_view_widget));
+ return e_storage_set_view_get_show_folders (E_STORAGE_SET_VIEW (priv->storage_set_view_widget));
}
static void
-impl_StorageSetView__set_show_folders (PortableServer_Servant servant,
- const CORBA_boolean value,
- CORBA_Environment * ev)
+impl_StorageSetView__set_showFolders (PortableServer_Servant servant,
+ const CORBA_boolean value,
+ CORBA_Environment * ev)
+{
+ BonoboObject *bonobo_object;
+ EvolutionStorageSetView *storage_set_view;
+ EvolutionStorageSetViewPrivate *priv;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object);
+ priv = storage_set_view->priv;
+
+ e_storage_set_view_set_show_folders (E_STORAGE_SET_VIEW (priv->storage_set_view_widget), value);
+}
+
+static void
+impl_StorageSetView__set_showCheckboxes (PortableServer_Servant servant,
+ const CORBA_boolean value,
+ CORBA_Environment *ev)
+{
+ BonoboObject *bonobo_object;
+ EvolutionStorageSetView *storage_set_view;
+ EvolutionStorageSetViewPrivate *priv;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object);
+ priv = storage_set_view->priv;
+
+ e_storage_set_view_set_show_checkboxes (E_STORAGE_SET_VIEW (priv->storage_set_view_widget), value);
+}
+
+static CORBA_boolean
+impl_StorageSetView__get_showCheckboxes (PortableServer_Servant servant,
+ CORBA_Environment *ev)
{
BonoboObject *bonobo_object;
EvolutionStorageSetView *storage_set_view;
@@ -235,9 +267,58 @@ impl_StorageSetView__set_show_folders (PortableServer_Servant servant,
storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object);
priv = storage_set_view->priv;
- e_storage_set_view_set_show_folders (
- E_STORAGE_SET_VIEW(priv->storage_set_view_widget),
- (gboolean)value);
+ return e_storage_set_view_get_show_checkboxes (E_STORAGE_SET_VIEW (priv->storage_set_view_widget));
+}
+
+static GNOME_Evolution_FolderList *
+impl_StorageSetView__get_checkedFolders (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ BonoboObject *bonobo_object;
+ EvolutionStorageSetView *storage_set_view;
+ EvolutionStorageSetViewPrivate *priv;
+ EStorageSet *storage_set;
+ GNOME_Evolution_FolderList *return_list;
+ GList *path_list;
+ GList *p;
+ int num_folders;
+ int i;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ storage_set_view = EVOLUTION_STORAGE_SET_VIEW (bonobo_object);
+ priv = storage_set_view->priv;
+
+ path_list = e_storage_set_view_get_checkboxes_list (E_STORAGE_SET_VIEW (priv->storage_set_view_widget));
+ num_folders = g_list_length (path_list);
+
+ return_list = GNOME_Evolution_FolderList__alloc ();
+ return_list->_maximum = num_folders;
+ return_list->_length = num_folders;
+ return_list->_buffer = CORBA_sequence_GNOME_Evolution_Folder_allocbuf (return_list->_maximum);
+
+ storage_set = e_storage_set_view_get_storage_set (E_STORAGE_SET_VIEW (priv->storage_set_view_widget));
+
+ for (p = path_list, i = 0; p != NULL; p = p->next, i ++) {
+ EFolder *folder;
+ const char *path;
+ char *evolution_uri;
+
+ path = (const char *) p->data;
+
+ folder = e_storage_set_get_folder (storage_set, path);
+ if (folder == NULL) {
+ g_warning ("Cannot find folder -- %s", path);
+ continue;
+ }
+
+ evolution_uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL);
+ e_folder_to_corba (folder, evolution_uri, return_list->_buffer + i);
+ g_free (evolution_uri);
+ }
+
+ e_free_string_list (path_list);
+
+ return return_list;
}
@@ -285,14 +366,17 @@ corba_class_init (void)
base_epv->default_POA = NULL;
epv = g_new0 (POA_GNOME_Evolution_StorageSetView__epv, 1);
- epv->addListener = impl_StorageSetView_add_listener;
- epv->removeListener = impl_StorageSetView_remove_listener;
- epv->_set_showFolders = impl_StorageSetView__set_show_folders;
- epv->_get_showFolders = impl_StorageSetView__get_show_folders;
+ epv->addListener = impl_StorageSetView_add_listener;
+ epv->removeListener = impl_StorageSetView_remove_listener;
+ epv->_set_showFolders = impl_StorageSetView__set_showFolders;
+ epv->_get_showFolders = impl_StorageSetView__get_showFolders;
+ epv->_set_showCheckboxes = impl_StorageSetView__set_showCheckboxes;
+ epv->_get_showCheckboxes = impl_StorageSetView__get_showCheckboxes;
+ epv->_get_checkedFolders = impl_StorageSetView__get_checkedFolders;
vepv = &StorageSetView_vepv;
- vepv->_base_epv = base_epv;
- vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
+ vepv->_base_epv = base_epv;
+ vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
vepv->GNOME_Evolution_StorageSetView_epv = epv;
}
diff --git a/shell/evolution-test-component.c b/shell/evolution-test-component.c
index cf6f0ba53f..c11d2c4607 100644
--- a/shell/evolution-test-component.c
+++ b/shell/evolution-test-component.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* evolution-test-component.c
*
- * Copyright (C) 2001 Ximian, Inc.
+ * Copyright (C) 2001, 2002 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
@@ -30,8 +30,10 @@
#include "evolution-activity-client.h"
#include "evolution-config-control.h"
+#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-main.h>
+#include <bonobo/bonobo-widget.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
@@ -144,6 +146,126 @@ spit_out_shortcuts (EvolutionShellClient *shell_client)
}
+/* Test the multiple folder selector. */
+
+static void
+dialog_clicked_callback (GnomeDialog *dialog,
+ int button_num,
+ void *data)
+{
+ GNOME_Evolution_StorageSetView storage_set_view_iface;
+ CORBA_Environment ev;
+ GNOME_Evolution_FolderList *folder_list;
+
+ if (button_num == 1) {
+ /* Close. */
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ return;
+ }
+
+ CORBA_exception_init (&ev);
+
+ storage_set_view_iface = (GNOME_Evolution_StorageSetView) data;
+
+ folder_list = GNOME_Evolution_StorageSetView__get_checkedFolders (storage_set_view_iface, &ev);
+ if (BONOBO_EX (&ev)) {
+ g_warning ("Cannot get checkedFolders -- %s", BONOBO_EX_ID (&ev));
+ } else {
+ int i;
+
+ for (i = 0; i < folder_list->_length; i ++) {
+#define PRINT(s) g_print ("\t" #s ": %s\n", folder_list->_buffer[i].s);
+ g_print ("Folder #%d:\n", i + 1);
+ PRINT (type);
+ PRINT (description);
+ PRINT (displayName);
+ PRINT (physicalUri);
+ PRINT (evolutionUri);
+#undef PRINT
+
+ g_print ("\tunreadCount: %d\n", folder_list->_buffer[i].unreadCount);
+ }
+ }
+
+ CORBA_exception_free (&ev);
+}
+
+static void
+dialog_destroy_callback (GtkObject *object,
+ void *data)
+{
+ GNOME_Evolution_StorageSetView storage_set_view_iface;
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+
+ storage_set_view_iface = (GNOME_Evolution_StorageSetView) data;
+ Bonobo_Unknown_unref (storage_set_view_iface, &ev);
+
+ CORBA_exception_free (&ev);
+}
+
+static void
+create_new_folder_selector (EvolutionShellComponent *shell_component)
+{
+ EvolutionShellClient *shell_client;
+ GNOME_Evolution_Shell corba_shell;
+ GNOME_Evolution_StorageSetView storage_set_view_iface;
+ GtkWidget *dialog;
+ Bonobo_Control control;
+ GtkWidget *control_widget;
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+
+ shell_client = evolution_shell_component_get_owner (shell_component);
+ g_assert (shell_client != NULL);
+ corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
+
+ control = GNOME_Evolution_Shell_createStorageSetView (corba_shell, &ev);
+ if (BONOBO_EX (&ev)) {
+ g_warning ("Cannot create StorageSetView -- %s", BONOBO_EX_ID (&ev));
+ CORBA_exception_free (&ev);
+ return;
+ }
+
+ storage_set_view_iface = Bonobo_Unknown_queryInterface (control, "IDL:GNOME/Evolution/StorageSetView:1.0", &ev);
+ if (BONOBO_EX (&ev) || storage_set_view_iface == CORBA_OBJECT_NIL) {
+ g_warning ("Cannot get StorageSetView interface");
+ if (BONOBO_EX (&ev))
+ g_warning ("CORBA exception -- %s", BONOBO_EX_ID (&ev));
+ CORBA_exception_free (&ev);
+ return;
+ }
+
+ GNOME_Evolution_StorageSetView__set_showCheckboxes (storage_set_view_iface, TRUE, &ev);
+ if (BONOBO_EX (&ev)) {
+ g_warning ("Cannot show checkboxes -- %s", BONOBO_EX_ID (&ev));
+ CORBA_exception_free (&ev);
+ return;
+ }
+
+ dialog = gnome_dialog_new ("Test the Selector here.", GNOME_STOCK_BUTTON_APPLY, GNOME_STOCK_BUTTON_CLOSE, NULL);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 200, 400);
+ gtk_window_set_policy (GTK_WINDOW (dialog), FALSE, TRUE, FALSE);
+
+ control_widget = bonobo_widget_new_control_from_objref (control, CORBA_OBJECT_NIL);
+ gtk_container_add (GTK_CONTAINER (GNOME_DIALOG (dialog)->vbox), control_widget);
+
+ gtk_widget_show (control_widget);
+ gtk_widget_show (dialog);
+
+ gtk_signal_connect (GTK_OBJECT (dialog), "clicked",
+ GTK_SIGNAL_FUNC (dialog_clicked_callback), storage_set_view_iface);
+
+ /* This is necessary to unref the StorageSetView iface. */
+ gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
+ GTK_SIGNAL_FUNC (dialog_destroy_callback), storage_set_view_iface);
+
+ CORBA_exception_free (&ev);
+}
+
+
/* Callbacks. */
static void
@@ -343,6 +465,9 @@ user_create_new_item_callback (EvolutionShellComponent *shell_component,
{
g_print ("\n*** Should create -- %s\n", id);
g_print ("\n\tType %s, URI %s\n", parent_folder_type, parent_folder_physical_uri);
+
+ if (strcmp (id, "FolderSelector") == 0)
+ create_new_folder_selector (shell_component);
}
@@ -366,6 +491,8 @@ register_component (void)
"New Stuff", "New _Stuff", '\0', NULL);
evolution_shell_component_add_user_creatable_item (shell_component, "MoreStuff",
"New More Stuff", "New _More Stuff", 'n', NULL);
+ evolution_shell_component_add_user_creatable_item (shell_component, "FolderSelector",
+ "Folder Selector", "New Folder _Selector", 's', NULL);
gtk_signal_connect (GTK_OBJECT (shell_component), "user_create_new_item",
GTK_SIGNAL_FUNC (user_create_new_item_callback), NULL);
@@ -398,6 +525,8 @@ main (int argc, char **argv)
register_component ();
+ g_print ("Test Component up and running.\n");
+
bonobo_main ();
return 0;