From 4ec9945f0595444a94b0816f0146bc797b3037b2 Mon Sep 17 00:00:00 2001 From: bertrand Date: Mon, 13 Mar 2000 00:10:21 +0000 Subject: added the get_e_folder_type function. 2000-03-12 bertrand * shell/e-folder.c (e_folder_get_folder_type): added the get_e_folder_type function. 2000-03-12 bertrand * folder-browser.h: added a reference to an Evolution::Shell object. * folder-browser-factory.c (folder_browser_set_shell): (folder_browser_control_add_service_repository_interface): (folder_browser_factory): the folder-browser control now implements the Evolution/ServiceRepository interface. Sync for matt svn path=/trunk/; revision=2108 --- ChangeLog | 3 +++ mail/ChangeLog | 10 +++++++++ mail/Makefile.am | 7 +++++- mail/folder-browser-factory.c | 52 +++++++++++++++++++++++++++++++++++++++++-- mail/folder-browser.c | 1 - mail/folder-browser.h | 7 ++++++ shell/e-folder.c | 13 +++++++++++ shell/e-folder.h | 2 ++ shell/e-shell-view.c | 37 ++++++++++++++++++++++-------- shell/e-shell.c | 1 + 10 files changed, 120 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 87c28dd3b6..fb55ab90cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2000-03-12 bertrand + * shell/e-folder.c (e_folder_get_folder_type): added the + get_e_folder_type function. + * shell/evolution-service-repository.c: (evolution_service_repository_new): creates an Evolution_ServiceRepository object. diff --git a/mail/ChangeLog b/mail/ChangeLog index 053f1b1d24..afff7a2efd 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,13 @@ +2000-03-12 bertrand + + * folder-browser.h: added a reference to an + Evolution::Shell object. + + * folder-browser-factory.c (folder_browser_set_shell): + (folder_browser_control_add_service_repository_interface): + (folder_browser_factory): the folder-browser control now + implements the Evolution/ServiceRepository interface. + 2000-03-07 bertrand * folder-browser-factory.c (development_warning): diff --git a/mail/Makefile.am b/mail/Makefile.am index 7fd2e98c7d..a7421d27e8 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -36,9 +36,14 @@ evolution_mail_SOURCES = \ message-list.c \ message-list.h \ session.c \ - session.h + session.h + evolution_mail_LDADD = \ + ../shell/Evolution-common.o \ + ../shell/Evolution-stubs.o \ + ../shell/Evolution-skels.o \ + ../shell/evolution-service-repository.o \ ../widgets/e-table/libetable.a \ ../widgets/e-text/libetext.a \ ../camel/libcamel.la \ diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index 638ebdcaaf..213e1408ad 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -17,6 +17,8 @@ #include "e-util/e-gui-utils.h" #include "folder-browser.h" #include "main.h" +#include "shell/Evolution.h" +#include "shell/evolution-service-repository.h" static const gchar *warning_dialog_buttons[] = { @@ -24,7 +26,44 @@ static const gchar *warning_dialog_buttons[] = { "OK", NULL }; - + +static void +folder_browser_set_shell (EvolutionServiceRepository *sr, + Evolution_Shell shell, + void *closure) +{ + FolderBrowser *folder_browser; + + g_return_if_fail (closure); + g_return_if_fail (IS_FOLDER_BROWSER (closure)); + g_return_if_fail (shell != CORBA_OBJECT_NIL); + + folder_browser = FOLDER_BROWSER (closure); + + /* FIXME : ref the shell here */ + folder_browser->shell = shell; + +} + +static void +folder_browser_control_add_service_repository_interface (BonoboControl *control, + GtkWidget *folder_browser) +{ + EvolutionServiceRepository *sr; + + /* + * create an implementation for the Evolution::ServiceRepository + * interface + */ + sr = evolution_service_repository_new (folder_browser_set_shell, + (void *)folder_browser); + + /* add the interface to the control */ + bonobo_object_add_interface (BONOBO_OBJECT (control), + BONOBO_OBJECT (sr)); +} + + static int development_warning () { @@ -92,7 +131,16 @@ folder_browser_factory (BonoboGenericFactory *factory, void *closure) bonobo_control_set_property_bag ( control, FOLDER_BROWSER (folder_browser)->properties); - + + /* for the moment, the control has the ability to register + * some services itself, but this should not last. + * + * It's not the way to do it, but we don't have the + * correct infrastructure in the shell now. + */ + folder_browser_control_add_service_repository_interface (control, folder_browser); + + return BONOBO_OBJECT (control); } diff --git a/mail/folder-browser.c b/mail/folder-browser.c index b305616bf8..130011732b 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -26,7 +26,6 @@ static GtkObjectClass *folder_browser_parent_class; - static void folder_browser_destroy (GtkObject *object) { diff --git a/mail/folder-browser.h b/mail/folder-browser.h index 7692b1a20a..04c3dbcb4a 100644 --- a/mail/folder-browser.h +++ b/mail/folder-browser.h @@ -1,3 +1,6 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + + #ifndef _FOLDER_BROWSER_H_ #define _FOLDER_BROWSER_H_ @@ -7,6 +10,8 @@ #include #include "message-list.h" #include "mail-display.h" +#include "shell/Evolution.h" + #define FOLDER_BROWSER_TYPE (folder_browser_get_type ()) #define FOLDER_BROWSER(o) (GTK_CHECK_CAST ((o), FOLDER_BROWSER_TYPE, FolderBrowser)) @@ -20,6 +25,8 @@ struct _FolderBrowser { BonoboPropertyBag *properties; + Evolution_Shell shell; + /* * The current URI being displayed by the FolderBrowser */ diff --git a/shell/e-folder.c b/shell/e-folder.c index 62e27cdfad..ba6e10b22e 100644 --- a/shell/e-folder.c +++ b/shell/e-folder.c @@ -165,6 +165,19 @@ e_folder_get_type_name (EFolder *efolder) return NULL; } + +EFolderType +e_folder_get_folder_type (EFolder *efolder) +{ + g_return_val_if_fail (efolder != NULL, E_FOLDER_OTHER); + g_return_val_if_fail (E_IS_FOLDER (efolder), E_FOLDER_OTHER); + + return (efolder->type); +} + + + + void e_folder_construct (EFolder *efolder, EFolderType type, const char *uri, const char *name, diff --git a/shell/e-folder.h b/shell/e-folder.h index 37b0f63862..f631191013 100644 --- a/shell/e-folder.h +++ b/shell/e-folder.h @@ -87,5 +87,7 @@ void e_folder_set_view_name (EFolder *efolder, const char *view_name); const char *e_folder_get_type_name (EFolder *efolder); +EFolderType e_folder_get_folder_type (EFolder *efolder); + #endif /* _E_FOLDER_H_ */ diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index ea5f30897a..10ce194af5 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -73,18 +73,37 @@ e_shell_view_setup_shortcut_display (EShellView *eshell_view) static GtkWidget * get_view (EFolder *efolder) { - GtkWidget *w; - /*char buffer [80]; + GtkWidget *w = NULL; + BonoboControl control; + EFolderType e_folder_type; - sprintf (buffer, "I am the view for %s\n", - e_folder_get_description (efolder)); - w = gtk_label_new (buffer); + + + printf ("I am the view for %s\n", + e_folder_get_description (efolder)); + + - */ - w = bonobo_widget_new_control ("GOADID:Evolution:FolderBrowser:1.0", - NULL); - gtk_widget_show (w); + /* get the folder type */ + e_folder_type = e_folder_get_folder_type (efolder); + + + /* depending on the type of folder, + * we launch a different bonobo component */ + switch (e_folder_type) { + + case E_FOLDER_MAIL : + w = bonobo_widget_new_control ("GOADID:Evolution:FolderBrowser:1.0", + NULL); + break; + + default : + printf ("No bonobo component associated to %s\n", + e_folder_get_description (efolder)); + } + + if (w) gtk_widget_show (w); return w; diff --git a/shell/e-shell.c b/shell/e-shell.c index e78a30e876..ec383746f0 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -9,6 +9,7 @@ * (C) 1999 Miguel de Icaza * (C) 2000 Helix Code, Inc. */ + #include #include #include -- cgit v1.2.3