diff options
author | Laurent Contzen <lcontzen@gmail.com> | 2012-06-25 22:31:00 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-06-27 22:56:27 +0800 |
commit | 539cd8f46f384fd209f6f87aa1e1add2d8197436 (patch) | |
tree | db36e7fb68d2da8b6eab7596b0298b12a326f691 | |
parent | dfa4c7069189ead061488b3057fd56f86f6d89a2 (diff) | |
download | gsoc2013-empathy-539cd8f46f384fd209f6f87aa1e1add2d8197436.tar gsoc2013-empathy-539cd8f46f384fd209f6f87aa1e1add2d8197436.tar.gz gsoc2013-empathy-539cd8f46f384fd209f6f87aa1e1add2d8197436.tar.bz2 gsoc2013-empathy-539cd8f46f384fd209f6f87aa1e1add2d8197436.tar.lz gsoc2013-empathy-539cd8f46f384fd209f6f87aa1e1add2d8197436.tar.xz gsoc2013-empathy-539cd8f46f384fd209f6f87aa1e1add2d8197436.tar.zst gsoc2013-empathy-539cd8f46f384fd209f6f87aa1e1add2d8197436.zip |
empathy-nautilus-sendto now uses a RosterView instead of EmpathyContactChooser
https://bugzilla.gnome.org/show_bug.cgi?id=678875
-rw-r--r-- | nautilus-sendto-plugin/empathy-nautilus-sendto.c | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/nautilus-sendto-plugin/empathy-nautilus-sendto.c b/nautilus-sendto-plugin/empathy-nautilus-sendto.c index 04b2c4e2c..f93088952 100644 --- a/nautilus-sendto-plugin/empathy-nautilus-sendto.c +++ b/nautilus-sendto-plugin/empathy-nautilus-sendto.c @@ -36,12 +36,17 @@ #include <libempathy-gtk/empathy-contact-chooser.h> #include <libempathy-gtk/empathy-ui-utils.h> +#include <libempathy-gtk/empathy-roster-view.h> +#include <libempathy-gtk/empathy-roster-contact.h> + #include "nautilus-sendto-plugin.h" static EmpathyFTFactory *factory = NULL; static guint transfers = 0; +#define BOX_DATA_KEY "roster_view" + static gboolean destroy (NstPlugin *plugin); static gboolean @@ -82,17 +87,17 @@ dup_contact_from_individual (FolksIndividual *individual) } static gboolean -filter_individual (EmpathyContactChooser *chooser, - FolksIndividual *individual, - gboolean is_online, - gboolean searching, +filter_individual (GtkWidget *child, gpointer user_data) { + FolksIndividual *individual; EmpathyContact *contact; - if (!is_online) + if (!EMPATHY_IS_ROSTER_CONTACT (child)) return FALSE; + individual = empathy_roster_contact_get_individual (EMPATHY_ROSTER_CONTACT (child)); + contact = dup_contact_from_individual (individual); if (contact == NULL) return FALSE; @@ -104,28 +109,47 @@ filter_individual (EmpathyContactChooser *chooser, static GtkWidget * get_contacts_widget (NstPlugin *plugin) { - GtkWidget *chooser; + GtkWidget *roster_view, *box, *scrolled; + EmpathyIndividualManager *mgr; + + box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); + + mgr = empathy_individual_manager_dup_singleton (); + roster_view = empathy_roster_view_new (mgr); - chooser = empathy_contact_chooser_new (); - empathy_contact_chooser_set_filter_func (EMPATHY_CONTACT_CHOOSER (chooser), - filter_individual, plugin); + scrolled = gtk_scrolled_window_new (NULL, NULL); - empathy_contact_chooser_show_search_entry (EMPATHY_CONTACT_CHOOSER (chooser), - FALSE); + g_object_unref (mgr); - /* Make sure to display some contacts */ - gtk_widget_set_size_request (chooser, -1, 300); - return chooser; + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), + GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + egg_list_box_set_filter_func (EGG_LIST_BOX (roster_view), filter_individual, + roster_view, NULL); + egg_list_box_add_to_scrolled (EGG_LIST_BOX (roster_view), + GTK_SCROLLED_WINDOW (scrolled)); + + gtk_box_pack_start (GTK_BOX (box), scrolled, TRUE, TRUE, 0); + + gtk_widget_set_size_request (box, -1, 300); + gtk_widget_show (roster_view); + gtk_widget_show (scrolled); + gtk_widget_show (box); + + g_object_set_data (G_OBJECT (box), BOX_DATA_KEY, roster_view); + + return box; } static EmpathyContact * get_selected_contact (GtkWidget *widget) { + EmpathyRosterView *roster_view; FolksIndividual *individual; EmpathyContact *contact; - individual = empathy_contact_chooser_dup_selected ( - EMPATHY_CONTACT_CHOOSER (widget)); + roster_view = g_object_get_data (G_OBJECT (widget), BOX_DATA_KEY); + individual = empathy_roster_view_get_selected_individual (roster_view); + if (individual == NULL) return NULL; |