diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2008-08-09 20:05:51 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2008-08-09 20:05:51 +0800 |
commit | ed9c8cc740baed6a67c9a8e5953bb062862c845b (patch) | |
tree | 854acca168db2681a6b35e976a2e7b5b8e39ffb0 | |
parent | 2351455697b4b31d41e9d2fa6fe86e3c1cb864fb (diff) | |
download | gsoc2013-evolution-ed9c8cc740baed6a67c9a8e5953bb062862c845b.tar gsoc2013-evolution-ed9c8cc740baed6a67c9a8e5953bb062862c845b.tar.gz gsoc2013-evolution-ed9c8cc740baed6a67c9a8e5953bb062862c845b.tar.bz2 gsoc2013-evolution-ed9c8cc740baed6a67c9a8e5953bb062862c845b.tar.lz gsoc2013-evolution-ed9c8cc740baed6a67c9a8e5953bb062862c845b.tar.xz gsoc2013-evolution-ed9c8cc740baed6a67c9a8e5953bb062862c845b.tar.zst gsoc2013-evolution-ed9c8cc740baed6a67c9a8e5953bb062862c845b.zip |
Treat the Preferences window as a singleton.
Kill a bunch of Bonobo crud, which breaks compilation again.
svn path=/branches/kill-bonobo/; revision=35947
-rw-r--r-- | shell/Evolution-Component.idl | 136 | ||||
-rw-r--r-- | shell/Evolution-ConfigControl.idl | 26 | ||||
-rw-r--r-- | shell/Evolution-Shell.idl | 87 | ||||
-rw-r--r-- | shell/Evolution.idl | 20 | ||||
-rw-r--r-- | shell/Makefile.am | 43 | ||||
-rw-r--r-- | shell/e-component-registry.c | 329 | ||||
-rw-r--r-- | shell/e-component-registry.h | 105 | ||||
-rw-r--r-- | shell/e-shell-window-actions.c | 7 | ||||
-rw-r--r-- | shell/e-shell-window.c | 1 | ||||
-rw-r--r-- | shell/e-shell.c | 20 | ||||
-rw-r--r-- | shell/e-shell.h | 2 | ||||
-rw-r--r-- | shell/evolution-listener.c | 69 | ||||
-rw-r--r-- | shell/evolution-listener.h | 52 |
13 files changed, 15 insertions, 882 deletions
diff --git a/shell/Evolution-Component.idl b/shell/Evolution-Component.idl deleted file mode 100644 index 8f52fa95ba..0000000000 --- a/shell/Evolution-Component.idl +++ /dev/null @@ -1,136 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Interface for the Evolution components. - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * - * Copyright (C) 2003 Ximian, Inc. - */ - -#ifndef _GNOME_EVOLUTION_COMPONENT_IDL -#define _GNOME_EVOLUTION_COMPONENT_IDL - -#include <Bonobo.idl> - -#ifndef __evolution_shell_COMPILATION -#ifdef __ORBIT_IDL__ -%{ -#pragma include_defs shell/evolution-component.h -%} -#pragma inhibit push -#endif -#endif - -module GNOME { -module Evolution { - enum CreatableItem { - CREATABLE_OBJECT, - CREATABLE_FOLDER - }; - enum ShellState { - USER_OFFLINE, - FORCED_OFFLINE, - USER_ONLINE - }; - - /* 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 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); - - - /* 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 ShellState shell_state, in Listener listener); - }; - -}; -}; - -#ifndef __evolution_shell_COMPILATION -#ifdef __ORBIT_IDL__ -#pragma inhibit pop -#endif -#endif -#endif /* _GNOME_EVOLUTION_COMPONENT_IDL */ diff --git a/shell/Evolution-ConfigControl.idl b/shell/Evolution-ConfigControl.idl deleted file mode 100644 index 901932d209..0000000000 --- a/shell/Evolution-ConfigControl.idl +++ /dev/null @@ -1,26 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Additional interfaces for the Controls used in configuration dialogs. - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * - * Copyright (C) 2002 Ximian, Inc. - */ - -#ifndef _GNOME_EVOLUTION_CONFIGCONTROL_IDL -#define _GNOME_EVOLUTION_CONFIGCONTROL_IDL - -module GNOME { -module Evolution { - interface ConfigControl : Bonobo::Unknown { - /* The actual Control. */ - readonly attribute Bonobo::Control control; - - /* Get the event source for this control. */ - readonly attribute Bonobo::EventSource eventSource; - }; -}; /* module Evolution */ -}; /* module GNOME */ - -#endif diff --git a/shell/Evolution-Shell.idl b/shell/Evolution-Shell.idl deleted file mode 100644 index d39ec8edeb..0000000000 --- a/shell/Evolution-Shell.idl +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Interface for the Evolution shell. - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * - * Copyright (C) 2000, 2001 Ximian, Inc. - */ - -#ifndef _GNOME_EVOLUTION_SHELL_IDL -#define _GNOME_EVOLUTION_SHELL_IDL - -#include <Bonobo.idl> - -#ifndef __evolution_shell_COMPILATION -#ifdef __ORBIT_IDL__ -%{ -#pragma include_defs shell/evolution-component.h -%} -#pragma inhibit push -#endif -#endif - -module GNOME { -module Evolution { - - - interface ShellView : Bonobo::Unknown { - /* Should really use a ComponentView i guess */ - void setTitle(in string component, in string title); - void setComponent(in string component); - void setButtonIcon(in string component, in string iconName); - }; - - interface Shell : Bonobo::Unknown { - exception Busy {}; - exception ComponentNotFound {}; - exception InternalError {}; - exception InvalidURI {}; - exception NotFound {}; - exception NotReady {}; - exception UnsupportedSchema {}; - - /** - * createNewWindow: - * @component_id: id or alias of the component to display in the new window. - * - */ - ShellView createNewWindow (in string component_id) - raises (NotReady, ComponentNotFound, UnsupportedSchema, InternalError); - - /** - * handleURI: - * @uri: URI to handle - * - * This handles the specified URI. It is different from - * `::createNewView' as it doesn't necessarily imply creating a - * new ShellView. (For example, a `mailto:' URI will invoke - * the message composer.) - */ - void handleURI (in string uri) - raises (NotReady, ComponentNotFound, NotFound, UnsupportedSchema, InvalidURI, InternalError); - - /** - * setLineStatus: - * - * Set the shell into on-line or off-line mode. - */ - void setLineStatus (in boolean online) - raises (NotReady); - - /* - * Lookup a component by id. - */ - /*Component findComponent(in string id) - raises (NotReady, ComponentNotFound);*/ - }; -}; -}; - -#ifndef __evolution_shell_COMPILATION -#ifdef __ORBIT_IDL__ -#pragma inhibit pop -#endif -#endif -#endif /* _GNOME_EVOLUTION_SHELL_IDL */ diff --git a/shell/Evolution.idl b/shell/Evolution.idl deleted file mode 100644 index 059d017444..0000000000 --- a/shell/Evolution.idl +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * CORBA interface for the Evolution shell. - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * - * Copyright (C) 2000, 2001 Ximian, Inc. - */ - -#ifndef _GNOME_EVOLUTION_IDL -#define _GNOME_EVOLUTION_IDL - -#include <Bonobo.idl> - -#include <Evolution-ConfigControl.idl> -#include <Evolution-Shell.idl> -#include <Evolution-Component.idl> - -#endif diff --git a/shell/Makefile.am b/shell/Makefile.am index 6b4d225164..1999a68a93 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -26,32 +26,6 @@ INCLUDES = \ noinst_PROGRAMS = evolution -# Shell CORBA stuff - -IDLS = \ - Evolution-ConfigControl.idl \ - Evolution-Component.idl \ - Evolution-Shell.idl \ - Evolution.idl - -IDL_GENERATED_H = \ - Evolution.h - -IDL_GENERATED_C = \ - Evolution-common.c \ - Evolution-skels.c \ - Evolution-stubs.c - -idl_defines = \ - -D__evolution_shell_COMPILATION - -IDL_GENERATED = $(IDL_GENERATED_H) $(IDL_GENERATED_C) - -$(IDL_GENERATED_H): $(IDLS) - $(ORBIT_IDL) -I $(srcdir) $(idl_defines) $(IDL_INCLUDES) $(srcdir)/Evolution.idl - -$(IDL_GENERATED_C): $(IDL_GENERATED_H) - if NM_SUPPORT_GLIB NM_SUPPORT_FILES = e-shell-nm-glib.c else @@ -77,10 +51,6 @@ $(DATASERVER_IDL_GENERATED_H): $(DATASERVER_IDL) $(DATASERVER_IDL_GENERATED_C): $(DATASERVER_IDL_GENERATED_H) -# IDL install - -idl_DATA = $(IDLS) - # Shell library privsolib_LTLIBRARIES = \ @@ -97,7 +67,6 @@ eshellinclude_HEADERS = \ e-shell-window-actions.h \ e-user-creatable-items-handler.h \ evolution-config-control.h \ - evolution-listener.h \ evolution-shell-component-utils.h \ es-event.h \ es-menu.h @@ -109,7 +78,6 @@ libeshell_la_SOURCES = \ e-shell-view.c \ e-shell-window.c \ e-shell-window-actions.c \ - evolution-listener.c \ e-user-creatable-items-handler.c \ evolution-config-control.c \ evolution-shell-component-utils.c \ @@ -127,8 +95,6 @@ libeshell_la_LIBADD = \ evolution_SOURCES = \ $(DATASERVER_IDL_GENERATED) \ $(NM_SUPPORT_FILES) \ - e-component-registry.c \ - e-component-registry.h \ e-config-upgrade.c \ e-config-upgrade.h \ e-shell.c \ @@ -156,11 +122,6 @@ evolution_LDADD = \ # Misc stuff -server_in_files = GNOME_Evolution_Shell.server.in.in -server_DATA = $(server_in_files:.server.in.in=.server) -@EVO_SERVER_RULE@ -@INTLTOOL_SERVER_RULE@ - error_DATA = shell.error errordir = $(privdatadir)/errors @EVO_PLUGIN_RULE@ @@ -228,8 +189,6 @@ MARSHAL_GENERATED = e-shell-marshal.c e-shell-marshal.h # Extra dist stuff EXTRA_DIST = \ - $(IDLS) \ - $(server_in_files) \ shell.error.xml \ $(glade_DATA) \ $(schema_in_files) \ @@ -251,7 +210,7 @@ evolution.pure: evolution endif -BUILT_SOURCES = $(IDL_GENERATED) $(MARSHAL_GENERATED) $(server_DATA) $(DATASERVER_IDL_GENERATED) $(error_DATA) +BUILT_SOURCES = $(MARSHAL_GENERATED) $(server_DATA) $(DATASERVER_IDL_GENERATED) $(error_DATA) CLEANFILES = $(BUILT_SOURCES) DISTCLEANFILES = $(schema_DATA) diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c deleted file mode 100644 index 146ceb26a6..0000000000 --- a/shell/e-component-registry.c +++ /dev/null @@ -1,329 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-component-registry.c - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-component-registry.h" - -#include <e-util/e-icon-factory.h> - -#include <glib/gi18n.h> - -#include <bonobo/bonobo-object.h> -#include <bonobo/bonobo-exception.h> - -#include <string.h> -#include <stdlib.h> - -struct _EComponentRegistryPrivate { - GSList *infos; - - guint init:1; -}; - -G_DEFINE_TYPE (EComponentRegistry, e_component_registry, G_TYPE_OBJECT) - -/* EComponentInfo handling. */ - -static EComponentInfo * -component_info_new (const char *id, - GNOME_Evolution_Component iface, - const char *alias, - const char *button_label, - const char *button_tooltips, - const char *menu_label, - const char *menu_accelerator, - const char *icon_name, - int sort_order) -{ - EComponentInfo *info = g_new0 (EComponentInfo, 1); - - info->id = g_strdup (id); - info->iface = bonobo_object_dup_ref(iface, NULL); - info->alias = g_strdup (alias); - info->button_label = g_strdup (button_label); - info->button_tooltips = g_strdup (button_tooltips); - info->menu_label = g_strdup (menu_label); - info->menu_accelerator = g_strdup (menu_accelerator); - info->icon_name = g_strdup (icon_name); - info->sort_order = sort_order; - - return info; -} - -static void -component_info_free (EComponentInfo *info) -{ - g_free (info->id); - g_free (info->alias); - g_free (info->button_label); - g_free (info->button_tooltips); - g_free (info->menu_label); - g_free (info->menu_accelerator); - - if (info->iface != NULL) - bonobo_object_release_unref (info->iface, NULL); - - g_slist_foreach (info->uri_schemas, (GFunc) g_free, NULL); - g_slist_free (info->uri_schemas); - - g_free (info); -} - -static int -component_info_compare_func (EComponentInfo *a, - EComponentInfo *b) -{ - if (a->sort_order != b->sort_order) - return a->sort_order - b->sort_order; - - return strcmp (a->button_label, b->button_label); -} - - -/* Utility methods. */ - -static void -set_schemas (EComponentInfo *component_info, - Bonobo_ServerInfo *server_info) -{ - Bonobo_ActivationProperty *property = bonobo_server_info_prop_find (server_info, "evolution:uri_schemas"); - Bonobo_StringList *list; - int i; - - if (property == NULL) - return; - - if (property->v._d != Bonobo_ACTIVATION_P_STRINGV) { - CORBA_free (property); - return; - } - - list = & property->v._u.value_stringv; - - for (i = 0; i < list->_length; i ++) - component_info->uri_schemas = g_slist_prepend (component_info->uri_schemas, g_strdup (list->_buffer [i])); - - CORBA_free (property); -} - -static void -query_components (EComponentRegistry *registry) -{ - Bonobo_ServerInfoList *info_list; - const gchar * const *language_names; - CORBA_Environment ev; - GSList *languages = NULL; - char *query; - int i; - - if (registry->priv->init) - return; - - registry->priv->init = TRUE; - - CORBA_exception_init (&ev); - query = g_strdup_printf ("repo_ids.has ('IDL:GNOME/Evolution/Component:%s')", BASE_VERSION); - info_list = bonobo_activation_query (query, NULL, &ev); - g_free (query); - - if (BONOBO_EX (&ev)) { - char *ex_text = bonobo_exception_get_text (&ev); - g_warning ("Cannot query for components: %s\n", ex_text); - g_free (ex_text); - CORBA_exception_free (&ev); - return; - } - - language_names = g_get_language_names (); - while (*language_names != NULL) - languages = g_slist_append (languages, (gpointer)(*language_names++)); - - for (i = 0; i < info_list->_length; i++) { - const char *id; - const char *label; - const char *menu_label; - const char *menu_accelerator; - const char *alias; - const char *icon_name; - const char *sort_order_string; - const char *tooltips; - EComponentInfo *info; - int sort_order; - GNOME_Evolution_Component iface; - - id = info_list->_buffer[i].iid; - iface = bonobo_activation_activate_from_id ((char *)id, 0, NULL, &ev); - if (BONOBO_EX (&ev) || iface == CORBA_OBJECT_NIL) { - char *ex_text = bonobo_exception_get_text (&ev); - - g_warning("Cannot activate '%s': %s\n", id, ex_text); - g_free(ex_text); - CORBA_exception_free(&ev); - CORBA_exception_init(&ev); - continue; - } - - label = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:button_label", languages); - - tooltips = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:button_tooltips", languages); - - menu_label = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:menu_label", languages); - - menu_accelerator = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:menu_accelerator", languages); - - alias = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:component_alias", NULL); - - icon_name = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:button_icon", NULL); - - sort_order_string = bonobo_server_info_prop_lookup (& info_list->_buffer[i], - "evolution:button_sort_order", NULL); - if (sort_order_string == NULL) - sort_order = 0; - else - sort_order = atoi (sort_order_string); - - info = component_info_new (id, iface, alias, label, tooltips, menu_label, - menu_accelerator, icon_name, sort_order); - set_schemas (info, & info_list->_buffer [i]); - - registry->priv->infos = g_slist_prepend (registry->priv->infos, info); - - bonobo_object_release_unref(iface, NULL); - } - g_slist_free(languages); - - CORBA_free (info_list); - CORBA_exception_free (&ev); - - registry->priv->infos = g_slist_sort (registry->priv->infos, - (GCompareFunc) component_info_compare_func); -} - - -/* GObject methods. */ - -static void -impl_finalize (GObject *object) -{ - EComponentRegistry *component_registry; - EComponentRegistryPrivate *priv; - - component_registry = E_COMPONENT_REGISTRY (object); - priv = component_registry->priv; - - g_slist_foreach (priv->infos, (GFunc) component_info_free, NULL); - g_free (priv); - - (* G_OBJECT_CLASS (e_component_registry_parent_class)->finalize) (object); -} - - -static void -e_component_registry_class_init (EComponentRegistryClass *klass) -{ - GObjectClass *object_class; - - object_class = G_OBJECT_CLASS (klass); - object_class->finalize = impl_finalize; -} - - -static void -e_component_registry_init (EComponentRegistry *registry) -{ - registry->priv = g_new0 (EComponentRegistryPrivate, 1); -} - - -EComponentRegistry * -e_component_registry_new (void) -{ - return g_object_new (e_component_registry_get_type (), NULL); -} - - -GSList * -e_component_registry_peek_list (EComponentRegistry *registry) -{ - g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (registry), NULL); - - query_components(registry); - - return registry->priv->infos; -} - - -EComponentInfo * -e_component_registry_peek_info (EComponentRegistry *registry, - enum _EComponentRegistryField field, - const char *key) -{ - GSList *p, *q; - - g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (registry), NULL); - - query_components(registry); - - for (p = registry->priv->infos; p != NULL; p = p->next) { - EComponentInfo *info = p->data; - - switch (field) { - case ECR_FIELD_ID: - if (info->id && (strcmp (info->id, key) == 0)) - return info; - break; - case ECR_FIELD_ALIAS: - if (info->alias && (strcmp (info->alias, key) == 0)) - return info; - break; - case ECR_FIELD_SCHEMA: - for (q = info->uri_schemas; q != NULL; q = q->next) - if (strcmp((char *)q->data, key) == 0) - return info; - break; - } - } - - return NULL; -} - -GNOME_Evolution_Component -e_component_registry_activate (EComponentRegistry *registry, - const char *id, - CORBA_Environment *ev) -{ - EComponentInfo *info; - - g_return_val_if_fail (E_IS_COMPONENT_REGISTRY (registry), CORBA_OBJECT_NIL); - - info = e_component_registry_peek_info (registry, ECR_FIELD_ID, id); - if (info == NULL) { - g_warning ("%s - Unknown id \"%s\"", G_STRFUNC, id); - return CORBA_OBJECT_NIL; - } - - /* it isn't in the registry unless it is already activated */ - return bonobo_object_dup_ref (info->iface, NULL); -} diff --git a/shell/e-component-registry.h b/shell/e-component-registry.h deleted file mode 100644 index 1d5943537c..0000000000 --- a/shell/e-component-registry.h +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-component-registry.h - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef __E_COMPONENT_REGISTRY_H__ -#define __E_COMPONENT_REGISTRY_H__ - - -#include "Evolution.h" - -#include <glib-object.h> -#include <gdk-pixbuf/gdk-pixbuf.h> - - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - - -#define E_TYPE_COMPONENT_REGISTRY (e_component_registry_get_type ()) -#define E_COMPONENT_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_COMPONENT_REGISTRY, EComponentRegistry)) -#define E_COMPONENT_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_COMPONENT_REGISTRY, EComponentRegistryClass)) -#define E_IS_COMPONENT_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_COMPONENT_REGISTRY)) -#define E_IS_COMPONENT_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_COMPONENT_REGISTRY)) - - -typedef struct _EComponentRegistry EComponentRegistry; -typedef struct _EComponentRegistryPrivate EComponentRegistryPrivate; -typedef struct _EComponentRegistryClass EComponentRegistryClass; - -struct _EComponentRegistry { - GObject parent; - - EComponentRegistryPrivate *priv; -}; - -struct _EComponentRegistryClass { - GObjectClass parent_class; -}; - -enum _EComponentRegistryField { - ECR_FIELD_ID, - ECR_FIELD_ALIAS, - ECR_FIELD_SCHEMA, -}; - -struct _EComponentInfo { - char *id; - - char *alias; - - /* NULL if not activated. */ - GNOME_Evolution_Component iface; - - char *button_label; - char *button_tooltips; - char *menu_label; - char *menu_accelerator; - char *icon_name; - - int sort_order; - - /* List of URI schemas that this component supports. */ - GSList *uri_schemas; /* <char *> */ -}; -typedef struct _EComponentInfo EComponentInfo; - - -GType e_component_registry_get_type (void); -EComponentRegistry *e_component_registry_new (void); - -GSList *e_component_registry_peek_list (EComponentRegistry *registry); -EComponentInfo *e_component_registry_peek_info (EComponentRegistry *registry, - enum _EComponentRegistryField type, - const char *key); - -GNOME_Evolution_Component e_component_registry_activate (EComponentRegistry *registry, - const char *id, - CORBA_Environment *ev); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_COMPONENT_REGISTRY_H__ */ diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c index e11563fa10..13c2d42506 100644 --- a/shell/e-shell-window-actions.c +++ b/shell/e-shell-window-actions.c @@ -720,7 +720,12 @@ static void action_preferences_cb (GtkAction *action, EShellWindow *window) { - e_shell_show_preferences (GTK_WINDOW (window)); + GtkWidget *preferences_window; + + preferences_window = e_shell_get_preferences_window (); + gtk_window_present (GTK_WINDOW (preferences_window)); + + /* FIXME Switch to a page appropriate for the current view. */ } static void diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c index 81d2b82f5f..8b842b50e1 100644 --- a/shell/e-shell-window.c +++ b/shell/e-shell-window.c @@ -29,7 +29,6 @@ #include "e-util/gconf-bridge.h" #include "widgets/misc/e-online-button.h" -#include "e-component-registry.h" #include "e-shell-marshal.h" #include "e-sidebar.h" #include "es-menu.h" diff --git a/shell/e-shell.c b/shell/e-shell.c index 2fe703f077..25572dbcdc 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -21,15 +21,14 @@ #include "e-shell.h" #include <glib/gi18n.h> +#include <e-preferences-window.h> #include "e-shell-module.h" #include "e-shell-registry.h" -#include "e-shell-settings-dialog.h" #define SHUTDOWN_TIMEOUT 500 /* milliseconds */ static GList *active_windows; -static GtkWidget *preferences; static gboolean shell_window_delete_event_cb (EShellWindow *shell_window) @@ -160,18 +159,13 @@ e_shell_handle_uri (const gchar *uri) return e_shell_module_handle_uri (shell_module, uri); } -void -e_shell_show_preferences (GtkWindow *parent) +GtkWidget * +e_shell_get_preferences_window (void) { - if (preferences != NULL) { - gtk_window_present (GTK_WINDOW (preferences)); - return; - } + static GtkWidget *preferences_window = NULL; - preferences = e_shell_settings_dialog_new (); - /* FIXME e_shell_settings_dialog_show_type (...); */ + if (G_UNLIKELY (preferences_window == NULL)) + preferences_window = e_preferences_window_new (); - gtk_window_set_transient_for (GTK_WINDOW (preferences), parent); - gtk_window_set_destroy_with_parent (GTK_WINDOW (preferences), TRUE); - gtk_widget_show (preferences); + return preferences_window; } diff --git a/shell/e-shell.h b/shell/e-shell.h index dcc6a99a3a..2fb814d153 100644 --- a/shell/e-shell.h +++ b/shell/e-shell.h @@ -45,11 +45,11 @@ enum _EShellStartupLineMode { EShellWindow * e_shell_create_window (void); gboolean e_shell_handle_uri (const gchar *uri); void e_shell_send_receive (GtkWindow *parent); -void e_shell_show_preferences (GtkWindow *parent); void e_shell_go_offline (void); void e_shell_go_online (void); EShellLineStatus e_shell_get_line_status (void); +GtkWidget * e_shell_get_preferences_window (void); gboolean e_shell_is_busy (void); gboolean e_shell_do_quit (void); gboolean e_shell_quit (void); diff --git a/shell/evolution-listener.c b/shell/evolution-listener.c deleted file mode 100644 index c9b8985107..0000000000 --- a/shell/evolution-listener.c +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - * Authors: Michael Zucchi <notzed@novell.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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "evolution-listener.h" - -#define PARENT_TYPE bonobo_object_get_type () - -static BonoboObjectClass *parent_class = NULL; - -/* Evolution.Listener */ -static void -impl_complete(PortableServer_Servant _servant, CORBA_Environment * ev) -{ - EvolutionListener *el = (EvolutionListener *)bonobo_object_from_servant(_servant); - - if (el->complete) - el->complete(el, el->data); -} - -static void -evolution_listener_class_init (EvolutionListenerClass *klass) -{ - POA_GNOME_Evolution_Listener__epv *epv = &klass->epv; - - parent_class = g_type_class_peek_parent (klass); - - epv->complete = impl_complete; -} - -static void -evolution_listener_init(EvolutionListener *emf, EvolutionListenerClass *klass) -{ -} - -BONOBO_TYPE_FUNC_FULL (EvolutionListener, GNOME_Evolution_Listener, PARENT_TYPE, evolution_listener) - -EvolutionListener * -evolution_listener_new(EvolutionListenerFunc complete, void *data) -{ - EvolutionListener *el; - - el = g_object_new(evolution_listener_get_type(), NULL); - el->complete = complete; - el->data = data; - - return el; -} diff --git a/shell/evolution-listener.h b/shell/evolution-listener.h deleted file mode 100644 index 48e00cad68..0000000000 --- a/shell/evolution-listener.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - * Author: Michael Zucchi <notzed@novell.com> - * - * Abstract class wrapper for EvolutionListener - */ - -#ifndef _EVOLUTION_LISTENER_H_ -#define _EVOLUTION_LISTENER_H_ - -#include <bonobo/bonobo-object.h> -#include "shell/Evolution.h" - -typedef struct _EvolutionListener EvolutionListener; -typedef struct _EvolutionListenerClass EvolutionListenerClass; - -typedef void (*EvolutionListenerFunc)(EvolutionListener *, void *); - -struct _EvolutionListener { - BonoboObject parent; - - /* we dont need signals, so why bother wasting resources on it */ - EvolutionListenerFunc complete; - void *data; -}; - -struct _EvolutionListenerClass { - BonoboObjectClass parent_class; - - POA_GNOME_Evolution_Listener__epv epv; -}; - -GType evolution_listener_get_type(void); -EvolutionListener *evolution_listener_new(EvolutionListenerFunc complete, void *data); - -#endif /* _EVOLUTION_LISTENER_H_ */ |