aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shortcuts.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2002-07-18 06:03:57 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2002-07-18 06:03:57 +0800
commit39c3739393bb6527a9829f1a0bdee27cff0da182 (patch)
treebd2d0649da89914a0a4ec78d8adb6d65e106ae0d /shell/e-shortcuts.c
parent515ebfd45c748cf31e2f45fe9180f97e08051498 (diff)
downloadgsoc2013-evolution-39c3739393bb6527a9829f1a0bdee27cff0da182.tar.gz
gsoc2013-evolution-39c3739393bb6527a9829f1a0bdee27cff0da182.tar.zst
gsoc2013-evolution-39c3739393bb6527a9829f1a0bdee27cff0da182.zip
Get the EStorageSet from the shortcut's shell since there is no
* e-shortcuts-view-model.c (get_icon_for_item): Get the EStorageSet from the shortcut's shell since there is no e_shortcuts_get_storage_set() anymore. * e-shortcuts-view.c (get_shortcut_info): Likewise. (impl_shortcut_drag_motion): Likewise. (impl_shortcut_drag_data_received): Likewise. * e-shell.c (e_shell_construct): e_shortcuts_new_from_file(), not e_shortcuts_new() here. * e-shortcuts.c: Removed members storage_set and folder_type_registy in EShortcutsPrivate. New member shell. (init): Init to NULL. (e_shortcuts_construct): Removed arg @storage_set and @folder_type_registry, new arg @shell. (e_shortcuts_new): Removed. (e_shortcuts_new_from_file): New. (impl_destroy): Renamed from destroy(). (e_shortcuts_get_storage_set): Removed. (e_shortcuts_get_shell): New. (load_shortcuts): Accept any URI that can be parsed (by e_shell_parse_uri). * e-shell.c (e_shell_parse_uri): New. * e-shell-view.c (evolution_uri_for_default_uri): New. (display_uri): Use it to determine the evolution: uri given a default: uri. * e-shell.c (impl_Shell_handleURI): Pass it over to e_shell_create_view_from_uri_and_settings() even if it's an E_SHELL_DEFAULTURI_PREFIX. (handle_default_uri): Removed. svn path=/trunk/; revision=17497
Diffstat (limited to 'shell/e-shortcuts.c')
-rw-r--r--shell/e-shortcuts.c62
1 files changed, 25 insertions, 37 deletions
diff --git a/shell/e-shortcuts.c b/shell/e-shortcuts.c
index 24c62fdfcb..9b1a26cb79 100644
--- a/shell/e-shortcuts.c
+++ b/shell/e-shortcuts.c
@@ -94,11 +94,8 @@ struct _EShortcutsPrivate {
/* Whether these shortcuts need to be saved to disk. */
gboolean dirty;
- /* The storage set to which these shortcuts are associated. */
- EStorageSet *storage_set;
-
- /* The folder type registry. */
- EFolderTypeRegistry *folder_type_registry;
+ /* The shell that is associated with these shortcuts. */
+ EShell *shell;
/* Total number of groups. */
int num_groups;
@@ -335,6 +332,7 @@ load_shortcuts (EShortcuts *shortcuts,
xmlChar *name;
xmlChar *type;
xmlChar *icon;
+ char *path;
if (strcmp ((char *) q->name, "item") != 0)
continue;
@@ -343,10 +341,10 @@ load_shortcuts (EShortcuts *shortcuts,
if (uri == NULL)
continue;
- if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0) {
+ if (e_shell_parse_uri (priv->shell, uri, &path, NULL)) {
EFolder *folder;
- folder = e_storage_set_get_folder (priv->storage_set, uri + E_SHELL_URI_PREFIX_LEN);
+ folder = e_storage_set_get_folder (e_shell_get_storage_set (priv->shell), path);
if (folder != NULL) {
name = xmlMemStrdup (e_folder_get_name (folder));
type = xmlMemStrdup (e_folder_get_type_string (folder));
@@ -512,7 +510,7 @@ update_shortcuts_by_path (EShortcuts *shortcuts,
gboolean changed = FALSE;
priv = shortcuts->priv;
- folder = e_storage_set_get_folder (priv->storage_set, path);
+ folder = e_storage_set_get_folder (e_shell_get_storage_set (priv->shell), path);
evolution_uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL);
@@ -623,7 +621,7 @@ storage_set_updated_folder_callback (EStorageSet *storage_set,
/* GtkObject methods. */
static void
-destroy (GtkObject *object)
+impl_destroy (GtkObject *object)
{
EShortcuts *shortcuts;
EShortcutsPrivate *priv;
@@ -633,12 +631,6 @@ destroy (GtkObject *object)
g_free (priv->file_name);
- if (priv->storage_set != NULL)
- gtk_object_unref (GTK_OBJECT (priv->storage_set));
-
- if (priv->folder_type_registry != NULL)
- gtk_object_unref (GTK_OBJECT (priv->folder_type_registry));
-
unload_shortcuts (shortcuts);
if (priv->save_idle_id != 0)
@@ -659,7 +651,7 @@ class_init (EShortcutsClass *klass)
GtkObjectClass *object_class;
object_class = (GtkObjectClass*) klass;
- object_class->destroy = destroy;
+ object_class->destroy = impl_destroy;
parent_class = gtk_type_class (gtk_object_get_type ());
@@ -743,35 +735,35 @@ init (EShortcuts *shortcuts)
priv = g_new (EShortcutsPrivate, 1);
priv->file_name = NULL;
- priv->storage_set = NULL;
priv->num_groups = 0;
priv->groups = NULL;
priv->views = NULL;
priv->dirty = 0;
priv->save_idle_id = 0;
+ priv->shell = NULL;
shortcuts->priv = priv;
}
void
-e_shortcuts_construct (EShortcuts *shortcuts,
- EStorageSet *storage_set,
- EFolderTypeRegistry *folder_type_registry)
+e_shortcuts_construct (EShortcuts *shortcuts,
+ EShell *shell)
{
EShortcutsPrivate *priv;
+ EStorageSet *storage_set;
- g_return_if_fail (shortcuts != NULL);
g_return_if_fail (E_IS_SHORTCUTS (shortcuts));
- g_return_if_fail (storage_set != NULL);
- g_return_if_fail (E_IS_STORAGE_SET (storage_set));
+ g_return_if_fail (E_IS_SHELL (shell));
GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (shortcuts), GTK_FLOATING);
priv = shortcuts->priv;
- gtk_object_ref (GTK_OBJECT (storage_set));
- priv->storage_set = storage_set;
+ /* Don't ref it so we don't create a circular dependency. */
+ priv->shell = shell;
+
+ storage_set = e_shell_get_storage_set (shell);
gtk_signal_connect_while_alive (GTK_OBJECT (storage_set), "new_folder",
GTK_SIGNAL_FUNC (storage_set_new_folder_callback),
@@ -779,23 +771,19 @@ e_shortcuts_construct (EShortcuts *shortcuts,
gtk_signal_connect_while_alive (GTK_OBJECT (storage_set), "updated_folder",
GTK_SIGNAL_FUNC (storage_set_updated_folder_callback),
shortcuts, GTK_OBJECT (shortcuts));
-
- gtk_object_ref (GTK_OBJECT (folder_type_registry));
- priv->folder_type_registry = folder_type_registry;
}
EShortcuts *
-e_shortcuts_new (EStorageSet *storage_set,
- EFolderTypeRegistry *folder_type_registry,
- const char *file_name)
+e_shortcuts_new_from_file (EShell *shell,
+ const char *file_name)
{
EShortcuts *new;
- g_return_val_if_fail (storage_set != NULL, NULL);
- g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL);
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+ g_return_val_if_fail (file_name != NULL, NULL);
new = gtk_type_new (e_shortcuts_get_type ());
- e_shortcuts_construct (new, storage_set, folder_type_registry);
+ e_shortcuts_construct (new, shell);
if (! e_shortcuts_load (new, file_name))
new->priv->file_name = g_strdup (file_name);
@@ -859,13 +847,13 @@ e_shortcuts_get_shortcuts_in_group (EShortcuts *shortcuts,
}
-EStorageSet *
-e_shortcuts_get_storage_set (EShortcuts *shortcuts)
+EShell *
+e_shortcuts_get_shell (EShortcuts *shortcuts)
{
g_return_val_if_fail (shortcuts != NULL, NULL);
g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL);
- return shortcuts->priv->storage_set;
+ return shortcuts->priv->shell;
}