diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2010-08-27 00:48:50 +0800 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2010-08-27 01:07:35 +0800 |
commit | 6db1a23b9956518d8c33443611960fe850e42872 (patch) | |
tree | 3fb44b4d38e0ffb685486efcf6b910aac6d41ce4 /libempathy-gtk | |
parent | d58a372562b1de6bd73bd521bd6dfcf4276bdcec (diff) | |
download | gsoc2013-empathy-6db1a23b9956518d8c33443611960fe850e42872.tar gsoc2013-empathy-6db1a23b9956518d8c33443611960fe850e42872.tar.gz gsoc2013-empathy-6db1a23b9956518d8c33443611960fe850e42872.tar.bz2 gsoc2013-empathy-6db1a23b9956518d8c33443611960fe850e42872.tar.lz gsoc2013-empathy-6db1a23b9956518d8c33443611960fe850e42872.tar.xz gsoc2013-empathy-6db1a23b9956518d8c33443611960fe850e42872.tar.zst gsoc2013-empathy-6db1a23b9956518d8c33443611960fe850e42872.zip |
Fix row toggling on activation in EmpathyIndividualLinker
Previously, row toggling was only working when activating rows at the end of a
live search. This makes it work for all row activation events (i.e. selecting
a row and pressing "enter").
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-individual-linker.c | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/libempathy-gtk/empathy-individual-linker.c b/libempathy-gtk/empathy-individual-linker.c index 3713a8bda..9ebb4718b 100644 --- a/libempathy-gtk/empathy-individual-linker.c +++ b/libempathy-gtk/empathy-individual-linker.c @@ -198,36 +198,22 @@ toggle_individual_row (EmpathyIndividualLinker *self, } static void -row_toggled_cb (GtkCellRendererToggle *cell_renderer, - const gchar *path, +row_activated_cb (EmpathyIndividualView *view, + GtkTreePath *path, + GtkTreeViewColumn *column, EmpathyIndividualLinker *self) { - GtkTreePath *tree_path = gtk_tree_path_new_from_string (path); - toggle_individual_row (self, tree_path); - gtk_tree_path_free (tree_path); + toggle_individual_row (self, path); } static void -search_bar_activate_cb (EmpathyLiveSearch *search_bar, +row_toggled_cb (GtkCellRendererToggle *cell_renderer, + const gchar *path, EmpathyIndividualLinker *self) { - EmpathyIndividualLinkerPriv *priv = GET_PRIV (self); - GtkTreeSelection *selection; - GList *rows, *l; - - /* Toggle the status of the selected individuals */ - selection = gtk_tree_view_get_selection ( - GTK_TREE_VIEW (priv->individual_view)); - rows = gtk_tree_selection_get_selected_rows (selection, NULL); - - for (l = rows; l != NULL; l = l->next) - { - GtkTreePath *path = (GtkTreePath *) l->data; - toggle_individual_row (self, path); - gtk_tree_path_free (path); - } - - g_list_free (rows); + GtkTreePath *tree_path = gtk_tree_path_new_from_string (path); + toggle_individual_row (self, tree_path); + gtk_tree_path_free (tree_path); } static void @@ -275,6 +261,9 @@ set_up (EmpathyIndividualLinker *self) EMPATHY_INDIVIDUAL_VIEW_FEATURE_NONE, EMPATHY_INDIVIDUAL_FEATURE_NONE); empathy_individual_view_set_show_offline (priv->individual_view, TRUE); + g_signal_connect (priv->individual_view, "row-activated", + (GCallback) row_activated_cb, self); + /* Add a checkbox column to the selector */ cell_renderer = gtk_cell_renderer_toggle_new (); g_signal_connect (cell_renderer, "toggled", (GCallback) row_toggled_cb, self); @@ -298,8 +287,6 @@ set_up (EmpathyIndividualLinker *self) search_bar = empathy_live_search_new (GTK_WIDGET (priv->individual_view)); empathy_individual_view_set_live_search (priv->individual_view, EMPATHY_LIVE_SEARCH (search_bar)); - g_signal_connect (search_bar, "activate", (GCallback) search_bar_activate_cb, - self); gtk_box_pack_end (vbox, search_bar, FALSE, TRUE, 0); |