| 27 #include "pidgindisplaywindow.h" |
27 #include "pidgindisplaywindow.h" |
| 28 |
28 |
| 29 #include "gtkconv.h" |
29 #include "gtkconv.h" |
| 30 #include "gtkdialogs.h" |
30 #include "gtkdialogs.h" |
| 31 #include "gtkutils.h" |
31 #include "gtkutils.h" |
| |
32 #include "pidginconversation.h" |
| 32 #include "pidgindisplayitem.h" |
33 #include "pidgindisplayitem.h" |
| 33 #include "pidgininvitedialog.h" |
34 #include "pidgininvitedialog.h" |
| 34 |
35 |
| 35 enum { |
36 enum { |
| 36 SIG_CONVERSATION_SWITCHED, |
37 SIG_CONVERSATION_SWITCHED, |
| 177 PidginDisplayWindow *window = data; |
178 PidginDisplayWindow *window = data; |
| 178 PurpleConversation *selected = NULL; |
179 PurpleConversation *selected = NULL; |
| 179 |
180 |
| 180 selected = pidgin_display_window_get_selected(window); |
181 selected = pidgin_display_window_get_selected(window); |
| 181 if(PURPLE_IS_CONVERSATION(selected)) { |
182 if(PURPLE_IS_CONVERSATION(selected)) { |
| |
183 GtkWidget *conversation = NULL; |
| |
184 |
| |
185 conversation = pidgin_conversation_from_purple_conversation(selected); |
| |
186 if(PIDGIN_IS_CONVERSATION(conversation)) { |
| |
187 pidgin_conversation_close(PIDGIN_CONVERSATION(conversation)); |
| |
188 g_clear_object(&conversation); |
| |
189 } |
| |
190 |
| 182 pidgin_display_window_remove(window, selected); |
191 pidgin_display_window_remove(window, selected); |
| 183 pidgin_conversation_detach(selected); |
|
| 184 } |
192 } |
| 185 } |
193 } |
| 186 |
194 |
| 187 static void |
195 static void |
| 188 pidgin_display_window_get_info(G_GNUC_UNUSED GSimpleAction *simple, |
196 pidgin_display_window_get_info(G_GNUC_UNUSED GSimpleAction *simple, |
| 510 NULL); |
518 NULL); |
| 511 } |
519 } |
| 512 |
520 |
| 513 void |
521 void |
| 514 pidgin_display_window_add(PidginDisplayWindow *window, |
522 pidgin_display_window_add(PidginDisplayWindow *window, |
| 515 PurpleConversation *conversation) |
523 PurpleConversation *purple_conversation) |
| 516 { |
524 { |
| 517 PidginConversationOld *gtkconv = NULL; |
525 GtkWidget *pidgin_conversation = NULL; |
| 518 |
526 |
| 519 g_return_if_fail(PIDGIN_IS_DISPLAY_WINDOW(window)); |
527 g_return_if_fail(PIDGIN_IS_DISPLAY_WINDOW(window)); |
| 520 g_return_if_fail(PURPLE_IS_CONVERSATION(conversation)); |
528 g_return_if_fail(PURPLE_IS_CONVERSATION(purple_conversation)); |
| 521 |
529 |
| 522 gtkconv = PIDGIN_CONVERSATION_OLD(conversation); |
530 pidgin_conversation = pidgin_conversation_from_purple_conversation(purple_conversation); |
| 523 if(gtkconv != NULL) { |
531 |
| |
532 if(!PIDGIN_IS_CONVERSATION(pidgin_conversation)) { |
| |
533 pidgin_conversation = pidgin_conversation_new(purple_conversation); |
| |
534 } |
| |
535 |
| |
536 if(PIDGIN_IS_CONVERSATION(pidgin_conversation)) { |
| 524 PidginDisplayItem *item = NULL; |
537 PidginDisplayItem *item = NULL; |
| 525 const char *value = NULL; |
538 const char *id = NULL; |
| 526 |
539 |
| 527 GtkWidget *parent = gtk_widget_get_parent(gtkconv->tab_cont); |
540 GtkWidget *parent = gtk_widget_get_parent(pidgin_conversation); |
| 528 |
541 |
| 529 if(GTK_IS_WIDGET(parent)) { |
542 if(GTK_IS_WIDGET(parent)) { |
| 530 g_object_ref(gtkconv->tab_cont); |
543 g_object_ref(pidgin_conversation); |
| 531 gtk_widget_unparent(gtkconv->tab_cont); |
544 gtk_widget_unparent(pidgin_conversation); |
| 532 } |
545 } |
| 533 |
546 |
| 534 value = purple_conversation_get_name(conversation); |
547 id = purple_conversation_get_name(purple_conversation); |
| 535 item = pidgin_display_item_new(gtkconv->tab_cont, value); |
548 item = pidgin_display_item_new(pidgin_conversation, id); |
| 536 g_object_set_data(G_OBJECT(item), "conversation", conversation); |
549 g_object_set_data(G_OBJECT(item), "conversation", purple_conversation); |
| 537 |
550 |
| 538 g_object_bind_property(conversation, "title", |
551 g_object_bind_property(purple_conversation, "title", |
| 539 item, "title", |
552 item, "title", |
| 540 G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); |
553 G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); |
| 541 |
554 |
| 542 g_list_store_append(window->conversation_model, item); |
555 g_list_store_append(window->conversation_model, item); |
| 543 g_clear_object(&item); |
556 g_clear_object(&item); |
| 544 |
557 |
| 545 if(GTK_IS_WIDGET(parent)) { |
558 if(GTK_IS_WIDGET(parent)) { |
| 546 g_object_unref(gtkconv->tab_cont); |
559 g_object_unref(pidgin_conversation); |
| 547 } |
560 } |
| 548 } |
561 } |
| 549 } |
562 } |
| 550 |
563 |
| 551 void |
564 void |