From 8f366de2a4fb5c5bddab80667a821c1acee91c21 Mon Sep 17 00:00:00 2001 From: Jason Leach Date: Tue, 5 Jun 2001 17:10:32 +0000 Subject: (Fixing bug #1299: Shell saves shortcuts when display name changes) 2001-06-04 Jason Leach (Fixing bug #1299: Shell saves shortcuts when display name changes) * e-shortcuts.c (class_init): New signal: "update_shortcut". * e-shortcuts-view-model.c (e_shortcuts_view_model_construct): Connect thew new signal here. * e-shortcuts-view-model.c (shortcuts_update_shortcut_cb): New function, uses the new e_shortcut_model_update_item(). * e-shell-view.c (corba_interface_set_folder_bar_label): Fix a warning here. svn path=/trunk/; revision=10116 --- shell/ChangeLog | 16 ++++++++++++++++ shell/e-shell-view.c | 12 ++++++------ shell/e-shortcuts-view-model.c | 35 +++++++++++++++++++++++++++++++++++ shell/e-shortcuts.c | 18 ++++++++++++------ shell/e-shortcuts.h | 1 + 5 files changed, 70 insertions(+), 12 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index 09102685a9..15652e0b15 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,19 @@ +2001-06-04 Jason Leach + + (Fixing bug #1299: Shell saves shortcuts when display name + changes) + + * e-shortcuts.c (class_init): New signal: "update_shortcut". + + * e-shortcuts-view-model.c (e_shortcuts_view_model_construct): + Connect thew new signal here. + + * e-shortcuts-view-model.c (shortcuts_update_shortcut_cb): New + function, uses the new e_shortcut_model_update_item(). + + * e-shell-view.c (corba_interface_set_folder_bar_label): Fix a + warning here. + 2001-06-03 Ettore Perazzoli * Makefile.am (evolution_LDADD): Move `$(DB3_LDADD)' before diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 7166a50454..7c2814de8b 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -1083,8 +1083,8 @@ corba_interface_change_current_view_cb (EvolutionShellView *shell_view, static void corba_interface_set_title (EvolutionShellView *shell_view, - const char *title, - void *data) + const char *title, + void *data) { EShellView *view; @@ -1096,9 +1096,9 @@ corba_interface_set_title (EvolutionShellView *shell_view, } static void -corba_interface_set_folder_bar_label (EvolutionShellView *shell_view, - const char *text, - void *data) +corba_interface_set_folder_bar_label (EvolutionShellView *evolution_shell_view, + const char *text, + void *data) { EShellView *shell_view; EShellViewPrivate *priv; @@ -1110,7 +1110,7 @@ corba_interface_set_folder_bar_label (EvolutionShellView *shell_view, priv = shell_view->priv; e_shell_folder_title_bar_set_folder_bar_label (E_SHELL_FOLDER_TITLE_BAR (priv->view_title_bar), - text); + text); } static void diff --git a/shell/e-shortcuts-view-model.c b/shell/e-shortcuts-view-model.c index 72afd70497..36625e2bfe 100644 --- a/shell/e-shortcuts-view-model.c +++ b/shell/e-shortcuts-view-model.c @@ -208,6 +208,38 @@ shortcuts_remove_shortcut_cb (EShortcuts *shortcuts, e_shortcut_model_remove_item (E_SHORTCUT_MODEL (shortcuts_view_model), group_num, item_num); } +static void +shortcuts_update_shortcut_cb (EShortcuts *shortcuts, + int group_num, + int item_num, + void *data) +{ + EShortcutsViewModel *shortcuts_view_model; + EShortcutsViewModelPrivate *priv; + EStorageSet *storage_set; + EFolder *folder; + const char *uri; + const char *storage_set_path; + const char *folder_name; + + shortcuts_view_model = E_SHORTCUTS_VIEW_MODEL (data); + priv = shortcuts_view_model->priv; + + uri = e_shortcuts_get_uri (priv->shortcuts, group_num, item_num); + g_assert (uri != NULL); + + storage_set_path = get_storage_set_path_from_uri (uri); + if (storage_set_path == NULL) + return; + + storage_set = e_shortcuts_get_storage_set (priv->shortcuts); + folder = e_storage_set_get_folder (storage_set, storage_set_path); + folder_name = e_folder_get_name (folder); + + e_shortcut_model_update_item (E_SHORTCUT_MODEL (shortcuts_view_model), + group_num, item_num, uri, folder_name); +} + /* GtkObject methods. */ @@ -277,6 +309,9 @@ e_shortcuts_view_model_construct (EShortcutsViewModel *model, gtk_signal_connect_while_alive (GTK_OBJECT (priv->shortcuts), "remove_shortcut", GTK_SIGNAL_FUNC (shortcuts_remove_shortcut_cb), model, GTK_OBJECT (model)); + gtk_signal_connect_while_alive (GTK_OBJECT (priv->shortcuts), + "update_shortcut", GTK_SIGNAL_FUNC (shortcuts_update_shortcut_cb), model, + GTK_OBJECT (model)); } EShortcutsViewModel * diff --git a/shell/e-shortcuts.c b/shell/e-shortcuts.c index 5fae9cfb9d..3317dd4835 100644 --- a/shell/e-shortcuts.c +++ b/shell/e-shortcuts.c @@ -112,6 +112,7 @@ enum { REMOVE_GROUP, NEW_SHORTCUT, REMOVE_SHORTCUT, + UPDATE_SHORTCUT, LAST_SIGNAL }; @@ -435,6 +436,16 @@ class_init (EShortcutsClass *klass) GTK_TYPE_INT, GTK_TYPE_INT); + signals[UPDATE_SHORTCUT] + = gtk_signal_new ("update_shortcut", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EShortcutsClass, update_shortcut), + gtk_marshal_NONE__INT_INT, + GTK_TYPE_NONE, 2, + GTK_TYPE_INT, + GTK_TYPE_INT); + gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); } @@ -741,13 +752,8 @@ e_shortcuts_update_shortcut (EShortcuts *shortcuts, { 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); + gtk_signal_emit (GTK_OBJECT (shortcuts), signals[UPDATE_SHORTCUT], group_num, num); } diff --git a/shell/e-shortcuts.h b/shell/e-shortcuts.h index bd7ed54080..2abbf6bb7f 100644 --- a/shell/e-shortcuts.h +++ b/shell/e-shortcuts.h @@ -60,6 +60,7 @@ struct _EShortcutsClass { void (* remove_group) (EShortcuts *shortcuts, int group_num); void (* new_shortcut) (EShortcuts *shortcuts, int group_num, int item_num); void (* remove_shortcut) (EShortcuts *shortcuts, int group_num, int item_num); + void (* update_shortcut) (EShortcuts *shortcuts, int group_num, int item_num); }; -- cgit v1.2.3