Re: [Evolution-hackers] Evolution UI Hackfest
- From: Not Zed <notzed ximian com>
- To: JP Rosevear <jpr novell com>
- Cc: evolution-hackers ximian com
- Subject: Re: [Evolution-hackers] Evolution UI Hackfest
- Date: Wed, 24 Nov 2004 15:45:51 +0800
On Tue, 2004-11-23 at 17:47 -0500, JP Rosevear wrote:
On Wednesday Nov 24th, 2004 the Evolution Team is going to have a UI Hackfest on irc in #evolution on gimp net. We want to focus on getting nice little bits of polish in the UI.
A detailed (but not exhaustive) list of ideas is available at: http://www.gnome.org/projects/evolution/hackfest-ui.shtml
Attached is a patch for window title info. It only does the mail info currently, but it is fairly easy to extend for the other components.
It is an old patch just updated for changelog updates.
Index: addressbook/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1867
diff -u -p -r1.1867 ChangeLog
--- addressbook/ChangeLog 22 Nov 2004 20:44:53 -0000 1.1867
+++ addressbook/ChangeLog 24 Nov 2004 07:54:00 -0000
@@ -801,6 +801,11 @@
a newline between street line and rest of extended address.
(extract_address_textview): Omit the newline trailing the street line.
+2004-06-28 Not Zed <NotZed Ximian com>
+
+ * gui/component/addressbook-component.c (impl_createView): changed
+ from createControls for new shell apis.
+
2004-06-24 Hans Petter Jansson <hpj ximian com>
* gui/contact-editor/e-contact-editor.c (address_labels): Add table.
Index: addressbook/gui/component/addressbook-component.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/addressbook-component.c,v
retrieving revision 1.132
diff -u -p -r1.132 addressbook-component.c
--- addressbook/gui/component/addressbook-component.c 21 Oct 2004 01:42:20 -0000 1.132
+++ addressbook/gui/component/addressbook-component.c 24 Nov 2004 07:54:00 -0000
@@ -39,6 +39,8 @@
#include "widgets/misc/e-task-bar.h"
#include "widgets/misc/e-info-label.h"
+#include "shell/e-component-view.h"
+
#include <string.h>
#include <bonobo/bonobo-i18n.h>
#include <gtk/gtkimage.h>
@@ -60,25 +62,20 @@ struct _AddressbookComponentPrivate {
/* Evolution::Component CORBA methods. */
-static void
-impl_createControls (PortableServer_Servant servant,
- Bonobo_Control *corba_sidebar_control,
- Bonobo_Control *corba_view_control,
- Bonobo_Control *corba_statusbar_control,
- CORBA_Environment *ev)
+static GNOME_Evolution_ComponentView
+impl_createView (PortableServer_Servant servant,
+ GNOME_Evolution_ShellView parent,
+ CORBA_Environment *ev)
{
AddressbookView *view = addressbook_view_new ();
- BonoboControl *sidebar_control;
- BonoboControl *view_control;
- BonoboControl *statusbar_control;
-
- sidebar_control = bonobo_control_new (addressbook_view_peek_sidebar (view));
- view_control = addressbook_view_peek_folder_view (view);
- statusbar_control = bonobo_control_new (addressbook_view_peek_statusbar (view));
-
- *corba_sidebar_control = CORBA_Object_duplicate (BONOBO_OBJREF (sidebar_control), ev);
- *corba_view_control = CORBA_Object_duplicate (BONOBO_OBJREF (view_control), ev);
- *corba_statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (statusbar_control), ev);
+ EComponentView *component_view;
+
+ component_view = e_component_view_new_controls (parent, "contacts",
+ bonobo_control_new (addressbook_view_peek_sidebar (view)),
+ addressbook_view_peek_folder_view (view),
+ bonobo_control_new (addressbook_view_peek_statusbar (view)));
+
+ return BONOBO_OBJREF(component_view);
}
static GNOME_Evolution_CreatableItemTypeList *
@@ -234,7 +231,7 @@ addressbook_component_class_init (Addres
POA_GNOME_Evolution_Component__epv *epv = &class->epv;
GObjectClass *object_class = G_OBJECT_CLASS (class);
- epv->createControls = impl_createControls;
+ epv->createView = impl_createView;
epv->_get_userCreatableItems = impl__get_userCreatableItems;
epv->requestCreateItem = impl_requestCreateItem;
epv->upgradeFromVersion = impl_upgradeFromVersion;
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2563
diff -u -p -r1.2563 ChangeLog
--- calendar/ChangeLog 23 Nov 2004 06:24:57 -0000 1.2563
+++ calendar/ChangeLog 24 Nov 2004 07:54:02 -0000
@@ -1607,6 +1607,13 @@
(dalarm_message_toggled_cb): sensitize message entry
(init_widgets): listen for toggle signals
+2004-06-28 Not Zed <NotZed Ximian com>
+
+ * gui/tasks-component.c (impl_createControls): same.
+
+ * gui/calendar-component.c (impl_createControls): ->createView for
+ new shell apis.
+
2004-06-24 JP Rosevear <jpr novell com>
* gui/dialogs/alarm-list-dialog.c (selection_changed_cb):
Index: calendar/gui/calendar-component.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-component.c,v
retrieving revision 1.190
diff -u -p -r1.190 calendar-component.c
--- calendar/gui/calendar-component.c 28 Oct 2004 09:26:13 -0000 1.190
+++ calendar/gui/calendar-component.c 24 Nov 2004 07:54:03 -0000
@@ -34,6 +34,7 @@
#include <libecal/e-cal-time-util.h>
#include <libedataserverui/e-source-selector.h>
#include <shell/e-user-creatable-items-handler.h>
+#include <shell/e-component-view.h>
#include "e-pub-utils.h"
#include "e-calendar-view.h"
#include "calendar-config-keys.h"
@@ -1189,16 +1190,15 @@ view_destroyed_cb (gpointer data, GObjec
}
}
-static void
-impl_createControls (PortableServer_Servant servant,
- Bonobo_Control *corba_sidebar_control,
- Bonobo_Control *corba_view_control,
- Bonobo_Control *corba_statusbar_control,
- CORBA_Environment *ev)
+static GNOME_Evolution_ComponentView
+impl_createView (PortableServer_Servant servant,
+ GNOME_Evolution_ShellView parent,
+ CORBA_Environment *ev)
{
CalendarComponent *calendar_component = CALENDAR_COMPONENT (bonobo_object_from_servant (servant));
CalendarComponentPrivate *priv;
CalendarComponentView *component_view;
+ EComponentView *ecv;
priv = calendar_component->priv;
@@ -1208,18 +1208,18 @@ impl_createControls (PortableServer_Serv
/* FIXME Should we describe the problem in a control? */
bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed);
- return;
+ return CORBA_OBJECT_NIL;
}
g_object_weak_ref (G_OBJECT (component_view->view_control), view_destroyed_cb, calendar_component);
priv->views = g_list_append (priv->views, component_view);
-
- /* Return the controls */
- *corba_sidebar_control = CORBA_Object_duplicate (BONOBO_OBJREF (component_view->sidebar_control), ev);
- *corba_view_control = CORBA_Object_duplicate (BONOBO_OBJREF (component_view->view_control), ev);
- *corba_statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (component_view->statusbar_control), ev);
-}
+ /* TODO: Make CalendarComponentView just subclass EComponentView */
+ ecv = e_component_view_new_controls (parent, "calendar", component_view->sidebar_control,
+ component_view->view_control, component_view->statusbar_control);
+
+ return BONOBO_OBJREF(ecv);
+}
static GNOME_Evolution_CreatableItemTypeList *
impl__get_userCreatableItems (PortableServer_Servant servant,
@@ -1361,7 +1361,7 @@ calendar_component_class_init (CalendarC
parent_class = g_type_class_peek_parent (class);
epv->upgradeFromVersion = impl_upgradeFromVersion;
- epv->createControls = impl_createControls;
+ epv->createView = impl_createView;
epv->_get_userCreatableItems = impl__get_userCreatableItems;
epv->requestCreateItem = impl_requestCreateItem;
Index: calendar/gui/tasks-component.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/tasks-component.c,v
retrieving revision 1.80
diff -u -p -r1.80 tasks-component.c
--- calendar/gui/tasks-component.c 28 Oct 2004 09:26:13 -0000 1.80
+++ calendar/gui/tasks-component.c 24 Nov 2004 07:54:03 -0000
@@ -33,6 +33,7 @@
#include <libecal/e-cal.h>
#include <libedataserverui/e-source-selector.h>
#include <shell/e-user-creatable-items-handler.h>
+#include <shell/e-component-view.h>
#include "e-cal-model.h"
#include "e-tasks.h"
#include "tasks-component.h"
@@ -989,16 +990,15 @@ view_destroyed_cb (gpointer data, GObjec
}
}
-static void
-impl_createControls (PortableServer_Servant servant,
- Bonobo_Control *corba_sidebar_control,
- Bonobo_Control *corba_view_control,
- Bonobo_Control *corba_statusbar_control,
- CORBA_Environment *ev)
+static GNOME_Evolution_ComponentView
+impl_createView (PortableServer_Servant servant,
+ GNOME_Evolution_ShellView parent,
+ CORBA_Environment *ev)
{
TasksComponent *component = TASKS_COMPONENT (bonobo_object_from_servant (servant));
TasksComponentPrivate *priv;
TasksComponentView *component_view;
+ EComponentView *ecv;
priv = component->priv;
@@ -1008,16 +1008,17 @@ impl_createControls (PortableServer_Serv
/* FIXME Should we describe the problem in a control? */
bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed);
- return;
+ return CORBA_OBJECT_NIL;
}
g_object_weak_ref (G_OBJECT (component_view->view_control), view_destroyed_cb, component);
priv->views = g_list_append (priv->views, component_view);
-
- /* Return the controls */
- *corba_sidebar_control = CORBA_Object_duplicate (BONOBO_OBJREF (component_view->sidebar_control), ev);
- *corba_view_control = CORBA_Object_duplicate (BONOBO_OBJREF (component_view->view_control), ev);
- *corba_statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (component_view->statusbar_control), ev);
+
+ /* TODO: Make TasksComponentView just subclass EComponentView */
+ ecv = e_component_view_new_controls (parent, "tasks", component_view->sidebar_control,
+ component_view->view_control, component_view->statusbar_control);
+
+ return BONOBO_OBJREF(ecv);
}
static GNOME_Evolution_CreatableItemTypeList *
@@ -1151,7 +1152,7 @@ tasks_component_class_init (TasksCompone
parent_class = g_type_class_peek_parent (klass);
epv->upgradeFromVersion = impl_upgradeFromVersion;
- epv->createControls = impl_createControls;
+ epv->createView = impl_createView;
epv->_get_userCreatableItems = impl__get_userCreatableItems;
epv->requestCreateItem = impl_requestCreateItem;
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3498
diff -u -p -r1.3498 ChangeLog
--- mail/ChangeLog 22 Nov 2004 20:37:05 -0000 1.3498
+++ mail/ChangeLog 24 Nov 2004 07:54:08 -0000
@@ -975,6 +975,19 @@
full_name so update the argument to make that clear.
(emft_create_folder): Same and also don't strip a leading '/'
+2004-06-28 Not Zed <NotZed Ximian com>
+
+ * mail-component.c (impl_createView, view_changed_cb): api updates.
+
+2004-06-25 Not Zed <NotZed Ximian com>
+
+ ** See bug #60354.
+
+ * mail-component.c (view_changed_cb): set the shell window title
+ as well.
+ (impl_createView): renamed from createControls, just return a
+ EComponentView instead.
+
2004-06-25 Not Zed <NotZed Ximian com>
* em-folder-tree.c (folder_tree_new): set search column. #60152.
Index: mail/mail-component.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-component.c,v
retrieving revision 1.101
diff -u -p -r1.101 mail-component.c
--- mail/mail-component.c 12 Nov 2004 05:54:07 -0000 1.101
+++ mail/mail-component.c 24 Nov 2004 07:54:09 -0000
@@ -65,6 +65,7 @@
#include "e-activity-handler.h"
#include "shell/e-user-creatable-items-handler.h"
+#include "shell/e-component-view.h"
#include "composer/e-msg-composer.h"
@@ -478,10 +479,15 @@ view_on_url (GObject *emitter, const cha
}
static void
-view_changed_cb(EMFolderView *emfv, EInfoLabel *el)
+view_changed_cb(EMFolderView *emfv, EComponentView *component_view)
{
+ EInfoLabel *el = g_object_get_data((GObject *)component_view, "info-label");
+ CORBA_Environment ev;
+
+ CORBA_exception_init(&ev);
+
if (emfv->folder) {
- char *name;
+ char *name, *title;
guint32 visible, unread, deleted, junked;
GString *tmp = g_string_new("");
@@ -538,27 +544,31 @@ view_changed_cb(EMFolderView *emfv, EInf
}
e_info_label_set_info(el, name, tmp->str);
+
+ title = g_strdup_printf("%s, %s", name, tmp->str);
+ e_component_view_set_title(component_view, title);
+ g_free(title);
+
g_string_free(tmp, TRUE);
camel_object_free(emfv->folder, CAMEL_FOLDER_NAME, name);
} else {
e_info_label_set_info(el, _("Mail"), "");
+ e_component_view_set_title(component_view, _("Mail"));
}
+
+ CORBA_exception_free(&ev);
}
/* Evolution::Component CORBA methods. */
-static void
-impl_createControls (PortableServer_Servant servant,
- Bonobo_Control *corba_tree_control,
- Bonobo_Control *corba_view_control,
- Bonobo_Control *corba_statusbar_control,
- CORBA_Environment *ev)
+static GNOME_Evolution_ComponentView
+impl_createView (PortableServer_Servant servant,
+ GNOME_Evolution_ShellView parent,
+ CORBA_Environment *ev)
{
MailComponent *mail_component = MAIL_COMPONENT (bonobo_object_from_servant (servant));
MailComponentPrivate *priv = mail_component->priv;
- BonoboControl *tree_control;
- BonoboControl *view_control;
- BonoboControl *statusbar_control;
+ EComponentView *component_view;
GtkWidget *tree_widget, *vbox, *info;
GtkWidget *view_widget;
GtkWidget *statusbar_widget;
@@ -599,23 +609,21 @@ impl_createControls (PortableServer_Serv
gtk_widget_show(info);
gtk_widget_show(vbox);
- tree_control = bonobo_control_new (vbox);
- view_control = bonobo_control_new (view_widget);
- statusbar_control = bonobo_control_new (statusbar_widget);
-
- *corba_tree_control = CORBA_Object_duplicate (BONOBO_OBJREF (tree_control), ev);
- *corba_view_control = CORBA_Object_duplicate (BONOBO_OBJREF (view_control), ev);
- *corba_statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (statusbar_control), ev);
+ component_view = e_component_view_new(parent, "mail", vbox, view_widget, statusbar_widget);
+
+ g_object_set_data((GObject *)component_view, "info-label", info);
g_object_set_data_full((GObject *)view_widget, "e-creatable-items-handler",
e_user_creatable_items_handler_new("mail", create_local_item_cb, tree_widget),
(GDestroyNotify)g_object_unref);
- g_signal_connect (view_control, "activate", G_CALLBACK (view_control_activate_cb), view_widget);
+ g_signal_connect (component_view->view_control, "activate", G_CALLBACK (view_control_activate_cb), view_widget);
g_signal_connect (tree_widget, "folder-selected", G_CALLBACK (folder_selected_cb), view_widget);
- g_signal_connect(view_widget, "changed", G_CALLBACK(view_changed_cb), info);
- g_signal_connect(view_widget, "loaded", G_CALLBACK(view_changed_cb), info);
+ g_signal_connect(view_widget, "changed", G_CALLBACK(view_changed_cb), component_view);
+ g_signal_connect(view_widget, "loaded", G_CALLBACK(view_changed_cb), component_view);
+
+ return BONOBO_OBJREF(component_view);
}
static CORBA_boolean
@@ -857,7 +865,7 @@ mail_component_class_init (MailComponent
object_class->dispose = impl_dispose;
object_class->finalize = impl_finalize;
- epv->createControls = impl_createControls;
+ epv->createView = impl_createView;
epv->requestQuit = impl_requestQuit;
epv->quit = impl_quit;
epv->_get_userCreatableItems = impl__get_userCreatableItems;
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1480
diff -u -p -r1.1480 ChangeLog
--- shell/ChangeLog 22 Nov 2004 20:52:04 -0000 1.1480
+++ shell/ChangeLog 24 Nov 2004 07:54:10 -0000
@@ -1,3 +1,45 @@
+2004-11-24 Not Zed <NotZed Ximian com>
+
+ * e-component-view.c (impl_ComponentView_setTitle): add a cv
+ set-title to round out the api.
+
+2004-06-28 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-06-25 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.
+
2004-11-22 Joan Sanfeliu <joan fibranet com>
* main.c: Evolution product name spelled with an uppercase E
Index: shell/Evolution-Component.idl
===================================================================
RCS file: /cvs/gnome/evolution/shell/Evolution-Component.idl,v
retrieving revision 1.15
diff -u -p -r1.15 Evolution-Component.idl
--- shell/Evolution-Component.idl 12 May 2004 03:33:51 -0000 1.15
+++ shell/Evolution-Component.idl 24 Nov 2004 07:54:10 -0000
@@ -30,6 +30,12 @@ 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 Component : Bonobo::Unknown {
exception Failed {};
exception UnknownType {};
@@ -48,11 +54,15 @@ module Evolution {
/*** Basic functionality. ***/
+ ComponentView createView(in ShellView parent)
+ raises (Failed);
+
+
/* Create the controls for embedding in the shell. */
- void createControls (out Bonobo::Control sidebar_control,
+ /*void createControls (out Bonobo::Control sidebar_control,
out Bonobo::Control view_control,
out Bonobo::Control statusbar_control)
- raises (Failed);
+ raises (Failed);*/
/* Check if the component can quit.
Do not perform any quit-related tasks however.
Index: shell/Evolution-Shell.idl
===================================================================
RCS file: /cvs/gnome/evolution/shell/Evolution-Shell.idl,v
retrieving revision 1.25
diff -u -p -r1.25 Evolution-Shell.idl
--- shell/Evolution-Shell.idl 11 Nov 2003 01:01:11 -0000 1.25
+++ shell/Evolution-Shell.idl 24 Nov 2004 07:54:10 -0000
@@ -12,6 +12,15 @@
module GNOME {
module Evolution {
+
+ interface ShellView : Bonobo::Unknown {
+ /* used by the component-view to manage the shell view title */
+ void setTitle(in string component, in string title);
+
+ /* changed viewed component in this window */
+ void setComponent(in string component);
+ };
+
interface Shell : Bonobo::Unknown {
exception Busy {};
exception ComponentNotFound {};
@@ -26,7 +35,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);
/**
Index: shell/Evolution.idl
===================================================================
RCS file: /cvs/gnome/evolution/shell/Evolution.idl,v
retrieving revision 1.22
diff -u -p -r1.22 Evolution.idl
--- shell/Evolution.idl 3 Dec 2003 17:59:27 -0000 1.22
+++ shell/Evolution.idl 24 Nov 2004 07:54:10 -0000
@@ -12,8 +12,8 @@
#include <Evolution-common.idl>
-#include <Evolution-Component.idl>
#include <Evolution-ConfigControl.idl>
#include <Evolution-Offline.idl>
#include <Evolution-Shell.idl>
+#include <Evolution-Component.idl>
#include <Evolution-Wizard.idl>
Index: shell/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/shell/Makefile.am,v
retrieving revision 1.201
diff -u -p -r1.201 Makefile.am
--- shell/Makefile.am 25 Oct 2004 04:46:18 -0000 1.201
+++ shell/Makefile.am 24 Nov 2004 07:54:10 -0000
@@ -79,6 +79,7 @@ eshellincludedir = $(privincludedir)/she
eshellinclude_HEADERS = \
Evolution.h \
+ e-component-view.h \
e-shell-corba-icon-utils.h \
e-shell-utils.h \
e-user-creatable-items-handler.h \
@@ -89,6 +90,7 @@ eshellinclude_HEADERS = \
libeshell_la_SOURCES = \
$(IDL_GENERATED) \
$(MARSHAL_GENERATED) \
+ e-component-view.c \
e-shell-corba-icon-utils.c \
e-shell-utils.c \
e-user-creatable-items-handler.c \
@@ -113,6 +115,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 \
@@ -128,8 +132,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 \
Index: shell/e-component-view.c
===================================================================
RCS file: shell/e-component-view.c
diff -N shell/e-component-view.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ shell/e-component-view.c 24 Nov 2004 07:54:10 -0000
@@ -0,0 +1,140 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+ * e-component-view.c
+ *
+ * Copyright (C) 2004 Novell Inc.
+ *
+ * Author(s): Michael Zucchi <notzed ximian com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Helper class for evolution components to setup a view
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+
+#include "e-component-view.h"
+
+#include "bonobo/bonobo-control.h"
+
+static BonoboObjectClass *parent_class = NULL;
+
+static void
+impl_ComponentView_getControls(PortableServer_Servant servant,
+ Bonobo_Control *side_control,
+ Bonobo_Control *view_control,
+ Bonobo_Control *statusbar_control,
+ CORBA_Environment *ev)
+{
+ EComponentView *ecv = (EComponentView *)bonobo_object_from_servant(servant);
+
+ *side_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->side_control), ev);
+ *view_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->view_control), ev);
+ *statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (ecv->statusbar_control), ev);
+}
+
+/* GObject methods. */
+
+static void
+impl_dispose (GObject *object)
+{
+ EComponentView *ecv = (EComponentView *)object;
+
+ ecv->side_control = NULL;
+ ecv->view_control = NULL;
+ ecv->statusbar_control = NULL;
+
+ ((GObjectClass *)parent_class)->dispose(object);
+}
+
+static void
+impl_finalise (GObject *object)
+{
+ EComponentView *ecv = (EComponentView *)object;
+
+ g_free(ecv->id);
+
+ ((GObjectClass *)parent_class)->finalize(object);
+}
+
+static void
+e_component_view_class_init (EComponentViewClass *klass)
+{
+ GObjectClass *object_class;
+ POA_GNOME_Evolution_ComponentView__epv *epv;
+
+ parent_class = g_type_class_ref(bonobo_object_get_type());
+
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->dispose = impl_dispose;
+ object_class->finalize = impl_finalise;
+
+ epv = & klass->epv;
+ epv->getControls = impl_ComponentView_getControls;
+}
+
+static void
+e_component_view_init (EComponentView *shell)
+{
+}
+
+EComponentView *e_component_view_new(GNOME_Evolution_ShellView parent, const char *id, struct _GtkWidget *side, struct _GtkWidget *view, struct _GtkWidget *statusbar)
+{
+ EComponentView *new = g_object_new (e_component_view_get_type (), NULL);
+ CORBA_Environment ev = { 0 };
+
+ new->id = g_strdup(id);
+ new->shell_view = CORBA_Object_duplicate(parent, &ev);
+ CORBA_exception_free(&ev);
+
+ /* FIXME: hook onto destroys */
+ new->side_control = bonobo_control_new(side);
+ new->view_control = bonobo_control_new(view);
+ new->statusbar_control = bonobo_control_new(statusbar);
+
+ return new;
+}
+
+EComponentView *e_component_view_new_controls(GNOME_Evolution_ShellView parent, const char *id, BonoboControl *side, BonoboControl *view, BonoboControl *statusbar)
+{
+ EComponentView *new = g_object_new (e_component_view_get_type (), NULL);
+ CORBA_Environment ev = { 0 };
+
+ new->id = g_strdup(id);
+ new->shell_view = CORBA_Object_duplicate(parent, &ev);
+ CORBA_exception_free(&ev);
+
+ /* FIXME: hook onto destroys */
+ new->side_control = side;
+ new->view_control = view;
+ new->statusbar_control = statusbar;
+
+ return new;
+}
+
+void
+e_component_view_set_title(EComponentView *ecv, const char *title)
+{
+ CORBA_Environment ev = { 0 };
+
+ /* save roundtrips, check title is the same */
+ GNOME_Evolution_ShellView_setTitle(ecv->shell_view, ecv->id, title, &ev);
+ CORBA_exception_free(&ev);
+}
+
+BONOBO_TYPE_FUNC_FULL (EComponentView, GNOME_Evolution_ComponentView, bonobo_object_get_type(), e_component_view)
Index: shell/e-component-view.h
===================================================================
RCS file: shell/e-component-view.h
diff -N shell/e-component-view.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ shell/e-component-view.h 24 Nov 2004 07:54:10 -0000
@@ -0,0 +1,77 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+ * e-component-view.h
+ *
+ * Copyright (C) 2004 Novell Inc.
+ *
+ * Author(s): Michael Zucchi <notzed ximian com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef _E_COMPONENT_VIEW_H_
+#define _E_COMPONENT_VIEW_H_
+
+#include <bonobo/bonobo-object.h>
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+struct _GtkWidget;
+
+typedef struct _EComponentView EComponentView;
+typedef struct _EComponentViewPrivate EComponentViewPrivate;
+typedef struct _EComponentViewClass EComponentViewClass;
+
+#include "Evolution.h"
+
+#define E_TYPE_COMPONENT_VIEW (e_component_view_get_type ())
+#define E_COMPONENT_VIEW(obj) (GTK_CHECK_CAST ((obj), E_TYPE_COMPONENT_VIEW, EComponentView))
+#define E_COMPONENT_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_COMPONENT_VIEW, EComponentViewClass))
+#define E_IS_COMPONENT_VIEW(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_COMPONENT_VIEW))
+#define E_IS_COMPONENT_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_COMPONENT_VIEW))
+
+struct _EComponentView {
+ BonoboObject parent;
+
+ EComponentViewPrivate *priv;
+
+ char *id;
+ GNOME_Evolution_ShellView shell_view;
+
+ struct _BonoboControl *side_control;
+ struct _BonoboControl *view_control;
+ struct _BonoboControl *statusbar_control;
+};
+
+struct _EComponentViewClass {
+ BonoboObjectClass parent_class;
+
+ POA_GNOME_Evolution_ComponentView__epv epv;
+};
+
+GType e_component_view_get_type(void);
+EComponentView *e_component_view_new(GNOME_Evolution_ShellView shell_view, const char *id, struct _GtkWidget *side, struct _GtkWidget *view, struct _GtkWidget *status);
+EComponentView *e_component_view_new_controls(GNOME_Evolution_ShellView parent, const char *id, struct _BonoboControl *side, struct _BonoboControl *view, struct _BonoboControl *statusbar);
+
+void e_component_view_set_title(EComponentView *ecv, const char *title);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _E_COMPONENT_VIEW_H_ */
Index: shell/e-shell-view.c
===================================================================
RCS file: shell/e-shell-view.c
diff -N shell/e-shell-view.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ shell/e-shell-view.c 24 Nov 2004 07:54:10 -0000
@@ -0,0 +1,108 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+ * e-shell-view.c
+ *
+ * Copyright (C) 2004 Novell Inc.
+ *
+ * Author(s): Michael Zucchi <notzed ximian com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Helper class for evolution shells to setup a view
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+
+#include <gtk/gtkwindow.h>
+
+#include "e-shell-view.h"
+#include "e-shell-window.h"
+
+static BonoboObjectClass *parent_class = NULL;
+
+struct _EShellViewPrivate {
+ int dummy;
+};
+
+static void
+impl_ShellView_setTitle(PortableServer_Servant _servant, const CORBA_char *id, const CORBA_char * title, CORBA_Environment * ev)
+{
+ EShellView *esw = (EShellView *)bonobo_object_from_servant(_servant);
+ char *tmp = g_strdup_printf("Evolution - %s", title);
+
+ printf("shell view:setTitle '%s'\n", title);
+
+ e_shell_window_set_title(esw->window, id, tmp);
+ g_free(tmp);
+}
+
+static void
+impl_ShellView_setComponent(PortableServer_Servant _servant, const CORBA_char *id, CORBA_Environment * ev)
+{
+ EShellView *esw = (EShellView *)bonobo_object_from_servant(_servant);
+
+ e_shell_window_switch_to_component(esw->window, id);
+}
+
+static void
+impl_dispose (GObject *object)
+{
+ /*EShellView *esv = (EShellView *)object;*/
+
+ ((GObjectClass *)parent_class)->dispose(object);
+}
+
+static void
+impl_finalise (GObject *object)
+{
+ ((GObjectClass *)parent_class)->finalize(object);
+}
+
+static void
+e_shell_view_class_init (EShellViewClass *klass)
+{
+ GObjectClass *object_class;
+ POA_GNOME_Evolution_ShellView__epv *epv;
+
+ parent_class = g_type_class_ref(bonobo_object_get_type());
+
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->dispose = impl_dispose;
+ object_class->finalize = impl_finalise;
+
+ epv = & klass->epv;
+ epv->setTitle = impl_ShellView_setTitle;
+ epv->setComponent = impl_ShellView_setComponent;
+}
+
+static void
+e_shell_view_init (EShellView *shell)
+{
+}
+
+EShellView *e_shell_view_new(struct _EShellWindow *window)
+{
+ EShellView *new = g_object_new (e_shell_view_get_type (), NULL);
+
+ /* TODO: listen to destroy? */
+ new->window = window;
+
+ return new;
+}
+
+BONOBO_TYPE_FUNC_FULL (EShellView, GNOME_Evolution_ShellView, bonobo_object_get_type(), e_shell_view)
Index: shell/e-shell-view.h
===================================================================
RCS file: shell/e-shell-view.h
diff -N shell/e-shell-view.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ shell/e-shell-view.h 24 Nov 2004 07:54:10 -0000
@@ -0,0 +1,69 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-shell-view.h
+ *
+ * Copyright (C) 2000 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
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * This is only a CORBA wrapper around e_shell_window.
+ */
+
+#ifndef _E_SHELL_VIEW_H_
+#define _E_SHELL_VIEW_H_
+
+#include <bonobo-activation/bonobo-activation.h>
+#include <bonobo/bonobo-object.h>
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+struct _EShell;
+
+typedef struct _EShellView EShellView;
+typedef struct _EShellViewPrivate EShellViewPrivate;
+typedef struct _EShellViewClass EShellViewClass;
+
+#include "Evolution.h"
+
+#define E_TYPE_SHELL_VIEW (e_shell_view_get_type ())
+#define E_SHELL_VIEW(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SHELL_VIEW, EShellView))
+#define E_SHELL_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SHELL_VIEW, EShellViewClass))
+#define E_IS_SHELL_VIEW(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SHELL_VIEW))
+#define E_IS_SHELL_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SHELL_VIEW))
+
+struct _EShellView {
+ BonoboObject parent;
+
+ struct _EShellWindow *window;
+
+ EShellViewPrivate *priv;
+};
+
+struct _EShellViewClass {
+ BonoboObjectClass parent_class;
+
+ POA_GNOME_Evolution_ShellView__epv epv;
+};
+
+GType e_shell_view_get_type (void);
+EShellView *e_shell_view_new(struct _EShellWindow *window);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _E_SHELL_VIEW_H_ */
Index: shell/e-shell-window.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window.c,v
retrieving revision 1.28
diff -u -p -r1.28 e-shell-window.c
--- shell/e-shell-window.c 25 Oct 2004 04:46:18 -0000 1.28
+++ shell/e-shell-window.c 24 Nov 2004 07:54:10 -0000
@@ -23,6 +23,7 @@
#include <config.h>
#include "e-shell-window.h"
+#include "e-shell-view.h"
#include "Evolution.h"
@@ -68,6 +69,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;
@@ -83,6 +87,8 @@ struct _EShellWindowPrivate {
/* plugin menu manager */
ESMenu *menu;
+ EShellView *shell_view; /* CORBA wrapper for this, just a placeholder */
+
/* All the ComponentViews. */
GSList *component_views;
@@ -149,6 +155,13 @@ component_view_new (const char *id, cons
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,30 @@ 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);
+ bonobo_object_release_unref (component_view, 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 +326,12 @@ switch_view (EShellWindow *window, Compo
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);
@@ -722,7 +750,6 @@ impl_finalize (GObject *object)
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
-
/* Initialization. */
static void
@@ -752,6 +779,7 @@ 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;
@@ -936,5 +964,30 @@ e_shell_window_show_settings (EShellWind
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);
+ }
+}
E_MAKE_TYPE (e_shell_window, "EShellWindow", EShellWindow, class_init, init, BONOBO_TYPE_WINDOW)
Index: shell/e-shell-window.h
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window.h,v
retrieving revision 1.8
diff -u -p -r1.8 e-shell-window.h
--- shell/e-shell-window.h 2 Dec 2003 02:17:23 -0000 1.8
+++ shell/e-shell-window.h 24 Nov 2004 07:54:10 -0000
@@ -65,6 +65,8 @@ const char *e_shell_window_peek_current_
EShell *e_shell_window_peek_shell (EShellWindow *window);
BonoboUIComponent *e_shell_window_peek_bonobo_ui_component (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);
Index: shell/e-shell.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell.c,v
retrieving revision 1.256
diff -u -p -r1.256 e-shell.c
--- shell/e-shell.c 25 Oct 2004 04:46:18 -0000 1.256
+++ shell/e-shell.c 24 Nov 2004 07:54:10 -0000
@@ -28,6 +28,7 @@
#include <dirent.h>
#include "e-shell.h"
+#include "e-shell-view.h"
#include "e-util/e-dialog-utils.h"
#include "e-util/e-bconf-map.h"
@@ -213,7 +214,7 @@ raise_exception_if_not_ready (PortableSe
return FALSE;
}
-static void
+static GNOME_Evolution_ShellView
impl_Shell_createNewWindow (PortableServer_Servant servant,
const CORBA_char *component_id,
CORBA_Environment *ev)
@@ -221,9 +222,10 @@ impl_Shell_createNewWindow (PortableServ
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);
@@ -235,8 +237,13 @@ impl_Shell_createNewWindow (PortableServ
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]