From 8a9d50f560ee0d5d26c77b5868af2baa0ab0bb2f Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Tue, 3 Jul 2001 13:29:12 +0000 Subject: [The following makes the shell able to create the `shortcuts.xml' file by itself when the file is not present or corrupted. Fixes #3668, failure to handle malformed shortcuts.xml file.] * e-shell.c (e_shell_construct): If the `e_shortcuts_new()' returns an object with no shortcuts in it, fill it in with `e_shortcuts_add_default_group()'. * e-shortcuts.c: New member `num_groups' in EShortcutsPrivate. (init): Init to zero. (e_shortcuts_add_group): Increment. (e_shortcuts_remove_group): Decrement. (e_shortcuts_get_num_groups): New. (e_shortcuts_add_default_group): New function to set up the default shortcuts. (e_shortcuts_new): Return an empty EShortcuts object if loading the file files, instead of returning NULL. svn path=/trunk/; revision=10744 --- shell/e-shell.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'shell/e-shell.c') diff --git a/shell/e-shell.c b/shell/e-shell.c index 69ed651448..02b3cde7b2 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -826,9 +826,10 @@ e_shell_construct (EShell *shell, priv->shortcuts = e_shortcuts_new (priv->storage_set, priv->folder_type_registry, shortcut_path); + g_assert (priv->shortcuts != NULL); - if (priv->shortcuts == NULL) - g_warning ("Cannot load shortcuts -- %s", shortcut_path); + if (e_shortcuts_get_num_groups (priv->shortcuts) == 0) + e_shortcuts_add_default_group (priv->shortcuts); g_free (shortcut_path); -- cgit v1.2.3