| 27 static void |
27 static void |
| 28 conv_placement_by_number(GaimConversation *conv) |
28 conv_placement_by_number(GaimConversation *conv) |
| 29 { |
29 { |
| 30 GaimConvWindow *win = NULL; |
30 GaimConvWindow *win = NULL; |
| 31 |
31 |
| 32 win = gaim_get_last_window_with_type(gaim_conversation_get_type(conv)); |
32 if (gaim_prefs_get_bool("/plugins/gtk/extplacement/placement_number_separate")) |
| |
33 win = gaim_get_last_window_with_type(gaim_conversation_get_type(conv)); |
| |
34 else |
| |
35 win = g_list_last(gaim_get_windows())->data; |
| 33 |
36 |
| 34 if (win == NULL) { |
37 if (win == NULL) { |
| 35 win = gaim_conv_window_new(); |
38 win = gaim_conv_window_new(); |
| 36 |
39 |
| 37 gaim_conv_window_add_conversation(win, conv); |
40 gaim_conv_window_add_conversation(win, conv); |
| 45 else { |
48 else { |
| 46 GList *l = NULL; |
49 GList *l = NULL; |
| 47 |
50 |
| 48 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
51 for (l = gaim_get_windows(); l != NULL; l = l->next) { |
| 49 win = (GaimConvWindow *)l->data; |
52 win = (GaimConvWindow *)l->data; |
| |
53 |
| |
54 if (gaim_prefs_get_bool("/plugins/gtk/extplacement/placement_number_separate") && |
| |
55 gaim_conversation_get_type(gaim_conv_window_get_active_conversation(win)) != gaim_conversation_get_type(conv)) |
| |
56 continue; |
| 50 |
57 |
| 51 count = gaim_conv_window_get_conversation_count(win); |
58 count = gaim_conv_window_get_conversation_count(win); |
| 52 if (count < max_count) { |
59 if (count < max_count) { |
| 53 gaim_conv_window_add_conversation(win, conv); |
60 gaim_conv_window_add_conversation(win, conv); |
| 54 return; |
61 return; |
| 88 |
95 |
| 89 ppref = gaim_plugin_pref_new_with_label(_("Conversation Placement")); |
96 ppref = gaim_plugin_pref_new_with_label(_("Conversation Placement")); |
| 90 gaim_plugin_pref_frame_add(frame, ppref); |
97 gaim_plugin_pref_frame_add(frame, ppref); |
| 91 |
98 |
| 92 ppref = gaim_plugin_pref_new_with_name_and_label( |
99 ppref = gaim_plugin_pref_new_with_name_and_label( |
| 93 "/plugins/gtk/extplacement/placement_number", |
100 "/plugins/gtk/extplacement/placement_number", |
| 94 _("Number of conversations per window")); |
101 _("Number of conversations per window")); |
| 95 gaim_plugin_pref_set_bounds(ppref, 1, 50); |
102 gaim_plugin_pref_set_bounds(ppref, 1, 50); |
| |
103 gaim_plugin_pref_frame_add(frame, ppref); |
| |
104 |
| |
105 ppref = gaim_plugin_pref_new_with_name_and_label( |
| |
106 "/plugins/gtk/extplacement/placement_number_separate", |
| |
107 _("Separate IM and Chat windows when placing by number")); |
| 96 gaim_plugin_pref_frame_add(frame, ppref); |
108 gaim_plugin_pref_frame_add(frame, ppref); |
| 97 |
109 |
| 98 return frame; |
110 return frame; |
| 99 } |
111 } |
| 100 |
112 |
| 113 "gtk-extplacement", /**< id */ |
125 "gtk-extplacement", /**< id */ |
| 114 N_("ExtPlacement"), /**< name */ |
126 N_("ExtPlacement"), /**< name */ |
| 115 VERSION, /**< version */ |
127 VERSION, /**< version */ |
| 116 N_("Extra conversation placement options."), /**< summary */ |
128 N_("Extra conversation placement options."), /**< summary */ |
| 117 /** description */ |
129 /** description */ |
| 118 N_("Either restrict the number of conversations per windows" |
130 N_("Restrict the number of conversations per windows," |
| 119 " or use separate windows for IMs and Chats"), |
131 " optionally separating IMs and Chats"), |
| 120 "Stu Tomlinson <stu@nosnilmot.com>", /**< author */ |
132 "Stu Tomlinson <stu@nosnilmot.com>", /**< author */ |
| 121 GAIM_WEBSITE, /**< homepage */ |
133 GAIM_WEBSITE, /**< homepage */ |
| 122 plugin_load, /**< load */ |
134 plugin_load, /**< load */ |
| 123 plugin_unload, /**< unload */ |
135 plugin_unload, /**< unload */ |
| 124 NULL, /**< destroy */ |
136 NULL, /**< destroy */ |
| 131 static void |
143 static void |
| 132 init_plugin(GaimPlugin *plugin) |
144 init_plugin(GaimPlugin *plugin) |
| 133 { |
145 { |
| 134 gaim_prefs_add_none("/plugins/gtk/extplacement"); |
146 gaim_prefs_add_none("/plugins/gtk/extplacement"); |
| 135 gaim_prefs_add_int("/plugins/gtk/extplacement/placement_number", 4); |
147 gaim_prefs_add_int("/plugins/gtk/extplacement/placement_number", 4); |
| |
148 gaim_prefs_add_bool("/plugins/gtk/extplacement/placement_number_separate", FALSE); |
| 136 } |
149 } |
| 137 |
150 |
| 138 GAIM_INIT_PLUGIN(extplacement, init_plugin, info) |
151 GAIM_INIT_PLUGIN(extplacement, init_plugin, info) |