aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog6
-rw-r--r--shell/e-shortcuts-view-model.c18
-rw-r--r--shell/e-shortcuts-view.c28
-rw-r--r--shell/e-shortcuts.c39
-rw-r--r--shell/e-shortcuts.h7
5 files changed, 97 insertions, 1 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 6cdc375c4a..bd19e4b9ae 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,11 @@
2001-07-01 Ettore Perazzoli <ettore@ximian.com>
+ * e-shortcuts.c (class_init): Install signal "rename_group".
+
+ * e-shortcuts.h: New signal "rename_group".
+
+2001-07-01 Ettore Perazzoli <ettore@ximian.com>
+
* e-shortcuts.c: Removed `title_to_group' hash from
`EShortcutsPrivate'.
(init): Don't initialize it anymore.
diff --git a/shell/e-shortcuts-view-model.c b/shell/e-shortcuts-view-model.c
index 15e1d3cec1..57d2762fb9 100644
--- a/shell/e-shortcuts-view-model.c
+++ b/shell/e-shortcuts-view-model.c
@@ -126,6 +126,21 @@ shortcuts_remove_group_cb (EShortcuts *shortcuts,
}
static void
+shortcuts_rename_group_cb (EShortcuts *shortcuts,
+ int group_num,
+ const char *new_title,
+ 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);
+ e_shortcut_model_add_group (E_SHORTCUT_MODEL (shortcuts_view_model), group_num, new_title);
+ load_group_into_model (shortcuts_view_model, group_num);
+}
+
+static void
shortcuts_new_shortcut_cb (EShortcuts *shortcuts,
int group_num,
int item_num,
@@ -245,6 +260,9 @@ e_shortcuts_view_model_construct (EShortcutsViewModel *model,
"remove_group", GTK_SIGNAL_FUNC (shortcuts_remove_group_cb), model,
GTK_OBJECT (model));
gtk_signal_connect_while_alive (GTK_OBJECT (priv->shortcuts),
+ "rename_group", GTK_SIGNAL_FUNC (shortcuts_rename_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),
diff --git a/shell/e-shortcuts-view.c b/shell/e-shortcuts-view.c
index 4009e7e5a8..de30fdba1c 100644
--- a/shell/e-shortcuts-view.c
+++ b/shell/e-shortcuts-view.c
@@ -274,6 +274,31 @@ destroy_group_cb (GtkWidget *widget,
e_shortcuts_remove_group (shortcuts, menu_data->group_num);
}
+static void
+rename_group_cb (GtkWidget *widget,
+ void *data)
+{
+ RightClickMenuData *menu_data;
+ EShortcuts *shortcuts;
+ const char *old_name;
+ const char *new_name;
+
+ menu_data = (RightClickMenuData *) data;
+ shortcuts = menu_data->shortcuts_view->priv->shortcuts;
+
+ old_name = e_shortcuts_get_group_title (shortcuts, menu_data->group_num);
+
+ new_name = e_request_string (GTK_WINDOW (gtk_widget_get_toplevel (widget)),
+ _("Rename Shortcut Group"),
+ _("Rename selected shortcut group to:"),
+ old_name);
+
+ if (new_name == NULL)
+ return;
+
+ e_shortcuts_rename_group (shortcuts, menu_data->group_num, new_name);
+}
+
static GnomeUIInfo icon_size_radio_group_uiinfo[] = {
{ GNOME_APP_UI_ITEM, N_("_Small Icons"),
N_("Show the shortcuts as small icons"), toggle_small_icons_cb, NULL,
@@ -296,6 +321,9 @@ static GnomeUIInfo right_click_menu_uiinfo[] = {
{ GNOME_APP_UI_ITEM, N_("_Remove This Group..."),
N_("Remove this shortcut group"), destroy_group_cb, NULL,
NULL, 0, 0, 0, 0 },
+ { GNOME_APP_UI_ITEM, N_("Re_name This Group..."),
+ N_("Rename this shortcut group"), rename_group_cb, NULL,
+ NULL, 0, 0, 0, 0 },
GNOMEUIINFO_SEPARATOR,
diff --git a/shell/e-shortcuts.c b/shell/e-shortcuts.c
index 20d12cce2d..5f1614a964 100644
--- a/shell/e-shortcuts.c
+++ b/shell/e-shortcuts.c
@@ -107,6 +107,7 @@ struct _EShortcutsPrivate {
enum {
NEW_GROUP,
REMOVE_GROUP,
+ RENAME_GROUP,
NEW_SHORTCUT,
REMOVE_SHORTCUT,
UPDATE_SHORTCUT,
@@ -627,6 +628,16 @@ class_init (EShortcutsClass *klass)
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
+ signals[RENAME_GROUP]
+ = gtk_signal_new ("rename_group",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EShortcutsClass, rename_group),
+ gtk_marshal_NONE__INT_POINTER,
+ GTK_TYPE_NONE, 2,
+ GTK_TYPE_INT,
+ GTK_TYPE_STRING);
+
signals[NEW_SHORTCUT]
= gtk_signal_new ("new_shortcut",
GTK_RUN_FIRST,
@@ -990,6 +1001,34 @@ e_shortcuts_remove_group (EShortcuts *shortcuts,
}
void
+e_shortcuts_rename_group (EShortcuts *shortcuts,
+ int group_num,
+ const char *new_title)
+{
+ EShortcutsPrivate *priv;
+ GSList *p;
+ ShortcutGroup *group;
+
+ g_return_if_fail (shortcuts != NULL);
+ g_return_if_fail (E_IS_SHORTCUTS (shortcuts));
+
+ priv = shortcuts->priv;
+
+ p = g_slist_nth (priv->groups, group_num);
+ g_return_if_fail (p != NULL);
+
+ group = (ShortcutGroup *) p->data;
+ if (group->title != new_title) {
+ g_free (group->title);
+ group->title = g_strdup (new_title);
+ }
+
+ gtk_signal_emit (GTK_OBJECT (shortcuts), signals[RENAME_GROUP], group_num, new_title);
+
+ make_dirty (shortcuts);
+}
+
+void
e_shortcuts_add_group (EShortcuts *shortcuts,
int group_num,
const char *group_name)
diff --git a/shell/e-shortcuts.h b/shell/e-shortcuts.h
index 8d08586c47..2a9836e2a0 100644
--- a/shell/e-shortcuts.h
+++ b/shell/e-shortcuts.h
@@ -65,6 +65,8 @@ struct _EShortcutsClass {
void (* new_group) (EShortcuts *shortcuts, int group_num);
void (* remove_group) (EShortcuts *shortcuts, int group_num);
+ void (* rename_group) (EShortcuts *shortcuts, int group_num, const char *new_title);
+
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);
@@ -118,7 +120,10 @@ void e_shortcuts_remove_group (EShortcuts *shortcuts,
int group_num);
void e_shortcuts_add_group (EShortcuts *shortcuts,
int group_num,
- const char *group_name);
+ const char *group_title);
+void e_shortcuts_rename_group (EShortcuts *shortcuts,
+ int group_name,
+ const char *new_title);
#ifdef __cplusplus
}