diff options
-rw-r--r-- | ChangeLog.API | 3 | ||||
-rw-r--r-- | doc/reference/pidgin/signals_gtkconv.xml | 24 | ||||
-rw-r--r-- | pidgin/gtkblist.c | 180 | ||||
-rw-r--r-- | pidgin/gtkconv.c | 223 | ||||
-rw-r--r-- | pidgin/gtkconv.h | 13 | ||||
-rw-r--r-- | pidgin/prefs/pidginprefs.c | 28 | ||||
-rw-r--r-- | pidgin/resources/Prefs/prefs.ui | 68 |
7 files changed, 57 insertions, 482 deletions
diff --git a/ChangeLog.API b/ChangeLog.API index d47349db3f..a77c3d4657 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -710,6 +710,7 @@ version 3.0.0 (??/??/????): * PALETTE_NUM_COLORS renamed to PIDGIN_PALETTE_NUM_COLORS * pidgin_account_option_menu_* renamed to pidgin_account_chooser_* + * pidgin_conversations_get_unseen_all removed hidden_only parameter. * pidgin_make_mini_dialog renamed to pidgin_mini_dialog_new_with_buttons; note the argument order has changed to match pidgin_mini_dialog_new @@ -721,6 +722,7 @@ version 3.0.0 (??/??/????): Removed: * conversation-timestamp (gtkconv signal) + * conversation-hiding (gtkconv signal) * GtkIMHtml.clipboard_html_string * GtkIMHtml.clipboard_text_string * GtkIMHtmlFontDetail @@ -777,6 +779,7 @@ version 3.0.0 (??/??/????): * PidginConversation.sg * PidginConvPlacementFunc * pidgin_conv_get_tab_icon, use PidginPresenceIcon instead. + * pidgin_conv_is_hidden * pidgin_conv_placement_get_name * pidgin_conv_placement_add_fnc * pidgin_conv_placement_remove_fnc diff --git a/doc/reference/pidgin/signals_gtkconv.xml b/doc/reference/pidgin/signals_gtkconv.xml index 811d1d6fb1..4c9fcf5951 100644 --- a/doc/reference/pidgin/signals_gtkconv.xml +++ b/doc/reference/pidgin/signals_gtkconv.xml @@ -14,7 +14,6 @@ "<link linkend="gtkconvs-displaying-chat-msg">displaying-chat-msg</link>" "<link linkend="gtkconvs-displayed-chat-msg">displayed-chat-msg</link>" "<link linkend="gtkconvs-conversation-switched">conversation-switched</link>" - "<link linkend="gtkconvs-conversation-hiding">conversation-hiding</link>" "<link linkend="gtkconvs-conversation-displayed">conversation-displayed</link>" </synopsis> </refsect1> @@ -248,27 +247,6 @@ Emitted when a window switched from one conversation to another. </variablelist> </refsect2> -<refsect2 id="gtkconvs-conversation-hiding" role="signal"> - <title>The <literal>"conversation-hiding"</literal> signal</title> -<programlisting> -void user_function (PidginConversation *gtkconv, - gpointer user_data) -</programlisting> - <para> -Emitted immediately before an existing conversation is hidden. - </para> - <variablelist role="params"> - <varlistentry> - <term><parameter>gtkconv</parameter> :</term> - <listitem><simpara>The PidginConversation.</simpara></listitem> - </varlistentry> - <varlistentry> - <term><parameter>user_data</parameter> :</term> - <listitem><simpara>user data set when the signal handler was connected.</simpara></listitem> - </varlistentry> - </variablelist> -</refsect2> - <refsect2 id="gtkconvs-conversation-displayed" role="signal"> <title>The <literal>"conversation-displayed"</literal> signal</title> <programlisting> @@ -276,7 +254,7 @@ void user_function (PidginConversation *gtkc gpointer user_data) </programlisting> <para> -Emitted right after the Pidgin UI is attached to a new or a hidden conversation. +Emitted right after the Pidgin UI is attached to a new conversation. </para> <variablelist role="params"> <varlistentry> diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 0cc09dab34..ac41029483 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -178,20 +178,12 @@ static char *pidgin_get_group_title(PurpleBlistNode *gnode, gboolean expanded); static void pidgin_blist_expand_contact_cb(GtkWidget *w, PurpleBlistNode *node); static void set_urgent(void); -typedef enum { - PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE = 1 << 0, /* Whether there's pending message in a conversation */ - PIDGIN_BLIST_CHAT_HAS_PENDING_MESSAGE_WITH_NICK = 1 << 1, /* Whether there's a pending message in a chat that mentions our nick */ -} PidginBlistNodeFlags; - typedef struct { GtkTreeRowReference *row; gboolean contact_expanded; gboolean recent_signonoff; gint recent_signonoff_timer; - struct { - PurpleConversation *conv; - PidginBlistNodeFlags flags; - } conv; + PurpleConversation *conv; } PidginBlistNode; /*************************************************** @@ -349,22 +341,6 @@ static void gtk_blist_menu_persistent_cb(GtkWidget *w, PurpleChat *chat) gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))); } -static PurpleConversation * -find_conversation_with_buddy(PurpleBuddy *buddy) -{ - PurpleConversationManager *manager; - PidginBlistNode *ui = g_object_get_data(G_OBJECT(buddy), UI_DATA); - - if(ui) { - return ui->conv.conv; - } - - manager = purple_conversation_manager_get_default(); - return purple_conversation_manager_find_im(manager, - purple_buddy_get_account(buddy), - purple_buddy_get_name(buddy)); -} - static void gtk_blist_join_chat(PurpleChat *chat) { PurpleAccount *account; @@ -3111,8 +3087,8 @@ static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full) g_free(tmp); } - if (bnode && bnode->conv.conv) { - conv = PURPLE_CHAT_CONVERSATION(bnode->conv.conv); + if (bnode && bnode->conv) { + conv = PURPLE_CHAT_CONVERSATION(bnode->conv); } else { PurpleConversation *chat_conv; PurpleConversationManager *manager; @@ -3559,39 +3535,25 @@ pidgin_blist_get_status_icon(PurpleBlistNode *node, PidginStatusIconSize size) } if(buddy) { - PurpleConversation *conv = find_conversation_with_buddy(buddy); - - if(conv != NULL) { - PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); - if (gtkconv == NULL && size == PIDGIN_STATUS_ICON_SMALL) { - PidginBlistNode *ui = g_object_get_data(G_OBJECT(buddy), UI_DATA); - if (ui == NULL || (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE)) { - icon = "message-new"; - } - } - } - - if (icon == NULL) { /* The conversation didn't have a new message. */ - PurplePresence *p = purple_buddy_get_presence(buddy); - trans = purple_presence_is_idle(p); - - if (PURPLE_BUDDY_IS_ONLINE(buddy) && gtkbuddynode && gtkbuddynode->recent_signonoff) { - icon = "log-in"; - } else if (gtkbuddynode && gtkbuddynode->recent_signonoff) { - icon = "log-out"; - } else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_UNAVAILABLE)) { - icon = "pidgin-user-busy"; - } else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_AWAY)) { - icon = "pidgin-user-away"; - } else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_EXTENDED_AWAY)) { - icon = "pidgin-user-extended-away"; - } else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_OFFLINE)) { - icon = "pidgin-user-offline"; - } else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_INVISIBLE)) { - icon = "pidgin-user-invisible"; - } else { - icon = "pidgin-user-available"; - } + PurplePresence *p = purple_buddy_get_presence(buddy); + trans = purple_presence_is_idle(p); + + if (PURPLE_BUDDY_IS_ONLINE(buddy) && gtkbuddynode && gtkbuddynode->recent_signonoff) { + icon = "log-in"; + } else if (gtkbuddynode && gtkbuddynode->recent_signonoff) { + icon = "log-out"; + } else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_UNAVAILABLE)) { + icon = "pidgin-user-busy"; + } else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_AWAY)) { + icon = "pidgin-user-away"; + } else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_EXTENDED_AWAY)) { + icon = "pidgin-user-extended-away"; + } else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_OFFLINE)) { + icon = "pidgin-user-offline"; + } else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_INVISIBLE)) { + icon = "pidgin-user-invisible"; + } else { + icon = "pidgin-user-available"; } } else if (chat) { icon = "chat"; @@ -3620,22 +3582,9 @@ pidgin_blist_get_name_markup(PurpleBuddy *b, gboolean selected, gboolean aliased PurplePresence *presence; PidginBlistNode *gtkcontactnode = NULL; char *idletime = NULL, *statustext = NULL, *nametext = NULL; - PurpleConversation *conv = find_conversation_with_buddy(b); - gboolean hidden_conv = FALSE; gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); gchar *contact_alias; - if (conv != NULL) { - PidginBlistNode *ui = g_object_get_data(G_OBJECT(b), UI_DATA); - if (ui) { - if (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE) - hidden_conv = TRUE; - } else { - if (PIDGIN_CONVERSATION(conv) == NULL) - hidden_conv = TRUE; - } - } - /* XXX Good luck cleaning up this crap */ contact = PURPLE_CONTACT(PURPLE_BLIST_NODE(b)->parent); if(contact) { @@ -3731,12 +3680,6 @@ pidgin_blist_get_name_markup(PurpleBuddy *b, gboolean selected, gboolean aliased status_color = NULL; } - if (hidden_conv) { - char *tmp = nametext; - nametext = g_strdup_printf("<b>%s</b>", tmp); - g_free(tmp); - } - /* Put it all together */ if ((!aliased || biglist) && (statustext || idletime)) { /* using <span size='smaller'> breaks the status, so it must be separated into <small><span>*/ @@ -3773,12 +3716,6 @@ pidgin_blist_get_name_markup(PurpleBuddy *b, gboolean selected, gboolean aliased g_free(idletime); g_free(contact_alias); - if (hidden_conv) { - char *tmp = text; - text = g_strdup_printf("<b>%s</b>", tmp); - g_free(tmp); - } - return text; } @@ -3876,42 +3813,9 @@ conversation_deleting_cb(PurpleConversation *conv, PidginBuddyList *gtkblist) static void conversation_deleted_update_ui_cb(PurpleConversation *conv, PidginBlistNode *ui) { - if (ui->conv.conv != conv) + if (ui->conv != conv) return; - ui->conv.conv = NULL; - ui->conv.flags = 0; -} - -static void -written_msg_update_ui_cb(PurpleConversation *conv, PurpleMessage *msg, PurpleBlistNode *node) -{ - PidginBlistNode *ui = g_object_get_data(G_OBJECT(node), UI_DATA); - - if (ui->conv.conv != conv) - return; - - if (!pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv))) - return; - - if (!(purple_message_get_flags(msg) & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV))) - return; - - ui->conv.flags |= PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE; - if (PURPLE_IS_CHAT_CONVERSATION(conv) && (purple_message_get_flags(msg) & PURPLE_MESSAGE_NICK)) - ui->conv.flags |= PIDGIN_BLIST_CHAT_HAS_PENDING_MESSAGE_WITH_NICK; - - pidgin_blist_update(purple_blist_get_default(), node); -} - -static void -displayed_msg_update_ui_cb(PidginConversation *gtkconv, PurpleBlistNode *node) -{ - PidginBlistNode *ui = g_object_get_data(G_OBJECT(node), UI_DATA); - if (ui->conv.conv != gtkconv->active_conv) - return; - ui->conv.flags &= ~(PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE | - PIDGIN_BLIST_CHAT_HAS_PENDING_MESSAGE_WITH_NICK); - pidgin_blist_update(purple_blist_get_default(), node); + ui->conv = NULL; } static void @@ -3927,14 +3831,10 @@ conversation_created_cb(PurpleConversation *conv, PidginBuddyList *gtkblist) buddies = g_slist_delete_link(buddies, buddies); if (!ui) continue; - ui->conv.conv = conv; - ui->conv.flags = 0; + ui->conv = conv; + purple_signal_connect(purple_conversations_get_handle(), "deleting-conversation", ui, PURPLE_CALLBACK(conversation_deleted_update_ui_cb), ui); - purple_signal_connect(purple_conversations_get_handle(), "wrote-im-msg", - ui, PURPLE_CALLBACK(written_msg_update_ui_cb), buddy); - purple_signal_connect(pidgin_conversations_get_handle(), "conversation-displayed", - ui, PURPLE_CALLBACK(displayed_msg_update_ui_cb), buddy); } } else if (PURPLE_IS_CHAT_CONVERSATION(conv)) { PurpleChat *chat = purple_blist_find_chat(account, purple_conversation_get_name(conv)); @@ -3944,14 +3844,10 @@ conversation_created_cb(PurpleConversation *conv, PidginBuddyList *gtkblist) ui = g_object_get_data(G_OBJECT(chat), UI_DATA); if (!ui) return; - ui->conv.conv = conv; - ui->conv.flags = 0; + ui->conv = conv; + purple_signal_connect(purple_conversations_get_handle(), "deleting-conversation", ui, PURPLE_CALLBACK(conversation_deleted_update_ui_cb), ui); - purple_signal_connect(purple_conversations_get_handle(), "wrote-chat-msg", - ui, PURPLE_CALLBACK(written_msg_update_ui_cb), chat); - purple_signal_connect(pidgin_conversations_get_handle(), "conversation-displayed", - ui, PURPLE_CALLBACK(displayed_msg_update_ui_cb), chat); } } @@ -5662,22 +5558,12 @@ static void pidgin_blist_update_chat(PurpleBuddyList *list, PurpleBlistNode *nod gchar *mark, *tmp; gboolean showicons = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); - PidginBlistNode *ui; - PurpleConversation *conv; - gboolean hidden = FALSE; gboolean selected = (gtkblist->selected_node == node); gboolean nick_said = FALSE; if (!insert_node(list, node, &iter)) return; - ui = g_object_get_data(G_OBJECT(node), UI_DATA); - conv = ui->conv.conv; - if (conv && pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv))) { - hidden = (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE); - nick_said = (ui->conv.flags & PIDGIN_BLIST_CHAT_HAS_PENDING_MESSAGE_WITH_NICK); - } - status = pidgin_blist_get_status_icon(node, biglist ? PIDGIN_STATUS_ICON_LARGE : PIDGIN_STATUS_ICON_SMALL); emblem = pidgin_blist_get_emblem(node); @@ -5696,14 +5582,10 @@ static void pidgin_blist_update_chat(PurpleBuddyList *list, PurpleBlistNode *nod } if(color) { - tmp = g_strdup_printf("<span color='%s' weight='%s'>%s</span>", - color, hidden ? "bold" : "normal", mark); - } else { - tmp = g_strdup_printf("<span weight='%s'>%s</span>", - hidden ? "bold" : "normal", mark); + tmp = g_strdup_printf("<span color='%s'>%s</span>", color, mark); + g_free(mark); + mark = tmp; } - g_free(mark); - mark = tmp; protocol_icon = pidgin_create_protocol_icon(purple_chat_get_account(chat), PIDGIN_PROTOCOL_ICON_SMALL); diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c index 953c954e8c..bcbce1caec 100644 --- a/pidgin/gtkconv.c +++ b/pidgin/gtkconv.c @@ -132,7 +132,6 @@ enum { static GtkWidget *invite_dialog = NULL; static GtkWidget *warn_close_dialog = NULL; -static PidginConvWindow *hidden_convwin = NULL; static GList *window_list = NULL; /* Lists of status icons at all available sizes for use as window icons */ @@ -158,7 +157,6 @@ gboolean pidgin_conv_has_focus(PurpleConversation *conv); static void pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields); static void focus_out_from_menubar(GtkWidget *wid, PidginConvWindow *win); static void pidgin_conv_tab_pack(PidginConvWindow *win, PidginConversation *gtkconv); -static void hide_conv(PidginConversation *gtkconv, gboolean closetimer); static void pidgin_conv_set_position_size(PidginConvWindow *win, int x, int y, int width, int height); @@ -202,21 +200,9 @@ close_conv_cb(GtkButton *button, PidginConversation *gtkconv) * For chats, close immediately if the chat is not in the buddylist, or if the chat is * not marked 'Persistent' */ PurpleConversation *conv = gtkconv->active_conv; - PurpleAccount *account = purple_conversation_get_account(conv); - const char *name = purple_conversation_get_name(conv); - if (PURPLE_IS_IM_CONVERSATION(conv)) { - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/im/close_immediately")) - close_this_sucker(gtkconv); - else - hide_conv(gtkconv, TRUE); - } else if (PURPLE_IS_CHAT_CONVERSATION(conv)) { - PurpleChat *chat = purple_blist_find_chat(account, name); - if (!chat || - !purple_blist_node_get_bool(&chat->node, "gtk-persistent")) - close_this_sucker(gtkconv); - else - hide_conv(gtkconv, FALSE); + if(PURPLE_IS_IM_CONVERSATION(conv) || PURPLE_IS_CHAT_CONVERSATION(conv)) { + close_this_sucker(gtkconv); } return TRUE; @@ -797,35 +783,6 @@ menu_add_remove_cb(GtkAction *action, gpointer data) add_remove_cb(NULL, PIDGIN_CONVERSATION(conv)); } -static gboolean -close_already(gpointer data) -{ - g_object_unref(data); - return FALSE; -} - -static void -hide_conv(PidginConversation *gtkconv, gboolean closetimer) -{ - GList *list; - - purple_signal_emit(pidgin_conversations_get_handle(), - "conversation-hiding", gtkconv); - - for (list = g_list_copy(gtkconv->convs); list; list = g_list_delete_link(list, list)) { - PurpleConversation *conv = list->data; - if (closetimer) { - guint timer = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), "close-timer")); - if (timer) - g_source_remove(timer); - timer = g_timeout_add_seconds(CLOSE_CONV_TIMEOUT_SECS, close_already, conv); - g_object_set_data(G_OBJECT(conv), "close-timer", GINT_TO_POINTER(timer)); - } - pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv); - pidgin_conv_window_add_gtkconv(hidden_convwin, gtkconv); - } -} - static void menu_close_conv_cb(GtkAction *action, gpointer data) { @@ -1582,7 +1539,6 @@ pidgin_conv_present_conversation(PurpleConversation *conv) static GList * pidgin_conversations_get_unseen(GList *l, PidginUnseenState min_state, - gboolean hidden_only, guint max_count) { GList *r = NULL; @@ -1592,12 +1548,11 @@ pidgin_conversations_get_unseen(GList *l, PurpleConversation *conv = (PurpleConversation*)l->data; PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); - if(gtkconv == NULL || gtkconv->active_conv != conv) + if(gtkconv == NULL || gtkconv->active_conv != conv) { continue; + } - if (gtkconv->unseen_state >= min_state && - (!hidden_only || gtkconv->win == hidden_convwin)) { - + if (gtkconv->unseen_state >= min_state) { r = g_list_prepend(r, conv); c++; } @@ -1608,8 +1563,7 @@ pidgin_conversations_get_unseen(GList *l, GList * pidgin_conversations_get_unseen_all(PidginUnseenState min_state, - gboolean hidden_only, - guint max_count) + guint max_count) { PurpleConversationManager *manager; GList *list, *ret = NULL; @@ -1617,8 +1571,7 @@ pidgin_conversations_get_unseen_all(PidginUnseenState min_state, manager = purple_conversation_manager_get_default(); list = purple_conversation_manager_get_all(manager); - ret = pidgin_conversations_get_unseen(list, min_state, hidden_only, - max_count); + ret = pidgin_conversations_get_unseen(list, min_state, max_count); g_list_free(list); return ret; @@ -2003,8 +1956,9 @@ regenerate_plugins_items(PidginConvWindow *win) PurpleConversation *conv; GtkWidget *item; - if (win->window == NULL || win == hidden_convwin) + if (win->window == NULL) { return; + } gtkconv = pidgin_conv_window_get_active_gtkconv(win); if (gtkconv == NULL) @@ -3239,16 +3193,7 @@ private_gtkconv_new(PurpleConversation *conv, gboolean hidden) G_CALLBACK(gtk_widget_grab_focus), gtkconv->editor); - if (hidden) - pidgin_conv_window_add_gtkconv(hidden_convwin, gtkconv); - else - pidgin_conv_placement_place(gtkconv); -} - -static void -pidgin_conv_new_hidden(PurpleConversation *conv) -{ - private_gtkconv_new(conv, TRUE); + pidgin_conv_placement_place(gtkconv); } void @@ -3264,33 +3209,8 @@ static void received_im_msg_cb(PurpleAccount *account, char *sender, char *message, PurpleConversation *conv, PurpleMessageFlags flags) { - PurpleConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops(); - gboolean hide = FALSE; guint timer; - /* create hidden conv if hide_new pref is always */ - if (purple_strequal(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "always")) - hide = TRUE; - - /* create hidden conv if hide_new pref is away and account is away */ - if (purple_strequal(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "away") && - !purple_status_is_available(purple_account_get_active_status(account))) - hide = TRUE; - - if (conv && PIDGIN_IS_PIDGIN_CONVERSATION(conv) && !hide) { - PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); - if (gtkconv->win == hidden_convwin) { - pidgin_conv_attach_to_conversation(gtkconv->active_conv); - } - return; - } - - if (hide) { - ui_ops->create_conversation = pidgin_conv_new_hidden; - purple_im_conversation_new(account, sender); - ui_ops->create_conversation = pidgin_conv_new; - } - /* Somebody wants to keep this conversation around, so don't time it out */ if (conv) { timer = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), "close-timer")); @@ -4034,7 +3954,7 @@ wrote_msg_update_unseen_cb(PurpleConversation *conv, PurpleMessage *msg, { PidginConversation *gtkconv = conv ? PIDGIN_CONVERSATION(conv) : NULL; PurpleMessageFlags flags; - if (conv == NULL || (gtkconv && gtkconv->win != hidden_convwin)) + if (conv == NULL) return; flags = purple_message_get_flags(msg); if (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)) { @@ -4265,74 +4185,6 @@ show_formatting_toolbar_pref_cb(const char *name, PurplePrefType type, } } -static void -account_status_changed_cb(PurpleAccount *account, PurpleStatus *oldstatus, - PurpleStatus *newstatus) -{ - GList *l; - PurpleConversation *conv = NULL; - PidginConversation *gtkconv; - - if(!purple_strequal(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "away")) - return; - - if(purple_status_is_available(oldstatus) || !purple_status_is_available(newstatus)) - return; - - for (l = hidden_convwin->gtkconvs; l; ) { - gtkconv = l->data; - l = l->next; - - conv = gtkconv->active_conv; - if (PURPLE_IS_CHAT_CONVERSATION(conv) || - account != purple_conversation_get_account(conv)) - continue; - - pidgin_conv_attach_to_conversation(conv); - - /* TODO: do we need to do anything for any other conversations that are in the same gtkconv here? - * I'm a little concerned that not doing so will cause the "pending" indicator in the gtkblist not to be cleared. -DAA*/ - purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_UNSEEN); - } -} - -static void -hide_new_pref_cb(const char *name, PurplePrefType type, - gconstpointer value, gpointer data) -{ - GList *l; - PurpleConversation *conv = NULL; - PidginConversation *gtkconv; - gboolean when_away = FALSE; - - if(!hidden_convwin) - return; - - if(purple_strequal(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "always")) - return; - - if(purple_strequal(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "away")) - when_away = TRUE; - - for (l = hidden_convwin->gtkconvs; l; ) - { - gtkconv = l->data; - l = l->next; - - conv = gtkconv->active_conv; - - if (PURPLE_IS_CHAT_CONVERSATION(conv) || - gtkconv->unseen_count == 0 || - (when_away && !purple_status_is_available( - purple_account_get_active_status( - purple_conversation_get_account(conv))))) - continue; - - pidgin_conv_attach_to_conversation(conv); - } -} - - static PidginConversation * get_gtkconv_with_contact(PurpleContact *contact) { @@ -4652,23 +4504,6 @@ gboolean pidgin_conv_attach_to_conversation(PurpleConversation *conv) GList *list; PidginConversation *gtkconv; - if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) { - /* This is pretty much always the case now. */ - gtkconv = PIDGIN_CONVERSATION(conv); - if (gtkconv->win != hidden_convwin) - return FALSE; - pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv); - pidgin_conv_placement_place(gtkconv); - purple_signal_emit(pidgin_conversations_get_handle(), - "conversation-displayed", gtkconv); - list = gtkconv->convs; - while (list) { - pidgin_conv_attach(list->data); - list = list->next; - } - return TRUE; - } - pidgin_conv_attach(conv); gtkconv = PIDGIN_CONVERSATION(conv); @@ -4784,9 +4619,6 @@ pidgin_conversations_init(void) purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/im/entry_height", 54); - purple_prefs_add_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new", "never"); - purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/im/close_immediately", TRUE); - #ifdef _WIN32 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/win32"); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/win32/minimize_new_convs", FALSE); @@ -4800,10 +4632,6 @@ pidgin_conversations_init(void) purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/tab_side", tab_side_pref_cb, NULL); - /* IM callbacks */ - purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/im/hide_new", - hide_new_pref_cb, NULL); - /********************************************************************** * Register signals **********************************************************************/ @@ -4832,10 +4660,6 @@ pidgin_conversations_init(void) purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, PURPLE_TYPE_CONVERSATION); - purple_signal_register(handle, "conversation-hiding", - purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, - G_TYPE_POINTER); /* (PidginConversation *) */ - purple_signal_register(handle, "conversation-displayed", purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); /* (PidginConversation *) */ @@ -4878,12 +4702,6 @@ pidgin_conversations_init(void) purple_conversations_set_ui_ops(&conversation_ui_ops); - hidden_convwin = pidgin_conv_window_new(); - window_list = g_list_remove(window_list, hidden_convwin); - - purple_signal_connect(purple_accounts_get_handle(), "account-status-changed", - handle, PURPLE_CALLBACK(account_status_changed_cb), NULL); - /* Callbacks to update a conversation */ purple_signal_connect(blist_handle, "blist-node-added", handle, G_CALLBACK(buddy_update_cb), NULL); @@ -5531,10 +5349,7 @@ switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, g_return_if_fail(conv != NULL); - /* clear unseen flag if conversation is not hidden */ - if(!pidgin_conv_is_hidden(gtkconv)) { - gtkconv_set_unseen(gtkconv, PIDGIN_UNSEEN_NONE); - } + gtkconv_set_unseen(gtkconv, PIDGIN_UNSEEN_NONE); /* Update the menubar */ @@ -6058,11 +5873,13 @@ pidgin_conv_window_remove_gtkconv(PidginConvWindow *win, PidginConversation *gtk g_signal_handlers_disconnect_matched(win->window, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, gtkconv); - if (win->gtkconvs && win->gtkconvs->next == NULL) + if (win->gtkconvs && win->gtkconvs->next == NULL) { pidgin_conv_tab_pack(win, win->gtkconvs->data); + } - if (!win->gtkconvs && win != hidden_convwin) + if (!win->gtkconvs) { pidgin_conv_window_destroy(win); + } } PidginConversation * @@ -6153,14 +5970,6 @@ pidgin_conv_window_get_gtkconv_count(PidginConvWindow *win) return g_list_length(win->gtkconvs); } -gboolean -pidgin_conv_is_hidden(PidginConversation *gtkconv) -{ - g_return_val_if_fail(gtkconv != NULL, FALSE); - - return (gtkconv->win == hidden_convwin); -} - void pidgin_conv_placement_place(PidginConversation *conv) { PidginConvWindow *win; diff --git a/pidgin/gtkconv.h b/pidgin/gtkconv.h index 7ce9c4b2c3..9b4cd48ec0 100644 --- a/pidgin/gtkconv.h +++ b/pidgin/gtkconv.h @@ -166,7 +166,6 @@ void pidgin_conv_update_buttons_by_protocol(PurpleConversation *conv); /** * pidgin_conversations_get_unseen_all: * @min_state: The minimum unseen state. - * @hidden_only: If %TRUE, only consider hidden conversations. * @max_count: Maximum number of conversations to return, or 0 for * no maximum. * @@ -180,9 +179,7 @@ void pidgin_conv_update_buttons_by_protocol(PurpleConversation *conv); * Returns: (transfer container) (element-type PurpleConversation): List of PurpleConversation matching criteria, or %NULL. */ GList * -pidgin_conversations_get_unseen_all(PidginUnseenState min_state, - gboolean hidden_only, - guint max_count); +pidgin_conversations_get_unseen_all(PidginUnseenState min_state, guint max_count); /** * pidgin_conversations_fill_menu: @@ -244,14 +241,6 @@ void pidgin_conv_new(PurpleConversation *conv); */ int pidgin_conv_get_tab_at_xy(PidginConvWindow *win, int x, int y, gboolean *to_right); -/** - * pidgin_conv_is_hidden: - * @gtkconv: The GTK conversation. - * - * Returns: %TRUE if the conversation is hidden, %FALSE otherwise. - */ -gboolean pidgin_conv_is_hidden(PidginConversation *gtkconv); - /**************************************************************************/ /* GTK Conversations Subsystem */ /**************************************************************************/ diff --git a/pidgin/prefs/pidginprefs.c b/pidgin/prefs/pidginprefs.c index 1f173bc428..4de37c4c8f 100644 --- a/pidgin/prefs/pidginprefs.c +++ b/pidgin/prefs/pidginprefs.c @@ -97,9 +97,6 @@ struct _PidginPrefsWindow { /* Interface page */ struct { struct { - PidginPrefCombo hide_new; - } im; - struct { GtkWidget *minimize_new_convs; } win32; struct { @@ -115,7 +112,6 @@ struct _PidginPrefsWindow { PidginPrefCombo notification_chat; GtkWidget *show_incoming_formatting; struct { - GtkWidget *close_immediately; GtkWidget *send_typing; } im; GtkWidget *use_smooth_scrolling; @@ -1329,11 +1325,6 @@ formatting_toggle_cb(TalkatuActionGroup *ag, GAction *action, const gchar *name, static void bind_interface_page(PidginPrefsWindow *win) { - /* System Tray */ - win->iface.im.hide_new.type = PURPLE_PREF_STRING; - win->iface.im.hide_new.key = PIDGIN_PREFS_ROOT "/conversations/im/hide_new"; - pidgin_prefs_bind_dropdown(&win->iface.im.hide_new); - #ifdef _WIN32 pidgin_prefs_bind_checkbox(PIDGIN_PREFS_ROOT "/win32/minimize_new_convs", win->iface.win32.minimize_new_convs); @@ -1399,8 +1390,6 @@ bind_conv_page(PidginPrefsWindow *win) pidgin_prefs_bind_checkbox(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", win->conversations.show_incoming_formatting); - pidgin_prefs_bind_checkbox(PIDGIN_PREFS_ROOT "/conversations/im/close_immediately", - win->conversations.im.close_immediately); pidgin_prefs_bind_checkbox("/purple/conversations/im/send_typing", win->conversations.im.send_typing); @@ -2336,9 +2325,6 @@ pidgin_prefs_window_class_init(PidginPrefsWindowClass *klass) /* Interface page */ gtk_widget_class_bind_template_child( widget_class, PidginPrefsWindow, - iface.im.hide_new.combo); - gtk_widget_class_bind_template_child( - widget_class, PidginPrefsWindow, iface.win32.minimize_new_convs); gtk_widget_class_bind_template_child( widget_class, PidginPrefsWindow, @@ -2362,9 +2348,6 @@ pidgin_prefs_window_class_init(PidginPrefsWindowClass *klass) conversations.show_incoming_formatting); gtk_widget_class_bind_template_child( widget_class, PidginPrefsWindow, - conversations.im.close_immediately); - gtk_widget_class_bind_template_child( - widget_class, PidginPrefsWindow, conversations.im.send_typing); gtk_widget_class_bind_template_child( widget_class, PidginPrefsWindow, @@ -2670,17 +2653,6 @@ pidgin_prefs_update_old(void) purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound/theme"); purple_prefs_remove(PIDGIN_PREFS_ROOT "/sound"); - /* Convert old queuing prefs to hide_new 3-way pref. */ - if (purple_prefs_exists("/plugins/gtk/docklet/queue_messages") && - purple_prefs_get_bool("/plugins/gtk/docklet/queue_messages")) - { - purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new", "always"); - } - else if (purple_prefs_exists(PIDGIN_PREFS_ROOT "/away/queue_messages") && - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/away/queue_messages")) - { - purple_prefs_set_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new", "away"); - } purple_prefs_remove(PIDGIN_PREFS_ROOT "/away/queue_messages"); purple_prefs_remove(PIDGIN_PREFS_ROOT "/away"); purple_prefs_remove("/plugins/gtk/docklet/queue_messages"); diff --git a/pidgin/resources/Prefs/prefs.ui b/pidgin/resources/Prefs/prefs.ui index 8dec68185d..986f76a255 100644 --- a/pidgin/resources/Prefs/prefs.ui +++ b/pidgin/resources/Prefs/prefs.ui @@ -348,50 +348,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <property name="orientation">vertical</property> <property name="spacing">6</property> <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes">_Hide new IM conversations:</property> - <property name="use-underline">True</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="iface.im.hide_new.combo"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="model">iface.im.hide_new.store</property> - <child> - <object class="GtkCellRendererText"/> - <attributes> - <attribute name="text">0</attribute> - </attributes> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> <object class="GtkCheckButton" id="iface.win32.minimize_new_convs"> <property name="label" translatable="yes">Minimi_ze new conversation windows</property> <property name="visible">True</property> @@ -403,7 +359,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">0</property> </packing> </child> </object> @@ -642,20 +598,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. </packing> </child> <child> - <object class="GtkCheckButton" id="conversations.im.close_immediately"> - <property name="label" translatable="yes">Close IMs immediately when the tab is closed</property> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="receives-default">False</property> - <property name="draw-indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> <object class="GtkCheckButton" id="conversations.im.send_typing"> <property name="label" translatable="yes">_Notify buddies that you are typing to them</property> <property name="visible">True</property> @@ -667,7 +609,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">3</property> + <property name="position">2</property> </packing> </child> <child> @@ -681,7 +623,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">4</property> + <property name="position">3</property> </packing> </child> <child> @@ -696,7 +638,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">5</property> + <property name="position">4</property> </packing> </child> <child> @@ -734,7 +676,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">6</property> + <property name="position">5</property> </packing> </child> </object> |