Mercurial > pidgin
changeset 8979:e2ad3e04d248
[gaim-migrate @ 9753]
"Adds a feature requested by my brother, a conversation placement option
limited by number of conversations in that window, so as to let one avoid
needing the GtkNotebook scroll arrows." --deryni
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 19 May 2004 04:44:36 +0000 |
parents | 8e69a730885c |
children | 382bbf503c3d |
files | src/conversation.c src/gtkprefs.c |
diffstat | 2 files changed, 66 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/conversation.c Wed May 19 04:43:16 2004 +0000 +++ b/src/conversation.c Wed May 19 04:44:36 2004 +0000 @@ -2414,6 +2414,47 @@ conv_placement_new_window(conv); } +static void +conv_placement_by_number(GaimConversation *conv) +{ + GaimConvWindow *win = NULL; + + if (gaim_prefs_get_bool("/core/conversations/combine_chat_im")) + win = g_list_last(gaim_get_windows())->data; + else + win = gaim_get_last_window_with_type(gaim_conversation_get_type(conv)); + + if (win == NULL) { + win = gaim_conv_window_new(); + + gaim_conv_window_add_conversation(win, conv); + gaim_conv_window_show(win); + } else { + int max_count = gaim_prefs_get_int("/gaim/gtk/conversations/placement_number"); + int count = gaim_conv_window_get_conversation_count(win); + + if (count < max_count) + gaim_conv_window_add_conversation(win, conv); + else { + GList *l = NULL; + + for (l = gaim_get_windows(); l != NULL; l = l->next) { + win = (GaimConvWindow *)l->data; + + count = gaim_conv_window_get_conversation_count(win); + if (count < max_count) { + gaim_conv_window_add_conversation(win, conv); + return; + } + } + win = gaim_conv_window_new(); + + gaim_conv_window_add_conversation(win, conv); + gaim_conv_window_show(win); + } + } +} + static ConvPlacementData * get_conv_placement_data(const char *id) { @@ -2457,6 +2498,8 @@ conv_placement_by_group); add_conv_placement_fnc("account", _("By account"), conv_placement_by_account); + add_conv_placement_fnc("number", _("By conversation count"), + conv_placement_by_number); } }
--- a/src/gtkprefs.c Wed May 19 04:43:16 2004 +0000 +++ b/src/gtkprefs.c Wed May 19 04:44:36 2004 +0000 @@ -84,6 +84,7 @@ static guint proxy_pref_id = 0; static guint sound_pref_id = 0; static guint auto_resp_pref_id = 0; +static guint placement_pref_id = 0; /* * PROTOTYPES @@ -346,6 +347,7 @@ gaim_prefs_disconnect_callback(proxy_pref_id); gaim_prefs_disconnect_callback(sound_pref_id); gaim_prefs_disconnect_callback(auto_resp_pref_id); + gaim_prefs_disconnect_callback(placement_pref_id); for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { plug = l->data; @@ -881,6 +883,18 @@ return ret; } +static void +conversation_placement_cb(const char *name, GaimPrefType type, gpointer value, + gpointer data) +{ + const char *placement = value; + + if (strcmp(placement, "number")) + gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); + else + gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE); +} + GtkWidget *conv_page() { GtkWidget *ret; GtkWidget *vbox; @@ -905,6 +919,15 @@ gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_size_group_add_widget(sg, label); + label = gaim_gtk_prefs_labeled_spin_button(vbox, "Number of conversations per window", + "/gaim/gtk/conversations/placement_number", + 1, 50, sg); + + placement_pref_id = gaim_prefs_connect_callback("/gaim/gtk/conversations/placement", + conversation_placement_cb, + label); + gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); + gaim_gtk_prefs_checkbox(_("Show _formatting toolbar"), "/gaim/gtk/conversations/show_formatting_toolbar", vbox);