aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-04-27 18:47:25 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-06-09 19:34:56 +0800
commit716f0dfd75b38a218ce75b854e6e00c075f71cbb (patch)
tree97575ff2ce583cf34d125b21b6c995ca660ec96c /libempathy-gtk
parent4198f9e38072f8e36640af81db324e8787dc8e51 (diff)
downloadgsoc2013-empathy-716f0dfd75b38a218ce75b854e6e00c075f71cbb.tar
gsoc2013-empathy-716f0dfd75b38a218ce75b854e6e00c075f71cbb.tar.gz
gsoc2013-empathy-716f0dfd75b38a218ce75b854e6e00c075f71cbb.tar.bz2
gsoc2013-empathy-716f0dfd75b38a218ce75b854e6e00c075f71cbb.tar.lz
gsoc2013-empathy-716f0dfd75b38a218ce75b854e6e00c075f71cbb.tar.xz
gsoc2013-empathy-716f0dfd75b38a218ce75b854e6e00c075f71cbb.tar.zst
gsoc2013-empathy-716f0dfd75b38a218ce75b854e6e00c075f71cbb.zip
Fix buttons to work again with multiselection
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-log-window.c83
1 files changed, 48 insertions, 35 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index 87730c3f9..1f629987e 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -284,6 +284,8 @@ toolbutton_profile_clicked (GtkToolButton *toolbutton,
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
+ GtkTreePath *path;
+ GList *paths;
TpAccount *account;
TplEntity *target;
EmpathyContact *contact;
@@ -294,26 +296,25 @@ toolbutton_profile_clicked (GtkToolButton *toolbutton,
view = GTK_TREE_VIEW (log_window->treeview_who);
selection = gtk_tree_view_get_selection (view);
- if (gtk_tree_selection_get_selected (selection, &model, &iter))
- {
- gtk_tree_model_get (model, &iter,
- COL_WHO_ACCOUNT, &account,
- COL_WHO_TARGET, &target,
- COL_WHO_TYPE, &type,
- -1);
- }
+ paths = gtk_tree_selection_get_selected_rows (selection, &model);
+ g_return_if_fail (paths != NULL);
- if (type == COL_TYPE_NORMAL)
- {
- contact = empathy_contact_from_tpl_contact (account, target);
- empathy_contact_information_dialog_show (contact,
- GTK_WINDOW (window->window));
- g_object_unref (contact);
- }
- else
- {
- g_warn_if_reached ();
- }
+ path = paths->data;
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_model_get (model, &iter,
+ COL_WHO_ACCOUNT, &account,
+ COL_WHO_TARGET, &target,
+ COL_WHO_TYPE, &type,
+ -1);
+
+ g_list_free_full (paths, (GDestroyNotify) gtk_tree_path_free);
+
+ g_return_if_fail (type == COL_TYPE_NORMAL);
+
+ contact = empathy_contact_from_tpl_contact (account, target);
+ empathy_contact_information_dialog_show (contact,
+ GTK_WINDOW (window->window));
+ g_object_unref (contact);
g_object_unref (account);
g_object_unref (target);
@@ -327,6 +328,8 @@ toolbutton_chat_clicked (GtkToolButton *toolbutton,
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
+ GtkTreePath *path;
+ GList *paths;
TpAccount *account;
TplEntity *target;
EmpathyContact *contact;
@@ -337,14 +340,18 @@ toolbutton_chat_clicked (GtkToolButton *toolbutton,
view = GTK_TREE_VIEW (log_window->treeview_who);
selection = gtk_tree_view_get_selection (view);
- if (gtk_tree_selection_get_selected (selection, &model, &iter))
- {
- gtk_tree_model_get (model, &iter,
- COL_WHO_ACCOUNT, &account,
- COL_WHO_TARGET, &target,
- COL_WHO_TYPE, &type,
- -1);
- }
+ paths = gtk_tree_selection_get_selected_rows (selection, &model);
+ g_return_if_fail (paths != NULL);
+
+ path = paths->data;
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_model_get (model, &iter,
+ COL_WHO_ACCOUNT, &account,
+ COL_WHO_TARGET, &target,
+ COL_WHO_TYPE, &type,
+ -1);
+
+ g_list_free_full (paths, (GDestroyNotify) gtk_tree_path_free);
g_return_if_fail (type == COL_TYPE_NORMAL);
@@ -365,6 +372,8 @@ toolbutton_av_clicked (GtkToolButton *toolbutton,
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
+ GtkTreePath *path;
+ GList *paths;
TpAccount *account;
gchar *contact;
gint type;
@@ -375,14 +384,18 @@ toolbutton_av_clicked (GtkToolButton *toolbutton,
view = GTK_TREE_VIEW (log_window->treeview_who);
selection = gtk_tree_view_get_selection (view);
- if (gtk_tree_selection_get_selected (selection, &model, &iter))
- {
- gtk_tree_model_get (model, &iter,
- COL_WHO_ACCOUNT, &account,
- COL_WHO_NAME, &contact,
- COL_WHO_TYPE, &type,
- -1);
- }
+ paths = gtk_tree_selection_get_selected_rows (selection, &model);
+ g_return_if_fail (paths != NULL);
+
+ path = paths->data;
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_model_get (model, &iter,
+ COL_WHO_ACCOUNT, &account,
+ COL_WHO_NAME, &contact,
+ COL_WHO_TYPE, &type,
+ -1);
+
+ g_list_free_full (paths, (GDestroyNotify) gtk_tree_path_free);
g_return_if_fail (type == COL_TYPE_NORMAL);