(Fixing bug #1299: Shell saves shortcuts when display name changes)

2001-06-04  Jason Leach  <jleach@ximian.com>

	(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
This commit is contained in:
Jason Leach
2001-06-05 17:10:32 +00:00
committed by Jacob Leach
parent bd19a9d79d
commit 8f366de2a4
5 changed files with 70 additions and 12 deletions

View File

@ -1,3 +1,19 @@
2001-06-04 Jason Leach <jleach@ximian.com>
(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 <ettore@ximian.com>
* Makefile.am (evolution_LDADD): Move `$(DB3_LDADD)' before

View File

@ -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

View File

@ -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 *

View File

@ -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);
}

View File

@ -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);
};