aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-accounts-dialog.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-03-30 20:37:27 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-04-02 15:28:48 +0800
commit7e7a112250b3b22190f8e50f5e34d2cafb60da49 (patch)
tree6980137198fae915c055c866e538f8f132b55e4a /src/empathy-accounts-dialog.c
parentbd198afab778a63e7f5d1bbc58419fea06255733 (diff)
downloadgsoc2013-empathy-7e7a112250b3b22190f8e50f5e34d2cafb60da49.tar
gsoc2013-empathy-7e7a112250b3b22190f8e50f5e34d2cafb60da49.tar.gz
gsoc2013-empathy-7e7a112250b3b22190f8e50f5e34d2cafb60da49.tar.bz2
gsoc2013-empathy-7e7a112250b3b22190f8e50f5e34d2cafb60da49.tar.lz
gsoc2013-empathy-7e7a112250b3b22190f8e50f5e34d2cafb60da49.tar.xz
gsoc2013-empathy-7e7a112250b3b22190f8e50f5e34d2cafb60da49.tar.zst
gsoc2013-empathy-7e7a112250b3b22190f8e50f5e34d2cafb60da49.zip
account-dialog: add 'Rename' item to the context menu
https://bugzilla.gnome.org/show_bug.cgi?id=673159
Diffstat (limited to 'src/empathy-accounts-dialog.c')
-rw-r--r--src/empathy-accounts-dialog.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 8a08c4ac2..b146f3838 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -1733,6 +1733,30 @@ accounts_dialog_treeview_enabled_cb (GtkMenuItem *item,
enable_and_connect_account (account, !enabled);
}
+static void
+accounts_dialog_treeview_rename_cb (GtkMenuItem *item,
+ EmpathyAccountsDialog *self)
+{
+ EmpathyAccountsDialogPriv *priv = GET_PRIV (self);
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+ return;
+ path = gtk_tree_model_get_path (model, &iter);
+
+ g_object_set (G_OBJECT (priv->name_renderer), "editable", TRUE, NULL);
+
+ gtk_widget_grab_focus (GTK_WIDGET (priv->treeview));
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (priv->treeview), path,
+ gtk_tree_view_get_column (GTK_TREE_VIEW (priv->treeview), 0), TRUE);
+
+ gtk_tree_path_free (path);
+}
+
static gboolean
accounts_dialog_treeview_button_press_event_cb (GtkTreeView *view,
GdkEventButton *event,
@@ -1790,6 +1814,15 @@ accounts_dialog_treeview_button_press_event_cb (GtkTreeView *view,
gtk_widget_show (item);
+ /* Menu item: Rename */
+ item = gtk_menu_item_new_with_mnemonic (_("Rename"));
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+
+ tp_g_signal_connect_object (item, "activate",
+ G_CALLBACK (accounts_dialog_treeview_rename_cb), dialog, 0);
+
+ gtk_widget_show (item);
+
/* FIXME: Add here presence items, to be able to set per-account presence */
/* Popup menu */