aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog54
-rw-r--r--shell/Evolution-Shell.idl8
-rw-r--r--shell/Evolution-ShellComponent.idl4
-rw-r--r--shell/e-component-registry.c13
-rw-r--r--shell/e-shell-view-menu.c120
-rw-r--r--shell/e-shell-view-menu.h6
-rw-r--r--shell/e-shell-view.c139
-rw-r--r--shell/e-shell-view.h41
-rw-r--r--shell/e-shell.c63
-rw-r--r--shell/evolution-shell-component.c49
-rw-r--r--shell/evolution-shell-component.h5
11 files changed, 407 insertions, 95 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 1a527fb022..151882ae04 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,57 @@
+2000-05-31 Ettore Perazzoli <ettore@helixcode.com>
+
+ * e-component-registry.c (component_free): Invoke `::unset_owner'
+ on the component before releasing it.
+
+ * evolution-shell-component.c (class_init): Install the
+ "owner_set" signal.
+ (impl_ShellComponent_unset_owner): New function, implementation of
+ `ShellComponent::unset_owner'.
+ (corba_class_init): Install it.
+
+ * evolution-shell-component.h: New signal "owner_unset".
+
+ * Evolution-ShellComponent.idl: New method `ShellComponent::
+ unset_owner'.
+
+ * e-shell.c (e_shell_quit): Destroy all the views explicitly.
+
+ * e-shell-view-menu.c: Changed `Show shortcut bar' and `Show
+ folder tree' items into toggle items.
+ (shortcut_bar_mode_changed_cb): New callback to update the status
+ of the "show shortcut bar" toggle item when the shortcut bar is
+ hidden/shown in the view.
+ (folder_bar_mode_changed_cb): Likewise for the folder bar.
+ (e_shell_view_menu_setup): Connect these to the corresponding
+ signals on the shell.
+
+ * e-shell-view.c: New members `shortcut_bar_mode' and
+ `folder_bar_mode' in `EShellViewPrivate'.
+ (init): Initialize `shortcut_bar_mode' and `folder_bar_mode' to
+ `E_SHELL_VIEW_SUBWINDOW_HIDDEN'.
+ (class_init): Add the new signals.
+ (e_shell_view_set_shortcut_bar_mode): Renamed from
+ `e_shell_view_show_shortcuts'. Emit "shortcut_bar_mode_changed"
+ and update the `shortcut_bar_mode' member.
+ (e_shell_view_set_folder_bar_mode): Renamed from
+ `e_shell_view_show_folders'. Emit "folder_bar_mode_changed" and
+ update the `folder_bar_mode' member.
+
+ * e-shell-view.h: New signals "shortcut_bar_mode_changed",
+ "folder_bar_mode_changed".
+
+ * e-shell-view.c (setup_menus): Removed.
+ (e_shell_view_construct): Use `e_shell_view_menu_setup' instead.
+ (e_shell_view_get_bonobo_ui_handler): New function.
+
+ * e-shell-view-menu.c (e_shell_view_menu_setup): New.
+
+ * e-shell.c (impl_Shell_get_component_for_type): New function,
+ implementation of `Evolution::Shell::get_component_for_type'.
+ (corba_class_init): Install it into the EPV.
+
+ * Evolution-Shell.idl: Added method `get_component_for_type'.
+
2000-05-30 Ettore Perazzoli <ettore@helixcode.com>
* e-shortcuts.c: New members `dirty', `save_idle_id' in
diff --git a/shell/Evolution-Shell.idl b/shell/Evolution-Shell.idl
index 496fdd8a27..4f3d18b169 100644
--- a/shell/Evolution-Shell.idl
+++ b/shell/Evolution-Shell.idl
@@ -11,8 +11,12 @@
#include <Bonobo.idl>
module Evolution {
+ interface ShellComponent;
+
interface Shell : Bonobo::Unknown {
- /* Nothing for now. */
- void dummy_method ();
+ exception NotFound {};
+
+ ShellComponent get_component_for_type (in string type)
+ raises (NotFound);
};
};
diff --git a/shell/Evolution-ShellComponent.idl b/shell/Evolution-ShellComponent.idl
index 2e67b18c17..6f0e566d44 100644
--- a/shell/Evolution-ShellComponent.idl
+++ b/shell/Evolution-ShellComponent.idl
@@ -28,6 +28,10 @@ module Evolution {
void set_owner (in Shell shell)
raises (AlreadyOwned);
+ exception NotOwned {};
+ void unset_owner ()
+ raises (NotOwned);
+
exception NotFound {};
Bonobo::Control create_view (in string physical_uri)
raises (NotFound);
diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c
index 15e5204569..a2fa72d182 100644
--- a/shell/e-component-registry.c
+++ b/shell/e-component-registry.c
@@ -79,7 +79,20 @@ component_new (const char *id,
static void
component_free (Component *component)
{
+ Evolution_ShellComponent corba_shell_component;
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+ corba_shell_component = bonobo_object_corba_objref (BONOBO_OBJECT (component->client));
+ Evolution_ShellComponent_unset_owner (corba_shell_component, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION)
+ g_warning ("Cannot unregister component -- %s", component->id);
+ else
+ g_print ("Component unregistered successfully -- %s\n", component->id);
+ CORBA_exception_free (&ev);
+
g_free (component->id);
+
bonobo_object_unref (BONOBO_OBJECT (component->client));
e_free_string_list (component->folder_type_names);
diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c
index b8836dad97..4526f5e6f3 100644
--- a/shell/e-shell-view-menu.c
+++ b/shell/e-shell-view-menu.c
@@ -30,6 +30,50 @@
#include "e-shell-view-menu.h"
+/* EShellView callbacks. */
+
+static void
+shortcut_bar_mode_changed_cb (EShellView *shell_view,
+ EShellViewSubwindowMode new_mode,
+ void *data)
+{
+ BonoboUIHandler *uih;
+ const char *path;
+ gboolean toggle_state;
+
+ if (new_mode == E_SHELL_VIEW_SUBWINDOW_HIDDEN)
+ toggle_state = FALSE;
+ else
+ toggle_state = TRUE;
+
+ path = (const char *) data;
+ uih = e_shell_view_get_bonobo_ui_handler (shell_view);
+
+ bonobo_ui_handler_menu_set_toggle_state (uih, path, toggle_state);
+}
+
+static void
+folder_bar_mode_changed_cb (EShellView *shell_view,
+ EShellViewSubwindowMode new_mode,
+ void *data)
+{
+ BonoboUIHandler *uih;
+ const char *path;
+ gboolean toggle_state;
+
+ if (new_mode == E_SHELL_VIEW_SUBWINDOW_HIDDEN)
+ toggle_state = FALSE;
+ else
+ toggle_state = TRUE;
+
+ path = (const char *) data;
+ uih = e_shell_view_get_bonobo_ui_handler (shell_view);
+
+ bonobo_ui_handler_menu_set_toggle_state (uih, path, toggle_state);
+}
+
+
+/* Command callbacks. */
static void
command_quit (GtkWidget *widget,
gpointer data)
@@ -123,34 +167,52 @@ command_about_box (GtkWidget *menuitem, gpointer data)
}
static void
-command_show_treeview (GtkWidget* widget, gpointer data)
+command_toggle_folder_bar (BonoboUIHandler *uih,
+ void *data,
+ const char *path)
{
- EShellView* shell_view;
+ EShellView *shell_view;
+ EShellViewSubwindowMode mode;
+ gboolean show;
- g_assert (E_IS_SHELL_VIEW (data));
+ puts (path);
shell_view = E_SHELL_VIEW (data);
- e_shell_view_show_folders (shell_view, TRUE);
+
+ show = bonobo_ui_handler_menu_get_toggle_state (uih, path);
+ if (show)
+ mode = E_SHELL_VIEW_SUBWINDOW_STICKY;
+ else
+ mode = E_SHELL_VIEW_SUBWINDOW_HIDDEN;
+
+ e_shell_view_set_folder_bar_mode (shell_view, mode);
}
static void
-command_show_shortcut_bar (GtkWidget* widget, gpointer data)
+command_toggle_shortcut_bar (BonoboUIHandler *uih,
+ void *data,
+ const char *path)
{
- EShellView* shell_view;
-
- g_assert (E_IS_SHELL_VIEW (data));
+ EShellView *shell_view;
+ EShellViewSubwindowMode mode;
+ gboolean show;
shell_view = E_SHELL_VIEW (data);
- e_shell_view_show_shortcuts (shell_view, TRUE);
-}
+ show = bonobo_ui_handler_menu_get_toggle_state (uih, path);
+ g_print ("%s -- %d\n", path, show);
+ if (show)
+ mode = E_SHELL_VIEW_SUBWINDOW_STICKY;
+ else
+ mode = E_SHELL_VIEW_SUBWINDOW_HIDDEN;
+
+ e_shell_view_set_shortcut_bar_mode (shell_view, mode);
+}
/* Unimplemented commands. */
-
-
#define DEFINE_UNIMPLEMENTED(func) \
static void \
func (GtkWidget *widget, gpointer data) \
@@ -262,11 +324,11 @@ static GnomeUIInfo menu_edit [] = {
};
static GnomeUIInfo menu_view [] = {
- { GNOME_APP_UI_ITEM, N_("Show _Shortcut Bar"),
- N_("Shows the shortcut bar"), command_show_shortcut_bar, NULL,
+ { GNOME_APP_UI_TOGGLEITEM, N_("Show _shortcut bar"),
+ N_("Show the shortcut bar"), command_toggle_shortcut_bar, NULL,
NULL, 0, 0, 'n', GDK_CONTROL_MASK | GDK_SHIFT_MASK },
- { GNOME_APP_UI_ITEM, N_("Show _Treeview"),
- N_("Shows the tree view"), command_show_treeview, NULL,
+ { GNOME_APP_UI_TOGGLEITEM, N_("Show _folder bar"),
+ N_("Show the folder bar"), command_toggle_folder_bar, NULL,
NULL, 0, 0, 'n', GDK_CONTROL_MASK | GDK_SHIFT_MASK },
GNOMEUIINFO_END
};
@@ -290,7 +352,7 @@ static GnomeUIInfo menu_help [] = {
/* Menu bar. */
-GnomeUIInfo e_shell_view_menu [] = {
+static GnomeUIInfo menu [] = {
GNOMEUIINFO_MENU_FILE_TREE (menu_file),
GNOMEUIINFO_MENU_EDIT_TREE (menu_edit),
GNOMEUIINFO_MENU_VIEW_TREE (menu_view),
@@ -305,3 +367,27 @@ GnomeUIInfo e_shell_view_menu [] = {
GNOMEUIINFO_END
};
+
+
+void
+e_shell_view_menu_setup (EShellView *shell_view)
+{
+ BonoboUIHandlerMenuItem *list;
+ BonoboUIHandler *uih;
+
+ g_return_if_fail (shell_view != NULL);
+ g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+
+ uih = e_shell_view_get_bonobo_ui_handler (shell_view);
+
+ list = bonobo_ui_handler_menu_parse_uiinfo_list_with_data (menu, shell_view);
+ bonobo_ui_handler_menu_add_list (uih, "/", list);
+ bonobo_ui_handler_menu_free_list (list);
+
+ gtk_signal_connect (GTK_OBJECT (shell_view), "shortcut_bar_mode_changed",
+ GTK_SIGNAL_FUNC (shortcut_bar_mode_changed_cb),
+ "");
+ gtk_signal_connect (GTK_OBJECT (shell_view), "shortcut_bar_mode_changed",
+ GTK_SIGNAL_FUNC (folder_bar_mode_changed_cb),
+ "");
+}
diff --git a/shell/e-shell-view-menu.h b/shell/e-shell-view-menu.h
index 52526c4187..fb86cb9e98 100644
--- a/shell/e-shell-view-menu.h
+++ b/shell/e-shell-view-menu.h
@@ -26,8 +26,10 @@
#ifndef E_SHELL_VIEW_MENU_H
#define E_SHELL_VIEW_MENU_H
-#include <gnome.h>
+#include <bonobo/bonobo-ui-handler.h>
-extern GnomeUIInfo e_shell_view_menu[];
+#include "e-shell-view.h"
+
+void e_shell_view_menu_setup (EShellView *shell_view);
#endif
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index f1774640ac..f9cc510102 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -80,8 +80,20 @@ struct _EShellViewPrivate {
after hiding them. */
unsigned int hpaned_position;
unsigned int view_hpaned_position;
+
+ /* Status of the shortcut and folder bars. */
+ EShellViewSubwindowMode shortcut_bar_mode;
+ EShellViewSubwindowMode folder_bar_mode;
+};
+
+enum {
+ SHORTCUT_BAR_MODE_CHANGED,
+ FOLDER_BAR_MODE_CHANGED,
+ LAST_SIGNAL
};
+static guint signals[LAST_SIGNAL] = { 0 };
+
#define DEFAULT_SHORTCUT_BAR_WIDTH 100
#define DEFAULT_TREE_WIDTH 100
@@ -102,23 +114,6 @@ create_label_for_empty_page (void)
return label;
}
-static void
-setup_menus (EShellView *shell_view)
-{
- BonoboUIHandlerMenuItem *list;
- EShellViewPrivate *priv;
-
- priv = shell_view->priv;
-
- priv->uih = bonobo_ui_handler_new ();
- bonobo_ui_handler_set_app (priv->uih, GNOME_APP (shell_view));
- bonobo_ui_handler_create_menubar (priv->uih);
-
- list = bonobo_ui_handler_menu_parse_uiinfo_list_with_data (e_shell_view_menu, shell_view);
- bonobo_ui_handler_menu_add_list (priv->uih, "/", list);
- bonobo_ui_handler_menu_free_list (list);
-}
-
/* FIXME this is broken. */
static gboolean
bonobo_widget_is_dead (BonoboWidget *bonobo_widget)
@@ -180,7 +175,7 @@ storage_set_view_close_button_clicked_cb (ETitleBar *title_bar,
shell_view = E_SHELL_VIEW (data);
- e_shell_view_show_folders (shell_view, FALSE);
+ e_shell_view_set_folder_bar_mode (shell_view, E_SHELL_VIEW_SUBWINDOW_HIDDEN);
}
@@ -286,11 +281,34 @@ setup_widgets (EShellView *shell_view)
gtk_widget_show (priv->view_vbox);
gtk_widget_show (priv->view_title_bar);
+ /* By default, both the folder bar and shortcut bar are visible. */
+ priv->shortcut_bar_mode = E_SHELL_VIEW_SUBWINDOW_STICKY;
+ priv->folder_bar_mode = E_SHELL_VIEW_SUBWINDOW_STICKY;
+
/* FIXME: Session management and stuff? */
gtk_window_set_default_size (GTK_WINDOW (shell_view), DEFAULT_WIDTH, DEFAULT_HEIGHT);
}
+/* BonoboUIHandler setup. */
+
+static void
+setup_bonobo_ui_handler (EShellView *shell_view)
+{
+ BonoboUIHandler *uih;
+ EShellViewPrivate *priv;
+
+ priv = shell_view->priv;
+
+ uih = bonobo_ui_handler_new ();
+
+ bonobo_ui_handler_set_app (uih, GNOME_APP (shell_view));
+ bonobo_ui_handler_create_menubar (uih);
+
+ priv->uih = uih;
+}
+
+
/* GtkObject methods. */
static void
@@ -298,20 +316,10 @@ hash_forall_destroy_control (void *name,
void *value,
void *data)
{
- CORBA_Object corba_control;
- CORBA_Environment ev;
- BonoboObject *bonobo_object;
BonoboWidget *bonobo_widget;
bonobo_widget = BONOBO_WIDGET (value);
- bonobo_object = BONOBO_OBJECT (bonobo_widget_get_server (bonobo_widget));
- corba_control = bonobo_object_corba_objref (bonobo_object);
-
- g_return_if_fail (corba_control != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
- Bonobo_Unknown_unref (corba_control, &ev);
- CORBA_exception_free (&ev);
+ gtk_widget_destroy (GTK_WIDGET (bonobo_widget));
g_free (name);
}
@@ -345,6 +353,26 @@ class_init (EShellViewClass *klass)
object_class->destroy = destroy;
parent_class = gtk_type_class (gnome_app_get_type ());
+
+ signals[SHORTCUT_BAR_MODE_CHANGED]
+ = gtk_signal_new ("shortcut_bar_mode_changed",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EShellViewClass, shortcut_bar_mode_changed),
+ gtk_marshal_NONE__INT,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_INT);
+
+ signals[FOLDER_BAR_MODE_CHANGED]
+ = gtk_signal_new ("folder_bar_mode_changed",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EShellViewClass, folder_bar_mode_changed),
+ gtk_marshal_NONE__INT,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_INT);
+
+ gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
static void
@@ -357,16 +385,20 @@ init (EShellView *shell_view)
priv->shell = NULL;
priv->uih = NULL;
priv->uri = NULL;
- priv->hpaned = NULL;
- priv->view_hpaned = NULL;
+
+ priv->hpaned = NULL;
+ priv->view_hpaned = NULL;
priv->contents = NULL;
priv->notebook = NULL;
priv->storage_set_view = NULL;
priv->storage_set_view_box = NULL;
priv->shortcut_bar = NULL;
+ priv->shortcut_bar_mode = E_SHELL_VIEW_SUBWINDOW_HIDDEN;
+ priv->folder_bar_mode = E_SHELL_VIEW_SUBWINDOW_HIDDEN;
+
priv->hpaned_position = 0;
- priv->view_hpaned_position = 0;
+ priv->view_hpaned_position = 0;
priv->uri_to_control = g_hash_table_new (g_str_hash, g_str_equal);
@@ -392,8 +424,10 @@ e_shell_view_construct (EShellView *shell_view,
gtk_object_ref (GTK_OBJECT (shell));
priv->shell = shell;
+ setup_bonobo_ui_handler (shell_view);
setup_widgets (shell_view);
- setup_menus (shell_view);
+
+ e_shell_view_menu_setup (shell_view);
}
GtkWidget *
@@ -803,17 +837,22 @@ e_shell_view_display_uri (EShellView *shell_view,
void
-e_shell_view_show_shortcuts (EShellView *shell_view,
- gboolean show)
+e_shell_view_set_shortcut_bar_mode (EShellView *shell_view,
+ EShellViewSubwindowMode mode)
{
EShellViewPrivate *priv;
g_return_if_fail (shell_view != NULL);
g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+ g_return_if_fail (mode == E_SHELL_VIEW_SUBWINDOW_STICKY
+ || mode == E_SHELL_VIEW_SUBWINDOW_HIDDEN);
priv = shell_view->priv;
- if (show) {
+ if (priv->shortcut_bar_mode == mode)
+ return;
+
+ if (mode == E_SHELL_VIEW_SUBWINDOW_STICKY) {
if (! GTK_WIDGET_VISIBLE (priv->shortcut_bar)) {
gtk_widget_show (priv->shortcut_bar);
e_paned_set_position (E_PANED (priv->hpaned), priv->hpaned_position);
@@ -826,20 +865,29 @@ e_shell_view_show_shortcuts (EShellView *shell_view,
e_paned_set_position (E_PANED (priv->hpaned), 0);
}
}
+
+ priv->shortcut_bar_mode = mode;
+
+ gtk_signal_emit (GTK_OBJECT (shell_view), signals[SHORTCUT_BAR_MODE_CHANGED], mode);
}
void
-e_shell_view_show_folders (EShellView *shell_view,
- gboolean show)
+e_shell_view_set_folder_bar_mode (EShellView *shell_view,
+ EShellViewSubwindowMode mode)
{
EShellViewPrivate *priv;
g_return_if_fail (shell_view != NULL);
g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+ g_return_if_fail (mode == E_SHELL_VIEW_SUBWINDOW_STICKY
+ || mode == E_SHELL_VIEW_SUBWINDOW_HIDDEN);
priv = shell_view->priv;
- if (show) {
+ if (priv->folder_bar_mode == mode)
+ return;
+
+ if (mode == E_SHELL_VIEW_SUBWINDOW_STICKY) {
if (! GTK_WIDGET_VISIBLE (priv->storage_set_view_box)) {
gtk_widget_show (priv->storage_set_view_box);
e_paned_set_position (E_PANED (priv->view_hpaned), priv->view_hpaned_position);
@@ -852,6 +900,10 @@ e_shell_view_show_folders (EShellView *shell_view,
e_paned_set_position (E_PANED (priv->view_hpaned), 0);
}
}
+
+ priv->folder_bar_mode = mode;
+
+ gtk_signal_emit (GTK_OBJECT (shell_view), signals[FOLDER_BAR_MODE_CHANGED], mode);
}
@@ -864,5 +916,14 @@ e_shell_view_get_shell (EShellView *shell_view)
return shell_view->priv->shell;
}
+BonoboUIHandler *
+e_shell_view_get_bonobo_ui_handler (EShellView *shell_view)
+{
+ g_return_val_if_fail (shell_view != NULL, NULL);
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return shell_view->priv->uih;
+}
+
E_MAKE_TYPE (e_shell_view, "EShellView", EShellView, class_init, init, PARENT_TYPE)
diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h
index d0ac824a96..fa38ff695c 100644
--- a/shell/e-shell-view.h
+++ b/shell/e-shell-view.h
@@ -28,7 +28,8 @@
#include <config.h>
#endif
-#include <gnome.h>
+#include <libgnomeui/gnome-app.h>
+#include <bonobo/bonobo-ui-handler.h>
#include "e-shell.h"
@@ -48,13 +49,12 @@ typedef struct _EShellView EShellView;
typedef struct _EShellViewPrivate EShellViewPrivate;
typedef struct _EShellViewClass EShellViewClass;
-enum _EShellViewShowFoldersMode {
- E_SHELL_VIEW_SHOW_FOLDERS_HIDDEN,
- E_SHELL_VIEW_SHOW_FOLDERS_TRANSIENT,
- E_SHELL_VIEW_SHOW_FOLDERS_STICKY
+enum _EShellViewSubwindowMode {
+ E_SHELL_VIEW_SUBWINDOW_HIDDEN,
+ E_SHELL_VIEW_SUBWINDOW_TRANSIENT,
+ E_SHELL_VIEW_SUBWINDOW_STICKY
};
-typedef enum _EShellViewShowFoldersMode EShellViewShowFoldersMode;
-
+typedef enum _EShellViewSubwindowMode EShellViewSubwindowMode;
struct _EShellView {
GnomeApp parent;
@@ -64,23 +64,28 @@ struct _EShellView {
struct _EShellViewClass {
GnomeAppClass parent_class;
+
+ /* Signals. */
+ void (* shortcut_bar_mode_changed) (EShellView *shell_view, EShellViewSubwindowMode new_mode);
+ void (* folder_bar_mode_changed) (EShellView *shell_view, EShellViewSubwindowMode mode);
};
-GtkType e_shell_view_get_type (void);
-void e_shell_view_construct (EShellView *shell_view,
- EShell *shell);
-GtkWidget *e_shell_view_new (EShell *shell);
+GtkType e_shell_view_get_type (void);
+void e_shell_view_construct (EShellView *shell_view,
+ EShell *shell);
+GtkWidget *e_shell_view_new (EShell *shell);
-gboolean e_shell_view_display_uri (EShellView *shell_view,
- const char *uri);
+gboolean e_shell_view_display_uri (EShellView *shell_view,
+ const char *uri);
-void e_shell_view_show_shortcuts (EShellView *shell_view,
- gboolean show);
-void e_shell_view_show_folders (EShellView *shell_view,
- gboolean show);
+void e_shell_view_set_shortcut_bar_mode (EShellView *shell_view,
+ EShellViewSubwindowMode mode);
+void e_shell_view_set_folder_bar_mode (EShellView *shell_view,
+ EShellViewSubwindowMode mode);
-EShell *e_shell_view_get_shell (EShellView *shell_view);
+EShell *e_shell_view_get_shell (EShellView *shell_view);
+BonoboUIHandler *e_shell_view_get_bonobo_ui_handler (EShellView *shell_view);
#ifdef __cplusplus
}
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 4378343973..af28df115a 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -25,8 +25,7 @@
#include <config.h>
#endif
-#include <gtk/gtkobject.h>
-#include <gtk/gtktypeutils.h>
+#include <gnome.h>
#include "Evolution.h"
@@ -112,11 +111,31 @@ create_servant (void)
return servant;
}
-static void
-impl_Shell_dummy_method (PortableServer_Servant servant,
- CORBA_Environment *ev)
+static Evolution_ShellComponent
+impl_Shell_get_component_for_type (PortableServer_Servant servant,
+ const CORBA_char *type,
+ CORBA_Environment *ev)
{
- g_print ("Evolution::Shell::dummy_method invoked!\n");
+ BonoboObject *bonobo_object;
+ BonoboObjectClient *handler;
+ EFolderTypeRegistry *folder_type_registry;
+ Evolution_ShellComponent corba_component;
+ EShell *shell;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ shell = E_SHELL (bonobo_object);
+ folder_type_registry = shell->priv->folder_type_registry;
+
+ handler = e_folder_type_registry_get_handler_for_type (folder_type_registry, type);
+
+ if (handler == NULL) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_Evolution_Shell_NotFound, NULL);
+ return CORBA_OBJECT_NIL;
+ }
+
+ corba_component = bonobo_object_corba_objref (BONOBO_OBJECT (handler));
+ Bonobo_Unknown_ref (corba_component, ev);
+ return CORBA_Object_duplicate (corba_component, ev);
}
@@ -273,7 +292,7 @@ corba_class_init (void)
base_epv->default_POA = NULL;
epv = g_new0 (POA_Evolution_Shell__epv, 1);
- epv->dummy_method = impl_Shell_dummy_method;
+ epv->get_component_for_type = impl_Shell_get_component_for_type;
vepv = &shell_vepv;
vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
@@ -451,10 +470,38 @@ e_shell_get_folder_type_registry (EShell *shell)
void
e_shell_quit (EShell *shell)
{
+ EShellPrivate *priv;
+ GList *p;
+
g_return_if_fail (shell != NULL);
g_return_if_fail (E_IS_SHELL (shell));
- bonobo_object_unref (BONOBO_OBJECT (shell));
+ priv = shell->priv;
+
+ for (p = priv->views; p != NULL; p = p->next) {
+ EShellView *shell_view;
+
+ shell_view = E_SHELL_VIEW (p->data);
+ gtk_signal_disconnect_by_func (GTK_OBJECT (shell_view),
+ GTK_SIGNAL_FUNC (view_destroy_cb), shell);
+ gtk_widget_destroy (GTK_WIDGET (shell_view));
+ }
+
+ g_list_free (priv->views);
+ priv->views = NULL;
+
+ gtk_object_unref (GTK_OBJECT (priv->storage_set));
+ gtk_object_unref (GTK_OBJECT (priv->shortcuts));
+ gtk_object_unref (GTK_OBJECT (priv->folder_type_registry));
+ gtk_object_unref (GTK_OBJECT (priv->component_registry));
+
+ priv->storage_set = NULL;
+ priv->shortcuts = NULL;
+ priv->folder_type_registry = NULL;
+ priv->component_registry = NULL;
+
+ /* FIXME Unref does not work here. Probably somewhere we are leaking a _ref(). */
+ bonobo_object_destroy (BONOBO_OBJECT (shell));
}
diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c
index 71952d4300..85ba002b30 100644
--- a/shell/evolution-shell-component.c
+++ b/shell/evolution-shell-component.c
@@ -47,6 +47,7 @@ struct _EvolutionShellComponentPrivate {
enum {
OWNER_SET,
+ OWNER_UNSET,
LAST_SIGNAL
};
@@ -139,6 +140,30 @@ impl_ShellComponent_set_owner (PortableServer_Servant servant,
gtk_signal_emit (GTK_OBJECT (shell_component), signals[OWNER_SET], priv->corba_owner);
}
+static void
+impl_ShellComponent_unset_owner (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ BonoboObject *bonobo_object;
+ EvolutionShellComponent *shell_component;
+ EvolutionShellComponentPrivate *priv;
+
+ bonobo_object = bonobo_object_from_servant (servant);
+ shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object);
+ priv = shell_component->priv;
+
+ if (priv->corba_owner == CORBA_OBJECT_NIL) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+ ex_Evolution_ShellComponent_NotOwned, NULL);
+ return;
+ }
+
+ Bonobo_Unknown_unref (priv->corba_owner, ev);
+ CORBA_Object_release (priv->corba_owner, ev);
+
+ gtk_signal_emit (GTK_OBJECT (shell_component), signals[OWNER_UNSET]);
+}
+
static Bonobo_Control
impl_ShellComponent_create_view (PortableServer_Servant servant,
const CORBA_char *physical_uri,
@@ -221,6 +246,7 @@ corba_class_init (void)
epv = g_new0 (POA_Evolution_ShellComponent__epv, 1);
epv->_get_supported_types = impl_ShellComponent__get_supported_types;
epv->set_owner = impl_ShellComponent_set_owner;
+ epv->unset_owner = impl_ShellComponent_unset_owner;
epv->create_view = impl_ShellComponent_create_view;
vepv = &ShellComponent_vepv;
@@ -237,13 +263,22 @@ class_init (EvolutionShellComponentClass *klass)
object_class = GTK_OBJECT_CLASS (klass);
object_class->destroy = destroy;
- signals[OWNER_SET] = gtk_signal_new ("owner_set",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EvolutionShellComponentClass, owner_set),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
+ signals[OWNER_SET]
+ = gtk_signal_new ("owner_set",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EvolutionShellComponentClass, owner_set),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_POINTER);
+
+ signals[OWNER_UNSET]
+ = gtk_signal_new ("owner_set",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EvolutionShellComponentClass, owner_unset),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
diff --git a/shell/evolution-shell-component.h b/shell/evolution-shell-component.h
index 4b00f5df0a..f60f89f93d 100644
--- a/shell/evolution-shell-component.h
+++ b/shell/evolution-shell-component.h
@@ -68,8 +68,9 @@ struct _EvolutionShellComponentClass {
/* Signals. */
- void (* owner_set) (EvolutionShellComponent *shell_component,
- Evolution_Shell shell_interface);
+ void (* owner_set) (EvolutionShellComponent *shell_component,
+ Evolution_Shell shell_interface);
+ void (* owner_unset) (EvolutionShellComponent *shell_component);
};