]> git.0d.be Git - empathy.git/blob - libempathy-gtk/empathy-contact-menu.c
tp-file: remove EmpathyTpFile
[empathy.git] / libempathy-gtk / empathy-contact-menu.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2008 Collabora Ltd.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library 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  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  *
19  * Authors: Xavier Claessens <xclaesse@gmail.com>
20  */
21
22 #include "config.h"
23
24 #include <string.h>
25
26 #include <glib/gi18n-lib.h>
27 #include <gtk/gtk.h>
28 #include <telepathy-logger/log-manager.h>
29
30 #include <libempathy/empathy-contact-manager.h>
31 #include <libempathy/empathy-request-util.h>
32 #include <libempathy/empathy-utils.h>
33 #include <libempathy/empathy-chatroom-manager.h>
34 #include <libempathy/empathy-contact-manager.h>
35
36 #include "empathy-contact-menu.h"
37 #include "empathy-images.h"
38 #include "empathy-log-window.h"
39 #include "empathy-contact-dialogs.h"
40 #include "empathy-ui-utils.h"
41 #include "empathy-share-my-desktop.h"
42 #include "empathy-call-utils.h"
43
44 static GtkWidget *empathy_contact_block_menu_item_new (EmpathyContact *);
45
46 GtkWidget *
47 empathy_contact_menu_new (EmpathyContact             *contact,
48                           EmpathyContactFeatureFlags  features)
49 {
50         GtkWidget    *menu;
51         GtkMenuShell *shell;
52         GtkWidget    *item;
53
54         g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
55
56         if (features == EMPATHY_CONTACT_FEATURE_NONE) {
57                 return NULL;
58         }
59
60         menu = gtk_menu_new ();
61         shell = GTK_MENU_SHELL (menu);
62
63         /* Add Contact */
64         item = empathy_contact_add_menu_item_new (contact);
65         if (item) {
66                 gtk_menu_shell_append (shell, item);
67                 gtk_widget_show (item);
68         }
69
70         /* Chat */
71         if (features & EMPATHY_CONTACT_FEATURE_CHAT) {
72                 item = empathy_contact_chat_menu_item_new (contact);
73                 gtk_menu_shell_append (shell, item);
74                 gtk_widget_show (item);
75         }
76
77         if (features & EMPATHY_CONTACT_FEATURE_CALL) {
78                 /* Audio Call */
79                 item = empathy_contact_audio_call_menu_item_new (contact);
80                 gtk_menu_shell_append (shell, item);
81                 gtk_widget_show (item);
82
83                 /* Video Call */
84                 item = empathy_contact_video_call_menu_item_new (contact);
85                 gtk_menu_shell_append (shell, item);
86                 gtk_widget_show (item);
87         }
88
89         /* Invite */
90         item = empathy_contact_invite_menu_item_new (contact);
91         gtk_menu_shell_append (shell, item);
92         gtk_widget_show (item);
93
94         /* File transfer */
95         if (features & EMPATHY_CONTACT_FEATURE_FT) {
96                 item = empathy_contact_file_transfer_menu_item_new (contact);
97                 gtk_menu_shell_append (shell, item);
98                 gtk_widget_show (item);
99         }
100
101         /* Share my desktop */
102         /* FIXME we should add the "Share my desktop" menu item if Vino is
103         a registered handler in MC5 */
104         item = empathy_contact_share_my_desktop_menu_item_new (contact);
105         gtk_menu_shell_append (shell, item);
106         gtk_widget_show (item);
107
108         /* Separator */
109         if (features & (EMPATHY_CONTACT_FEATURE_EDIT |
110                         EMPATHY_CONTACT_FEATURE_INFO)) {
111                 item = gtk_separator_menu_item_new ();
112                 gtk_menu_shell_append (shell, item);
113                 gtk_widget_show (item);
114         }
115
116         /* Edit */
117         if (features & EMPATHY_CONTACT_FEATURE_EDIT) {
118                 item = empathy_contact_edit_menu_item_new (contact);
119                 gtk_menu_shell_append (shell, item);
120                 gtk_widget_show (item);
121         }
122
123         /* Log */
124         if (features & EMPATHY_CONTACT_FEATURE_LOG) {
125                 item = empathy_contact_log_menu_item_new (contact);
126                 gtk_menu_shell_append (shell, item);
127                 gtk_widget_show (item);
128         }
129
130         /* Info */
131         if (features & EMPATHY_CONTACT_FEATURE_INFO) {
132                 item = empathy_contact_info_menu_item_new (contact);
133                 gtk_menu_shell_append (shell, item);
134                 gtk_widget_show (item);
135         }
136
137         /* Separator & Block */
138         if (features & EMPATHY_CONTACT_FEATURE_BLOCK &&
139             (item = empathy_contact_block_menu_item_new (contact)) != NULL) {
140                 GtkWidget *sep;
141
142                 sep = gtk_separator_menu_item_new ();
143                 gtk_menu_shell_append (shell, sep);
144                 gtk_widget_show (sep);
145
146                 gtk_menu_shell_append (shell, item);
147                 gtk_widget_show (item);
148         }
149
150         return menu;
151 }
152
153 static void
154 empathy_contact_add_menu_item_activated (GtkMenuItem *item,
155         EmpathyContact *contact)
156 {
157         GtkWidget *toplevel;
158
159         toplevel = gtk_widget_get_toplevel (GTK_WIDGET (item));
160         if (!gtk_widget_is_toplevel (toplevel) || !GTK_IS_WINDOW (toplevel)) {
161                 toplevel = NULL;
162         }
163
164         empathy_new_contact_dialog_show_with_contact (GTK_WINDOW (toplevel),
165                                                       contact);
166 }
167
168 GtkWidget *
169 empathy_contact_add_menu_item_new (EmpathyContact *contact)
170 {
171         GtkWidget *item;
172         GtkWidget *image;
173         EmpathyContactManager *manager;
174         TpConnection *connection;
175         GList *l, *members;
176         gboolean found = FALSE;
177         EmpathyContactListFlags flags;
178
179         g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
180
181         if (!empathy_contact_manager_initialized ()) {
182                 return NULL;
183         }
184
185         manager = empathy_contact_manager_dup_singleton ();
186         connection = empathy_contact_get_connection (contact);
187
188         flags = empathy_contact_manager_get_flags_for_connection (manager,
189                         connection);
190
191         if (!(flags & EMPATHY_CONTACT_LIST_CAN_ADD)) {
192                 return NULL;
193         }
194
195         members = empathy_contact_list_get_members (EMPATHY_CONTACT_LIST (manager));
196         for (l = members; l; l = l->next) {
197                 if (!found && empathy_contact_equal (l->data, contact)) {
198                         found = TRUE;
199                         /* we keep iterating so that we don't leak contact
200                          * refs */
201                 }
202
203                 g_object_unref (l->data);
204         }
205         g_list_free (members);
206         g_object_unref (manager);
207
208         if (found) {
209                 return NULL;
210         }
211
212         item = gtk_image_menu_item_new_with_mnemonic (_("_Add Contact…"));
213         image = gtk_image_new_from_icon_name (GTK_STOCK_ADD,
214                                               GTK_ICON_SIZE_MENU);
215         gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
216
217         g_signal_connect (item, "activate",
218                         G_CALLBACK (empathy_contact_add_menu_item_activated),
219                         contact);
220
221         return item;
222 }
223
224 static void
225 empathy_contact_block_menu_item_toggled (GtkCheckMenuItem *item,
226                                          EmpathyContact   *contact)
227 {
228         static guint block_signal = 0;
229         EmpathyContactManager *manager;
230         gboolean blocked, abusive;
231
232         if (block_signal > 0)
233                 return;
234
235         blocked = gtk_check_menu_item_get_active (item);
236
237         if (blocked) {
238                 /* confirm the user really wishes to block the contact */
239                 GtkWidget *parent;
240                 GdkPixbuf *avatar;
241
242                 /* gtk_menu_get_attach_widget () doesn't behave properly here
243                  * for some reason */
244                 parent = g_object_get_data (
245                         G_OBJECT (gtk_widget_get_parent (GTK_WIDGET (item))),
246                         "window");
247
248                 avatar = empathy_pixbuf_avatar_from_contact_scaled (contact, 48, 48);
249
250                 if (!empathy_block_contact_dialog_show (GTK_WINDOW (parent),
251                                         contact, avatar, &abusive))
252                         return;
253         }
254
255         manager = empathy_contact_manager_dup_singleton ();
256         empathy_contact_list_set_blocked (EMPATHY_CONTACT_LIST (manager),
257                                           contact, blocked, abusive);
258         g_object_unref (manager);
259
260         /* update the toggle with the blocked status */
261         block_signal++;
262         gtk_check_menu_item_set_active (item, blocked);
263         block_signal--;
264 }
265
266 static GtkWidget *
267 empathy_contact_block_menu_item_new (EmpathyContact *contact)
268 {
269         GtkWidget *item;
270         EmpathyContactManager *manager;
271         TpConnection *connection;
272         EmpathyContactListFlags flags;
273         gboolean blocked;
274
275         g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
276
277         manager = empathy_contact_manager_dup_singleton ();
278
279         if (!empathy_contact_manager_initialized ()) {
280                 return NULL;
281         }
282
283         connection = empathy_contact_get_connection (contact);
284
285         flags = empathy_contact_manager_get_flags_for_connection (manager,
286                         connection);
287
288         if (!(flags & EMPATHY_CONTACT_LIST_CAN_BLOCK)) {
289                 return NULL;
290         }
291
292         item = gtk_check_menu_item_new_with_mnemonic (_("_Block Contact"));
293         blocked = empathy_contact_list_get_blocked (
294                         EMPATHY_CONTACT_LIST (manager),
295                         contact);
296
297         gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), blocked);
298
299         g_signal_connect (item, "toggled",
300                         G_CALLBACK (empathy_contact_block_menu_item_toggled),
301                         contact);
302
303         return item;
304 }
305
306 static void
307 empathy_contact_chat_menu_item_activated (GtkMenuItem *item,
308         EmpathyContact *contact)
309 {
310         empathy_chat_with_contact (contact, empathy_get_current_action_time ());
311 }
312
313 GtkWidget *
314 empathy_contact_chat_menu_item_new (EmpathyContact *contact)
315 {
316         GtkWidget *item;
317         GtkWidget *image;
318
319         g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
320
321         item = gtk_image_menu_item_new_with_mnemonic (_("_Chat"));
322         image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_MESSAGE,
323                                               GTK_ICON_SIZE_MENU);
324         gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
325         gtk_widget_set_sensitive (item, !empathy_contact_is_user (contact));
326         gtk_widget_show (image);
327
328         g_signal_connect (item, "activate",
329                                   G_CALLBACK (empathy_contact_chat_menu_item_activated),
330                                   contact);
331
332         return item;
333 }
334
335 static void
336 empathy_contact_audio_call_menu_item_activated (GtkMenuItem *item,
337         EmpathyContact *contact)
338 {
339         empathy_call_new_with_streams (empathy_contact_get_id (contact),
340                 empathy_contact_get_account (contact),
341                 TRUE, FALSE,
342                 empathy_get_current_action_time ());
343 }
344
345 GtkWidget *
346 empathy_contact_audio_call_menu_item_new (EmpathyContact *contact)
347 {
348         GtkWidget *item;
349         GtkWidget *image;
350
351         g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
352
353         item = gtk_image_menu_item_new_with_mnemonic (C_("menu item", "_Audio Call"));
354         image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_VOIP,
355                                               GTK_ICON_SIZE_MENU);
356         gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
357         gtk_widget_set_sensitive (item, empathy_contact_can_voip_audio (contact) &&
358                                         !empathy_contact_is_user (contact));
359         gtk_widget_show (image);
360
361         g_signal_connect (item, "activate",
362                                   G_CALLBACK (empathy_contact_audio_call_menu_item_activated),
363                                   contact);
364
365         return item;
366 }
367
368 static void
369 empathy_contact_video_call_menu_item_activated (GtkMenuItem *item,
370         EmpathyContact *contact)
371 {
372         empathy_call_new_with_streams (empathy_contact_get_id (contact),
373                 empathy_contact_get_account (contact),
374                 TRUE, TRUE,
375                 empathy_get_current_action_time ());
376 }
377
378 GtkWidget *
379 empathy_contact_video_call_menu_item_new (EmpathyContact *contact)
380 {
381         GtkWidget *item;
382         GtkWidget *image;
383
384         g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
385
386         item = gtk_image_menu_item_new_with_mnemonic (C_("menu item", "_Video Call"));
387         image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_VIDEO_CALL,
388                                               GTK_ICON_SIZE_MENU);
389         gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
390         gtk_widget_set_sensitive (item, empathy_contact_can_voip_video (contact) &&
391                                         !empathy_contact_is_user (contact));
392         gtk_widget_show (image);
393
394         g_signal_connect (item, "activate",
395                                   G_CALLBACK (empathy_contact_video_call_menu_item_activated),
396                                   contact);
397
398         return item;
399 }
400
401 static void
402 contact_log_menu_item_activate_cb (EmpathyContact *contact)
403 {
404         empathy_log_window_show (empathy_contact_get_account (contact),
405                                  empathy_contact_get_id (contact),
406                                  FALSE, NULL);
407 }
408
409 GtkWidget *
410 empathy_contact_log_menu_item_new (EmpathyContact *contact)
411 {
412         TplLogManager     *manager;
413         TplEntity         *entity;
414         gboolean           have_log;
415         GtkWidget         *item;
416         GtkWidget         *image;
417
418         g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
419
420         manager = tpl_log_manager_dup_singleton ();
421         entity = tpl_entity_new_from_tp_contact (empathy_contact_get_tp_contact (contact),
422                                                  TPL_ENTITY_CONTACT);
423
424         have_log = tpl_log_manager_exists (manager,
425                                            empathy_contact_get_account (contact),
426                                            entity,
427                                            TPL_EVENT_MASK_TEXT);
428
429         g_object_unref (entity);
430         g_object_unref (manager);
431
432         item = gtk_image_menu_item_new_with_mnemonic (_("_Previous Conversations"));
433         image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_LOG,
434                                               GTK_ICON_SIZE_MENU);
435         gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
436         gtk_widget_set_sensitive (item, have_log);
437         gtk_widget_show (image);
438
439         g_signal_connect_swapped (item, "activate",
440                                   G_CALLBACK (contact_log_menu_item_activate_cb),
441                                   contact);
442
443         return item;
444 }
445
446 GtkWidget *
447 empathy_contact_file_transfer_menu_item_new (EmpathyContact *contact)
448 {
449         GtkWidget         *item;
450         GtkWidget         *image;
451
452         g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
453
454         item = gtk_image_menu_item_new_with_mnemonic (_("Send File"));
455         image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_DOCUMENT_SEND,
456                                               GTK_ICON_SIZE_MENU);
457         gtk_widget_set_sensitive (item, empathy_contact_can_send_files (contact) &&
458                                         !empathy_contact_is_user (contact));
459         gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
460         gtk_widget_show (image);
461
462         g_signal_connect_swapped (item, "activate",
463                                   G_CALLBACK (empathy_send_file_with_file_chooser),
464                                   contact);
465
466         return item;
467 }
468
469 GtkWidget *
470 empathy_contact_share_my_desktop_menu_item_new (EmpathyContact *contact)
471 {
472         GtkWidget         *item;
473         GtkWidget         *image;
474
475         g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
476
477         item = gtk_image_menu_item_new_with_mnemonic (_("Share My Desktop"));
478         image = gtk_image_new_from_icon_name (GTK_STOCK_NETWORK,
479                                               GTK_ICON_SIZE_MENU);
480         gtk_widget_set_sensitive (item, empathy_contact_can_use_rfb_stream_tube (
481                 contact));
482         gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
483         gtk_widget_show (image);
484
485         g_signal_connect_swapped (item, "activate",
486                                   G_CALLBACK (empathy_share_my_desktop_share_with_contact),
487                                   contact);
488
489         return item;
490 }
491
492 static void
493 contact_info_menu_item_activate_cb (EmpathyContact *contact)
494 {
495         empathy_contact_information_dialog_show (contact, NULL);
496 }
497
498 GtkWidget *
499 empathy_contact_info_menu_item_new (EmpathyContact *contact)
500 {
501         GtkWidget *item;
502         GtkWidget *image;
503
504         g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
505
506         item = gtk_image_menu_item_new_with_mnemonic (_("Infor_mation"));
507         image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_CONTACT_INFORMATION,
508                                               GTK_ICON_SIZE_MENU);
509         gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
510         gtk_widget_show (image);
511
512         g_signal_connect_swapped (item, "activate",
513                                   G_CALLBACK (contact_info_menu_item_activate_cb),
514                                   contact);
515
516         return item;
517 }
518
519 static void
520 contact_edit_menu_item_activate_cb (EmpathyContact *contact)
521 {
522         empathy_contact_edit_dialog_show (contact, NULL);
523 }
524
525 GtkWidget *
526 empathy_contact_edit_menu_item_new (EmpathyContact *contact)
527 {
528         EmpathyContactManager *manager;
529         GtkWidget *item;
530         GtkWidget *image;
531         gboolean enable = FALSE;
532
533         g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
534
535         if (empathy_contact_manager_initialized ()) {
536                 TpConnection *connection;
537                 EmpathyContactListFlags flags;
538
539                 manager = empathy_contact_manager_dup_singleton ();
540                 connection = empathy_contact_get_connection (contact);
541                 flags = empathy_contact_manager_get_flags_for_connection (
542                                 manager, connection);
543
544                 enable = (flags & EMPATHY_CONTACT_LIST_CAN_ALIAS ||
545                           flags & EMPATHY_CONTACT_LIST_CAN_GROUP);
546
547                 g_object_unref (manager);
548         }
549
550         item = gtk_image_menu_item_new_with_mnemonic (
551                                                      C_("Edit contact (contextual menu)",
552                                                         "_Edit"));
553         image = gtk_image_new_from_icon_name (GTK_STOCK_EDIT,
554                                               GTK_ICON_SIZE_MENU);
555         gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
556         gtk_widget_show (image);
557
558         gtk_widget_set_sensitive (item, enable);
559
560         g_signal_connect_swapped (item, "activate",
561                                   G_CALLBACK (contact_edit_menu_item_activate_cb),
562                                   contact);
563
564         return item;
565 }
566
567 typedef struct  {
568         EmpathyContact *contact;
569         EmpathyChatroom *chatroom;
570 } RoomSubMenuData;
571
572 static RoomSubMenuData *
573 room_sub_menu_data_new (EmpathyContact *contact,
574                         EmpathyChatroom *chatroom)
575 {
576         RoomSubMenuData *data;
577
578         data = g_slice_new (RoomSubMenuData);
579         data->contact = g_object_ref (contact);
580         data->chatroom = g_object_ref (chatroom);
581         return data;
582 }
583
584 static void
585 room_sub_menu_data_free (RoomSubMenuData *data)
586 {
587         g_object_unref (data->contact);
588         g_object_unref (data->chatroom);
589         g_slice_free (RoomSubMenuData, data);
590 }
591
592 static void
593 room_sub_menu_activate_cb (GtkWidget *item,
594                            RoomSubMenuData *data)
595 {
596         EmpathyTpChat *chat;
597
598         chat = empathy_chatroom_get_tp_chat (data->chatroom);
599         if (chat == NULL) {
600                 /* channel was invalidated. Ignoring */
601                 return;
602         }
603
604         /* send invitation */
605         empathy_contact_list_add (EMPATHY_CONTACT_LIST (chat), data->contact,
606                 _("Inviting you to this room"));
607 }
608
609 static GtkWidget *
610 create_room_sub_menu (EmpathyContact *contact,
611                       EmpathyChatroom *chatroom)
612 {
613         GtkWidget *item;
614         RoomSubMenuData *data;
615
616         item = gtk_menu_item_new_with_label (empathy_chatroom_get_name (chatroom));
617         data = room_sub_menu_data_new (contact, chatroom);
618         g_signal_connect_data (item, "activate",
619                                G_CALLBACK (room_sub_menu_activate_cb), data,
620                                (GClosureNotify) room_sub_menu_data_free, 0);
621
622         return item;
623 }
624
625 GtkWidget *
626 empathy_contact_invite_menu_item_new (EmpathyContact *contact)
627 {
628         GtkWidget *item;
629         GtkWidget *image;
630         GtkWidget *room_item;
631         EmpathyChatroomManager *mgr;
632         GList *rooms, *l;
633         GtkWidget *submenu = NULL;
634
635         g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
636
637         item = gtk_image_menu_item_new_with_mnemonic (_("_Invite to Chat Room"));
638         image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_GROUP_MESSAGE,
639                                               GTK_ICON_SIZE_MENU);
640         gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
641
642         if (empathy_contact_is_user (contact)) {
643                 gtk_widget_set_sensitive (item, FALSE);
644                 gtk_widget_show (image);
645                 return item;
646         }
647
648         mgr = empathy_chatroom_manager_dup_singleton (NULL);
649         rooms = empathy_chatroom_manager_get_chatrooms (mgr,
650                 empathy_contact_get_account (contact));
651
652         for (l = rooms; l != NULL; l = g_list_next (l)) {
653                 EmpathyChatroom *chatroom = l->data;
654
655                 if (empathy_chatroom_get_tp_chat (chatroom) != NULL) {
656                         if (G_UNLIKELY (submenu == NULL))
657                                 submenu = gtk_menu_new ();
658
659                         room_item = create_room_sub_menu (contact, chatroom);
660                         gtk_menu_shell_append ((GtkMenuShell *) submenu, room_item);
661                         gtk_widget_show (room_item);
662                 }
663         }
664
665         if (submenu) {
666                 gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu);
667         } else {
668                 gtk_widget_set_sensitive (item, FALSE);
669         }
670
671         gtk_widget_show (image);
672
673         g_object_unref (mgr);
674         g_list_free (rooms);
675
676         return item;
677 }
678