aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-07-01 14:25:43 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-07-01 14:25:43 +0800
commit6077a94d84eb66bd81e52a92d3703db72ab5614a (patch)
treecd7b8aeb1acfbc4c7b6bc302cbe18c0400cbb5f4 /shell
parent3950295c0f8adbf2003eb84322fa6e7c8ba6af47 (diff)
downloadgsoc2013-evolution-6077a94d84eb66bd81e52a92d3703db72ab5614a.tar
gsoc2013-evolution-6077a94d84eb66bd81e52a92d3703db72ab5614a.tar.gz
gsoc2013-evolution-6077a94d84eb66bd81e52a92d3703db72ab5614a.tar.bz2
gsoc2013-evolution-6077a94d84eb66bd81e52a92d3703db72ab5614a.tar.lz
gsoc2013-evolution-6077a94d84eb66bd81e52a92d3703db72ab5614a.tar.xz
gsoc2013-evolution-6077a94d84eb66bd81e52a92d3703db72ab5614a.tar.zst
gsoc2013-evolution-6077a94d84eb66bd81e52a92d3703db72ab5614a.zip
Change EShortcuts to not use group titles to access specific groups.
Also, allow more than one group with the same title. svn path=/trunk/; revision=10652
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog17
-rw-r--r--shell/e-shortcuts-view-model.c5
-rw-r--r--shell/e-shortcuts.c29
-rw-r--r--shell/e-shortcuts.h14
4 files changed, 33 insertions, 32 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index bf1fa018c3..6cdc375c4a 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,22 @@
2001-07-01 Ettore Perazzoli <ettore@ximian.com>
+ * e-shortcuts.c: Removed `title_to_group' hash from
+ `EShortcutsPrivate'.
+ (init): Don't initialize it anymore.
+ (unload_shortcuts): Don't remove the groups from the hash, and
+ don't destroy/realloc the hash.
+ (load_shortcuts): Don't check for duplicate group names. Don't
+ add the groups to the hash.
+ (destroy): Don't free the hash.
+ (e_shortcuts_get_shortcuts_in_group): Changed to get a @group_num
+ instead of a @group_title.
+
+ * e-shortcuts-view-model.c (load_group_into_model): Updated to
+ pass the group number to `e_shortcuts_get_shortcuts_in_group()'.
+ Removed arg @group_title.
+
+2001-07-01 Ettore Perazzoli <ettore@ximian.com>
+
* e-shortcuts-view.c: Added a "Rename" right-click command.
(rename_shortcut_cb): New function, implementation for the "Rename
command".
diff --git a/shell/e-shortcuts-view-model.c b/shell/e-shortcuts-view-model.c
index f13971ac9a..15e1d3cec1 100644
--- a/shell/e-shortcuts-view-model.c
+++ b/shell/e-shortcuts-view-model.c
@@ -49,7 +49,6 @@ struct _EShortcutsViewModelPrivate {
static void
load_group_into_model (EShortcutsViewModel *shortcuts_view_model,
- const char *group_title,
int group_num)
{
EShortcutsViewModelPrivate *priv;
@@ -62,7 +61,7 @@ load_group_into_model (EShortcutsViewModel *shortcuts_view_model,
storage_set = e_shortcuts_get_storage_set (priv->shortcuts);
g_assert (storage_set != NULL);
- shortcut_list = e_shortcuts_get_shortcuts_in_group (priv->shortcuts, group_title);
+ shortcut_list = e_shortcuts_get_shortcuts_in_group (priv->shortcuts, group_num);
if (shortcut_list == NULL)
return;
@@ -92,7 +91,7 @@ load_all_shortcuts_into_model (EShortcutsViewModel *shortcuts_view_model)
group_title = (const char *) p->data;
group_num = e_shortcut_model_add_group (E_SHORTCUT_MODEL (shortcuts_view_model), -1, group_title);
- load_group_into_model (shortcuts_view_model, group_title, group_num);
+ load_group_into_model (shortcuts_view_model, group_num);
}
}
diff --git a/shell/e-shortcuts.c b/shell/e-shortcuts.c
index 1dff42e6f7..20d12cce2d 100644
--- a/shell/e-shortcuts.c
+++ b/shell/e-shortcuts.c
@@ -102,9 +102,6 @@ struct _EShortcutsPrivate {
/* A list of ShortcutViews. */
GSList *views;
-
- /* A hash table to get a group given its name. */
- GHashTable *title_to_group;
};
enum {
@@ -258,7 +255,6 @@ unload_shortcuts (EShortcuts *shortcuts)
group = (ShortcutGroup *) p->data;
- g_hash_table_remove (priv->title_to_group, group->title);
shortcut_group_free (group);
priv->groups = priv->groups->next;
@@ -268,9 +264,6 @@ unload_shortcuts (EShortcuts *shortcuts)
g_slist_free (orig_groups);
priv->groups = NULL;
-
- g_hash_table_destroy (priv->title_to_group);
- priv->title_to_group = g_hash_table_new (g_str_hash, g_str_equal);
}
static gboolean
@@ -309,14 +302,6 @@ load_shortcuts (EShortcuts *shortcuts,
if (shortcut_group_title == NULL)
continue;
- shortcut_group = g_hash_table_lookup (priv->title_to_group, shortcut_group_title);
- if (shortcut_group != NULL) {
- g_warning ("Duplicate shortcut group title -- %s",
- shortcut_group_title);
- xmlFree (shortcut_group_title);
- continue;
- }
-
shortcut_group = shortcut_group_new (shortcut_group_title);
xmlFree (shortcut_group_title);
@@ -353,7 +338,6 @@ load_shortcuts (EShortcuts *shortcuts,
shortcut_group->shortcuts = g_slist_reverse (shortcut_group->shortcuts);
priv->groups = g_slist_prepend (priv->groups, shortcut_group);
- g_hash_table_insert (priv->title_to_group, shortcut_group->title, shortcut_group);
}
priv->groups = g_slist_reverse (priv->groups);
@@ -611,8 +595,6 @@ destroy (GtkObject *object)
g_warning (_("Error saving shortcuts.")); /* FIXME */
}
- g_hash_table_destroy (priv->title_to_group);
-
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
@@ -690,7 +672,6 @@ init (EShortcuts *shortcuts)
priv->storage_set = NULL;
priv->groups = NULL;
priv->views = NULL;
- priv->title_to_group = g_hash_table_new (g_str_hash, g_str_equal);
priv->dirty = 0;
priv->save_idle_id = 0;
@@ -773,21 +754,23 @@ e_shortcuts_get_group_titles (EShortcuts *shortcuts)
const GSList *
e_shortcuts_get_shortcuts_in_group (EShortcuts *shortcuts,
- const char *group_title)
+ int group_num)
{
EShortcutsPrivate *priv;
ShortcutGroup *shortcut_group;
+ GSList *shortcut_group_list_item;
priv = shortcuts->priv;
g_return_val_if_fail (shortcuts != NULL, NULL);
g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL);
- g_return_val_if_fail (group_title != NULL, NULL);
- shortcut_group = g_hash_table_lookup (priv->title_to_group, group_title);
- if (shortcut_group == NULL)
+ shortcut_group_list_item = g_slist_nth (priv->groups, group_num);
+ if (shortcut_group_list_item == NULL)
return NULL;
+ shortcut_group = (ShortcutGroup *) shortcut_group_list_item->data;
+
return shortcut_group->shortcuts;
}
diff --git a/shell/e-shortcuts.h b/shell/e-shortcuts.h
index 8ccd552f87..8d08586c47 100644
--- a/shell/e-shortcuts.h
+++ b/shell/e-shortcuts.h
@@ -84,7 +84,8 @@ GSList *e_shortcuts_get_group_titles (EShortcuts *shortcuts);
const char *e_shortcuts_get_group_title (EShortcuts *shortcuts,
int group_num);
const GSList *e_shortcuts_get_shortcuts_in_group (EShortcuts *shortcuts,
- const char *group_title);
+ int group_num);
+
const EShortcutItem *e_shortcuts_get_shortcut (EShortcuts *shortcuts,
int group_num,
int num);
@@ -112,11 +113,12 @@ void e_shortcuts_update_shortcut (EShortcuts *shortcuts,
const char *uri,
const char *name,
const char *type);
-void e_shortcuts_remove_group (EShortcuts *shortcuts,
- int group_num);
-void e_shortcuts_add_group (EShortcuts *shortcuts,
- int group_num,
- const char *group_name);
+
+void e_shortcuts_remove_group (EShortcuts *shortcuts,
+ int group_num);
+void e_shortcuts_add_group (EShortcuts *shortcuts,
+ int group_num,
+ const char *group_name);
#ifdef __cplusplus
}