aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/e-shell.c')
-rw-r--r--shell/e-shell.c54
1 files changed, 54 insertions, 0 deletions
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);
+}