aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-07-09 23:20:54 +0800
committerDan Winship <danw@src.gnome.org>2001-07-09 23:20:54 +0800
commit7fa7518bd69dab32b11b7fa53b8b4055873cc5bb (patch)
tree494ebc92793511e3139fdafa0c9cd236ca3e2ae0
parentb9578e485877ed6864aab9bfc84e72cf79c4667d (diff)
downloadgsoc2013-evolution-7fa7518bd69dab32b11b7fa53b8b4055873cc5bb.tar
gsoc2013-evolution-7fa7518bd69dab32b11b7fa53b8b4055873cc5bb.tar.gz
gsoc2013-evolution-7fa7518bd69dab32b11b7fa53b8b4055873cc5bb.tar.bz2
gsoc2013-evolution-7fa7518bd69dab32b11b7fa53b8b4055873cc5bb.tar.lz
gsoc2013-evolution-7fa7518bd69dab32b11b7fa53b8b4055873cc5bb.tar.xz
gsoc2013-evolution-7fa7518bd69dab32b11b7fa53b8b4055873cc5bb.tar.zst
gsoc2013-evolution-7fa7518bd69dab32b11b7fa53b8b4055873cc5bb.zip
Return a gboolean saying whether or not the shortcut changed. Use strcmp
* e-shortcuts.c (shortcut_item_update): Return a gboolean saying whether or not the shortcut changed. Use strcmp rather than pointer comparisons to determine this. (update_shortcut_and_emit_signal): propagate the gboolean from shortcut_item_update (and only emit the signal if it's TRUE). (update_shortcuts_by_path): Only call make_dirty if something changed. (storage_set_new_folder_callback, storage_set_updated_folder_callback): Don't call make_dirty: update_shortcuts_by_path will have called it if necessary. * e-shell-view.c (updated_folder_cb): Don't call update_for_current_uri if the folder that was updated isn't the one being displayed. svn path=/trunk/; revision=10912
-rw-r--r--shell/ChangeLog17
-rw-r--r--shell/e-shell-view.c5
-rw-r--r--shell/e-shortcuts.c47
3 files changed, 52 insertions, 17 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 4e864d755a..f5dbae568a 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,20 @@
+2001-07-06 Dan Winship <danw@ximian.com>
+
+ * e-shortcuts.c (shortcut_item_update): Return a gboolean saying
+ whether or not the shortcut changed. Use strcmp rather than
+ pointer comparisons to determine this.
+ (update_shortcut_and_emit_signal): propagate the gboolean from
+ shortcut_item_update (and only emit the signal if it's TRUE).
+ (update_shortcuts_by_path): Only call make_dirty if something
+ changed.
+ (storage_set_new_folder_callback,
+ storage_set_updated_folder_callback): Don't call make_dirty:
+ update_shortcuts_by_path will have called it if necessary.
+
+ * e-shell-view.c (updated_folder_cb): Don't call
+ update_for_current_uri if the folder that was updated isn't the
+ one being displayed.
+
2001-07-06 Jason Leach <jleach@ximian.com>
* e-shortcuts-view.c: Little UI tweak for right click menu,
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 03906a20d3..c8385ebbc4 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -1122,6 +1122,7 @@ updated_folder_cb (EStorageSet *storage_set,
{
EShellView *shell_view;
EShellViewPrivate *priv;
+ const char *view_path;
shell_view = E_SHELL_VIEW (data);
priv = shell_view->priv;
@@ -1134,6 +1135,10 @@ updated_folder_cb (EStorageSet *storage_set,
g_free (uri);
#endif
+ view_path = get_storage_set_path_from_uri (priv->uri);
+ if (strcmp (path, view_path) != 0)
+ return;
+
/* Update the folder title bar and the window title bar */
update_for_current_uri (shell_view);
}
diff --git a/shell/e-shortcuts.c b/shell/e-shortcuts.c
index 2942cdd75f..b19336a988 100644
--- a/shell/e-shortcuts.c
+++ b/shell/e-shortcuts.c
@@ -141,29 +141,39 @@ shortcut_item_new (const char *uri,
return new;
}
-static void
+static gboolean
shortcut_item_update (EShortcutItem *shortcut_item,
const char *uri,
const char *name,
const char *type)
{
+ gboolean changed = FALSE;
+
if (name == NULL)
name = g_basename (uri);
- if (shortcut_item->uri != uri) {
+ if (shortcut_item->uri == NULL || uri == NULL ||
+ strcmp (shortcut_item->uri, uri) != 0) {
g_free (shortcut_item->uri);
shortcut_item->uri = g_strdup (uri);
+ changed = TRUE;
}
- if (shortcut_item->name != name) {
+ if (shortcut_item->name == NULL || name == NULL ||
+ strcmp (shortcut_item->name, name) != 0) {
g_free (shortcut_item->name);
shortcut_item->name = g_strdup (name);
+ changed = TRUE;
}
- if (shortcut_item->type != type) {
+ if (shortcut_item->type == NULL || type == NULL ||
+ strcmp (shortcut_item->type, type) != 0) {
g_free (shortcut_item->type);
shortcut_item->type = g_strdup (type);
+ changed = TRUE;
}
+
+ return changed;
}
static void
@@ -205,7 +215,7 @@ shortcut_group_free (ShortcutGroup *group)
/* Utility functions. */
-static void
+static gboolean
update_shortcut_and_emit_signal (EShortcuts *shortcuts,
EShortcutItem *shortcut_item,
int group_num,
@@ -214,8 +224,11 @@ update_shortcut_and_emit_signal (EShortcuts *shortcuts,
const char *name,
const char *type)
{
- shortcut_item_update (shortcut_item, uri, name, type);
- gtk_signal_emit (GTK_OBJECT (shortcuts), signals[UPDATE_SHORTCUT], group_num, num);
+ if (shortcut_item_update (shortcut_item, uri, name, type)) {
+ gtk_signal_emit (GTK_OBJECT (shortcuts), signals[UPDATE_SHORTCUT], group_num, num);
+ return TRUE;
+ } else
+ return FALSE;
}
static void
@@ -464,6 +477,7 @@ update_shortcuts_by_path (EShortcuts *shortcuts,
const GSList *p, *q;
char *evolution_uri;
int group_num, num;
+ gboolean changed = FALSE;
priv = shortcuts->priv;
folder = e_storage_set_get_folder (priv->storage_set, path);
@@ -482,19 +496,20 @@ update_shortcuts_by_path (EShortcuts *shortcuts,
shortcut_item = (EShortcutItem *) q->data;
if (strcmp (shortcut_item->uri, evolution_uri) == 0)
- update_shortcut_and_emit_signal (shortcuts,
- shortcut_item,
- group_num,
- num,
- evolution_uri,
- NULL,
- e_folder_get_type_string (folder));
+ changed = update_shortcut_and_emit_signal (shortcuts,
+ shortcut_item,
+ group_num,
+ num,
+ evolution_uri,
+ NULL,
+ e_folder_get_type_string (folder));
}
}
g_free (evolution_uri);
- make_dirty (shortcuts);
+ if (changed)
+ make_dirty (shortcuts);
}
@@ -555,7 +570,6 @@ storage_set_new_folder_callback (EStorageSet *storage_set,
shortcuts = E_SHORTCUTS (data);
update_shortcuts_by_path (shortcuts, path);
- make_dirty (shortcuts);
}
static void
@@ -568,7 +582,6 @@ storage_set_updated_folder_callback (EStorageSet *storage_set,
shortcuts = E_SHORTCUTS (data);
update_shortcuts_by_path (shortcuts, path);
- make_dirty (shortcuts);
}