aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shortcuts.c
diff options
context:
space:
mode:
authorJason Leach <jasonleach@usa.net>2001-01-19 15:36:55 +0800
committerJacob Leach <jleach@src.gnome.org>2001-01-19 15:36:55 +0800
commitfb06ffa383cd7f2398ff9332438d78a4921b5fc1 (patch)
tree12c046a50be55304bafb5a7ed577a826e1344ddb /shell/e-shortcuts.c
parent788351db0a44bbbb19c2bc4b3962e5abfd001c69 (diff)
downloadgsoc2013-evolution-fb06ffa383cd7f2398ff9332438d78a4921b5fc1.tar
gsoc2013-evolution-fb06ffa383cd7f2398ff9332438d78a4921b5fc1.tar.gz
gsoc2013-evolution-fb06ffa383cd7f2398ff9332438d78a4921b5fc1.tar.bz2
gsoc2013-evolution-fb06ffa383cd7f2398ff9332438d78a4921b5fc1.tar.lz
gsoc2013-evolution-fb06ffa383cd7f2398ff9332438d78a4921b5fc1.tar.xz
gsoc2013-evolution-fb06ffa383cd7f2398ff9332438d78a4921b5fc1.tar.zst
gsoc2013-evolution-fb06ffa383cd7f2398ff9332438d78a4921b5fc1.zip
(Bug #883: Shortcut bar does not update when a folders display name
2001-01-17 Jason Leach <jasonleach@usa.net> (Bug #883: Shortcut bar does not update when a folders display name changes) * e-local-storage.c (class_init): Define a new "folder_updated" signal here. (bonobo_interface_update_folder_cb): Emit the new folder_updated signal here. * e-shell-view.c (e_shell_view_construct): Connect the EShell::ELocalStorage folder_updated signal here. Also connect the updated_folder signal coming from EShell::EStorageSet to the new callback. * e-shell-view.c (folder_updated_cb): Callback that actually initiates the shell updating. * e-shortcuts.c (e_shortcuts_update_shortcut_by_uri): New function. Given a uri for a shortcut bar item, we'll update it. * e-shortcuts.c (e_shortcuts_remove_shortcut_by_uri): New function. Given a uri for a shortcut bar item, we'll remove it. * e-shortcuts.c (removed_folder_cb): Connect this callback that will remove a renamed vfolder from the shortcut bar. Temporary fix to the problem of renaming vfolders and having the shortcut bar think the old vfolder still exists. (Bug #1168: Shortcut bar and icon size persistence) * e-shell-view.c (save_shortcut_bar_icon_modes): New static function, save the icon modes (for all shortcut bar groups, even though we only have one group now). (load_shortcut_bar_icon_modes): New static function, load the saved shortcut bar group icon modes and apply them to our shortcut bar. svn path=/trunk/; revision=7639
Diffstat (limited to 'shell/e-shortcuts.c')
-rw-r--r--shell/e-shortcuts.c126
1 files changed, 126 insertions, 0 deletions
diff --git a/shell/e-shortcuts.c b/shell/e-shortcuts.c
index 4719f3965c..63d9480f00 100644
--- a/shell/e-shortcuts.c
+++ b/shell/e-shortcuts.c
@@ -58,6 +58,7 @@
#include "e-shortcuts-view.h"
#include "e-shortcuts.h"
+#include "e-shell-constants.h"
#define PARENT_TYPE GTK_TYPE_OBJECT
@@ -312,6 +313,22 @@ make_dirty (EShortcuts *shortcuts)
schedule_idle (shortcuts);
}
+/* Signal handlers for the storage set */
+static void
+removed_folder_cb (EStorageSet *storage_set,
+ const char *path,
+ void *data)
+{
+ EShortcuts *shortcuts;
+ char *tmp;
+
+ shortcuts = E_SHORTCUTS (data);
+
+ tmp = g_strconcat (E_SHELL_URI_PREFIX, path, NULL);
+ e_shortcuts_remove_shortcut_by_uri (shortcuts, tmp);
+ g_free (tmp);
+}
+
/* Signal handlers for the views. */
@@ -454,6 +471,9 @@ e_shortcuts_construct (EShortcuts *shortcuts,
gtk_object_ref (GTK_OBJECT (storage_set));
priv->storage_set = storage_set;
+ gtk_signal_connect (GTK_OBJECT (priv->storage_set), "removed_folder",
+ removed_folder_cb, shortcuts);
+
gtk_object_ref (GTK_OBJECT (folder_type_registry));
priv->folder_type_registry = folder_type_registry;
}
@@ -708,6 +728,112 @@ e_shortcuts_add_shortcut (EShortcuts *shortcuts,
}
void
+e_shortcuts_update_shortcut (EShortcuts *shortcuts,
+ int group_num,
+ int num,
+ const char *uri)
+{
+ g_return_if_fail (shortcuts != NULL);
+ g_return_if_fail (E_IS_SHORTCUTS (shortcuts));
+
+ /* FIXME: need support in e-shortcut-bar widget (and also
+ e-icon-bar) to be able to "update" a shortcut without doing
+ this lame remove then add */
+
+ e_shortcuts_remove_shortcut (shortcuts, group_num, num);
+ e_shortcuts_add_shortcut (shortcuts, group_num, num, uri);
+}
+
+
+/* The shortcuts_by_uri functions */
+
+
+typedef struct {
+ int group_num;
+ int num;
+} EShortcutPosition;
+
+static GList *
+find_positions_by_uri (EShortcuts *shortcuts,
+ const char *uri)
+{
+ EShortcutsPrivate *priv;
+ GList *p = NULL, *q = NULL;
+ GList *retval = NULL;
+ int group_num = 0, num = 0;
+
+ priv = shortcuts->priv;
+
+ for (p = priv->groups; p != NULL; p = p->next) {
+ ShortcutGroup *group;
+
+ group = (ShortcutGroup *) p->data;
+
+ for (q = group->shortcuts; q != NULL; q = q->next) {
+ char *listeduri = q->data;
+
+ if (!strcmp (uri, listeduri)) {
+ EShortcutPosition *position;
+
+ position = g_new (EShortcutPosition, 1);
+ position->group_num = group_num;
+ position->num = num;
+
+ retval = g_list_append (retval, position);
+ }
+ num++;
+ }
+
+ group_num++;
+ num = 0;
+ }
+
+ return g_list_first (retval);
+}
+
+void
+e_shortcuts_remove_shortcut_by_uri (EShortcuts *shortcuts,
+ const char *uri)
+{
+ GList *items = NULL;
+
+ items = find_positions_by_uri (shortcuts, uri);
+
+ while (items) {
+ EShortcutPosition *pos = (EShortcutPosition *) items->data;
+
+ if (pos) {
+ e_shortcuts_remove_shortcut (shortcuts, pos->group_num, pos->num);
+ g_free (pos);
+ }
+ items = g_list_next (items);
+ }
+ g_list_free (items);
+}
+
+void
+e_shortcuts_update_shortcut_by_uri (EShortcuts *shortcuts,
+ const char *uri)
+{
+ GList *items = NULL;
+
+ items = find_positions_by_uri (shortcuts, uri);
+
+ while (items) {
+ EShortcutPosition *pos = (EShortcutPosition *) items->data;
+
+ if (pos) {
+ e_shortcuts_update_shortcut (shortcuts,
+ pos->group_num, pos->num,
+ uri);
+ g_free (pos);
+ }
+ items = g_list_next (items);
+ }
+ g_list_free (items);
+}
+
+void
e_shortcuts_remove_group (EShortcuts *shortcuts,
int group_num)
{