| 229 g_list_free(list); |
229 g_list_free(list); |
| 230 return FALSE; |
230 return FALSE; |
| 231 } |
231 } |
| 232 |
232 |
| 233 static gboolean |
233 static gboolean |
| 234 close_conv_cb(GtkWidget *w, GdkEventButton *dontuse, PidginConversation *gtkconv) |
234 close_conv_cb(GtkButton *button, PidginConversation *gtkconv) |
| 235 { |
235 { |
| 236 /* We are going to destroy the conversations immediately only if the 'close immediately' |
236 /* We are going to destroy the conversations immediately only if the 'close immediately' |
| 237 * preference is selected. Otherwise, close the conversation after a reasonable timeout |
237 * preference is selected. Otherwise, close the conversation after a reasonable timeout |
| 238 * (I am going to consider 10 minutes as a 'reasonable timeout' here. |
238 * (I am going to consider 10 minutes as a 'reasonable timeout' here. |
| 239 * For chats, close immediately if the chat is not in the buddylist, or if the chat is |
239 * For chats, close immediately if the chat is not in the buddylist, or if the chat is |
| 279 static void |
279 static void |
| 280 default_formatize(PidginConversation *c) |
280 default_formatize(PidginConversation *c) |
| 281 { |
281 { |
| 282 PurpleConversation *conv = c->active_conv; |
282 PurpleConversation *conv = c->active_conv; |
| 283 gtk_imhtml_setup_entry(GTK_IMHTML(c->entry), conv->features); |
283 gtk_imhtml_setup_entry(GTK_IMHTML(c->entry), conv->features); |
| |
284 } |
| |
285 |
| |
286 static void |
| |
287 conversation_entry_clear(PidginConversation *gtkconv) |
| |
288 { |
| |
289 GtkIMHtml *imhtml = GTK_IMHTML(gtkconv->entry); |
| |
290 gtk_source_undo_manager_begin_not_undoable_action(imhtml->undo_manager); |
| |
291 gtk_imhtml_clear(imhtml); |
| |
292 gtk_source_undo_manager_end_not_undoable_action(imhtml->undo_manager); |
| 284 } |
293 } |
| 285 |
294 |
| 286 static void |
295 static void |
| 287 clear_formatting_cb(GtkIMHtml *imhtml, PidginConversation *gtkconv) |
296 clear_formatting_cb(GtkIMHtml *imhtml, PidginConversation *gtkconv) |
| 288 { |
297 { |
| 557 char *buf, *clean; |
566 char *buf, *clean; |
| 558 |
567 |
| 559 account = purple_conversation_get_account(conv); |
568 account = purple_conversation_get_account(conv); |
| 560 |
569 |
| 561 if (check_for_and_do_command(conv)) { |
570 if (check_for_and_do_command(conv)) { |
| 562 gtk_imhtml_clear(GTK_IMHTML(gtkconv->entry)); |
571 conversation_entry_clear(gtkconv); |
| 563 return; |
572 return; |
| 564 } |
573 } |
| 565 |
574 |
| 566 if ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) && |
575 if ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) && |
| 567 purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) |
576 purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) |
| 1411 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
1420 menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) |
| 1412 #endif |
1421 #endif |
| 1413 { |
1422 { |
| 1414 PidginWindow *win = data; |
1423 PidginWindow *win = data; |
| 1415 |
1424 |
| 1416 close_conv_cb(NULL, NULL, PIDGIN_CONVERSATION(pidgin_conv_window_get_active_conversation(win))); |
1425 close_conv_cb(NULL, PIDGIN_CONVERSATION(pidgin_conv_window_get_active_conversation(win))); |
| 1417 } |
1426 } |
| 1418 |
1427 |
| 1419 static void |
1428 static void |
| 1420 #if GTK_CHECK_VERSION(2,6,0) |
1429 #if GTK_CHECK_VERSION(2,6,0) |
| 1421 menu_logging_cb(GtkAction *action, gpointer data) |
1430 menu_logging_cb(GtkAction *action, gpointer data) |
| 5228 if (node) |
5237 if (node) |
| 5229 pidgin_blist_draw_tooltip(node, gtkconv->infopane); |
5238 pidgin_blist_draw_tooltip(node, gtkconv->infopane); |
| 5230 return FALSE; |
5239 return FALSE; |
| 5231 } |
5240 } |
| 5232 |
5241 |
| 5233 /* Close button {{{ */ |
|
| 5234 static gboolean |
|
| 5235 close_button_left_cb(GtkWidget *widget, GdkEventCrossing *event, GtkLabel *label) |
|
| 5236 { |
|
| 5237 static GdkCursor *ptr = NULL; |
|
| 5238 if (ptr == NULL) { |
|
| 5239 ptr = gdk_cursor_new(GDK_LEFT_PTR); |
|
| 5240 } |
|
| 5241 |
|
| 5242 gtk_label_set_markup(label, "×"); |
|
| 5243 gdk_window_set_cursor(event->window, ptr); |
|
| 5244 return FALSE; |
|
| 5245 } |
|
| 5246 |
|
| 5247 static gboolean |
|
| 5248 close_button_entered_cb(GtkWidget *widget, GdkEventCrossing *event, GtkLabel *label) |
|
| 5249 { |
|
| 5250 static GdkCursor *hand = NULL; |
|
| 5251 if (hand == NULL) { |
|
| 5252 hand = gdk_cursor_new(GDK_HAND2); |
|
| 5253 } |
|
| 5254 |
|
| 5255 gtk_label_set_markup(label, "<u>×</u>"); |
|
| 5256 gdk_window_set_cursor(event->window, hand); |
|
| 5257 return FALSE; |
|
| 5258 } |
|
| 5259 |
|
| 5260 static GtkWidget * |
|
| 5261 create_close_button(void) |
|
| 5262 { |
|
| 5263 GtkWidget *ebox = gtk_event_box_new(); |
|
| 5264 GtkWidget *close_image; |
|
| 5265 |
|
| 5266 gtk_event_box_set_visible_window(GTK_EVENT_BOX(ebox), FALSE); |
|
| 5267 gtk_widget_set_events(ebox, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); |
|
| 5268 close_image = gtk_label_new("×"); |
|
| 5269 g_signal_connect(G_OBJECT(ebox), "enter-notify-event", G_CALLBACK(close_button_entered_cb), close_image); |
|
| 5270 g_signal_connect(G_OBJECT(ebox), "leave-notify-event", G_CALLBACK(close_button_left_cb), close_image); |
|
| 5271 gtk_widget_show(close_image); |
|
| 5272 gtk_container_add(GTK_CONTAINER(ebox), close_image); |
|
| 5273 |
|
| 5274 return ebox; |
|
| 5275 } |
|
| 5276 |
|
| 5277 /* }}} */ |
|
| 5278 |
|
| 5279 /* Quick Find {{{ */ |
5242 /* Quick Find {{{ */ |
| 5280 static gboolean |
5243 static gboolean |
| 5281 pidgin_conv_end_quickfind(PidginConversation *gtkconv) |
5244 pidgin_conv_end_quickfind(PidginConversation *gtkconv) |
| 5282 { |
5245 { |
| 5283 gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, NULL); |
5246 gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, NULL); |
| 5320 GtkWidget *widget = gtk_hbox_new(FALSE, 0); |
5283 GtkWidget *widget = gtk_hbox_new(FALSE, 0); |
| 5321 GtkWidget *label, *entry, *close; |
5284 GtkWidget *label, *entry, *close; |
| 5322 |
5285 |
| 5323 gtk_box_pack_start(GTK_BOX(container), widget, FALSE, FALSE, 0); |
5286 gtk_box_pack_start(GTK_BOX(container), widget, FALSE, FALSE, 0); |
| 5324 |
5287 |
| 5325 close = create_close_button(); |
5288 close = pidgin_create_small_button(gtk_label_new("×")); |
| 5326 gtk_box_pack_start(GTK_BOX(widget), close, FALSE, FALSE, 0); |
5289 gtk_box_pack_start(GTK_BOX(widget), close, FALSE, FALSE, 0); |
| 5327 gtk_tooltips_set_tip(gtkconv->tooltips, close, |
5290 gtk_tooltips_set_tip(gtkconv->tooltips, close, |
| 5328 _("Close Find bar"), NULL); |
5291 _("Close Find bar"), NULL); |
| 5329 |
5292 |
| 5330 label = gtk_label_new(_("Find:")); |
5293 label = gtk_label_new(_("Find:")); |
| 9125 |
9088 |
| 9126 if (tab_clicked == -1) |
9089 if (tab_clicked == -1) |
| 9127 return FALSE; |
9090 return FALSE; |
| 9128 |
9091 |
| 9129 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, tab_clicked); |
9092 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, tab_clicked); |
| 9130 close_conv_cb(NULL, NULL, gtkconv); |
9093 close_conv_cb(NULL, gtkconv); |
| 9131 return TRUE; |
9094 return TRUE; |
| 9132 } |
9095 } |
| 9133 |
9096 |
| 9134 |
9097 |
| 9135 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) |
9098 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) |
| 9405 PidginConversation *gtkconv; |
9368 PidginConversation *gtkconv; |
| 9406 |
9369 |
| 9407 gtkconv = g_object_get_data(menu, "clicked_tab"); |
9370 gtkconv = g_object_get_data(menu, "clicked_tab"); |
| 9408 |
9371 |
| 9409 if (gtkconv) |
9372 if (gtkconv) |
| 9410 close_conv_cb(NULL, NULL, gtkconv); |
9373 close_conv_cb(NULL, gtkconv); |
| 9411 } |
9374 } |
| 9412 |
9375 |
| 9413 static gboolean |
9376 static gboolean |
| 9414 right_click_menu_cb(GtkNotebook *notebook, GdkEventButton *event, PidginWindow *win) |
9377 right_click_menu_cb(GtkNotebook *notebook, GdkEventButton *event, PidginWindow *win) |
| 9415 { |
9378 { |
| 9886 gtk_widget_destroy(win->dialogs.search); |
9849 gtk_widget_destroy(win->dialogs.search); |
| 9887 |
9850 |
| 9888 if (win->gtkconvs) { |
9851 if (win->gtkconvs) { |
| 9889 while (win->gtkconvs) { |
9852 while (win->gtkconvs) { |
| 9890 gboolean last = (win->gtkconvs->next == NULL); |
9853 gboolean last = (win->gtkconvs->next == NULL); |
| 9891 close_conv_cb(NULL, NULL, win->gtkconvs->data); |
9854 close_conv_cb(NULL, win->gtkconvs->data); |
| 9892 if (last) |
9855 if (last) |
| 9893 break; |
9856 break; |
| 9894 } |
9857 } |
| 9895 return; |
9858 return; |
| 9896 } |
9859 } |
| 9975 if (win->gtkconvs && win->gtkconvs->next && win->gtkconvs->next->next == NULL) |
9938 if (win->gtkconvs && win->gtkconvs->next && win->gtkconvs->next->next == NULL) |
| 9976 pidgin_conv_tab_pack(win, ((PidginConversation*)win->gtkconvs->data)); |
9939 pidgin_conv_tab_pack(win, ((PidginConversation*)win->gtkconvs->data)); |
| 9977 |
9940 |
| 9978 |
9941 |
| 9979 /* Close button. */ |
9942 /* Close button. */ |
| 9980 gtkconv->close = create_close_button(); |
9943 gtkconv->close = pidgin_create_small_button(gtk_label_new("×")); |
| 9981 #if GTK_CHECK_VERSION(2,12,0) |
9944 #if GTK_CHECK_VERSION(2,12,0) |
| 9982 gtk_widget_set_tooltip_text(gtkconv->close, _("Close conversation")); |
9945 gtk_widget_set_tooltip_text(gtkconv->close, _("Close conversation")); |
| 9983 #else |
9946 #else |
| 9984 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, |
9947 gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, |
| 9985 _("Close conversation"), NULL); |
9948 _("Close conversation"), NULL); |
| 9986 #endif |
9949 #endif |
| 9987 |
9950 |
| 9988 g_signal_connect(G_OBJECT(gtkconv->close), "button-press-event", |
9951 g_signal_connect(gtkconv->close, "clicked", G_CALLBACK (close_conv_cb), gtkconv); |
| 9989 G_CALLBACK(close_conv_cb), gtkconv); |
|
| 9990 |
9952 |
| 9991 /* Status icon. */ |
9953 /* Status icon. */ |
| 9992 gtkconv->icon = gtk_image_new(); |
9954 gtkconv->icon = gtk_image_new(); |
| 9993 gtkconv->menu_icon = gtk_image_new(); |
9955 gtkconv->menu_icon = gtk_image_new(); |
| 9994 g_object_set(G_OBJECT(gtkconv->icon), |
9956 g_object_set(G_OBJECT(gtkconv->icon), |