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-shortcuts.h | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'shell/e-shortcuts.h') diff --git a/shell/e-shortcuts.h b/shell/e-shortcuts.h index 2a9836e2a0..aea29de23d 100644 --- a/shell/e-shortcuts.h +++ b/shell/e-shortcuts.h @@ -82,6 +82,8 @@ EShortcuts *e_shortcuts_new (EStorageSet *storage_s EFolderTypeRegistry *folder_type_registry, const char *file_name); +int e_shortcuts_get_num_groups (EShortcuts *shortcuts); + GSList *e_shortcuts_get_group_titles (EShortcuts *shortcuts); const char *e_shortcuts_get_group_title (EShortcuts *shortcuts, int group_num); @@ -100,21 +102,23 @@ gboolean e_shortcuts_load (EShortcuts *shortcuts gboolean e_shortcuts_save (EShortcuts *shortcuts, const char *path); -void e_shortcuts_remove_shortcut (EShortcuts *shortcuts, - int group_num, - int num); -void e_shortcuts_add_shortcut (EShortcuts *shortcuts, - int group_num, - int num, - const char *uri, - const char *name, - const char *type); -void e_shortcuts_update_shortcut (EShortcuts *shortcuts, - int group_num, - int num, - const char *uri, - const char *name, - const char *type); +void e_shortcuts_add_default_group (EShortcuts *shortcuts); + +void e_shortcuts_remove_shortcut (EShortcuts *shortcuts, + int group_num, + int num); +void e_shortcuts_add_shortcut (EShortcuts *shortcuts, + int group_num, + int num, + const char *uri, + const char *name, + const char *type); +void e_shortcuts_update_shortcut (EShortcuts *shortcuts, + int group_num, + int num, + const char *uri, + const char *name, + const char *type); void e_shortcuts_remove_group (EShortcuts *shortcuts, int group_num); -- cgit