aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-status-preset-dialog.c
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-06-11 04:09:33 +0800
committerWill Thompson <will.thompson@collabora.co.uk>2011-06-24 17:45:38 +0800
commit901256e30ba93abc86dfd3826ee28f322251c673 (patch)
tree06f99b36b9135a5c4eff44ed6b8cab23f88f8650 /libempathy-gtk/empathy-status-preset-dialog.c
parent096e82cbc6e05aa693991d215cefe0ace429d497 (diff)
downloadgsoc2013-empathy-901256e30ba93abc86dfd3826ee28f322251c673.tar
gsoc2013-empathy-901256e30ba93abc86dfd3826ee28f322251c673.tar.gz
gsoc2013-empathy-901256e30ba93abc86dfd3826ee28f322251c673.tar.bz2
gsoc2013-empathy-901256e30ba93abc86dfd3826ee28f322251c673.tar.lz
gsoc2013-empathy-901256e30ba93abc86dfd3826ee28f322251c673.tar.xz
gsoc2013-empathy-901256e30ba93abc86dfd3826ee28f322251c673.tar.zst
gsoc2013-empathy-901256e30ba93abc86dfd3826ee28f322251c673.zip
PresetDialog: Select text cell of freshly-added status
This means you can just mash Enter to edit your mistake. It's more useful than leaving the text entry focused. It also helps hide a bug where the entry doesn't get cleared if you just start typing another message. So previously, typing: Hello<Enter>Miaow<Enter> would give you two statuses, "Hello" and "MiaowEnter Custom Message". It didn't seem worth fixing this much more since Gtk+ 3.2 will probably grow native support for placeholder text: <https://bugzilla.gnome.org/show_bug.cgi?id=440963>
Diffstat (limited to 'libempathy-gtk/empathy-status-preset-dialog.c')
-rw-r--r--libempathy-gtk/empathy-status-preset-dialog.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/libempathy-gtk/empathy-status-preset-dialog.c b/libempathy-gtk/empathy-status-preset-dialog.c
index 7dc77afa0..8176e9ea7 100644
--- a/libempathy-gtk/empathy-status-preset-dialog.c
+++ b/libempathy-gtk/empathy-status-preset-dialog.c
@@ -65,6 +65,9 @@ struct _EmpathyStatusPresetDialogPriv
int block_add_combo_changed;
GtkWidget *presets_treeview;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *text_cell;
+
GtkWidget *add_combobox;
GtkWidget *add_button;
@@ -278,6 +281,7 @@ status_preset_dialog_setup_presets_treeview (EmpathyStatusPresetDialog *self)
status_preset_dialog_presets_update (self);
column = gtk_tree_view_column_new ();
+ priv->column = column;
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
renderer = gtk_cell_renderer_pixbuf_new ();
@@ -286,6 +290,7 @@ status_preset_dialog_setup_presets_treeview (EmpathyStatusPresetDialog *self)
"icon-name", PRESETS_STORE_ICON_NAME);
renderer = gtk_cell_renderer_text_new ();
+ priv->text_cell = renderer;
gtk_tree_view_column_pack_start (column, renderer, TRUE);
gtk_tree_view_column_add_attribute (column, renderer,
"text", PRESETS_STORE_STATUS);
@@ -460,14 +465,13 @@ status_preset_dialog_add_preset (GtkWidget *widget,
GtkTreePath *path;
path = gtk_tree_model_get_path (model, &iter);
-
- gtk_tree_selection_select_iter (
- gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->presets_treeview)),
- &iter);
- gtk_tree_view_scroll_to_cell (
- GTK_TREE_VIEW (priv->presets_treeview),
- path, NULL,
- FALSE, 0., 0.);
+ gtk_tree_view_set_cursor_on_cell (
+ GTK_TREE_VIEW (priv->presets_treeview),
+ path,
+ priv->column,
+ priv->text_cell,
+ FALSE);
+ gtk_widget_grab_focus (priv->presets_treeview);
break;
}
}