aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2000-09-26 03:11:15 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2000-09-26 03:11:15 +0800
commita75e971a552b0e4138ce901fd33d50d45319c919 (patch)
tree85d6d9350bc2eb1d1495343051b463f93290020b /shell
parent72fff3213ae1221b3c13841cb43df39f963efb1f (diff)
downloadgsoc2013-evolution-a75e971a552b0e4138ce901fd33d50d45319c919.tar.gz
gsoc2013-evolution-a75e971a552b0e4138ce901fd33d50d45319c919.tar.zst
gsoc2013-evolution-a75e971a552b0e4138ce901fd33d50d45319c919.zip
Update the shortcut bar in the shell view to match the changes in the
way drag and drop is handled. Separate the handling for the view into a separate object. This should make the shortcut bar work again, but it's untested. svn path=/trunk/; revision=5575
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog17
-rw-r--r--shell/Makefile.am2
-rw-r--r--shell/e-shortcuts-view-model.c296
-rw-r--r--shell/e-shortcuts-view-model.h67
-rw-r--r--shell/e-shortcuts-view.c184
-rw-r--r--shell/e-shortcuts.c20
-rw-r--r--shell/e-shortcuts.h3
7 files changed, 431 insertions, 158 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index f127aff6b0..c401a3e5d5 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,20 @@
+2000-09-25 Ettore Perazzoli <ettore@helixcode.com>
+
+ * e-shortcuts-view.c (item_selected): Renamed from
+ `selected_item'.
+ (class_init): Updated accordingly.
+ (impl_shortcut_dropped): New function, implementation for
+ `EShortcutBar::shortcut_dropped'.
+ (impl_shortcut_dragged): New function, implementation for
+ `EShortcutBar::shortcut_dragged'.
+ (e_shortcuts_view_construct): Update to use EShortcutsViewModel.
+ (class_init): Install them.
+
+ * e-shortcuts.c (e_shortcuts_get_group_title): New.
+
+ * e-shortcuts-view-model.c: New.
+ * e-shortcuts-view-model.h: New.
+
2000-09-24 Ettore Perazzoli <ettore@helixcode.com>
* e-shell.c (setup_local_storage): Don't unref the local storage.
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 9928d52774..f68b15bc75 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -102,6 +102,8 @@ evolution_SOURCES = \
e-shell-view.h \
e-shell.c \
e-shell.h \
+ e-shortcuts-view-model.c \
+ e-shortcuts-view-model.h \
e-shortcuts-view.c \
e-shortcuts-view.h \
e-shortcuts.c \
diff --git a/shell/e-shortcuts-view-model.c b/shell/e-shortcuts-view-model.c
new file mode 100644
index 0000000000..c37e45092c
--- /dev/null
+++ b/shell/e-shortcuts-view-model.c
@@ -0,0 +1,296 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-shortcuts-view-model.c
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Ettore Perazzoli
+ */
+
+/* FIXME. This really sucks. We are using the model/view approach in the
+ dumbest possible way. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gnome.h>
+#include <gal/util/e-util.h>
+
+#include "e-shortcuts-view-model.h"
+
+
+#define PARENT_TYPE e_shortcut_model_get_type ()
+static EShortcutModelClass *parent_class = NULL;
+
+struct _EShortcutsViewModelPrivate {
+ EShortcuts *shortcuts;
+};
+
+
+/* View initialization. */
+
+static const char *
+get_storage_set_path_from_uri (const char *uri)
+{
+ const char *colon;
+
+ if (g_path_is_absolute (uri))
+ return NULL;
+
+ colon = strchr (uri, ':');
+ if (colon == NULL || colon == uri || colon[1] == '\0')
+ return NULL;
+
+ if (! g_path_is_absolute (colon + 1))
+ return NULL;
+
+ if (g_strncasecmp (uri, "evolution", colon - uri) != 0)
+ return NULL;
+
+ return colon + 1;
+}
+
+static void
+load_group_into_model (EShortcutsViewModel *shortcuts_view_model,
+ const char *group_title,
+ int group_num)
+{
+ EShortcutsViewModelPrivate *priv;
+ EStorageSet *storage_set;
+ GList *shortcut_list;
+ GList *p;
+
+ priv = shortcuts_view_model->priv;
+
+ 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);
+ if (shortcut_list == NULL)
+ return;
+
+ for (p = shortcut_list; p != NULL; p = p->next) {
+ EFolder *folder;
+ const char *path;
+ const char *uri;
+ const char *name;
+
+ uri = (const char *) p->data;
+ path = get_storage_set_path_from_uri (uri);
+ if (path != NULL)
+ folder = e_storage_set_get_folder (storage_set, path);
+
+ if (path == NULL || folder == NULL) {
+ /* FIXME */
+ g_warning ("Invalid link while loading shortcut bar view -- %s\n",
+ uri);
+ continue;
+ }
+
+ name = e_folder_get_name (folder);
+ e_shortcut_model_add_item (E_SHORTCUT_MODEL (shortcuts_view_model), group_num, -1, uri, name);
+ }
+
+ e_free_string_list (shortcut_list);
+}
+
+static void
+load_all_shortcuts_into_model (EShortcutsViewModel *shortcuts_view_model)
+{
+ EShortcutsViewModelPrivate *priv;
+ GList *group_titles;
+ GList *p;
+ int group_num;
+
+ priv = shortcuts_view_model->priv;
+
+ group_titles = e_shortcuts_get_group_titles (priv->shortcuts);
+
+ for (p = group_titles; p != NULL; p = p->next) {
+ const char *group_title;
+
+ 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);
+ }
+
+ e_free_string_list (group_titles);
+}
+
+
+/* EShortcuts callbacks. */
+
+static void
+shortcuts_new_group_cb (EShortcuts *shortcuts,
+ int group_num,
+ void *data)
+{
+ EShortcutsViewModel *shortcuts_view_model;
+ EShortcutsViewModelPrivate *priv;
+ const char *title;
+
+ shortcuts_view_model = E_SHORTCUTS_VIEW_MODEL (shortcuts);
+ priv = shortcuts_view_model->priv;
+
+ title = e_shortcuts_get_group_title (priv->shortcuts, group_num);
+ e_shortcut_model_add_group (E_SHORTCUT_MODEL (shortcuts_view_model), group_num, title);
+}
+
+static void
+shortcuts_remove_group_cb (EShortcuts *shortcuts,
+ int group_num,
+ void *data)
+{
+ EShortcutsViewModel *shortcuts_view_model;
+
+ shortcuts_view_model = E_SHORTCUTS_VIEW_MODEL (data);
+ e_shortcut_model_remove_group (E_SHORTCUT_MODEL (shortcuts_view_model), group_num);
+}
+
+static void
+shortcuts_new_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_add_item (E_SHORTCUT_MODEL (shortcuts_view_model),
+ group_num, item_num, uri, folder_name);
+}
+
+static void
+shortcuts_remove_shortcut_cb (EShortcuts *shortcuts,
+ int group_num,
+ int item_num,
+ void *data)
+{
+ EShortcutsViewModel *shortcuts_view_model;
+
+ shortcuts_view_model = E_SHORTCUTS_VIEW_MODEL (data);
+ e_shortcut_model_remove_item (E_SHORTCUT_MODEL (shortcuts_view_model), group_num, item_num);
+}
+
+
+/* GtkObject methods. */
+
+static void
+impl_destroy (GtkObject *object)
+{
+ EShortcutsViewModel *view_model;
+ EShortcutsViewModelPrivate *priv;
+
+ view_model = E_SHORTCUTS_VIEW_MODEL (object);
+ priv = view_model->priv;
+
+ g_free (priv);
+}
+
+
+static void
+class_init (EShortcutsViewModelClass *klass)
+{
+ GtkObjectClass *object_class;
+
+ object_class = GTK_OBJECT_CLASS (klass);
+
+ parent_class = gtk_type_class (e_shortcut_model_get_type ());
+}
+
+static void
+init (EShortcutsViewModel *shortcuts_view_model)
+{
+ EShortcutsViewModelPrivate *priv;
+
+ priv = g_new (EShortcutsViewModelPrivate, 1);
+ priv->shortcuts = NULL;
+
+ shortcuts_view_model->priv = priv;
+}
+
+
+void
+e_shortcuts_view_model_construct (EShortcutsViewModel *model,
+ EShortcuts *shortcuts)
+{
+ EShortcutsViewModelPrivate *priv;
+
+ g_return_if_fail (model != NULL);
+ g_return_if_fail (E_IS_SHORTCUTS_VIEW_MODEL (model));
+ g_return_if_fail (shortcuts != NULL);
+ g_return_if_fail (E_IS_SHORTCUTS (shortcuts));
+
+ priv = model->priv;
+ g_return_if_fail (priv->shortcuts == NULL);
+
+ priv->shortcuts = shortcuts;
+
+ load_all_shortcuts_into_model (model);
+
+ gtk_signal_connect_while_alive (GTK_OBJECT (priv->shortcuts),
+ "new_group", GTK_SIGNAL_FUNC (shortcuts_new_group_cb), model,
+ GTK_OBJECT (model));
+ gtk_signal_connect_while_alive (GTK_OBJECT (priv->shortcuts),
+ "remove_group", GTK_SIGNAL_FUNC (shortcuts_remove_group_cb), model,
+ GTK_OBJECT (model));
+ gtk_signal_connect_while_alive (GTK_OBJECT (priv->shortcuts),
+ "new_shortcut", GTK_SIGNAL_FUNC (shortcuts_new_shortcut_cb), model,
+ GTK_OBJECT (model));
+ gtk_signal_connect_while_alive (GTK_OBJECT (priv->shortcuts),
+ "remove_shortcut", GTK_SIGNAL_FUNC (shortcuts_remove_shortcut_cb), model,
+ GTK_OBJECT (model));
+}
+
+EShortcutsViewModel *
+e_shortcuts_view_model_new (EShortcuts *shortcuts)
+{
+ EShortcutsViewModel *new;
+
+ g_return_val_if_fail (shortcuts != NULL, NULL);
+ g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL);
+
+ new = gtk_type_new (e_shortcuts_view_model_get_type ());
+
+ e_shortcuts_view_model_construct (new, shortcuts);
+
+ return new;
+}
+
+
+E_MAKE_TYPE (e_shortcuts_view_model, "EShortcutsViewModel", EShortcutsViewModel, class_init, init, PARENT_TYPE)
diff --git a/shell/e-shortcuts-view-model.h b/shell/e-shortcuts-view-model.h
new file mode 100644
index 0000000000..af5259bbee
--- /dev/null
+++ b/shell/e-shortcuts-view-model.h
@@ -0,0 +1,67 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-shortcuts-view-model.h
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Ettore Perazzoli
+ */
+
+#ifndef _E_SHORTCUTS_VIEW_MODEL_H_
+#define _E_SHORTCUTS_VIEW_MODEL_H_
+
+#include "e-shortcuts.h"
+
+#include "shortcut-bar/e-shortcut-model.h"
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+#define E_TYPE_SHORTCUTS_VIEW_MODEL (e_shortcuts_view_model_get_type ())
+#define E_SHORTCUTS_VIEW_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SHORTCUTS_VIEW_MODEL, EShortcutsViewModel))
+#define E_SHORTCUTS_VIEW_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SHORTCUTS_VIEW_MODEL, EShortcutsViewModelClass))
+#define E_IS_SHORTCUTS_VIEW_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SHORTCUTS_VIEW_MODEL))
+#define E_IS_SHORTCUTS_VIEW_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SHORTCUTS_VIEW_MODEL))
+
+
+typedef struct _EShortcutsViewModel EShortcutsViewModel;
+typedef struct _EShortcutsViewModelPrivate EShortcutsViewModelPrivate;
+typedef struct _EShortcutsViewModelClass EShortcutsViewModelClass;
+
+struct _EShortcutsViewModel {
+ EShortcutModel parent;
+
+ EShortcutsViewModelPrivate *priv;
+};
+
+struct _EShortcutsViewModelClass {
+ EShortcutModelClass parent_class;
+};
+
+
+GtkType e_shortcuts_view_model_get_type (void);
+void e_shortcuts_view_model_construct (EShortcutsViewModel *model,
+ EShortcuts *shortcuts);
+EShortcutsViewModel *e_shortcuts_view_model_new (EShortcuts *shortcuts);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _E_SHORTCUTS_VIEW_MODEL_H_ */
diff --git a/shell/e-shortcuts-view.c b/shell/e-shortcuts-view.c
index 7a9b75a86a..014be21beb 100644
--- a/shell/e-shortcuts-view.c
+++ b/shell/e-shortcuts-view.c
@@ -29,6 +29,8 @@
#include <gal/util/e-util.h>
+#include "e-shortcuts-view-model.h"
+
#include "e-shortcuts-view.h"
@@ -47,7 +49,7 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
-/* View initialization. */
+/* FIXME this should all be in the model. */
static const char *
get_storage_set_path_from_uri (const char *uri)
@@ -70,80 +72,6 @@ get_storage_set_path_from_uri (const char *uri)
return colon + 1;
}
-static void
-load_group (EShortcutsView *shortcuts_view,
- EShortcuts *shortcuts,
- const char *group_title,
- int group_num)
-{
- EShortcutsViewPrivate *priv;
- EStorageSet *storage_set;
- GList *shortcut_list;
- GList *p;
-
- priv = shortcuts_view->priv;
-
- storage_set = e_shortcuts_get_storage_set (shortcuts);
- g_assert (storage_set != NULL);
-
- shortcut_list = e_shortcuts_get_shortcuts_in_group (shortcuts, group_title);
- if (shortcut_list == NULL)
- return;
-
- for (p = shortcut_list; p != NULL; p = p->next) {
- EFolder *folder;
- const char *path;
- const char *uri;
- const char *name;
-
- uri = (const char *) p->data;
- path = get_storage_set_path_from_uri (uri);
- if (path != NULL)
- folder = e_storage_set_get_folder (storage_set, path);
-
- if (path == NULL || folder == NULL) {
- /* FIXME */
- g_warning ("Invalid link while loading shortcut bar view -- %s\n",
- uri);
- continue;
- }
-
- name = e_folder_get_name (folder);
- e_shortcut_model_add_item (E_SHORTCUT_BAR (shortcuts_view)->model, group_num, -1, uri, name);
- }
-
- e_free_string_list (shortcut_list);
-}
-
-static void
-load_all_shortcuts (EShortcutsView *shortcuts_view,
- EShortcuts *shortcuts)
-{
- EShortcutsViewPrivate *priv;
- GList *group_titles;
- GList *p;
- int group_num;
-
- priv = shortcuts_view->priv;
-
- group_titles = e_shortcuts_get_group_titles (shortcuts);
-
- for (p = group_titles; p != NULL; p = p->next) {
- const char *group_title;
-
- group_title = (const char *) p->data;
- group_num = e_shortcut_model_add_group (E_SHORTCUT_BAR (shortcuts_view)->model,
- -1, group_title);
-
- load_group (shortcuts_view, shortcuts, group_title, group_num);
- }
-
- e_free_string_list (group_titles);
-
- gtk_object_ref (GTK_OBJECT (shortcuts));
- priv->shortcuts = shortcuts;
-}
-
/* Icon callback for the shortcut bar. */
static GdkPixbuf *
icon_callback (EShortcutBar *shortcut_bar,
@@ -381,7 +309,7 @@ destroy (GtkObject *object)
/* EShortcutBar methods. */
static void
-selected_item (EShortcutBar *shortcut_bar,
+item_selected (EShortcutBar *shortcut_bar,
GdkEvent *event,
int group_num,
int item_num)
@@ -416,90 +344,35 @@ selected_item (EShortcutBar *shortcut_bar,
shortcuts, uri);
}
-#if 0
-static void
-added_item (EShortcutBar *shortcut_bar,
- int group_num,
- int item_num)
-{
- EShortcutsViewPrivate *priv;
- EShortcutBarGroup *group;
- EShortcuts *shortcuts;
- const char *url;
-
- priv = E_SHORTCUTS_VIEW (shortcut_bar)->priv;
- shortcuts = priv->shortcuts;
-
- if (shortcuts == NULL)
- return;
-
- /* FIXME ** NASTY ** */
-
- group = &g_array_index (shortcut_bar->groups, EShortcutBarGroup, group_num);
- url = e_icon_bar_get_item_data (E_ICON_BAR (group->icon_bar), item_num);
-
- if (url == NULL) {
- g_warning ("NULL URL being added to the shortcut bar!?");
- return;
- }
-
- e_shortcuts_add_shortcut (shortcuts, group_num, item_num, url);
-}
-
static void
-removed_item (EShortcutBar *shortcut_bar,
- int group_num,
- int item_num)
-{
- EShortcutsViewPrivate *priv;
- EShortcuts *shortcuts;
-
- priv = E_SHORTCUTS_VIEW (shortcut_bar)->priv;
- shortcuts = priv->shortcuts;
-
- e_shortcuts_remove_shortcut (shortcuts, group_num, item_num);
-}
-
-static void
-added_group (EShortcutBar *shortcut_bar,
- int group_num)
+impl_shortcut_dropped (EShortcutBar *shortcut_bar,
+ int group_num,
+ int position,
+ const char *item_url,
+ const char *item_name)
{
+ EShortcutsView *shortcuts_view;
EShortcutsViewPrivate *priv;
- EShortcuts *shortcuts;
- EShortcutBarGroup *group;
- const char *group_name;
- priv = E_SHORTCUTS_VIEW (shortcut_bar)->priv;
- shortcuts = priv->shortcuts;
-
- if (shortcuts == NULL)
- return;
-
- group = &g_array_index (shortcut_bar->groups, EShortcutBarGroup, group_num);
-
- /* FIXME Losing EShortcutBar does not give me a method to retrieve the
- group name. */
- group_name = "Foo";
+ shortcuts_view = E_SHORTCUTS_VIEW (shortcut_bar);
+ priv = shortcuts_view->priv;
- e_shortcuts_add_group (shortcuts, group_num, group_name);
+ e_shortcuts_add_shortcut (priv->shortcuts, group_num, position, item_url);
}
static void
-removed_group (EShortcutBar *shortcut_bar,
- int group_num)
+impl_shortcut_dragged (EShortcutBar *shortcut_bar,
+ gint group_num,
+ gint item_num)
{
+ EShortcutsView *shortcuts_view;
EShortcutsViewPrivate *priv;
- EShortcuts *shortcuts;
-
- priv = E_SHORTCUTS_VIEW (shortcut_bar)->priv;
- shortcuts = priv->shortcuts;
- if (shortcuts == NULL)
- return;
+ shortcuts_view = E_SHORTCUTS_VIEW (shortcut_bar);
+ priv = shortcuts_view->priv;
- e_shortcuts_remove_group (shortcuts, group_num);
+ e_shortcuts_remove_shortcut (priv->shortcuts, group_num, item_num);
}
-#endif
static void
@@ -512,13 +385,10 @@ class_init (EShortcutsViewClass *klass)
object_class->destroy = destroy;
shortcut_bar_class = E_SHORTCUT_BAR_CLASS (klass);
- shortcut_bar_class->selected_item = selected_item;
-#if 0
- shortcut_bar_class->added_item = added_item;
- shortcut_bar_class->removed_item = removed_item;
- shortcut_bar_class->added_group = added_group;
- shortcut_bar_class->removed_group = removed_group;
-#endif
+ shortcut_bar_class->item_selected = item_selected;
+ shortcut_bar_class->shortcut_dropped = impl_shortcut_dropped;
+ shortcut_bar_class->shortcut_dragged = impl_shortcut_dragged;
+
parent_class = gtk_type_class (e_shortcut_bar_get_type ());
signals[ACTIVATE_SHORTCUT] =
@@ -557,13 +427,11 @@ e_shortcuts_view_construct (EShortcutsView *shortcuts_view,
priv = shortcuts_view->priv;
- e_shortcut_bar_set_model (E_SHORTCUT_BAR (shortcuts_view),
- e_shortcut_model_new ());
-
e_shortcut_bar_set_icon_callback (E_SHORTCUT_BAR (shortcuts_view), icon_callback,
shortcuts);
- load_all_shortcuts (shortcuts_view, shortcuts);
+ e_shortcut_bar_set_model (E_SHORTCUT_BAR (shortcuts_view),
+ E_SHORTCUT_MODEL (e_shortcuts_view_model_new (shortcuts)));
}
GtkWidget *
diff --git a/shell/e-shortcuts.c b/shell/e-shortcuts.c
index 4d4b8ed9ee..4befb87cb7 100644
--- a/shell/e-shortcuts.c
+++ b/shell/e-shortcuts.c
@@ -756,5 +756,25 @@ e_shortcuts_add_group (EShortcuts *shortcuts,
}
+const char *
+e_shortcuts_get_group_title (EShortcuts *shortcuts,
+ int group_num)
+{
+ EShortcutsPrivate *priv;
+ const ShortcutGroup *group;
+
+ g_return_val_if_fail (shortcuts != NULL, NULL);
+ g_return_val_if_fail (E_IS_SHORTCUTS (shortcuts), NULL);
+
+ priv = shortcuts->priv;
+
+ group = g_list_nth (priv->groups, group_num);
+ if (group == NULL)
+ return NULL;
+
+ return group->title;
+}
+
+
E_MAKE_TYPE (e_shortcuts, "EShortcuts", EShortcuts, class_init, init, PARENT_TYPE)
diff --git a/shell/e-shortcuts.h b/shell/e-shortcuts.h
index da4dfc1fa0..8fc5b335da 100644
--- a/shell/e-shortcuts.h
+++ b/shell/e-shortcuts.h
@@ -76,6 +76,9 @@ EShortcuts *e_shortcuts_new (EStorageSet *storage_s
const char *file_name);
GList *e_shortcuts_get_group_titles (EShortcuts *shortcuts);
+const char *e_shortcuts_get_group_title (EShortcuts *shortcuts,
+ int group_num);
+
GList *e_shortcuts_get_shortcuts_in_group (EShortcuts *shortcuts,
const char *group_title);
EStorageSet *e_shortcuts_get_storage_set (EShortcuts *shortcuts);