1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 2007 Collabora Ltd.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Authors: Xavier Claessens <xclaesse@gmail.com>
27 #include <glade/glade.h>
28 #include <glib/gi18n.h>
30 #include <libtelepathy/tp-helpers.h>
31 #include <libmissioncontrol/mission-control.h>
33 #include <libempathy/gossip-conf.h>
34 #include <libempathy/gossip-contact.h>
35 #include <libempathy/gossip-debug.h>
36 #include <libempathy/gossip-utils.h>
38 #include "empathy-main-window.h"
39 #include "ephy-spinner.h"
40 #include "gossip-contact-list.h"
41 #include "gossip-presence-chooser.h"
42 #include "gossip-ui-utils.h"
43 #include "gossip-status-presets.h"
44 #include "gossip-geometry.h"
45 #include "gossip-preferences.h"
46 #include "gossip-accounts-dialog.h"
48 #define DEBUG_DOMAIN "MainWindow"
50 /* Minimum width of roster window if something goes wrong. */
53 /* Accels (menu shortcuts) can be configured and saved */
54 #define ACCELS_FILENAME "accels.txt"
56 /* Flashing delay for icons (milliseconds). */
57 #define FLASH_TIMEOUT 500
59 /* Name in the geometry file */
60 #define GEOMETRY_NAME "main-window"
63 GossipContactList *contact_list;
70 /* Tooltips for all widgets */
71 GtkTooltips *tooltips;
77 GtkWidget *room_join_favorites;
78 GtkWidget *edit_context;
79 GtkWidget *edit_context_separator;
84 /* Widgets that are enabled when we're connected/disconnected */
85 GList *widgets_connected;
86 GList *widgets_disconnected;
89 GtkWidget *presence_toolbar;
90 GtkWidget *presence_chooser;
93 guint size_timeout_id;
96 static void main_window_destroy_cb (GtkWidget *widget,
97 EmpathyMainWindow *window);
98 static void main_window_favorite_chatroom_menu_setup (void);
99 static void main_window_chat_quit_cb (GtkWidget *widget,
100 EmpathyMainWindow *window);
101 static void main_window_chat_new_message_cb (GtkWidget *widget,
102 EmpathyMainWindow *window);
103 static void main_window_chat_history_cb (GtkWidget *widget,
104 EmpathyMainWindow *window);
105 static void main_window_room_join_new_cb (GtkWidget *widget,
106 EmpathyMainWindow *window);
107 static void main_window_room_join_favorites_cb (GtkWidget *widget,
108 EmpathyMainWindow *window);
109 static void main_window_room_manage_favorites_cb (GtkWidget *widget,
110 EmpathyMainWindow *window);
111 static void main_window_chat_add_contact_cb (GtkWidget *widget,
112 EmpathyMainWindow *window);
113 static void main_window_chat_show_offline_cb (GtkCheckMenuItem *item,
114 EmpathyMainWindow *window);
115 static gboolean main_window_edit_button_press_event_cb (GtkWidget *widget,
116 GdkEventButton *event,
117 EmpathyMainWindow *window);
118 static void main_window_edit_accounts_cb (GtkWidget *widget,
119 EmpathyMainWindow *window);
120 static void main_window_edit_personal_information_cb (GtkWidget *widget,
121 EmpathyMainWindow *window);
122 static void main_window_edit_preferences_cb (GtkWidget *widget,
123 EmpathyMainWindow *window);
124 static void main_window_help_about_cb (GtkWidget *widget,
125 EmpathyMainWindow *window);
126 static void main_window_help_contents_cb (GtkWidget *widget,
127 EmpathyMainWindow *window);
128 static gboolean main_window_throbber_button_press_event_cb (GtkWidget *throbber_ebox,
129 GdkEventButton *event,
131 static void main_window_accels_load (void);
132 static void main_window_accels_save (void);
133 static void main_window_connection_items_setup (EmpathyMainWindow *window,
135 //static void main_window_connection_items_update (void);
136 static void main_window_presence_changed_cb (MissionControl *mc,
138 EmpathyMainWindow *window);
139 static void main_window_presence_chooser_changed_cb (GtkWidget *chooser,
142 EmpathyMainWindow *window);
143 static gboolean main_window_configure_event_timeout_cb (EmpathyMainWindow *window);
144 static gboolean main_window_configure_event_cb (GtkWidget *widget,
145 GdkEventConfigure *event,
146 EmpathyMainWindow *window);
147 static void main_window_notify_show_offline_cb (GossipConf *conf,
149 gpointer check_menu_item);
150 static void main_window_notify_show_avatars_cb (GossipConf *conf,
152 EmpathyMainWindow *window);
153 static void main_window_notify_compact_contact_list_cb (GossipConf *conf,
155 EmpathyMainWindow *window);
156 static void main_window_notify_sort_criterium_cb (GossipConf *conf,
158 EmpathyMainWindow *window);
161 empathy_main_window_show (void)
163 static EmpathyMainWindow *window = NULL;
167 GtkWidget *show_offline_widget;
172 gboolean show_offline;
173 gboolean show_avatars;
174 gboolean compact_contact_list;
178 gtk_window_present (GTK_WINDOW (window->window));
179 return window->window;
182 window = g_new0 (EmpathyMainWindow, 1);
184 /* Set up interface */
185 glade = gossip_glade_get_file ("empathy-main-window.glade",
188 "main_window", &window->window,
189 "main_vbox", &window->main_vbox,
190 "chat_show_offline", &show_offline_widget,
191 "room", &window->room,
192 "room_sep", &window->room_sep,
193 "room_join_favorites", &window->room_join_favorites,
194 "edit_context", &window->edit_context,
195 "edit_context_separator", &window->edit_context_separator,
196 "presence_toolbar", &window->presence_toolbar,
197 "roster_scrolledwindow", &sw,
200 gossip_glade_connect (glade,
202 "main_window", "destroy", main_window_destroy_cb,
203 "main_window", "configure_event", main_window_configure_event_cb,
204 "chat_quit", "activate", main_window_chat_quit_cb,
205 "chat_new_message", "activate", main_window_chat_new_message_cb,
206 "chat_history", "activate", main_window_chat_history_cb,
207 "room_join_new", "activate", main_window_room_join_new_cb,
208 "room_join_favorites", "activate", main_window_room_join_favorites_cb,
209 "room_manage_favorites", "activate", main_window_room_manage_favorites_cb,
210 "chat_add_contact", "activate", main_window_chat_add_contact_cb,
211 "chat_show_offline", "toggled", main_window_chat_show_offline_cb,
212 "edit", "button-press-event", main_window_edit_button_press_event_cb,
213 "edit_accounts", "activate", main_window_edit_accounts_cb,
214 "edit_personal_information", "activate", main_window_edit_personal_information_cb,
215 "edit_preferences", "activate", main_window_edit_preferences_cb,
216 "help_about", "activate", main_window_help_about_cb,
217 "help_contents", "activate", main_window_help_contents_cb,
220 /* Set up connection related widgets. */
221 main_window_connection_items_setup (window, glade);
222 g_object_unref (glade);
224 window->tooltips = g_object_ref_sink (gtk_tooltips_new ());
227 main_window_favorite_chatroom_menu_setup ();
229 gtk_widget_hide (window->edit_context);
230 gtk_widget_hide (window->edit_context_separator);
232 /* Set up presence chooser */
233 window->mc = mission_control_new (tp_get_bus ());
234 window->presence_chooser = gossip_presence_chooser_new ();
235 gossip_presence_chooser_set_flash_interval (GOSSIP_PRESENCE_CHOOSER (window->presence_chooser),
237 dbus_g_proxy_connect_signal (DBUS_G_PROXY (window->mc),
238 "PresenceStatusActual",
239 G_CALLBACK (main_window_presence_changed_cb),
241 g_signal_connect (window->presence_chooser,
243 G_CALLBACK (main_window_presence_chooser_changed_cb),
245 state = mission_control_get_presence_actual (window->mc, NULL);
246 main_window_presence_changed_cb (window->mc, state, window);
247 gtk_widget_show (window->presence_chooser);
249 item = gtk_tool_item_new ();
250 gtk_widget_show (GTK_WIDGET (item));
251 gtk_container_add (GTK_CONTAINER (item), window->presence_chooser);
252 gtk_tool_item_set_is_important (item, TRUE);
253 gtk_tool_item_set_expand (item, TRUE);
254 gtk_toolbar_insert (GTK_TOOLBAR (window->presence_toolbar), item, -1);
256 window->widgets_connected = g_list_prepend (window->widgets_connected,
257 window->presence_chooser);
259 /* Set up the throbber */
260 ebox = gtk_event_box_new ();
261 gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
263 window->throbber = ephy_spinner_new ();
264 ephy_spinner_set_size (EPHY_SPINNER (window->throbber), GTK_ICON_SIZE_LARGE_TOOLBAR);
265 gtk_container_add (GTK_CONTAINER (ebox), window->throbber);
267 item = gtk_tool_item_new ();
268 gtk_container_add (GTK_CONTAINER (item), ebox);
269 gtk_widget_show_all (GTK_WIDGET (item));
271 gtk_toolbar_insert (GTK_TOOLBAR (window->presence_toolbar), item, -1);
273 str = _("Show and edit accounts");
274 gtk_tooltips_set_tip (GTK_TOOLTIPS (window->tooltips),
277 g_signal_connect (ebox,
278 "button-press-event",
279 G_CALLBACK (main_window_throbber_button_press_event_cb),
282 /* Set up contact list. */
283 gossip_status_presets_get_all ();
284 window->contact_list = gossip_contact_list_new ();
285 gtk_widget_show (GTK_WIDGET (window->contact_list));
286 gtk_container_add (GTK_CONTAINER (sw),
287 GTK_WIDGET (window->contact_list));
289 /* Load user-defined accelerators. */
290 main_window_accels_load ();
292 /* Set window size. */
293 gossip_geometry_load (GEOMETRY_NAME, &x, &y, &w, &h);
295 if (w >= 1 && h >= 1) {
296 /* Use the defaults from the glade file if we
297 * don't have good w, h geometry.
299 gossip_debug (DEBUG_DOMAIN, "Configuring window default size w:%d, h:%d", w, h);
300 gtk_window_set_default_size (GTK_WINDOW (window->window), w, h);
303 if (x >= 0 && y >= 0) {
304 /* Let the window manager position it if we
305 * don't have good x, y coordinates.
307 gossip_debug (DEBUG_DOMAIN, "Configuring window default position x:%d, y:%d", x, y);
308 gtk_window_move (GTK_WINDOW (window->window), x, y);
311 conf = gossip_conf_get ();
314 gossip_conf_get_bool (conf,
315 GOSSIP_PREFS_CONTACTS_SHOW_OFFLINE,
317 gossip_conf_notify_add (conf,
318 GOSSIP_PREFS_CONTACTS_SHOW_OFFLINE,
319 main_window_notify_show_offline_cb,
320 show_offline_widget);
322 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (show_offline_widget),
326 gossip_conf_get_bool (conf,
327 GOSSIP_PREFS_UI_SHOW_AVATARS,
329 gossip_conf_notify_add (conf,
330 GOSSIP_PREFS_UI_SHOW_AVATARS,
331 (GossipConfNotifyFunc) main_window_notify_show_avatars_cb,
333 gossip_contact_list_set_show_avatars (window->contact_list, show_avatars);
336 gossip_conf_get_bool (conf,
337 GOSSIP_PREFS_UI_COMPACT_CONTACT_LIST,
338 &compact_contact_list);
339 gossip_conf_notify_add (conf,
340 GOSSIP_PREFS_UI_COMPACT_CONTACT_LIST,
341 (GossipConfNotifyFunc) main_window_notify_compact_contact_list_cb,
343 gossip_contact_list_set_is_compact (window->contact_list, compact_contact_list);
346 gossip_conf_notify_add (conf,
347 GOSSIP_PREFS_CONTACTS_SORT_CRITERIUM,
348 (GossipConfNotifyFunc) main_window_notify_sort_criterium_cb,
350 main_window_notify_sort_criterium_cb (conf,
351 GOSSIP_PREFS_CONTACTS_SORT_CRITERIUM,
354 gtk_widget_show (window->window);
356 return window->window;
360 main_window_destroy_cb (GtkWidget *widget,
361 EmpathyMainWindow *window)
363 /* Save user-defined accelerators. */
364 main_window_accels_save ();
366 if (window->size_timeout_id) {
367 g_source_remove (window->size_timeout_id);
370 g_list_free (window->widgets_connected);
371 g_list_free (window->widgets_disconnected);
373 g_object_unref (window->tooltips);
374 g_object_unref (window->mc);
380 main_window_favorite_chatroom_menu_setup (void)
385 main_window_chat_quit_cb (GtkWidget *widget,
386 EmpathyMainWindow *window)
388 gtk_widget_destroy (window->window);
392 main_window_chat_new_message_cb (GtkWidget *widget,
393 EmpathyMainWindow *window)
395 //gossip_new_message_dialog_show (GTK_WINDOW (window->window));
399 main_window_chat_history_cb (GtkWidget *widget,
400 EmpathyMainWindow *window)
402 //gossip_log_window_show (NULL, NULL);
406 main_window_room_join_new_cb (GtkWidget *widget,
407 EmpathyMainWindow *window)
409 //gossip_new_chatroom_dialog_show (GTK_WINDOW (window->window));
413 main_window_room_join_favorites_cb (GtkWidget *widget,
414 EmpathyMainWindow *window)
416 //gossip_session_chatroom_join_favorites (window->session);
420 main_window_room_manage_favorites_cb (GtkWidget *widget,
421 EmpathyMainWindow *window)
423 //gossip_chatrooms_window_show (NULL, FALSE);
427 main_window_chat_add_contact_cb (GtkWidget *widget,
428 EmpathyMainWindow *window)
430 //gossip_add_contact_dialog_show (GTK_WINDOW (window->window), NULL);
434 main_window_chat_show_offline_cb (GtkCheckMenuItem *item,
435 EmpathyMainWindow *window)
439 current = gtk_check_menu_item_get_active (item);
441 gossip_conf_set_bool (gossip_conf_get (),
442 GOSSIP_PREFS_CONTACTS_SHOW_OFFLINE,
445 /* Turn off sound just while we alter the contact list. */
446 // FIXME: gossip_sound_set_enabled (FALSE);
447 g_object_set (window->contact_list, "show_offline", current, NULL);
448 //gossip_sound_set_enabled (TRUE);
452 main_window_edit_button_press_event_cb (GtkWidget *widget,
453 GdkEventButton *event,
454 EmpathyMainWindow *window)
456 GossipContact *contact;
459 if (!event->button == 1) {
463 group = gossip_contact_list_get_selected_group (window->contact_list);
469 item = GTK_MENU_ITEM (window->edit_context);
470 label = gtk_bin_get_child (GTK_BIN (item));
471 gtk_label_set_text (GTK_LABEL (label), _("Group"));
473 gtk_widget_show (window->edit_context);
474 gtk_widget_show (window->edit_context_separator);
476 submenu = gossip_contact_list_get_group_menu (window->contact_list);
477 gtk_menu_item_set_submenu (item, submenu);
484 contact = gossip_contact_list_get_selected (window->contact_list);
490 item = GTK_MENU_ITEM (window->edit_context);
491 label = gtk_bin_get_child (GTK_BIN (item));
492 gtk_label_set_text (GTK_LABEL (label), _("Contact"));
494 gtk_widget_show (window->edit_context);
495 gtk_widget_show (window->edit_context_separator);
497 submenu = gossip_contact_list_get_contact_menu (window->contact_list,
499 gtk_menu_item_set_submenu (item, submenu);
501 g_object_unref (contact);
506 gtk_widget_hide (window->edit_context);
507 gtk_widget_hide (window->edit_context_separator);
513 main_window_edit_accounts_cb (GtkWidget *widget,
514 EmpathyMainWindow *window)
516 gossip_accounts_dialog_show ();
520 main_window_edit_personal_information_cb (GtkWidget *widget,
521 EmpathyMainWindow *window)
523 //gossip_vcard_dialog_show (GTK_WINDOW (window->window));
527 main_window_edit_preferences_cb (GtkWidget *widget,
528 EmpathyMainWindow *window)
530 gossip_preferences_show ();
534 main_window_help_about_cb (GtkWidget *widget,
535 EmpathyMainWindow *window)
537 //gossip_about_dialog_new (GTK_WINDOW (window->window));
541 main_window_help_contents_cb (GtkWidget *widget,
542 EmpathyMainWindow *window)
544 //gossip_help_show ();
548 main_window_throbber_button_press_event_cb (GtkWidget *throbber_ebox,
549 GdkEventButton *event,
552 if (event->type != GDK_BUTTON_PRESS ||
553 event->button != 1) {
557 gossip_accounts_dialog_show ();
563 main_window_session_protocol_connecting_cb (GossipSession *session,
564 GossipAccount *account,
565 GossipProtocol *protocol,
571 priv = GET_PRIV (app);
573 name = gossip_account_get_name (account);
574 gossip_debug (DEBUG_DOMAIN, "Connecting account:'%s'", name);
576 ephy_spinner_start (EPHY_SPINNER (window->throbber));
580 main_window_session_protocol_connected_cb (GossipSession *session,
581 GossipAccount *account,
582 GossipProtocol *protocol,
589 priv = GET_PRIV (app);
591 name = gossip_account_get_name (account);
592 gossip_debug (DEBUG_DOMAIN, "Connected account:'%s'", name);
594 gossip_session_count_accounts (window->session,
599 if (connecting < 1) {
600 ephy_spinner_stop (EPHY_SPINNER (window->throbber));
603 g_hash_table_remove (window->errors, account);
604 g_hash_table_remove (window->reconnects, account);
606 app_connection_items_update ();
607 app_favorite_chatroom_menu_update ();
609 /* Use saved presence */
610 gossip_app_set_presence (gossip_status_presets_get_default_state (),
611 gossip_status_presets_get_default_status());
613 app_presence_updated ();
617 main_window_session_protocol_disconnected_cb (GossipSession *session,
618 GossipAccount *account,
619 GossipProtocol *protocol,
625 gboolean should_reconnect;
628 priv = GET_PRIV (app);
630 name = gossip_account_get_name (account);
631 gossip_debug (DEBUG_DOMAIN, "Disconnected account:'%s'", name);
633 gossip_session_count_accounts (window->session,
638 if (connecting < 1) {
639 ephy_spinner_stop (EPHY_SPINNER (window->throbber));
642 app_connection_items_update ();
643 app_favorite_chatroom_menu_update ();
644 app_presence_updated ();
646 should_reconnect = reason != GOSSIP_PROTOCOL_DISCONNECT_ASKED;
649 should_reconnect &= !g_hash_table_lookup (window->reconnects, account);
651 if (should_reconnect) {
654 /* Unexpected disconnection, try to reconnect */
655 id = g_timeout_add (RETRY_CONNECT_TIMEOUT * 1000,
656 (GSourceFunc) app_reconnect_cb,
658 g_hash_table_insert (window->reconnects,
659 g_object_ref (account),
669 main_window_accels_load (void)
673 filename = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, ACCELS_FILENAME, NULL);
674 if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
675 gossip_debug (DEBUG_DOMAIN, "Loading from:'%s'", filename);
676 gtk_accel_map_load (filename);
683 main_window_accels_save (void)
686 gchar *file_with_path;
688 dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL);
689 g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR);
690 file_with_path = g_build_filename (dir, ACCELS_FILENAME, NULL);
693 gossip_debug (DEBUG_DOMAIN, "Saving to:'%s'", file_with_path);
694 gtk_accel_map_save (file_with_path);
696 g_free (file_with_path);
700 main_window_connection_items_setup (EmpathyMainWindow *window,
706 const gchar *widgets_connected[] = {
711 "edit_personal_information"
713 const gchar *widgets_disconnected[] = {
717 for (i = 0, list = NULL; i < G_N_ELEMENTS (widgets_connected); i++) {
718 w = glade_xml_get_widget (glade, widgets_connected[i]);
719 list = g_list_prepend (list, w);
722 window->widgets_connected = list;
724 for (i = 0, list = NULL; i < G_N_ELEMENTS (widgets_disconnected); i++) {
725 w = glade_xml_get_widget (glade, widgets_disconnected[i]);
726 list = g_list_prepend (list, w);
729 window->widgets_disconnected = list;
735 main_window_connection_items_update (void)
739 guint disconnected = 0;
741 /* Get account count for:
742 * - connected and disabled,
743 * - connected and enabled
744 * - disabled and enabled
746 gossip_session_count_accounts (window->session,
751 for (l = window->widgets_connected; l; l = l->next) {
752 gtk_widget_set_sensitive (l->data, (connected > 0));
755 for (l = window->widgets_disconnected; l; l = l->next) {
756 gtk_widget_set_sensitive (l->data, (disconnected > 0));
762 main_window_presence_changed_cb (MissionControl *mc,
764 EmpathyMainWindow *window)
768 gossip_debug (DEBUG_DOMAIN, "presence changed to %d", state);
770 status = mission_control_get_presence_message_actual (window->mc, NULL);
772 if (G_STR_EMPTY (status)) {
774 status = g_strdup (gossip_presence_state_get_default_status (state));
777 gossip_presence_chooser_set_state (GOSSIP_PRESENCE_CHOOSER (window->presence_chooser),
779 gossip_presence_chooser_set_status (GOSSIP_PRESENCE_CHOOSER (window->presence_chooser),
785 main_window_presence_chooser_changed_cb (GtkWidget *chooser,
788 EmpathyMainWindow *window)
790 gossip_status_presets_set_default (state, status);
791 mission_control_set_presence (window->mc, state, status, NULL, NULL);
795 main_window_configure_event_timeout_cb (EmpathyMainWindow *window)
799 gtk_window_get_size (GTK_WINDOW (window->window), &w, &h);
800 gtk_window_get_position (GTK_WINDOW (window->window), &x, &y);
802 gossip_geometry_save (GEOMETRY_NAME, x, y, w, h);
804 window->size_timeout_id = 0;
810 main_window_configure_event_cb (GtkWidget *widget,
811 GdkEventConfigure *event,
812 EmpathyMainWindow *window)
814 if (window->size_timeout_id) {
815 g_source_remove (window->size_timeout_id);
818 window->size_timeout_id = g_timeout_add (500,
819 (GSourceFunc) main_window_configure_event_timeout_cb,
826 main_window_notify_show_offline_cb (GossipConf *conf,
828 gpointer check_menu_item)
830 gboolean show_offline;
832 if (gossip_conf_get_bool (conf, key, &show_offline)) {
833 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (check_menu_item),
839 main_window_notify_show_avatars_cb (GossipConf *conf,
841 EmpathyMainWindow *window)
843 gboolean show_avatars;
845 if (gossip_conf_get_bool (conf, key, &show_avatars)) {
846 gossip_contact_list_set_show_avatars (window->contact_list,
852 main_window_notify_compact_contact_list_cb (GossipConf *conf,
854 EmpathyMainWindow *window)
856 gboolean compact_contact_list;
858 if (gossip_conf_get_bool (conf, key, &compact_contact_list)) {
859 gossip_contact_list_set_is_compact (window->contact_list,
860 compact_contact_list);
865 main_window_notify_sort_criterium_cb (GossipConf *conf,
867 EmpathyMainWindow *window)
871 if (gossip_conf_get_string (conf, key, &str)) {
873 GEnumClass *enum_class;
874 GEnumValue *enum_value;
876 type = gossip_contact_list_sort_get_type ();
877 enum_class = G_ENUM_CLASS (g_type_class_peek (type));
878 enum_value = g_enum_get_value_by_nick (enum_class, str);
881 gossip_contact_list_set_sort_criterium (window->contact_list,