diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/e-shell.c | 71 | ||||
-rw-r--r-- | shell/e-shell.h | 1 | ||||
-rw-r--r-- | shell/main.c | 1 |
3 files changed, 67 insertions, 6 deletions
diff --git a/shell/e-shell.c b/shell/e-shell.c index 544b960e6c..130e0f0912 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -52,6 +52,7 @@ struct _EShellPrivate { gpointer preparing_for_quit; /* weak pointer */ gchar *geometry; + gchar *module_directory; guint auto_reconnect : 1; guint network_available : 1; @@ -63,6 +64,7 @@ struct _EShellPrivate { enum { PROP_0, PROP_GEOMETRY, + PROP_MODULE_DIRECTORY, PROP_NETWORK_AVAILABLE, PROP_ONLINE, PROP_SHELL_SETTINGS @@ -373,15 +375,18 @@ shell_request_quit (EShell *shell) static void shell_load_modules (EShell *shell) { - GList *modules; + const gchar *module_directory; + GList *modules = NULL; /* Load all shared library modules. */ - modules = e_module_load_all_in_directory (EVOLUTION_MODULEDIR); - while (modules != NULL) { - g_type_module_unuse (G_TYPE_MODULE (modules->data)); - modules = g_list_delete_link (modules, modules); - } + module_directory = e_shell_get_module_directory (shell); + g_return_if_fail (module_directory != NULL); + + modules = e_module_load_all_in_directory (module_directory); + + g_list_foreach (modules, (GFunc) g_type_module_unuse, NULL); + g_list_free (modules); } /* Helper for shell_add_backend() */ @@ -480,6 +485,15 @@ shell_set_geometry (EShell *shell, } static void +shell_set_module_directory (EShell *shell, + const gchar *module_directory) +{ + g_return_if_fail (shell->priv->module_directory == NULL); + + shell->priv->module_directory = g_strdup (module_directory); +} + +static void shell_set_property (GObject *object, guint property_id, const GValue *value, @@ -492,6 +506,12 @@ shell_set_property (GObject *object, g_value_get_string (value)); return; + case PROP_MODULE_DIRECTORY: + shell_set_module_directory ( + E_SHELL (object), + g_value_get_string (value)); + return; + case PROP_NETWORK_AVAILABLE: e_shell_set_network_available ( E_SHELL (object), @@ -515,6 +535,12 @@ shell_get_property (GObject *object, GParamSpec *pspec) { switch (property_id) { + case PROP_MODULE_DIRECTORY: + g_value_set_string ( + value, e_shell_get_module_directory ( + E_SHELL (object))); + return; + case PROP_NETWORK_AVAILABLE: g_value_set_boolean ( value, e_shell_get_network_available ( @@ -588,6 +614,7 @@ shell_finalize (GObject *object) e_file_lock_destroy (); g_free (priv->geometry); + g_free (priv->module_directory); /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (parent_class)->finalize (object); @@ -747,6 +774,22 @@ shell_class_init (EShellClass *class) G_PARAM_CONSTRUCT_ONLY)); /** + * EShell:module-directory + * + * The directory from which to load #EModule<!-- -->s. + **/ + g_object_class_install_property ( + object_class, + PROP_MODULE_DIRECTORY, + g_param_spec_string ( + "module-directory", + _("Module Directory"), + _("The directory from which to load EModules"), + NULL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + + /** * EShell:network-available * * Whether the network is available. @@ -1504,6 +1547,22 @@ e_shell_send_receive (EShell *shell, } /** + * e_shell_get_module_directory: + * @shell: an #EShell + * + * Returns the directory from which #EModule<!-- -->s were loaded. + * + * Returns: the #EModule directory + **/ +const gchar * +e_shell_get_module_directory (EShell *shell) +{ + g_return_val_if_fail (E_IS_SHELL (shell), NULL); + + return shell->priv->module_directory; +} + +/** * e_shell_get_network_available: * @shell: an #EShell * diff --git a/shell/e-shell.h b/shell/e-shell.h index 7d1904a828..1a324806a2 100644 --- a/shell/e-shell.h +++ b/shell/e-shell.h @@ -114,6 +114,7 @@ GList * e_shell_get_watched_windows (EShell *shell); GtkWindow * e_shell_get_active_window (EShell *shell); void e_shell_send_receive (EShell *shell, GtkWindow *parent); +const gchar * e_shell_get_module_directory (EShell *shell); gboolean e_shell_get_network_available (EShell *shell); void e_shell_set_network_available (EShell *shell, gboolean network_available); diff --git a/shell/main.c b/shell/main.c index 7a09f60d12..c1a4e5decf 100644 --- a/shell/main.c +++ b/shell/main.c @@ -435,6 +435,7 @@ create_default_shell (void) E_TYPE_SHELL, "name", "org.gnome.Evolution", "geometry", geometry, + "module-directory", EVOLUTION_MODULEDIR, "online", online, NULL); |