comparison pidgin/plugins/extplacement.c @ 15823:32c366eeeb99

sed -ie 's/gaim/purple/g'
author Sean Egan <seanegan@gmail.com>
date Mon, 19 Mar 2007 07:01:17 +0000
parents 535f002e7b0f
children 66dff3dfdea6
comparison
equal deleted inserted replaced
15822:84b0f9b23ede 15823:32c366eeeb99
1 /* 1 /*
2 * Extra conversation placement options for Gaim 2 * Extra conversation placement options for Purple
3 * 3 *
4 * Gaim is the legal property of its developers, whose names are too numerous 4 * Purple is the legal property of its developers, whose names are too numerous
5 * to list here. Please refer to the COPYRIGHT file distributed with this 5 * to list here. Please refer to the COPYRIGHT file distributed with this
6 * source distribution. 6 * source distribution.
7 * 7 *
8 * This program is free software; you can redistribute it and/or 8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License 9 * modify it under the terms of the GNU General Public License
32 conv_placement_by_number(PidginConversation *conv) 32 conv_placement_by_number(PidginConversation *conv)
33 { 33 {
34 PidginWindow *win = NULL; 34 PidginWindow *win = NULL;
35 GList *wins = NULL; 35 GList *wins = NULL;
36 36
37 if (gaim_prefs_get_bool("/plugins/gtk/extplacement/placement_number_separate")) 37 if (purple_prefs_get_bool("/plugins/gtk/extplacement/placement_number_separate"))
38 win = pidgin_conv_window_last_with_type(gaim_conversation_get_type(conv->active_conv)); 38 win = pidgin_conv_window_last_with_type(purple_conversation_get_type(conv->active_conv));
39 else if ((wins = pidgin_conv_windows_get_list()) != NULL) 39 else if ((wins = pidgin_conv_windows_get_list()) != NULL)
40 win = g_list_last(wins)->data; 40 win = g_list_last(wins)->data;
41 41
42 if (win == NULL) { 42 if (win == NULL) {
43 win = pidgin_conv_window_new(); 43 win = pidgin_conv_window_new();
44 44
45 pidgin_conv_window_add_gtkconv(win, conv); 45 pidgin_conv_window_add_gtkconv(win, conv);
46 pidgin_conv_window_show(win); 46 pidgin_conv_window_show(win);
47 } else { 47 } else {
48 int max_count = gaim_prefs_get_int("/plugins/gtk/extplacement/placement_number"); 48 int max_count = purple_prefs_get_int("/plugins/gtk/extplacement/placement_number");
49 int count = pidgin_conv_window_get_gtkconv_count(win); 49 int count = pidgin_conv_window_get_gtkconv_count(win);
50 50
51 if (count < max_count) 51 if (count < max_count)
52 pidgin_conv_window_add_gtkconv(win, conv); 52 pidgin_conv_window_add_gtkconv(win, conv);
53 else { 53 else {
54 GList *l = NULL; 54 GList *l = NULL;
55 55
56 for (l = pidgin_conv_windows_get_list(); l != NULL; l = l->next) { 56 for (l = pidgin_conv_windows_get_list(); l != NULL; l = l->next) {
57 win = l->data; 57 win = l->data;
58 58
59 if (gaim_prefs_get_bool("/plugins/gtk/extplacement/placement_number_separate") && 59 if (purple_prefs_get_bool("/plugins/gtk/extplacement/placement_number_separate") &&
60 gaim_conversation_get_type(pidgin_conv_window_get_active_conversation(win)) != gaim_conversation_get_type(conv->active_conv)) 60 purple_conversation_get_type(pidgin_conv_window_get_active_conversation(win)) != purple_conversation_get_type(conv->active_conv))
61 continue; 61 continue;
62 62
63 count = pidgin_conv_window_get_gtkconv_count(win); 63 count = pidgin_conv_window_get_gtkconv_count(win);
64 if (count < max_count) { 64 if (count < max_count) {
65 pidgin_conv_window_add_gtkconv(win, conv); 65 pidgin_conv_window_add_gtkconv(win, conv);
73 } 73 }
74 } 74 }
75 } 75 }
76 76
77 static gboolean 77 static gboolean
78 plugin_load(GaimPlugin *plugin) 78 plugin_load(PurplePlugin *plugin)
79 { 79 {
80 pidgin_conv_placement_add_fnc("number", _("By conversation count"), 80 pidgin_conv_placement_add_fnc("number", _("By conversation count"),
81 &conv_placement_by_number); 81 &conv_placement_by_number);
82 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); 82 purple_prefs_trigger_callback("/purple/gtk/conversations/placement");
83 return TRUE; 83 return TRUE;
84 } 84 }
85 85
86 static gboolean 86 static gboolean
87 plugin_unload(GaimPlugin *plugin) 87 plugin_unload(PurplePlugin *plugin)
88 { 88 {
89 pidgin_conv_placement_remove_fnc("number"); 89 pidgin_conv_placement_remove_fnc("number");
90 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); 90 purple_prefs_trigger_callback("/purple/gtk/conversations/placement");
91 return TRUE; 91 return TRUE;
92 } 92 }
93 93
94 static GaimPluginPrefFrame * 94 static PurplePluginPrefFrame *
95 get_plugin_pref_frame(GaimPlugin *plugin) { 95 get_plugin_pref_frame(PurplePlugin *plugin) {
96 GaimPluginPrefFrame *frame; 96 PurplePluginPrefFrame *frame;
97 GaimPluginPref *ppref; 97 PurplePluginPref *ppref;
98 98
99 frame = gaim_plugin_pref_frame_new(); 99 frame = purple_plugin_pref_frame_new();
100 100
101 ppref = gaim_plugin_pref_new_with_label(_("Conversation Placement")); 101 ppref = purple_plugin_pref_new_with_label(_("Conversation Placement"));
102 gaim_plugin_pref_frame_add(frame, ppref); 102 purple_plugin_pref_frame_add(frame, ppref);
103 103
104 ppref = gaim_plugin_pref_new_with_name_and_label( 104 ppref = purple_plugin_pref_new_with_name_and_label(
105 "/plugins/gtk/extplacement/placement_number", 105 "/plugins/gtk/extplacement/placement_number",
106 _("Number of conversations per window")); 106 _("Number of conversations per window"));
107 gaim_plugin_pref_set_bounds(ppref, 1, 50); 107 purple_plugin_pref_set_bounds(ppref, 1, 50);
108 gaim_plugin_pref_frame_add(frame, ppref); 108 purple_plugin_pref_frame_add(frame, ppref);
109 109
110 ppref = gaim_plugin_pref_new_with_name_and_label( 110 ppref = purple_plugin_pref_new_with_name_and_label(
111 "/plugins/gtk/extplacement/placement_number_separate", 111 "/plugins/gtk/extplacement/placement_number_separate",
112 _("Separate IM and Chat windows when placing by number")); 112 _("Separate IM and Chat windows when placing by number"));
113 gaim_plugin_pref_frame_add(frame, ppref); 113 purple_plugin_pref_frame_add(frame, ppref);
114 114
115 return frame; 115 return frame;
116 } 116 }
117 117
118 static GaimPluginUiInfo prefs_info = { 118 static PurplePluginUiInfo prefs_info = {
119 get_plugin_pref_frame, 119 get_plugin_pref_frame,
120 0, /* page_num (Reserved) */ 120 0, /* page_num (Reserved) */
121 NULL /* frame (Reserved) */ 121 NULL /* frame (Reserved) */
122 }; 122 };
123 123
124 static GaimPluginInfo info = 124 static PurplePluginInfo info =
125 { 125 {
126 GAIM_PLUGIN_MAGIC, 126 PURPLE_PLUGIN_MAGIC,
127 GAIM_MAJOR_VERSION, 127 PURPLE_MAJOR_VERSION,
128 GAIM_MINOR_VERSION, 128 PURPLE_MINOR_VERSION,
129 GAIM_PLUGIN_STANDARD, /**< type */ 129 PURPLE_PLUGIN_STANDARD, /**< type */
130 PIDGIN_PLUGIN_TYPE, /**< ui_requirement */ 130 PIDGIN_PLUGIN_TYPE, /**< ui_requirement */
131 0, /**< flags */ 131 0, /**< flags */
132 NULL, /**< dependencies */ 132 NULL, /**< dependencies */
133 GAIM_PRIORITY_DEFAULT, /**< priority */ 133 PURPLE_PRIORITY_DEFAULT, /**< priority */
134 "gtk-extplacement", /**< id */ 134 "gtk-extplacement", /**< id */
135 N_("ExtPlacement"), /**< name */ 135 N_("ExtPlacement"), /**< name */
136 VERSION, /**< version */ 136 VERSION, /**< version */
137 N_("Extra conversation placement options."), /**< summary */ 137 N_("Extra conversation placement options."), /**< summary */
138 /** description */ 138 /** description */
139 N_("Restrict the number of conversations per windows," 139 N_("Restrict the number of conversations per windows,"
140 " optionally separating IMs and Chats"), 140 " optionally separating IMs and Chats"),
141 "Stu Tomlinson <stu@nosnilmot.com>", /**< author */ 141 "Stu Tomlinson <stu@nosnilmot.com>", /**< author */
142 GAIM_WEBSITE, /**< homepage */ 142 PURPLE_WEBSITE, /**< homepage */
143 plugin_load, /**< load */ 143 plugin_load, /**< load */
144 plugin_unload, /**< unload */ 144 plugin_unload, /**< unload */
145 NULL, /**< destroy */ 145 NULL, /**< destroy */
146 NULL, /**< ui_info */ 146 NULL, /**< ui_info */
147 NULL, /**< extra_info */ 147 NULL, /**< extra_info */
148 &prefs_info, /**< prefs_info */ 148 &prefs_info, /**< prefs_info */
149 NULL /**< actions */ 149 NULL /**< actions */
150 }; 150 };
151 151
152 static void 152 static void
153 init_plugin(GaimPlugin *plugin) 153 init_plugin(PurplePlugin *plugin)
154 { 154 {
155 gaim_prefs_add_none("/plugins/gtk/extplacement"); 155 purple_prefs_add_none("/plugins/gtk/extplacement");
156 gaim_prefs_add_int("/plugins/gtk/extplacement/placement_number", 4); 156 purple_prefs_add_int("/plugins/gtk/extplacement/placement_number", 4);
157 gaim_prefs_add_bool("/plugins/gtk/extplacement/placement_number_separate", FALSE); 157 purple_prefs_add_bool("/plugins/gtk/extplacement/placement_number_separate", FALSE);
158 } 158 }
159 159
160 GAIM_INIT_PLUGIN(extplacement, init_plugin, info) 160 PURPLE_INIT_PLUGIN(extplacement, init_plugin, info)