From 7542d81fcf7d8c076d87320de3f17c1afefaf3b0 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Thu, 23 Jan 2003 17:09:33 +0000 Subject: [Port fix for #34129 from evolution-1-2-branch, unread count in shortcut bar doesn't update properly.] * e-shortcuts.c (update_shortcuts_by_path): Use e_shell_parse_uri() so we handle default shortcuts properly as well. (update_shortcut_and_emit_signal): Use shortcut_item_update() once, and use the return value from it. [Thanks to Leon Zhang for pointing out the brokenness of this code.] svn path=/trunk/; revision=19585 --- shell/ChangeLog | 13 +++++++++++++ shell/e-shortcuts.c | 29 +++++++++++++++-------------- 2 files changed, 28 insertions(+), 14 deletions(-) (limited to 'shell') diff --git a/shell/ChangeLog b/shell/ChangeLog index 364e2eccaa..b98cc6c90c 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,16 @@ +2002-01-23 Ettore Perazzoli + + [Port fix for #34129 from evolution-1-2-branch, unread count in + shortcut bar doesn't update properly.] + + * e-shortcuts.c (update_shortcuts_by_path): Use + e_shell_parse_uri() so we handle default shortcuts properly as + well. + (update_shortcut_and_emit_signal): Use shortcut_item_update() + once, and use the return value from it. [Thanks to Leon Zhang + for pointing out the brokenness of this + code.] + 2003-01-23 Ettore Perazzoli * e-shell-about-box.c: Update copyright year. diff --git a/shell/e-shortcuts.c b/shell/e-shortcuts.c index e37104612f..5f43f8c315 100644 --- a/shell/e-shortcuts.c +++ b/shell/e-shortcuts.c @@ -238,22 +238,15 @@ update_shortcut_and_emit_signal (EShortcuts *shortcuts, const char *type, const char *custom_icon_name) { - /* Only thing that changed was the unread count */ - if (shortcut_item->unread_count != unread_count - && !shortcut_item_update (shortcut_item, uri, name, unread_count, type, custom_icon_name)) { - g_signal_emit (shortcuts, signals[UPDATE_SHORTCUT], 0, group_num, num); - return FALSE; - } + gboolean shortcut_changed; - /* Unread count is the same, but other stuff changed */ - else if (shortcut_item_update (shortcut_item, uri, name, unread_count, type, custom_icon_name)) { - g_signal_emit (shortcuts, signals[UPDATE_SHORTCUT], 0, group_num, num); + shortcut_changed = shortcut_item_update (shortcut_item, uri, name, unread_count, type, custom_icon_name); + if (shortcut_changed) { + gtk_signal_emit (GTK_OBJECT (shortcuts), signals[UPDATE_SHORTCUT], group_num, num); return TRUE; } - /* Nothing at all changed, return false only */ - else - return FALSE; + return FALSE; } static void @@ -527,20 +520,28 @@ update_shortcuts_by_path (EShortcuts *shortcuts, num = 0; for (q = group->shortcuts; q != NULL; q = q->next, num++) { EShortcutItem *shortcut_item; + char *shortcut_path; shortcut_item = (EShortcutItem *) q->data; - if (strcmp (shortcut_item->uri, evolution_uri) == 0) { + if (! e_shell_parse_uri (priv->shell, shortcut_item->uri, &shortcut_path, NULL)) { + /* Ignore bogus URIs. */ + continue; + } + + if (strcmp (shortcut_path, path) == 0) { changed = update_shortcut_and_emit_signal (shortcuts, shortcut_item, group_num, num, - evolution_uri, + shortcut_item->uri, shortcut_item->name, e_folder_get_unread_count (folder), e_folder_get_type_string (folder), e_folder_get_custom_icon_name (folder)); } + + g_free (shortcut_path); } } -- cgit v1.2.3