diff options
author | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-04-27 18:47:25 +0800 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-04-27 18:47:25 +0800 |
commit | cfaa76cf91c2037b0ffe49730417afe3132332cb (patch) | |
tree | 27756197bda98e50341b1026386c17a90b71eb6c /libempathy-gtk | |
parent | 69c06be1de1ec60afd3237efef260873c65b3cd2 (diff) | |
download | gsoc2013-empathy-cfaa76cf91c2037b0ffe49730417afe3132332cb.tar gsoc2013-empathy-cfaa76cf91c2037b0ffe49730417afe3132332cb.tar.gz gsoc2013-empathy-cfaa76cf91c2037b0ffe49730417afe3132332cb.tar.bz2 gsoc2013-empathy-cfaa76cf91c2037b0ffe49730417afe3132332cb.tar.lz gsoc2013-empathy-cfaa76cf91c2037b0ffe49730417afe3132332cb.tar.xz gsoc2013-empathy-cfaa76cf91c2037b0ffe49730417afe3132332cb.tar.zst gsoc2013-empathy-cfaa76cf91c2037b0ffe49730417afe3132332cb.zip |
Fix buttons to work again with multiselection
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-log-window.c | 83 |
1 files changed, 48 insertions, 35 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index ca36c83d4..1ed0b44c9 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -283,6 +283,8 @@ toolbutton_profile_clicked (GtkToolButton *toolbutton, GtkTreeSelection *selection; GtkTreeModel *model; GtkTreeIter iter; + GtkTreePath *path; + GList *paths; TpAccount *account; TplEntity *target; EmpathyContact *contact; @@ -293,26 +295,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); @@ -326,6 +327,8 @@ toolbutton_chat_clicked (GtkToolButton *toolbutton, GtkTreeSelection *selection; GtkTreeModel *model; GtkTreeIter iter; + GtkTreePath *path; + GList *paths; TpAccount *account; TplEntity *target; EmpathyContact *contact; @@ -336,14 +339,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); @@ -364,6 +371,8 @@ toolbutton_av_clicked (GtkToolButton *toolbutton, GtkTreeSelection *selection; GtkTreeModel *model; GtkTreeIter iter; + GtkTreePath *path; + GList *paths; TpAccount *account; gchar *contact; gint type; @@ -374,14 +383,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); |