Mercurial > pidgin.yaz
comparison pidgin/gtkconv.c @ 17257:cb5bd3c045a9
merge of '10181aa0574db4bb368e5eb9c7eb9440c61d930a'
and '12efd7c55efaf31eca5fecc6ccdeeb12ee4b7d95'
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Wed, 23 May 2007 23:17:50 +0000 |
parents | 580c6c5d9480 1f0657cd89d3 |
children | 9c7abb947af4 319bcb73eb4e 591d6c3e9f1f |
comparison
equal
deleted
inserted
replaced
17054:6ec8bae7d98a | 17257:cb5bd3c045a9 |
---|---|
1010 static void | 1010 static void |
1011 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) | 1011 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) |
1012 { | 1012 { |
1013 PidginWindow *win = data; | 1013 PidginWindow *win = data; |
1014 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); | 1014 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); |
1015 PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); | |
1016 const char *name; | |
1015 gchar *buf; | 1017 gchar *buf; |
1016 | 1018 gchar *c; |
1017 buf = g_strdup_printf("%s.html", purple_normalize(conv->account, conv->name)); | 1019 |
1018 | 1020 if (buddy != NULL) |
1021 name = purple_buddy_get_contact_alias(buddy); | |
1022 else | |
1023 name = purple_normalize(conv->account, conv->name); | |
1024 | |
1025 buf = g_strdup_printf("%s.html", name); | |
1026 for (c = buf ; *c ; c++) | |
1027 { | |
1028 if (*c == '/' || *c == '\\') | |
1029 *c = ' '; | |
1030 } | |
1019 purple_request_file(PIDGIN_CONVERSATION(conv), _("Save Conversation"), | 1031 purple_request_file(PIDGIN_CONVERSATION(conv), _("Save Conversation"), |
1020 purple_escape_filename(buf), | 1032 buf, |
1021 TRUE, G_CALLBACK(savelog_writefile_cb), NULL, | 1033 TRUE, G_CALLBACK(savelog_writefile_cb), NULL, |
1022 NULL, NULL, conv, | 1034 NULL, NULL, conv, |
1023 conv); | 1035 conv); |
1024 | 1036 |
1025 g_free(buf); | 1037 g_free(buf); |
1753 } | 1765 } |
1754 | 1766 |
1755 static void | 1767 static void |
1756 move_to_next_unread_tab(PidginConversation *gtkconv, gboolean forward) | 1768 move_to_next_unread_tab(PidginConversation *gtkconv, gboolean forward) |
1757 { | 1769 { |
1758 PidginConversation *next_gtkconv = NULL; | 1770 PidginConversation *next_gtkconv = NULL, *most_active = NULL; |
1771 PidginUnseenState unseen_state = PIDGIN_UNSEEN_NONE; | |
1759 PidginWindow *win; | 1772 PidginWindow *win; |
1760 int initial, i, total, diff; | 1773 int initial, i, total, diff; |
1761 | 1774 |
1762 win = gtkconv->win; | 1775 win = gtkconv->win; |
1763 initial = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook), | 1776 initial = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook), |
1769 */ | 1782 */ |
1770 diff = (forward ? 1 : -1) + total; | 1783 diff = (forward ? 1 : -1) + total; |
1771 | 1784 |
1772 for (i = (initial + diff) % total; i != initial; i = (i + diff) % total) { | 1785 for (i = (initial + diff) % total; i != initial; i = (i + diff) % total) { |
1773 next_gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, i); | 1786 next_gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, i); |
1774 if (next_gtkconv->unseen_state > 0) | 1787 if (next_gtkconv->unseen_state > unseen_state) { |
1775 break; | 1788 most_active = next_gtkconv; |
1776 } | 1789 unseen_state = most_active->unseen_state; |
1777 | 1790 if(PIDGIN_UNSEEN_NICK == unseen_state) /* highest possible state */ |
1778 if (i == initial) { /* no new messages */ | 1791 break; |
1792 } | |
1793 } | |
1794 | |
1795 if (most_active == NULL) { /* no new messages */ | |
1779 i = (i + diff) % total; | 1796 i = (i + diff) % total; |
1780 next_gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, i); | 1797 most_active = pidgin_conv_window_get_gtkconv_at_index(win, i); |
1781 } | 1798 } |
1782 | 1799 |
1783 if (next_gtkconv != NULL && next_gtkconv != gtkconv) | 1800 if (most_active != NULL && most_active != gtkconv) |
1784 pidgin_conv_window_switch_gtkconv(win, next_gtkconv); | 1801 pidgin_conv_window_switch_gtkconv(win, most_active); |
1785 } | 1802 } |
1786 | 1803 |
1787 static gboolean | 1804 static gboolean |
1788 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) | 1805 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) |
1789 { | 1806 { |
3975 update_chat_alias((PurpleBuddy *)bnode, conv, gc, prpl_info); | 3992 update_chat_alias((PurpleBuddy *)bnode, conv, gc, prpl_info); |
3976 } | 3993 } |
3977 } | 3994 } |
3978 else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) | 3995 else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
3979 update_chat_alias((PurpleBuddy *)node, conv, gc, prpl_info); | 3996 update_chat_alias((PurpleBuddy *)node, conv, gc, prpl_info); |
3997 else if (PURPLE_BLIST_NODE_IS_CHAT(node) && | |
3998 purple_conversation_get_account(conv) == ((PurpleChat*)node)->account) | |
3999 { | |
4000 if (old_alias == NULL || g_utf8_collate(old_alias, purple_conversation_get_title(conv)) == 0) | |
4001 pidgin_conv_update_fields(conv, PIDGIN_CONV_SET_TITLE); | |
4002 } | |
3980 } | 4003 } |
3981 | 4004 |
3982 static void | 4005 static void |
3983 buddy_cb_common(PurpleBuddy *buddy, PurpleConversation *conv, gboolean is_buddy) | 4006 buddy_cb_common(PurpleBuddy *buddy, PurpleConversation *conv, gboolean is_buddy) |
3984 { | 4007 { |
4126 GtkListStore *ls; | 4149 GtkListStore *ls; |
4127 GtkCellRenderer *rend; | 4150 GtkCellRenderer *rend; |
4128 GtkTreeViewColumn *col; | 4151 GtkTreeViewColumn *col; |
4129 void *blist_handle = purple_blist_get_handle(); | 4152 void *blist_handle = purple_blist_get_handle(); |
4130 GList *focus_chain = NULL; | 4153 GList *focus_chain = NULL; |
4154 int ul_width; | |
4131 | 4155 |
4132 gtkchat = gtkconv->u.chat; | 4156 gtkchat = gtkconv->u.chat; |
4133 gc = purple_conversation_get_gc(conv); | 4157 gc = purple_conversation_get_gc(conv); |
4134 g_return_val_if_fail(gc != NULL, NULL); | 4158 g_return_val_if_fail(gc != NULL, NULL); |
4135 g_return_val_if_fail(gc->prpl != NULL, NULL); | 4159 g_return_val_if_fail(gc->prpl != NULL, NULL); |
4226 | 4250 |
4227 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | 4251 col = gtk_tree_view_column_new_with_attributes(NULL, rend, |
4228 "pixbuf", CHAT_USERS_ICON_COLUMN, NULL); | 4252 "pixbuf", CHAT_USERS_ICON_COLUMN, NULL); |
4229 gtk_tree_view_column_set_sizing(col, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | 4253 gtk_tree_view_column_set_sizing(col, GTK_TREE_VIEW_COLUMN_AUTOSIZE); |
4230 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | 4254 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); |
4231 gtk_widget_set_size_request(lbox, | 4255 ul_width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/chat/userlist_width"); |
4232 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/chat/userlist_width"), -1); | 4256 gtk_widget_set_size_request(lbox, ul_width, -1); |
4257 | |
4258 /* Hack to prevent completely collapsed userlist coming back with a 1 pixel width. | |
4259 * I would have liked to use the GtkPaned "max-position", but for some reason that didn't work */ | |
4260 if (ul_width == 0) | |
4261 gtk_paned_set_position(GTK_PANED(hpaned), 999999); | |
4233 | 4262 |
4234 g_signal_connect(G_OBJECT(list), "button_press_event", | 4263 g_signal_connect(G_OBJECT(list), "button_press_event", |
4235 G_CALLBACK(right_click_chat_cb), gtkconv); | 4264 G_CALLBACK(right_click_chat_cb), gtkconv); |
4236 g_signal_connect(G_OBJECT(list), "popup-menu", | 4265 g_signal_connect(G_OBJECT(list), "popup-menu", |
4237 G_CALLBACK(gtkconv_chat_popup_menu_cb), gtkconv); | 4266 G_CALLBACK(gtkconv_chat_popup_menu_cb), gtkconv); |
4583 | 4612 |
4584 pidgin_conv_update_fields(conv, PIDGIN_CONV_MENU); | 4613 pidgin_conv_update_fields(conv, PIDGIN_CONV_MENU); |
4585 } | 4614 } |
4586 } | 4615 } |
4587 | 4616 |
4617 static gboolean | |
4618 ignore_middle_click(GtkWidget *widget, GdkEventButton *e, gpointer null) | |
4619 { | |
4620 /* A click on the pane is propagated to the notebook containing the pane. | |
4621 * So if Stu accidentally aims high and middle clicks on the pane-handle, | |
4622 * it causes a conversation tab to close. Let's stop that from happening. | |
4623 */ | |
4624 if (e->button == 2 && e->type == GDK_BUTTON_PRESS) | |
4625 return TRUE; | |
4626 return FALSE; | |
4627 } | |
4628 | |
4588 /************************************************************************** | 4629 /************************************************************************** |
4589 * Conversation UI operations | 4630 * Conversation UI operations |
4590 **************************************************************************/ | 4631 **************************************************************************/ |
4591 static void | 4632 static void |
4592 private_gtkconv_new(PurpleConversation *conv, gboolean hidden) | 4633 private_gtkconv_new(PurpleConversation *conv, gboolean hidden) |
4656 | 4697 |
4657 gtk_drag_dest_set(gtkconv->entry, 0, | 4698 gtk_drag_dest_set(gtkconv->entry, 0, |
4658 te, sizeof(te) / sizeof(GtkTargetEntry), | 4699 te, sizeof(te) / sizeof(GtkTargetEntry), |
4659 GDK_ACTION_COPY); | 4700 GDK_ACTION_COPY); |
4660 | 4701 |
4702 g_signal_connect(G_OBJECT(pane), "button_press_event", | |
4703 G_CALLBACK(ignore_middle_click), NULL); | |
4661 g_signal_connect(G_OBJECT(pane), "drag_data_received", | 4704 g_signal_connect(G_OBJECT(pane), "drag_data_received", |
4662 G_CALLBACK(conv_dnd_recv), gtkconv); | 4705 G_CALLBACK(conv_dnd_recv), gtkconv); |
4663 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", | 4706 g_signal_connect(G_OBJECT(gtkconv->imhtml), "drag_data_received", |
4664 G_CALLBACK(conv_dnd_recv), gtkconv); | 4707 G_CALLBACK(conv_dnd_recv), gtkconv); |
4665 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", | 4708 g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received", |
5549 | 5592 |
5550 g_return_if_fail(alias != NULL); | 5593 g_return_if_fail(alias != NULL); |
5551 | 5594 |
5552 flags = purple_conv_chat_user_get_flags(chat, user); | 5595 flags = purple_conv_chat_user_get_flags(chat, user); |
5553 | 5596 |
5554 cbuddy = purple_conv_chat_cb_new(user, alias, flags); | 5597 cbuddy = purple_conv_chat_cb_find(chat, user); |
5555 | 5598 if (cbuddy) |
5556 add_chat_buddy_common(conv, cbuddy, NULL); | 5599 add_chat_buddy_common(conv, cbuddy, NULL); |
5557 g_free(alias); | 5600 g_free(alias); |
5558 } | 5601 } |
5559 | 5602 |
5560 gboolean | 5603 gboolean |
5561 pidgin_conv_has_focus(PurpleConversation *conv) | 5604 pidgin_conv_has_focus(PurpleConversation *conv) |
7380 } | 7423 } |
7381 else { /* Otherwise, draw the arrows. */ | 7424 else { /* Otherwise, draw the arrows. */ |
7382 PidginWindow *dest_win; | 7425 PidginWindow *dest_win; |
7383 GtkNotebook *dest_notebook; | 7426 GtkNotebook *dest_notebook; |
7384 GtkWidget *tab; | 7427 GtkWidget *tab; |
7385 gint nb_x, nb_y, page_num; | 7428 gint page_num; |
7386 gint arrow1_x, arrow1_y, arrow2_x, arrow2_y; | |
7387 gboolean horiz_tabs = FALSE; | 7429 gboolean horiz_tabs = FALSE; |
7388 PidginConversation *gtkconv; | 7430 PidginConversation *gtkconv; |
7389 gboolean to_right = FALSE; | 7431 gboolean to_right = FALSE; |
7390 | 7432 |
7391 /* Get the window that the cursor is over. */ | 7433 /* Get the window that the cursor is over. */ |
7397 return TRUE; | 7439 return TRUE; |
7398 } | 7440 } |
7399 | 7441 |
7400 dest_notebook = GTK_NOTEBOOK(dest_win->notebook); | 7442 dest_notebook = GTK_NOTEBOOK(dest_win->notebook); |
7401 | 7443 |
7402 gdk_window_get_origin(GTK_WIDGET(dest_notebook)->window, &nb_x, &nb_y); | |
7403 | |
7404 arrow1_x = arrow2_x = nb_x; | |
7405 arrow1_y = arrow2_y = nb_y; | |
7406 | |
7407 page_num = pidgin_conv_get_tab_at_xy(dest_win, | 7444 page_num = pidgin_conv_get_tab_at_xy(dest_win, |
7408 e->x_root, e->y_root, &to_right); | 7445 e->x_root, e->y_root, &to_right); |
7409 to_right = to_right && (win != dest_win); | 7446 to_right = to_right && (win != dest_win); |
7410 | 7447 |
7411 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || | 7448 if (gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_TOP || |
7412 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { | 7449 gtk_notebook_get_tab_pos(dest_notebook) == GTK_POS_BOTTOM) { |
7413 | 7450 horiz_tabs = TRUE; |
7414 horiz_tabs = TRUE; | 7451 } |
7415 } | |
7416 | 7452 |
7417 gtkconv = pidgin_conv_window_get_gtkconv_at_index(dest_win, page_num); | 7453 gtkconv = pidgin_conv_window_get_gtkconv_at_index(dest_win, page_num); |
7418 tab = gtkconv->tabby; | 7454 tab = gtkconv->tabby; |
7419 | 7455 |
7420 if (horiz_tabs) { | 7456 if (horiz_tabs) { |
7421 arrow1_x = arrow2_x = nb_x + tab->allocation.x; | |
7422 | |
7423 if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) { | 7457 if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) { |
7424 arrow1_x += tab->allocation.width; | 7458 dnd_hints_show_relative(HINT_ARROW_DOWN, tab, HINT_POSITION_RIGHT, HINT_POSITION_TOP); |
7425 arrow2_x += tab->allocation.width; | 7459 dnd_hints_show_relative(HINT_ARROW_UP, tab, HINT_POSITION_RIGHT, HINT_POSITION_BOTTOM); |
7460 } else { | |
7461 dnd_hints_show_relative(HINT_ARROW_DOWN, tab, HINT_POSITION_LEFT, HINT_POSITION_TOP); | |
7462 dnd_hints_show_relative(HINT_ARROW_UP, tab, HINT_POSITION_LEFT, HINT_POSITION_BOTTOM); | |
7426 } | 7463 } |
7427 | |
7428 arrow1_y = nb_y + tab->allocation.y; | |
7429 arrow2_y = nb_y + tab->allocation.y + tab->allocation.height; | |
7430 } else { | 7464 } else { |
7431 arrow1_x = nb_x + tab->allocation.x; | |
7432 arrow2_x = nb_x + tab->allocation.x + tab->allocation.width; | |
7433 arrow1_y = arrow2_y = nb_y + tab->allocation.y; | |
7434 | |
7435 if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) { | 7465 if (((gpointer)win == (gpointer)dest_win && win->drag_tab < page_num) || to_right) { |
7436 arrow1_y += tab->allocation.height; | 7466 dnd_hints_show_relative(HINT_ARROW_RIGHT, tab, HINT_POSITION_LEFT, HINT_POSITION_BOTTOM); |
7437 arrow2_y += tab->allocation.height; | 7467 dnd_hints_show_relative(HINT_ARROW_LEFT, tab, HINT_POSITION_RIGHT, HINT_POSITION_BOTTOM); |
7468 } else { | |
7469 dnd_hints_show_relative(HINT_ARROW_RIGHT, tab, HINT_POSITION_LEFT, HINT_POSITION_TOP); | |
7470 dnd_hints_show_relative(HINT_ARROW_LEFT, tab, HINT_POSITION_RIGHT, HINT_POSITION_TOP); | |
7438 } | 7471 } |
7439 } | |
7440 | |
7441 if (horiz_tabs) { | |
7442 dnd_hints_show(HINT_ARROW_DOWN, arrow1_x, arrow1_y); | |
7443 dnd_hints_show(HINT_ARROW_UP, arrow2_x, arrow2_y); | |
7444 } else { | |
7445 dnd_hints_show(HINT_ARROW_RIGHT, arrow1_x, arrow1_y); | |
7446 dnd_hints_show(HINT_ARROW_LEFT, arrow2_x, arrow2_y); | |
7447 } | 7472 } |
7448 } | 7473 } |
7449 | 7474 |
7450 return TRUE; | 7475 return TRUE; |
7451 } | 7476 } |
7802 item = gtk_menu_item_new_with_label(_("Close this tab")); | 7827 item = gtk_menu_item_new_with_label(_("Close this tab")); |
7803 gtk_widget_show(item); | 7828 gtk_widget_show(item); |
7804 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); | 7829 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
7805 g_signal_connect(G_OBJECT(item), "activate", | 7830 g_signal_connect(G_OBJECT(item), "activate", |
7806 G_CALLBACK(close_tab_cb), menu); | 7831 G_CALLBACK(close_tab_cb), menu); |
7832 | |
7833 return FALSE; | |
7834 } | |
7835 | |
7836 static void | |
7837 remove_edit_entry(PidginConversation *gtkconv, GtkWidget *entry) | |
7838 { | |
7839 g_signal_handlers_disconnect_matched(G_OBJECT(entry), G_SIGNAL_MATCH_DATA, | |
7840 0, 0, NULL, NULL, gtkconv); | |
7841 gtk_widget_show(gtkconv->tab_label); | |
7842 gtk_widget_grab_focus(gtkconv->entry); | |
7843 gtk_widget_destroy(entry); | |
7844 } | |
7845 | |
7846 static gboolean | |
7847 alias_focus_cb(GtkWidget *widget, GdkEventFocus *event, gpointer user_data) | |
7848 { | |
7849 remove_edit_entry(user_data, widget); | |
7850 return FALSE; | |
7851 } | |
7852 | |
7853 static gboolean | |
7854 alias_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data) | |
7855 { | |
7856 if (event->keyval == GDK_Escape) { | |
7857 remove_edit_entry(user_data, widget); | |
7858 return TRUE; | |
7859 } | |
7860 return FALSE; | |
7861 } | |
7862 | |
7863 static void | |
7864 alias_cb(GtkEntry *entry, gpointer user_data) | |
7865 { | |
7866 PidginConversation *gtkconv; | |
7867 PurpleConversation *conv; | |
7868 PurpleAccount *account; | |
7869 const char *name; | |
7870 | |
7871 gtkconv = (PidginConversation *)user_data; | |
7872 if (gtkconv == NULL) { | |
7873 return; | |
7874 } | |
7875 conv = gtkconv->active_conv; | |
7876 account = purple_conversation_get_account(conv); | |
7877 name = purple_conversation_get_name(conv); | |
7878 | |
7879 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { | |
7880 PurpleBuddy *buddy; | |
7881 buddy = purple_find_buddy(account, name); | |
7882 if (buddy != NULL) { | |
7883 purple_blist_alias_buddy(buddy, | |
7884 gtk_entry_get_text(entry)); | |
7885 } | |
7886 serv_alias_buddy(buddy); | |
7887 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { | |
7888 PurpleChat *chat; | |
7889 | |
7890 chat = purple_blist_find_chat(account, name); | |
7891 if (chat != NULL) { | |
7892 purple_blist_alias_chat(chat, | |
7893 gtk_entry_get_text(entry)); | |
7894 } | |
7895 } | |
7896 remove_edit_entry(user_data, GTK_WIDGET(entry)); | |
7897 } | |
7898 | |
7899 static gboolean | |
7900 alias_double_click_cb(GtkNotebook *notebook, GdkEventButton *event, PidginConversation *gtkconv) | |
7901 { | |
7902 GtkWidget *entry = NULL; | |
7903 | |
7904 if (event->button != 1 || event->type != GDK_2BUTTON_PRESS) { | |
7905 return FALSE; | |
7906 } | |
7907 | |
7908 if (!GTK_WIDGET_VISIBLE(gtkconv->tab_label)) { | |
7909 /* There's already an entry for alias. Let's not create another one. */ | |
7910 return FALSE; | |
7911 } | |
7912 | |
7913 /* alias label */ | |
7914 entry = gtk_entry_new(); | |
7915 gtk_entry_set_has_frame(GTK_ENTRY(entry), FALSE); | |
7916 gtk_entry_set_width_chars(GTK_ENTRY(entry), 10); | |
7917 gtk_entry_set_alignment(GTK_ENTRY(entry), 0.5); | |
7918 | |
7919 gtk_box_pack_start(GTK_BOX(gtkconv->tabby), entry, TRUE, TRUE, 0); | |
7920 /* after the tab label */ | |
7921 gtk_box_reorder_child(GTK_BOX(gtkconv->tabby), entry, 2); | |
7922 | |
7923 g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(alias_cb), gtkconv); | |
7924 g_signal_connect(G_OBJECT(entry), "focus-out-event", G_CALLBACK(alias_focus_cb), gtkconv); | |
7925 g_signal_connect(G_OBJECT(entry), "key-press-event", G_CALLBACK(alias_key_press_cb), gtkconv); | |
7926 gtk_entry_set_text(GTK_ENTRY(entry), | |
7927 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); | |
7928 gtk_widget_show(entry); | |
7929 gtk_widget_hide(gtkconv->tab_label); | |
7930 gtk_widget_grab_focus(entry); | |
7807 | 7931 |
7808 return FALSE; | 7932 return FALSE; |
7809 } | 7933 } |
7810 | 7934 |
7811 static void | 7935 static void |
8149 static void | 8273 static void |
8150 pidgin_conv_tab_pack(PidginWindow *win, PidginConversation *gtkconv) | 8274 pidgin_conv_tab_pack(PidginWindow *win, PidginConversation *gtkconv) |
8151 { | 8275 { |
8152 gboolean tabs_side = FALSE; | 8276 gboolean tabs_side = FALSE; |
8153 gint angle = 0; | 8277 gint angle = 0; |
8154 GtkWidget *first, *third; | 8278 GtkWidget *first, *third, *ebox; |
8155 | 8279 |
8156 if (purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side") == GTK_POS_LEFT || | 8280 if (purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side") == GTK_POS_LEFT || |
8157 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side") == GTK_POS_RIGHT) | 8281 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side") == GTK_POS_RIGHT) |
8158 tabs_side = TRUE; | 8282 tabs_side = TRUE; |
8159 else if (purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side") == (GTK_POS_LEFT|8)) | 8283 else if (purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/tab_side") == (GTK_POS_LEFT|8)) |
8194 } else { | 8318 } else { |
8195 first = gtkconv->icon; | 8319 first = gtkconv->icon; |
8196 third = gtkconv->close; | 8320 third = gtkconv->close; |
8197 } | 8321 } |
8198 | 8322 |
8323 ebox = gtk_event_box_new(); | |
8324 gtk_event_box_set_visible_window(GTK_EVENT_BOX(ebox), FALSE); | |
8325 gtk_container_add(GTK_CONTAINER(ebox), gtkconv->tabby); | |
8326 g_signal_connect(G_OBJECT(ebox), "button-press-event", | |
8327 G_CALLBACK(alias_double_click_cb), gtkconv); | |
8328 | |
8199 if (gtkconv->tab_label->parent == NULL) { | 8329 if (gtkconv->tab_label->parent == NULL) { |
8200 /* Pack if it's a new widget */ | 8330 /* Pack if it's a new widget */ |
8201 gtk_box_pack_start(GTK_BOX(gtkconv->tabby), first, FALSE, FALSE, 0); | 8331 gtk_box_pack_start(GTK_BOX(gtkconv->tabby), first, FALSE, FALSE, 0); |
8202 gtk_box_pack_start(GTK_BOX(gtkconv->tabby), gtkconv->tab_label, TRUE, TRUE, 0); | 8332 gtk_box_pack_start(GTK_BOX(gtkconv->tabby), gtkconv->tab_label, TRUE, TRUE, 0); |
8203 gtk_box_pack_start(GTK_BOX(gtkconv->tabby), third, FALSE, FALSE, 0); | 8333 gtk_box_pack_start(GTK_BOX(gtkconv->tabby), third, FALSE, FALSE, 0); |
8204 | 8334 |
8205 /* Add this pane to the conversation's notebook. */ | 8335 /* Add this pane to the conversation's notebook. */ |
8206 gtk_notebook_append_page(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, gtkconv->tabby); | 8336 gtk_notebook_append_page(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, ebox); |
8207 } else { | 8337 } else { |
8208 /* reparent old widgets on preference changes */ | 8338 /* reparent old widgets on preference changes */ |
8209 gtk_widget_reparent(first, gtkconv->tabby); | 8339 gtk_widget_reparent(first, gtkconv->tabby); |
8210 gtk_widget_reparent(gtkconv->tab_label, gtkconv->tabby); | 8340 gtk_widget_reparent(gtkconv->tab_label, gtkconv->tabby); |
8211 gtk_widget_reparent(third, gtkconv->tabby); | 8341 gtk_widget_reparent(third, gtkconv->tabby); |
8212 gtk_box_set_child_packing(GTK_BOX(gtkconv->tabby), first, FALSE, FALSE, 0, GTK_PACK_START); | 8342 gtk_box_set_child_packing(GTK_BOX(gtkconv->tabby), first, FALSE, FALSE, 0, GTK_PACK_START); |
8213 gtk_box_set_child_packing(GTK_BOX(gtkconv->tabby), gtkconv->tab_label, TRUE, TRUE, 0, GTK_PACK_START); | 8343 gtk_box_set_child_packing(GTK_BOX(gtkconv->tabby), gtkconv->tab_label, TRUE, TRUE, 0, GTK_PACK_START); |
8214 gtk_box_set_child_packing(GTK_BOX(gtkconv->tabby), third, FALSE, FALSE, 0, GTK_PACK_START); | 8344 gtk_box_set_child_packing(GTK_BOX(gtkconv->tabby), third, FALSE, FALSE, 0, GTK_PACK_START); |
8215 | 8345 |
8216 /* Reset the tabs label to the new version */ | 8346 /* Reset the tabs label to the new version */ |
8217 gtk_notebook_set_tab_label(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, gtkconv->tabby); | 8347 gtk_notebook_set_tab_label(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, ebox); |
8218 } | 8348 } |
8219 | 8349 |
8220 gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, !tabs_side && !angle, TRUE, GTK_PACK_START); | 8350 gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, !tabs_side && !angle, TRUE, GTK_PACK_START); |
8221 | 8351 |
8222 /* show the widgets */ | 8352 /* show the widgets */ |
8223 gtk_widget_show(gtkconv->icon); | 8353 gtk_widget_show(gtkconv->icon); |
8224 gtk_widget_show(gtkconv->tab_label); | 8354 gtk_widget_show(gtkconv->tab_label); |
8225 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs")) | 8355 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/close_on_tabs")) |
8226 gtk_widget_show(gtkconv->close); | 8356 gtk_widget_show(gtkconv->close); |
8227 gtk_widget_show(gtkconv->tabby); | 8357 gtk_widget_show(gtkconv->tabby); |
8358 gtk_widget_show(ebox); | |
8228 } | 8359 } |
8229 | 8360 |
8230 void | 8361 void |
8231 pidgin_conv_window_remove_gtkconv(PidginWindow *win, PidginConversation *gtkconv) | 8362 pidgin_conv_window_remove_gtkconv(PidginWindow *win, PidginConversation *gtkconv) |
8232 { | 8363 { |