aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/e-shell-importer.c25
-rw-r--r--shell/e-shell-importer.h15
-rw-r--r--shell/e-shell-module.c15
-rw-r--r--shell/e-shell-module.h5
-rw-r--r--shell/e-shell-registry.c14
-rw-r--r--shell/e-shell-registry.h2
-rw-r--r--shell/e-shell-settings-dialog.c190
-rw-r--r--shell/e-shell-settings-dialog.h56
-rw-r--r--shell/e-shell.c54
-rw-r--r--shell/e-shell.h1
-rw-r--r--shell/es-event.c18
-rw-r--r--shell/es-event.h15
-rw-r--r--shell/main.c171
-rw-r--r--shell/shell.error.xml22
14 files changed, 249 insertions, 354 deletions
diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c
index bf2a67f9b0..adf662aacf 100644
--- a/shell/e-shell-importer.c
+++ b/shell/e-shell-importer.c
@@ -85,7 +85,6 @@ typedef struct _ImportDialogImporterPage {
} ImportDialogImporterPage;
typedef struct _ImportData {
- EShell *shell;
EShellWindow *window;
GladeXML *wizard;
@@ -242,29 +241,6 @@ item_selected (GtkWidget *item,
filename_changed(data->filepage->filename, data);
}
-#if 0
-static int
-compare_info_name (const void *data1, const void *data2)
-{
- const Bonobo_ServerInfo *info1 = (Bonobo_ServerInfo *)data1;
- const Bonobo_ServerInfo *info2 = (Bonobo_ServerInfo *)data2;
- const char *name1 = get_name_from_component_info (info1);
- const char *name2 = get_name_from_component_info (info2);
-
- /* If we can't find a name for a plug-in, its iid will be used
- * for display. Put such plug-ins at the end of the list since
- * their displayed name won't be really user-friendly
- */
- if (name1 == NULL) {
- return -1;
- }
- if (name2 == NULL) {
- return 1;
- }
- return g_utf8_collate (name1, name2);
-}
-#endif
-
static ImportDialogFilePage *
importer_file_page_new (ImportData *data)
{
@@ -678,7 +654,6 @@ e_shell_importer_start_import (EShellWindow *shell_window)
dialog_open = TRUE;
data->window = shell_window;
- data->shell = e_shell_window_peek_shell (data->window);
gladefile = g_build_filename (EVOLUTION_GLADEDIR, "import.glade", NULL);
data->wizard = glade_xml_new (gladefile, NULL, NULL);
diff --git a/shell/e-shell-importer.h b/shell/e-shell-importer.h
index 72fdd11ffc..88cfaef2f8 100644
--- a/shell/e-shell-importer.h
+++ b/shell/e-shell-importer.h
@@ -20,9 +20,16 @@
* Author: Iain Holmes <iain@ximian.com>
*/
-#ifndef _E_SHELL_IMPORTER_H_
-#define _E_SHELL_IMPORTER_H_
+#ifndef E_SHELL_IMPORTER_H
+#define E_SHELL_IMPORTER_H
-void e_shell_importer_start_import (EShellWindow *shell_window);
+#include "e-shell-common.h"
+#include "e-shell-window.h"
-#endif
+G_BEGIN_DECLS
+
+void e_shell_importer_start_import (EShellWindow *shell_window);
+
+G_END_DECLS
+
+#endif /* E_SHELL_IMPORTER_H */
diff --git a/shell/e-shell-module.c b/shell/e-shell-module.c
index 7a006fe9d4..e969bbe382 100644
--- a/shell/e-shell-module.c
+++ b/shell/e-shell-module.c
@@ -267,6 +267,19 @@ e_shell_module_shutdown (EShellModule *shell_module)
return TRUE;
}
+gboolean
+e_shell_module_handle_uri (EShellModule *shell_module,
+ const gchar *uri)
+{
+ g_return_val_if_fail (E_IS_SHELL_MODULE (shell_module), FALSE);
+ g_return_val_if_fail (uri != NULL, FALSE);
+
+ if (shell_module->priv->info.handle_uri != NULL)
+ return shell_module->priv->info.handle_uri (uri);
+
+ return FALSE;
+}
+
void
e_shell_module_send_and_receive (EShellModule *shell_module)
{
@@ -296,7 +309,7 @@ e_shell_module_set_info (EShellModule *shell_module,
shell_module->priv->info.sort_order = info->sort_order;
shell_module->priv->info.aliases = g_intern_string (info->aliases);
- shell_module->priv->info.schemas = g_intern_string (info->schemas);
+ shell_module->priv->info.schemes = g_intern_string (info->schemes);
shell_module->priv->info.shell_view_type = info->shell_view_type;
shell_module->priv->info.is_busy = info->is_busy;
diff --git a/shell/e-shell-module.h b/shell/e-shell-module.h
index b93a77a89d..7ea9dee4ef 100644
--- a/shell/e-shell-module.h
+++ b/shell/e-shell-module.h
@@ -53,11 +53,12 @@ typedef struct _EShellModulePrivate EShellModulePrivate;
struct _EShellModuleInfo {
gint sort_order;
const gchar *aliases; /* colon-separated list */
- const gchar *schemas; /* colon-separated list */
+ const gchar *schemes; /* colon-separated list */
GType shell_view_type; /* EShellView subclass */
gboolean (*is_busy) (void);
gboolean (*shutdown) (void);
+ gboolean (*handle_uri) (const gchar *uri);
void (*send_and_receive) (void);
void (*window_created) (EShellWindow *window);
};
@@ -79,6 +80,8 @@ const gchar * e_shell_module_get_filename (EShellModule *shell_module);
GType e_shell_module_get_view_type (EShellModule *shell_module);
gboolean e_shell_module_is_busy (EShellModule *shell_module);
gboolean e_shell_module_shutdown (EShellModule *shell_module);
+gboolean e_shell_module_handle_uri (EShellModule *shell_module,
+ const gchar *uri);
void e_shell_module_send_and_receive (EShellModule *shell_module);
void e_shell_module_window_created (EShellModule *shell_module,
EShellWindow *shell_window);
diff --git a/shell/e-shell-registry.c b/shell/e-shell-registry.c
index 8329b59444..5c841398c3 100644
--- a/shell/e-shell-registry.c
+++ b/shell/e-shell-registry.c
@@ -22,7 +22,7 @@
static GList *loaded_modules;
static GHashTable *modules_by_name;
-static GHashTable *modules_by_schema;
+static GHashTable *modules_by_scheme;
static void
shell_registry_insert_items (GHashTable *hash_table,
@@ -77,9 +77,9 @@ shell_registry_query_module (const gchar *filename)
shell_registry_insert_items (
modules_by_name, string, shell_module);
- if ((string = info->schemas) != NULL)
+ if ((string = info->schemes) != NULL)
shell_registry_insert_items (
- modules_by_schema, string, shell_module);
+ modules_by_scheme, string, shell_module);
}
void
@@ -93,7 +93,7 @@ e_shell_registry_init (void)
g_return_if_fail (loaded_modules == NULL);
modules_by_name = g_hash_table_new (g_str_hash, g_str_equal);
- modules_by_schema = g_hash_table_new (g_str_hash, g_str_equal);
+ modules_by_scheme = g_hash_table_new (g_str_hash, g_str_equal);
dirname = EVOLUTION_MODULEDIR;
@@ -161,9 +161,9 @@ e_shell_registry_get_module_by_name (const gchar *name)
}
EShellModule *
-e_shell_registry_get_module_by_schema (const gchar *schema)
+e_shell_registry_get_module_by_scheme (const gchar *scheme)
{
- g_return_val_if_fail (schema != NULL, NULL);
+ g_return_val_if_fail (scheme != NULL, NULL);
- return g_hash_table_lookup (modules_by_schema, schema);
+ return g_hash_table_lookup (modules_by_scheme, scheme);
}
diff --git a/shell/e-shell-registry.h b/shell/e-shell-registry.h
index 07e1acaf4b..ad86a94797 100644
--- a/shell/e-shell-registry.h
+++ b/shell/e-shell-registry.h
@@ -30,7 +30,7 @@ void e_shell_registry_init (void);
GList * e_shell_registry_list_modules (void);
GType * e_shell_registry_get_view_types (guint *n_types);
EShellModule * e_shell_registry_get_module_by_name (const gchar *name);
-EShellModule * e_shell_registry_get_module_by_schema (const gchar *schema);
+EShellModule * e_shell_registry_get_module_by_scheme (const gchar *scheme);
G_END_DECLS
diff --git a/shell/e-shell-settings-dialog.c b/shell/e-shell-settings-dialog.c
index 27c4fde6df..a2e470c909 100644
--- a/shell/e-shell-settings-dialog.c
+++ b/shell/e-shell-settings-dialog.c
@@ -30,7 +30,6 @@
#include "e-shell-settings-dialog.h"
#include "e-corba-config-page.h"
-#include <e-util/e-icon-factory.h>
#include <bonobo/bonobo-widget.h>
#include <bonobo/bonobo-exception.h>
@@ -40,48 +39,21 @@
#include <stdlib.h>
#include <string.h>
+#define E_SHELL_SETTINGS_DIALOG_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_SHELL_SETTINGS_DIALOG, EShellSettingsDialogPrivate))
+
struct _EShellSettingsDialogPrivate {
GHashTable *types;
};
-G_DEFINE_TYPE (EShellSettingsDialog, e_shell_settings_dialog, E_TYPE_MULTI_CONFIG_DIALOG)
-
-
-/* FIXME ugly hack to work around that sizing of invisible widgets is broken
- with Bonobo. */
+static gpointer parent_class;
-static void
-set_dialog_size (EShellSettingsDialog *dialog)
-{
- PangoLayout *layout;
- PangoContext *context;
- PangoFontMetrics *metrics;
- int width, height;
-
- layout = gtk_widget_create_pango_layout (GTK_WIDGET (dialog), "M");
- context = pango_layout_get_context (layout);
- metrics = pango_context_get_metrics (context,
- gtk_widget_get_style (GTK_WIDGET (dialog))->font_desc,
- pango_context_get_language (context));
-
- pango_layout_get_pixel_size (layout, &width, NULL);
-
- width *= 60;
- height = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics)
- + pango_font_metrics_get_descent (metrics)) * 30;
-
- gtk_window_set_default_size((GtkWindow *)dialog, width, height);
- g_object_unref (layout);
- pango_font_metrics_unref (metrics);
-}
-
-
/* Page handling. */
struct _Page {
- char *title;
- char *description;
- GdkPixbuf *icon;
+ char *caption;
+ char *icon_name;
Bonobo_ActivationProperty *type;
int priority;
EConfigPage *page_widget;
@@ -89,22 +61,17 @@ struct _Page {
typedef struct _Page Page;
static Page *
-page_new (const char *title,
- const char *description,
- GdkPixbuf *icon,
+page_new (const char *caption,
+ const char *icon_name,
Bonobo_ActivationProperty *type,
int priority,
EConfigPage *page_widget)
{
Page *page;
- if (icon != NULL)
- g_object_ref (icon);
-
page = g_new (Page, 1);
- page->title = g_strdup (title);
- page->description = g_strdup (description);
- page->icon = icon;
+ page->caption = g_strdup (caption);
+ page->icon_name = g_strdup (icon_name);;
page->type = type;
page->priority = priority;
page->page_widget = page_widget;
@@ -115,35 +82,25 @@ page_new (const char *title,
static void
page_free (Page *page)
{
- g_free (page->title);
- g_free (page->description);
-
- if (page->icon != NULL)
- g_object_unref (page->icon);
-
+ g_free (page->caption);
+ g_free (page->icon_name);
g_free (page);
}
-static int
-compare_page_func (const void *a,
- const void *b)
+static gint
+compare_page_func (const Page *a,
+ const Page *b)
{
- const Page *page_a;
- const Page *page_b;
+ if (a->priority == b->priority)
+ return strcmp (a->caption, b->caption);
- page_a = (const Page *) a;
- page_b = (const Page *) b;
-
- if (page_a->priority == page_b->priority)
- return strcmp (page_a->title, page_b->title);
-
- return page_a->priority - page_b->priority;
+ return a->priority - b->priority;
}
static GList *
sort_page_list (GList *list)
{
- return g_list_sort (list, compare_page_func);
+ return g_list_sort (list, (GCompareFunc) compare_page_func);
}
static void
@@ -179,34 +136,21 @@ load_pages (EShellSettingsDialog *dialog)
for (i = 0; i < control_list->_length; i ++) {
CORBA_Object corba_object;
Bonobo_ServerInfo *info;
- const char *title;
- const char *description;
- const char *icon_path;
+ const char *caption;
+ const char *icon_name;
const char *priority_string;
Bonobo_ActivationProperty *type;
int priority;
- GdkPixbuf *icon;
CORBA_exception_init (&ev);
info = & control_list->_buffer[i];
- title = bonobo_server_info_prop_lookup (info, "evolution2:config_item:title", languages);
- description = bonobo_server_info_prop_lookup (info, "evolution2:config_item:description", languages);
- icon_path = bonobo_server_info_prop_lookup (info, "evolution2:config_item:icon_name", NULL);
+ caption = bonobo_server_info_prop_lookup (info, "evolution2:config_item:title", languages);
+ icon_name = bonobo_server_info_prop_lookup (info, "evolution2:config_item:icon_name", NULL);
type = bonobo_server_info_prop_find (info, "evolution2:config_item:type");
priority_string = bonobo_server_info_prop_lookup (info, "evolution2:config_item:priority", NULL);
- if (icon_path == NULL) {
- icon = NULL;
- } else {
- if (g_path_is_absolute (icon_path)) {
- icon = gdk_pixbuf_new_from_file (icon_path, NULL);
- } else {
- icon = e_icon_factory_get_icon (icon_path, E_ICON_SIZE_DIALOG);
- }
- }
-
if (type != NULL && type->v._d != Bonobo_ACTIVATION_P_STRINGV)
type = NULL;
if (priority_string == NULL)
@@ -219,7 +163,7 @@ load_pages (EShellSettingsDialog *dialog)
if (! BONOBO_EX (&ev)) {
Page *page;
- page = page_new (title, description, icon, type, priority,
+ page = page_new (caption, icon_name, type, priority,
E_CONFIG_PAGE (e_corba_config_page_new_from_objref (corba_object)));
page_list = g_list_prepend (page_list, page);
@@ -229,9 +173,6 @@ load_pages (EShellSettingsDialog *dialog)
g_free (bonobo_ex_text);
}
- if (icon != NULL)
- g_object_unref (icon);
-
CORBA_exception_free (&ev);
}
g_slist_free(languages);
@@ -243,9 +184,8 @@ load_pages (EShellSettingsDialog *dialog)
page = (Page *) p->data;
e_multi_config_dialog_add_page (E_MULTI_CONFIG_DIALOG (dialog),
- page->title,
- page->description,
- page->icon,
+ page->caption,
+ page->icon_name,
page->page_widget);
if (page->type != NULL) {
@@ -266,74 +206,88 @@ load_pages (EShellSettingsDialog *dialog)
CORBA_free (control_list);
}
-
-/* GtkObject methods. */
-
static void
-impl_finalize (GObject *object)
+shell_settings_dialog_finalize (GObject *object)
{
- EShellSettingsDialog *dialog;
EShellSettingsDialogPrivate *priv;
- dialog = E_SHELL_SETTINGS_DIALOG (object);
- priv = dialog->priv;
+ priv = E_SHELL_SETTINGS_DIALOG_GET_PRIVATE (object);
g_hash_table_destroy (priv->types);
- g_free (priv);
-
- (* G_OBJECT_CLASS (e_shell_settings_dialog_parent_class)->finalize) (object);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
-
static void
-e_shell_settings_dialog_class_init (EShellSettingsDialogClass *klass)
+shell_settings_dialog_class_init (EShellSettingsDialogClass *class)
{
GObjectClass *object_class;
- object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = impl_finalize;
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EShellSettingsDialogPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = shell_settings_dialog_finalize;
}
static void
-e_shell_settings_dialog_init (EShellSettingsDialog *dialog)
+shell_settings_dialog_init (EShellSettingsDialog *dialog)
{
- EShellSettingsDialogPrivate *priv;
+ dialog->priv = E_SHELL_SETTINGS_DIALOG_GET_PRIVATE (dialog);
- priv = g_new (EShellSettingsDialogPrivate, 1);
- priv->types = g_hash_table_new_full (
+ dialog->priv->types = g_hash_table_new_full (
g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) NULL);
- dialog->priv = priv;
-
load_pages (dialog);
- set_dialog_size (dialog);
gtk_window_set_title (GTK_WINDOW (dialog), _("Evolution Preferences"));
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
}
-
-GtkWidget *
-e_shell_settings_dialog_new (void)
+GType
+e_shell_settings_dialog_get_type (void)
{
- EShellSettingsDialog *new;
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ const GTypeInfo type_info = {
+ sizeof (EShellSettingsDialogClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) shell_settings_dialog_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EShellSettingsDialog),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) shell_settings_dialog_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ E_TYPE_MULTI_CONFIG_DIALOG, "EShellSettingsDialog",
+ &type_info, 0);
+ }
- new = g_object_new (e_shell_settings_dialog_get_type (), NULL);
+ return type;
+}
- return GTK_WIDGET (new);
+GtkWidget *
+e_shell_settings_dialog_new (void)
+{
+ return g_object_new (E_TYPE_SHELL_SETTINGS_DIALOG, NULL);
}
void
-e_shell_settings_dialog_show_type (EShellSettingsDialog *dialog, const char *type)
+e_shell_settings_dialog_show_type (EShellSettingsDialog *dialog,
+ const gchar *type)
{
EShellSettingsDialogPrivate *priv;
gpointer key, value;
int page;
- g_return_if_fail (dialog != NULL);
g_return_if_fail (E_IS_SHELL_SETTINGS_DIALOG (dialog));
g_return_if_fail (type != NULL);
@@ -350,9 +304,7 @@ e_shell_settings_dialog_show_type (EShellSettingsDialog *dialog, const char *typ
} else
value = NULL;
}
- page = GPOINTER_TO_INT (value);
+ page = GPOINTER_TO_INT (value);
e_multi_config_dialog_show_page (E_MULTI_CONFIG_DIALOG (dialog), page);
}
-
-
diff --git a/shell/e-shell-settings-dialog.h b/shell/e-shell-settings-dialog.h
index aeab973959..bf81a61682 100644
--- a/shell/e-shell-settings-dialog.h
+++ b/shell/e-shell-settings-dialog.h
@@ -17,34 +17,40 @@
* 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 <ettore@ximian.com>
*/
-#ifndef _E_SHELL_SETTINGS_DIALOG_H_
-#define _E_SHELL_SETTINGS_DIALOG_H_
+#ifndef E_SHELL_SETTINGS_DIALOG_H
+#define E_SHELL_SETTINGS_DIALOG_H
#include "e-multi-config-dialog.h"
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
+G_BEGIN_DECLS
-#define E_TYPE_SHELL_SETTINGS_DIALOG (e_shell_settings_dialog_get_type ())
-#define E_SHELL_SETTINGS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SHELL_SETTINGS_DIALOG, EShellSettingsDialog))
-#define E_SHELL_SETTINGS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SHELL_SETTINGS_DIALOG, EShellSettingsDialogClass))
-#define E_IS_SHELL_SETTINGS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SHELL_SETTINGS_DIALOG))
-#define E_IS_SHELL_SETTINGS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_SHELL_SETTINGS_DIALOG))
+/* Standard GObject macros */
+#define E_TYPE_SHELL_SETTINGS_DIALOG \
+ (e_shell_settings_dialog_get_type ())
+#define E_SHELL_SETTINGS_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_SHELL_SETTINGS_DIALOG, EShellSettingsDialog))
+#define E_SHELL_SETTINGS_DIALOG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_SHELL_SETTINGS_DIALOG, EShellSettingsDialogClass))
+#define E_IS_SHELL_SETTINGS_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_SHELL_SETTINGS_DIALOG))
+#define E_IS_SHELL_SETTINGS_DIALOG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_SHELL_SETTINGS_DIALOG))
+#define E_SHELL_SETTINGS_DIALOG_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_SHELL_SETTINGS_DIALOG, EShellSettingsDialogClass))
-
-typedef struct _EShellSettingsDialog EShellSettingsDialog;
+typedef struct _EShellSettingsDialog EShellSettingsDialog;
+typedef struct _EShellSettingsDialogClass EShellSettingsDialogClass;
typedef struct _EShellSettingsDialogPrivate EShellSettingsDialogPrivate;
-typedef struct _EShellSettingsDialogClass EShellSettingsDialogClass;
struct _EShellSettingsDialog {
EMultiConfigDialog parent;
-
EShellSettingsDialogPrivate *priv;
};
@@ -52,14 +58,12 @@ struct _EShellSettingsDialogClass {
EMultiConfigDialogClass parent_class;
};
-
-GType e_shell_settings_dialog_get_type (void);
-GtkWidget *e_shell_settings_dialog_new (void);
-void e_shell_settings_dialog_show_type (EShellSettingsDialog *dialog,
- const char *type);
+GType e_shell_settings_dialog_get_type(void);
+GtkWidget * e_shell_settings_dialog_new (void);
+void e_shell_settings_dialog_show_type
+ (EShellSettingsDialog *dialog,
+ const gchar *type);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
-#endif /* _E_SHELL_SETTINGS_DIALOG_H_ */
+#endif /* E_SHELL_SETTINGS_DIALOG_H */
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 43c30363f7..2fe703f077 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -24,10 +24,12 @@
#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)
@@ -121,3 +123,55 @@ e_shell_create_window (void)
return E_SHELL_WINDOW (shell_window);
}
+
+gboolean
+e_shell_handle_uri (const gchar *uri)
+{
+ EShellModule *shell_module;
+ GFile *file;
+ gchar *scheme;
+
+ g_return_val_if_fail (uri != NULL, FALSE);
+
+ file = g_file_new_for_uri (uri);
+ scheme = g_file_get_uri_scheme (file);
+ g_object_unref (file);
+
+ if (scheme == NULL)
+ return FALSE;
+
+ shell_module = e_shell_registry_get_module_by_scheme (scheme);
+
+ /* Scheme lookup failed so try looking up the shell module by
+ * name. Note, we only open a shell window if the URI refers
+ * to a shell module by name, not by scheme. */
+ if (shell_module == NULL) {
+ EShellWindow *shell_window;
+
+ shell_module = e_shell_registry_get_module_by_name (scheme);
+
+ if (shell_module == NULL)
+ return FALSE;
+
+ shell_window = e_shell_create_window ();
+ /* FIXME Set window to appropriate view. */
+ }
+
+ return e_shell_module_handle_uri (shell_module, uri);
+}
+
+void
+e_shell_show_preferences (GtkWindow *parent)
+{
+ if (preferences != NULL) {
+ gtk_window_present (GTK_WINDOW (preferences));
+ return;
+ }
+
+ preferences = e_shell_settings_dialog_new ();
+ /* FIXME e_shell_settings_dialog_show_type (...); */
+
+ gtk_window_set_transient_for (GTK_WINDOW (preferences), parent);
+ gtk_window_set_destroy_with_parent (GTK_WINDOW (preferences), TRUE);
+ gtk_widget_show (preferences);
+}
diff --git a/shell/e-shell.h b/shell/e-shell.h
index a2582190b9..dcc6a99a3a 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -43,6 +43,7 @@ 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);
diff --git a/shell/es-event.c b/shell/es-event.c
index 4146cbccae..ee1cdb400a 100644
--- a/shell/es-event.c
+++ b/shell/es-event.c
@@ -112,6 +112,14 @@ ESEvent *es_event_peek(void)
return es_event;
}
+ESEventTargetShell *
+es_event_target_new (ESEvent *eme)
+{
+ return e_event_target_new (
+ &eme->event, ES_EVENT_TARGET_SHELL,
+ sizeof (ESEventTargetShell));
+}
+
ESEventTargetState *
es_event_target_new_state(ESEvent *eme, int state)
{
@@ -130,16 +138,6 @@ es_event_target_new_state(ESEvent *eme, int state)
return t;
}
-ESEventTargetShell *
-es_event_target_new_shell(ESEvent *eme, EShell *shell)
-{
- ESEventTargetShell *t = e_event_target_new(&eme->event, ES_EVENT_TARGET_SHELL, sizeof(*t));
-
- t->shell = shell;
-
- return t;
-}
-
ESEventTargetUpgrade *
es_event_target_new_upgrade(ESEvent *eme, int major, int minor, int revision)
{
diff --git a/shell/es-event.h b/shell/es-event.h
index bb707050a7..8b8d356e2f 100644
--- a/shell/es-event.h
+++ b/shell/es-event.h
@@ -27,12 +27,7 @@
#include "e-util/e-event.h"
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-struct _EShell; /* Avoid including "e-shell.h" */
+G_BEGIN_DECLS
typedef struct _ESEvent ESEvent;
typedef struct _ESEventClass ESEventClass;
@@ -58,8 +53,6 @@ typedef struct _ESEventTargetComponent ESEventTargetComponent;
struct _ESEventTargetShell {
EEventTarget target;
-
- struct _EShell *shell;
};
struct _ESEventTargetState {
@@ -99,8 +92,8 @@ GType es_event_get_type(void);
ESEvent *es_event_peek(void);
+ESEventTargetShell *es_event_target_new(ESEvent *eme);
ESEventTargetState *es_event_target_new_state(ESEvent *emp, int state);
-ESEventTargetShell *es_event_target_new_shell(ESEvent *eme, struct _EShell *shell);
ESEventTargetUpgrade *es_event_target_new_upgrade(ESEvent *emp, int major, int minor, int revision);
ESEventTargetComponent *es_event_target_new_component(ESEvent *eme, const char *id);
@@ -119,8 +112,6 @@ struct _ESEventHookClass {
GType es_event_hook_get_type(void);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
#endif /* __ES_EVENT_H__ */
diff --git a/shell/main.c b/shell/main.c
index f363d3bdd9..533c678236 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -56,8 +56,6 @@
#include <libgnomeui/gnome-ui-init.h>
#include <libgnomeui/gnome-client.h>
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-moniker-util.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo-activation/bonobo-activation.h>
@@ -92,9 +90,6 @@
#define RECOVERY_KEY \
"/apps/evolution/shell/recovery"
-
-static EShell *shell = NULL;
-
/* Command-line options. */
static gboolean start_online = FALSE;
static gboolean start_offline = FALSE;
@@ -111,21 +106,6 @@ static char *default_component_id = NULL;
static char *evolution_debug_log = NULL;
static gchar **remaining_args;
-static void
-no_windows_left_cb (EShell *shell, gpointer data)
-{
- bonobo_object_unref (BONOBO_OBJECT (shell));
- bonobo_main_quit ();
-}
-
-static void
-shell_weak_notify (void *data,
- GObject *where_the_object_was)
-{
- bonobo_main_quit ();
-}
-
-
#ifdef KILL_PROCESS_CMD
static void
@@ -352,25 +332,15 @@ show_recovery_warning(void)
}
static void
-open_uris (GNOME_Evolution_Shell corba_shell, gchar **uris)
+open_uris (gchar **uris)
{
- CORBA_Environment ev;
- guint n_uris, ii;
+ guint ii;
g_return_if_fail (uris != NULL);
- n_uris = g_strv_length (uris);
-
- CORBA_exception_init (&ev);
- for (ii = 0; ii < n_uris; ii++) {
- GNOME_Evolution_Shell_handleURI (corba_shell, uris[ii], &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
+ for (ii = 0; uris[ii] != NULL; ii++)
+ if (!e_shell_handle_uri (uris[ii]))
g_warning ("Invalid URI: %s", uris[ii]);
- CORBA_exception_free (&ev);
- }
- }
-
- CORBA_exception_free (&ev);
}
/* This is for doing stuff that requires the GTK+ loop to be running already. */
@@ -378,9 +348,6 @@ open_uris (GNOME_Evolution_Shell corba_shell, gchar **uris)
static gboolean
idle_cb (gchar **uris)
{
- GNOME_Evolution_Shell corba_shell;
- CORBA_Environment ev;
- EShellConstructResult result;
EShellStartupLineMode startup_line_mode;
g_return_val_if_fail (uris == NULL || g_strv_length (uris) > 0, FALSE);
@@ -389,8 +356,6 @@ idle_cb (gchar **uris)
kill_old_dataserver ();
#endif
- CORBA_exception_init (&ev);
-
if (! start_online && ! start_offline)
startup_line_mode = E_SHELL_STARTUP_LINE_MODE_CONFIG;
else if (start_online)
@@ -398,93 +363,51 @@ idle_cb (gchar **uris)
else
startup_line_mode = E_SHELL_STARTUP_LINE_MODE_OFFLINE;
- shell = e_shell_new (startup_line_mode, &result);
-
- switch (result) {
- case E_SHELL_CONSTRUCT_RESULT_OK:
- g_signal_connect (shell, "no_windows_left", G_CALLBACK (no_windows_left_cb), NULL);
- g_object_weak_ref (G_OBJECT (shell), shell_weak_notify, NULL);
- corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell));
- corba_shell = CORBA_Object_duplicate (corba_shell, &ev);
- break;
-
- case E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER:
- corba_shell = bonobo_activation_activate_from_id (E_SHELL_OAFIID, 0, NULL, &ev);
- if (ev._major != CORBA_NO_EXCEPTION || corba_shell == CORBA_OBJECT_NIL) {
- e_error_run(NULL, "shell:noshell", NULL);
- CORBA_exception_free (&ev);
- bonobo_main_quit ();
- return FALSE;
- }
- break;
-
- default:
- e_error_run(NULL, "shell:noshell-reason",
- e_shell_construct_result_to_string(result), NULL);
- CORBA_exception_free (&ev);
- bonobo_main_quit ();
- return FALSE;
-
- }
+ /* FIXME Do something with startup_line_mode. */
- if (shell != NULL) {
- if (uris != NULL)
- open_uris (corba_shell, uris);
- else {
- GConfClient *client = gconf_client_get_default ();
-
- if (gconf_client_get_bool (client, RECOVERY_KEY, NULL) && e_file_lock_exists ()) {
- /* It should have crashed last time or a force-shutdown */
- gboolean skip = gconf_client_get_bool (client, SKIP_RECOVERY_DIALOG_KEY, NULL);
- gboolean recover = TRUE;
- if (!skip){
- int flags = show_recovery_warning ();
-
- gconf_client_set_bool (client, SKIP_RECOVERY_DIALOG_KEY, (flags & (1<<2)) ? TRUE : FALSE, NULL);
- recover = (flags & (1<<1)) ? TRUE: FALSE;
- }
-
- if (recover) {
- /* Disable the previews */
- gconf_client_set_bool (client, "/apps/evolution/mail/display/show_preview", FALSE, NULL);
- gconf_client_set_bool (client, "/apps/evolution/mail/display/safe_list", TRUE, NULL);
- gconf_client_set_bool (client, "/apps/evolution/addressbook/display/show_preview", FALSE, NULL);
- gconf_client_set_bool (client, "/apps/evolution/calendar/display/show_task_preview", FALSE, NULL);
- }
- /* Let us not delete and recreate a lock, instead reuse it. We don't use timestamps anyways */
- } else {
- /* What great can we do, if lock creation fails ?*/
- e_file_lock_create ();
+ if (uris != NULL)
+ open_uris (uris);
+ else {
+ EShellWindow *shell_window;
+ GConfClient *client = gconf_client_get_default ();
+
+ if (gconf_client_get_bool (client, RECOVERY_KEY, NULL) && e_file_lock_exists ()) {
+ /* It should have crashed last time or a force-shutdown */
+ gboolean skip = gconf_client_get_bool (client, SKIP_RECOVERY_DIALOG_KEY, NULL);
+ gboolean recover = TRUE;
+ if (!skip){
+ int flags = show_recovery_warning ();
+
+ gconf_client_set_bool (client, SKIP_RECOVERY_DIALOG_KEY, (flags & (1<<2)) ? TRUE : FALSE, NULL);
+ recover = (flags & (1<<1)) ? TRUE: FALSE;
}
- g_object_unref (client);
- e_shell_create_window (shell, default_component_id);
+ if (recover) {
+ /* Disable the previews */
+ gconf_client_set_bool (client, "/apps/evolution/mail/display/show_preview", FALSE, NULL);
+ gconf_client_set_bool (client, "/apps/evolution/mail/display/safe_list", TRUE, NULL);
+ gconf_client_set_bool (client, "/apps/evolution/addressbook/display/show_preview", FALSE, NULL);
+ gconf_client_set_bool (client, "/apps/evolution/calendar/display/show_task_preview", FALSE, NULL);
+ }
+ /* Let us not delete and recreate a lock, instead reuse it. We don't use timestamps anyways */
+ } else {
+ /* What great can we do, if lock creation fails ?*/
+ e_file_lock_create ();
}
- } else {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- if (uris != NULL)
- open_uris (corba_shell, uris);
- else
- if (default_component_id == NULL)
- GNOME_Evolution_Shell_createNewWindow (corba_shell, "", &ev);
- else
- GNOME_Evolution_Shell_createNewWindow (corba_shell, default_component_id, &ev);
+ g_object_unref (client);
- CORBA_exception_free (&ev);
+ shell_window = e_shell_create_window ();
+ /* XXX Switch to default_component_id. */
}
- CORBA_Object_release (corba_shell, &ev);
-
- CORBA_exception_free (&ev);
-
+#if 0 /* MBARNES */
if (shell == NULL) {
/*there is another instance but because we don't open any windows
we must notify the startup was complete manually*/
gdk_notify_startup_complete ();
bonobo_main_quit ();
}
+#endif
return FALSE;
}
@@ -547,15 +470,20 @@ setup_segv_redirect (void)
#endif
static gint
-gnome_master_client_save_yourself_cb (GnomeClient *client, GnomeSaveStyle save_style, gint shutdown, GnomeInteractStyle interact_style, gint fast, gpointer user_data)
+gnome_master_client_save_yourself_cb (GnomeClient *client,
+ GnomeSaveStyle save_style,
+ gint shutdown,
+ GnomeInteractStyle interact_style,
+ gint fast,
+ gpointer user_data)
{
- return !shell || e_shell_can_quit (shell);
+ return !e_shell_is_busy ();
}
static void
gnome_master_client_die_cb (GnomeClient *client)
{
- e_shell_do_quit (shell);
+ e_shell_do_quit ();
}
static const GOptionEntry options[] = {
@@ -627,15 +555,6 @@ set_paths (void)
g_free (path);
- /* Set BONOBO_ACTIVATION_PATH */
- if (g_getenv ("BONOBO_ACTIVATION_PATH" ) == NULL) {
- path = g_build_filename (top_folder_utf8,
- "lib/bonobo/servers",
- NULL);
- if (!g_setenv ("BONOBO_ACTIVATION_PATH", path, TRUE))
- g_warning ("Could not set BONOBO_ACTIVATION_PATH");
- g_free (path);
- }
g_free (top_folder_utf8);
}
#endif
@@ -780,7 +699,7 @@ main (int argc, char **argv)
#endif
g_object_unref (client);
- bonobo_main ();
+ gtk_main ();
e_icon_factory_shutdown ();
g_object_unref (program);
diff --git a/shell/shell.error.xml b/shell/shell.error.xml
index 6f5364e026..75a6247eb6 100644
--- a/shell/shell.error.xml
+++ b/shell/shell.error.xml
@@ -51,28 +51,6 @@ Once deleted, you cannot downgrade to the previous version of Evolution without
<button stock="gtk-delete" response="GTK_RESPONSE_OK"/>
</error>
- <error id="noshell" type="error">
- <title>Cannot start Evolution</title>
- <_primary>Evolution can not start.</_primary>
- <_secondary xml:space="preserve">Your system configuration does not match your Evolution configuration.
-
-Click help for details</_secondary>
- <help uri="http://go-evolution.org/FAQ#What_does_.22Your_system_configuration_does_not_match_your_Evolution_configuration.22_mean.3F"/>
- <button stock="gtk-quit" response="GTK_RESPONSE_CANCEL"/>
- </error>
-
- <error id="noshell-reason" type="error">
- <title>Cannot start Evolution</title>
- <_primary>Evolution can not start.</_primary>
- <_secondary xml:space="preserve">Your system configuration does not match your Evolution configuration:
-
-{0}
-
-Click help for details.</_secondary>
- <help uri="http://go-evolution.org/FAQ#What_does_.22Your_system_configuration_does_not_match_your_Evolution_configuration.22_mean.3F"/>
- <button stock="gtk-quit" response="GTK_RESPONSE_CANCEL"/>
- </error>
-
<error id="forget-passwords" type="question" default="GTK_RESPONSE_CANCEL">
<_primary>Are you sure you want to forget all remembered passwords?</_primary>
<_secondary xml:space="preserve">Forgetting your passwords will clear all remembered passwords. You will be reprompted next time they are needed.</_secondary>