aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorParthasarathi Susarla <saps@src.gnome.org>2005-12-21 15:18:49 +0800
committerParthasarathi Susarla <saps@src.gnome.org>2005-12-21 15:18:49 +0800
commit57884e830b43bf7a4a1eb08ce59cb8dd06a0de60 (patch)
tree8924656fe29b0ca86450ed4c55c185d917f2770b /shell
parent8e71ebe0f4885419bb524fed4838a3277003a828 (diff)
downloadgsoc2013-evolution-57884e830b43bf7a4a1eb08ce59cb8dd06a0de60.tar
gsoc2013-evolution-57884e830b43bf7a4a1eb08ce59cb8dd06a0de60.tar.gz
gsoc2013-evolution-57884e830b43bf7a4a1eb08ce59cb8dd06a0de60.tar.bz2
gsoc2013-evolution-57884e830b43bf7a4a1eb08ce59cb8dd06a0de60.tar.lz
gsoc2013-evolution-57884e830b43bf7a4a1eb08ce59cb8dd06a0de60.tar.xz
gsoc2013-evolution-57884e830b43bf7a4a1eb08ce59cb8dd06a0de60.tar.zst
gsoc2013-evolution-57884e830b43bf7a4a1eb08ce59cb8dd06a0de60.zip
committed these files to fix http://bugzilla.gnome.org/show_bug.cgi?id=260354
ChangeLog addressbook/ChangeLog addressbook/gui/component/addressbook-component.c calendar/ChangeLog calendar/gui/calendar-component.c calendar/gui/memos-component.c calendar/gui/tasks-component.c mail/ChangeLog mail/Evolution-Mail.idl mail/mail-component.c shell/ChangeLog shell/Evolution-Component.idl shell/Evolution-Shell.idl shell/Evolution.idl shell/Makefile.am shell/e-shell-window.c shell/e-shell-window.h shell/e-shell.c svn path=/trunk/; revision=30915
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog39
-rw-r--r--shell/Evolution-Component.idl18
-rw-r--r--shell/Evolution-Shell.idl105
-rw-r--r--shell/Evolution.idl1
-rw-r--r--shell/Makefile.am8
-rw-r--r--shell/e-shell-window.c72
-rw-r--r--shell/e-shell-window.h2
-rw-r--r--shell/e-shell.c14
8 files changed, 239 insertions, 20 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index c89628c529..206ce41681 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,42 @@
+2005-12-21 Not Zed <NotZed@Ximian.com>
+
+ * e-shell-view.c (impl_ShellView_setTitle): take a component id
+ argument.
+
+ * e-shell-window.c (component_view_free): release the corba object
+ properly.
+ (e_shell_window_set_title): new helper to set the title for the
+ component.
+ (switch_view): use the component specific title if available or
+ fallback to the component name.
+
+2004-12-21 Not Zed <NotZed@Ximian.com>
+
+ ** See bug #60354.
+
+ * Evolution-Component.idl: createControls -> createView and
+ ComponentView to keep track of things.
+
+ * Evolution-Shell.idl: return a new type ShellView from
+ createNewWindow so other parts of the system can access it later.
+ ShellView so far just lets you set title or switch component, but
+ could be subclassed later.
+
+ * e-shell.c (impl_Shell_createNewWindow): return a shell view.
+
+ * e-shell-window.c (init_view): create the view from the compnent
+ first, then get the controls from it separately.
+ (init): setup the e-shell-view object for the create view
+ thing.
+
+ * e-shell-view.c (e_shell_view_new): simple bonobo object for
+ Evolution_ShellView, keep track of the EShellWindow.
+
+ * e-component-view.[ch]: simple bonobo object for
+ Evolution_ComponentView. Just keep track of the controls.
+
+ Committed on behalf of NotZed - partha
+
2005-12-17 Tor Lillqvist <tml@novell.com>
* e-config-upgrade.c: Use libedataserver's e_xml_parse_file()
diff --git a/shell/Evolution-Component.idl b/shell/Evolution-Component.idl
index d464327a31..a64efebe42 100644
--- a/shell/Evolution-Component.idl
+++ b/shell/Evolution-Component.idl
@@ -42,6 +42,18 @@ module Evolution {
};
typedef sequence <CreatableItemType> CreatableItemTypeList;
+ interface ComponentView : Bonobo::Unknown {
+ void getControls (out Bonobo::Control sidebar_control,
+ out Bonobo::Control view_control,
+ out Bonobo::Control statusbar_control);
+ };
+
+ interface ComponentView : Bonobo::Unknown {
+ void getControls (out Bonobo::Control sidebar_control,
+ out Bonobo::Control view_control,
+ out Bonobo::Control statusbar_control);
+ };
+
interface Listener : Bonobo::Unknown {
/* Indicate the change of state is complete */
void complete();
@@ -64,12 +76,10 @@ module Evolution {
raises (UnsupportedVersion, UpgradeFailed);
/*** Basic functionality. ***/
+ ComponentView createView(in ShellView parent)
+ raises (Failed);
/* Create the controls for embedding in the shell. */
- void createControls (out Bonobo::Control sidebar_control,
- out Bonobo::Control view_control,
- out Bonobo::Control statusbar_control)
- raises (Failed);
/* Check if the component can quit.
Do not perform any quit-related tasks however.
diff --git a/shell/Evolution-Shell.idl b/shell/Evolution-Shell.idl
index c9d075918d..b67aee1151 100644
--- a/shell/Evolution-Shell.idl
+++ b/shell/Evolution-Shell.idl
@@ -15,6 +15,109 @@
module GNOME {
module Evolution {
+ enum CreatableItem {
+ CREATABLE_OBJECT,
+ CREATABLE_FOLDER
+ };
+
+ /* A type of item that the component can create when asked by the user,
+ e.g. a mail message or an appointment. */
+ struct CreatableItemType {
+ string id;
+ string description;
+ string menuDescription;
+ string tooltip;
+ char menuShortcut;
+ string iconName;
+ CreatableItem type;
+ };
+ typedef sequence <CreatableItemType> CreatableItemTypeList;
+
+ interface ComponentView : Bonobo::Unknown {
+ void getControls (out Bonobo::Control sidebar_control,
+ out Bonobo::Control view_control,
+ out Bonobo::Control statusbar_control);
+ };
+
+ interface Listener : Bonobo::Unknown {
+ /* Indicate the change of state is complete */
+ void complete();
+ };
+
+ interface ShellView : Bonobo::Unknown {
+ /* Should really use a ComponentView i guess */
+ void setTitle(in string component, in string title);
+ void setComponent(in string component);
+ };
+
+ interface Component : Bonobo::Unknown {
+ exception Failed {};
+ exception UnknownType {};
+ /* We don't know about the old version we're upgrading from */
+ exception UnsupportedVersion {};
+ /* We encountered a non-recoverable, fatal error, explain why */
+ exception UpgradeFailed {
+ string what;
+ string why;
+ };
+
+ /*** Upgrade path. ***/
+
+ void upgradeFromVersion (in short major, in short minor, in short revision)
+ raises (UnsupportedVersion, UpgradeFailed);
+
+ /*** Basic functionality. ***/
+ ComponentView createView(in ShellView parent)
+ raises (Failed);
+
+ /* Create the controls for embedding in the shell. */
+
+ /* Check if the component can quit.
+ Do not perform any quit-related tasks however.
+ May be called multiple times, depending on user interaction. */
+ boolean requestQuit ();
+
+ /* Ask the component to quit. Returns TRUE when the
+ component has completed any closing-down tasks, and
+ is ready to exit(). This will be called repeatedly
+ at intervals until it returns TRUE. */
+ boolean quit ();
+
+ /* Notify the component of whether the shell is currently
+ running in interactive mode or not. (I.e. basically,
+ whether there are any Evolution windows on the screen.)
+ @new_view_xid is an X Window ID ("None" if @now_interactive
+ is FALSE) */
+ void interactive (in boolean now_interactive,
+ in unsigned long new_view_xid);
+
+
+ /*** The following stuff is needed to build the "New" toolbar
+ item as well as the "File -> New" submenu. ***/
+
+ /* List of creatable items. */
+ readonly attribute CreatableItemTypeList userCreatableItems;
+
+ /* Pop up a new editing dialog for the item with the specified
+ @item_type_name. */
+ void requestCreateItem (in string item_type_name)
+ raises (UnknownType, Failed);
+
+
+ /*** URI handling (e.g. for the command-line, "evolution
+ mailto:foo@bar.org") ***/
+ void handleURI (in string uri);
+
+
+ /*** Send/receive. ***/
+
+ void sendAndReceive ();
+
+ /* Set the online status of the component asynchronously */
+
+ void setLineStatus(in boolean online, in Listener listener);
+ };
+
interface Shell : Bonobo::Unknown {
exception Busy {};
exception ComponentNotFound {};
@@ -29,7 +132,7 @@ module Evolution {
* @component_id: id or alias of the component to display in the new window.
*
*/
- void createNewWindow (in string component_id)
+ ShellView createNewWindow (in string component_id)
raises (NotReady, ComponentNotFound, UnsupportedSchema, InternalError);
/**
diff --git a/shell/Evolution.idl b/shell/Evolution.idl
index a734c091fd..167caa258b 100644
--- a/shell/Evolution.idl
+++ b/shell/Evolution.idl
@@ -13,7 +13,6 @@
#include <Bonobo.idl>
-#include <Evolution-Component.idl>
#include <Evolution-ConfigControl.idl>
#include <Evolution-Shell.idl>
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 944c25cd7c..1082df8ed0 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -79,6 +79,7 @@ eshellincludedir = $(privincludedir)/shell
eshellinclude_HEADERS = \
Evolution.h \
+ e-component-view.h \
e-shell-utils.h \
e-user-creatable-items-handler.h \
evolution-config-control.h \
@@ -91,6 +92,7 @@ eshellinclude_HEADERS = \
libeshell_la_SOURCES = \
$(IDL_GENERATED) \
$(MARSHAL_GENERATED) \
+ e-component-view.c \
evolution-component.c \
evolution-listener.c \
e-shell-utils.c \
@@ -118,6 +120,8 @@ evolution_SOURCES = \
e-corba-config-page.h \
e-history.c \
e-history.h \
+ e-shell.c \
+ e-shell.h \
e-shell-constants.h \
e-shell-folder-title-bar.c \
e-shell-folder-title-bar.h \
@@ -129,8 +133,8 @@ evolution_SOURCES = \
e-shell-window-commands.h \
e-shell-window.c \
e-shell-window.h \
- e-shell.c \
- e-shell.h \
+ e-shell-view.c \
+ e-shell-view.h \
e-sidebar.c \
e-sidebar.h \
es-event.c \
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 0fd5fe3dca..a0f70c7ccf 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -25,6 +25,7 @@
#endif
#include "e-shell-window.h"
+#include "e-shell-view.h"
#include "Evolution.h"
@@ -67,6 +68,9 @@ struct _ComponentView {
char *component_id;
char *component_alias;
+ GNOME_Evolution_ComponentView component_view;
+ char *title;
+
GtkWidget *sidebar_widget;
GtkWidget *view_widget;
GtkWidget *statusbar_widget;
@@ -79,6 +83,8 @@ typedef struct _ComponentView ComponentView;
struct _EShellWindowPrivate {
EShell *shell;
+ EShellView *shell_view; /* CORBA wrapper for this, just a placeholder */
+
/* plugin menu manager */
ESMenu *menu;
@@ -149,6 +155,13 @@ component_view_new (const char *id, const char *alias, int button_id)
static void
component_view_free (ComponentView *view)
{
+ if (view->component_view) {
+ CORBA_Environment ev = { 0 };
+
+ CORBA_Object_release(view->component_view, &ev);
+ CORBA_exception_free(&ev);
+ }
+
g_free (view->component_id);
g_free (view->component_alias);
g_free (view);
@@ -193,6 +206,7 @@ init_view (EShellWindow *window,
EShellWindowPrivate *priv = window->priv;
EComponentRegistry *registry = e_shell_peek_component_registry (window->priv->shell);
GNOME_Evolution_Component component_iface;
+ GNOME_Evolution_ComponentView component_view;
Bonobo_UIContainer container;
Bonobo_Control sidebar_control;
Bonobo_Control view_control;
@@ -221,19 +235,29 @@ init_view (EShellWindow *window,
/* 2. Set up view. */
- GNOME_Evolution_Component_createControls (component_iface, &sidebar_control, &view_control, &statusbar_control, &ev);
- if (BONOBO_EX (&ev)) {
+ /* The rest of the code assumes that the component is valid and can create
+ controls; if this fails something is really wrong in the component
+ (e.g. methods not implemented)... So handle it as if there was no
+ component at all. */
+
+ component_view = GNOME_Evolution_Component_createView(component_iface, BONOBO_OBJREF(priv->shell_view), &ev);
+ if (component_view == NULL || BONOBO_EX (&ev)) {
g_warning ("Cannot create view for %s", view->component_id);
+ bonobo_object_release_unref (component_iface, NULL);
+ CORBA_exception_free (&ev);
+ return;
+ }
- /* The rest of the code assumes that the component is valid and can create
- controls; if this fails something is really wrong in the component
- (e.g. methods not implemented)... So handle it as if there was no
- component at all. */
+ GNOME_Evolution_ComponentView_getControls(component_view, &sidebar_control, &view_control, &statusbar_control, &ev);
+ if (BONOBO_EX (&ev)) {
+ g_warning ("Cannot create view for %s", view->component_id);
bonobo_object_release_unref (component_iface, NULL);
CORBA_exception_free (&ev);
return;
}
+ view->component_view = component_view;
+
CORBA_exception_free (&ev);
container = bonobo_ui_component_get_container (priv->ui_component);
@@ -301,9 +325,12 @@ switch_view (EShellWindow *window, ComponentView *component_view)
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->statusbar_notebook), component_view->notebook_page_num);
}
- title = g_strdup_printf ("Evolution - %s", info->button_label);
- gtk_window_set_title (GTK_WINDOW (window), title);
- g_free (title);
+ if (component_view->title == NULL) {
+ title = g_strdup_printf ("Evolution - %s", info->button_label);
+ gtk_window_set_title (GTK_WINDOW (window), title);
+ g_free (title);
+ } else
+ gtk_window_set_title (GTK_WINDOW (window), component_view->title);
if (info->button_icon)
gtk_window_set_icon (GTK_WINDOW (window), info->button_icon);
@@ -839,6 +866,7 @@ e_shell_window_init (EShellWindow *shell_window)
EShellWindowPrivate *priv = g_new0 (EShellWindowPrivate, 1);
priv->tooltips = gtk_tooltips_new ();
+ priv->shell_view = e_shell_view_new(shell_window);
shell_window->priv = priv;
@@ -1064,3 +1092,29 @@ e_shell_window_show_settings (EShellWindow *window)
e_shell_show_settings (window->priv->shell, window->priv->current_view ? window->priv->current_view->component_alias : NULL, window);
}
+void
+e_shell_window_set_title(EShellWindow *window, const char *component_id, const char *title)
+{
+ EShellWindowPrivate *priv = window->priv;
+ ComponentView *view = NULL;
+ GSList *p;
+
+ for (p = priv->component_views; p != NULL; p = p->next) {
+ ComponentView *this_view = p->data;
+
+ if (strcmp (this_view->component_id, component_id) == 0
+ || (this_view->component_alias != NULL
+ && strcmp (this_view->component_alias, component_id) == 0)) {
+ view = p->data;
+ break;
+ }
+ }
+
+ if (view) {
+ g_free(view->title);
+ view->title = g_strdup(title);
+ if (view->title && view == priv->current_view)
+ gtk_window_set_title((GtkWindow *)window, title);
+ }
+}
+
diff --git a/shell/e-shell-window.h b/shell/e-shell-window.h
index 796e08d050..2c54d73ef0 100644
--- a/shell/e-shell-window.h
+++ b/shell/e-shell-window.h
@@ -68,6 +68,8 @@ BonoboUIComponent *e_shell_window_peek_bonobo_ui_component (EShellWindow *windo
ESidebar *e_shell_window_peek_sidebar (EShellWindow *window);
GtkWidget *e_shell_window_peek_statusbar (EShellWindow *window);
+void e_shell_window_set_title(EShellWindow *window, const char *component_id, const char *title);
+
void e_shell_window_save_defaults (EShellWindow *window);
void e_shell_window_show_settings (EShellWindow *window);
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 99277b1cf6..433baa9ccf 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -67,6 +67,7 @@
#include "e-shell-marshal.h"
#include "e-shell-settings-dialog.h"
#include "e-shell.h"
+#include "e-shell-view.h"
#include "es-event.h"
#include "evolution-listener.h"
#include "evolution-shell-component-utils.h"
@@ -216,7 +217,7 @@ raise_exception_if_not_ready (PortableServer_Servant servant,
return FALSE;
}
-static void
+static GNOME_Evolution_ShellView
impl_Shell_createNewWindow (PortableServer_Servant servant,
const CORBA_char *component_id,
CORBA_Environment *ev)
@@ -224,9 +225,10 @@ impl_Shell_createNewWindow (PortableServer_Servant servant,
BonoboObject *bonobo_object;
EShell *shell;
EShellWindow *shell_window;
+ EShellView *shell_view;
if (raise_exception_if_not_ready (servant, ev))
- return;
+ return CORBA_OBJECT_NIL;
bonobo_object = bonobo_object_from_servant (servant);
shell = E_SHELL (bonobo_object);
@@ -238,8 +240,14 @@ impl_Shell_createNewWindow (PortableServer_Servant servant,
if (shell_window == NULL) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_GNOME_Evolution_Shell_ComponentNotFound, NULL);
- return;
+ return CORBA_OBJECT_NIL;
}
+
+ /* refs?? */
+ shell_view = e_shell_view_new(shell_window);
+
+ return BONOBO_OBJREF(shell_view);
+
}
static void