aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-config.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/mail-config.c')
-rw-r--r--mail/mail-config.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 74dbdaf27c..a406ba1367 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -1455,26 +1455,29 @@ add_shortcut_entry (const char *name, const char *uri, const char *type)
GNOME_Evolution_Shortcuts_Group *the_group;
GNOME_Evolution_Shortcuts_Shortcut *the_shortcut;
int i, group_num;
-
+
+ if (!global_shell_client)
+ return;
+
CORBA_exception_init (&ev);
-
+
shortcuts_interface = evolution_shell_client_get_shortcuts_interface (global_shell_client);
if (CORBA_Object_is_nil (shortcuts_interface, &ev)) {
g_warning ("No ::Shortcut interface on the shell");
CORBA_exception_free (&ev);
return;
}
-
+
groups = GNOME_Evolution_Shortcuts__get_groups (shortcuts_interface, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Exception getting the groups: %s", ev._repo_id);
CORBA_exception_free (&ev);
return;
}
-
+
the_group = NULL;
group_num = 0;
-
+
for (i = 0; i < groups->_length; i++) {
GNOME_Evolution_Shortcuts_Group *iter;
@@ -1485,33 +1488,33 @@ add_shortcut_entry (const char *name, const char *uri, const char *type)
break;
}
}
-
+
if (the_group == NULL) {
/* Bleah, just create it. Probably not the best
* course of action. */
-
+
GNOME_Evolution_Shortcuts_addGroup (shortcuts_interface,
group_num,
"Evolution Shortcuts",
&ev);
-
+
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Exception recreating \"Evolution Shortcuts\" group: %s", ev._repo_id);
goto cleanup;
}
-
+
the_group = GNOME_Evolution_Shortcuts_getGroup (shortcuts_interface,
group_num,
&ev);
-
+
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Exception getting newly created \"Evolution Shortcuts\" group: %s", ev._repo_id);
goto cleanup;
}
}
-
+
the_shortcut = NULL;
-
+
for (i = 0; i < the_group->shortcuts._length; i++) {
GNOME_Evolution_Shortcuts_Shortcut *iter;
@@ -1521,30 +1524,29 @@ add_shortcut_entry (const char *name, const char *uri, const char *type)
break;
}
}
-
+
if (the_shortcut == NULL) {
the_shortcut =
GNOME_Evolution_Shortcuts_Shortcut__alloc ();
-
+
the_shortcut->name = CORBA_string_dup (name);
the_shortcut->uri = CORBA_string_dup (uri);
the_shortcut->type = CORBA_string_dup (type);
-
+
GNOME_Evolution_Shortcuts_add (shortcuts_interface,
group_num,
the_group->shortcuts._length,
the_shortcut,
&ev);
-
+
CORBA_free (the_shortcut);
-
+
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("Exception creating shortcut \"%s\": %s", name, ev._repo_id);
goto cleanup;
}
-
- }
-
+ }
+
cleanup:
CORBA_exception_free (&ev);
CORBA_free (groups);