diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-12-05 04:38:55 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-12-05 04:38:55 +0800 |
commit | 658e0f835f68aba58e9cb5860291452a8c0e995a (patch) | |
tree | a1ba6ab316673e58865fa17c10c2f10bab3169b4 /tests/contact-manager.c | |
parent | 839d83a5116610bfc117d56347dee516e118a4c7 (diff) | |
download | gsoc2013-empathy-658e0f835f68aba58e9cb5860291452a8c0e995a.tar gsoc2013-empathy-658e0f835f68aba58e9cb5860291452a8c0e995a.tar.gz gsoc2013-empathy-658e0f835f68aba58e9cb5860291452a8c0e995a.tar.bz2 gsoc2013-empathy-658e0f835f68aba58e9cb5860291452a8c0e995a.tar.lz gsoc2013-empathy-658e0f835f68aba58e9cb5860291452a8c0e995a.tar.xz gsoc2013-empathy-658e0f835f68aba58e9cb5860291452a8c0e995a.tar.zst gsoc2013-empathy-658e0f835f68aba58e9cb5860291452a8c0e995a.zip |
Improve the contact-manager to display contacts in a combobox
svn path=/trunk/; revision=1946
Diffstat (limited to 'tests/contact-manager.c')
-rw-r--r-- | tests/contact-manager.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/tests/contact-manager.c b/tests/contact-manager.c index 31a601249..4372f2093 100644 --- a/tests/contact-manager.c +++ b/tests/contact-manager.c @@ -1,36 +1,41 @@ #include <stdlib.h> #include <glib.h> +#include <gtk/gtk.h> #include <libempathy/empathy-contact-manager.h> #include <libempathy/empathy-debug.h> - -static gboolean -time_out (gpointer main_loop) -{ - g_main_loop_quit (main_loop); - - return FALSE; -} +#include <libempathy-gtk/empathy-contact-list-store.h> int main (int argc, char **argv) { EmpathyContactManager *manager; GMainLoop *main_loop; + EmpathyContactListStore *store; + GtkWidget *combo; + GtkWidget *window; + GtkCellRenderer *renderer; - g_type_init (); + gtk_init (&argc, &argv); empathy_debug_set_flags (g_getenv ("EMPATHY_DEBUG")); main_loop = g_main_loop_new (NULL, FALSE); manager = empathy_contact_manager_new (); - - g_timeout_add_seconds (5, time_out, main_loop); - - g_main_loop_run (main_loop); - + store = empathy_contact_list_store_new (EMPATHY_CONTACT_LIST (manager)); + empathy_contact_list_store_set_is_compact (store, TRUE); + empathy_contact_list_store_set_show_groups (store, FALSE); + combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store)); + renderer = gtk_cell_renderer_text_new (); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE); + gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer, "text", EMPATHY_CONTACT_LIST_STORE_COL_NAME); + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_container_add (GTK_CONTAINER (window), combo); + gtk_widget_show (combo); + gtk_widget_show (window); g_object_unref (manager); - g_main_loop_unref (main_loop); + + gtk_main (); return EXIT_SUCCESS; } |