[empathy: 7/12] PresetDialog: Select text cell of freshly-added status
- From: Will Thompson <wjt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy: 7/12] PresetDialog: Select text cell of freshly-added status
- Date: Fri, 24 Jun 2011 13:50:17 +0000 (UTC)
commit 901256e30ba93abc86dfd3826ee28f322251c673
Author: Will Thompson <will thompson collabora co uk>
Date: Fri Jun 10 21:09:33 2011 +0100
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>
libempathy-gtk/empathy-status-preset-dialog.c | 20 ++++++++++++--------
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 7dc77af..8176e9e 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;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]