Mon, 28 Oct 2013 00:02:17 +0530
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
- Renamed "preferences-frame" to "pref-frame-cb"
- Renamed "preferences-request" to "pref-request-cb"
- Renamed "get-actions" to "actions-cb"
- Renamed "finch-preferences-frame" to "finch-pref-frame-cb"
- Renamed "pidgin-config-frame" to "pidgin-config-frame-cb"
| 14286 | 1 | /* |
|
16792
6174b9ff9ac5
Fix #432 - "Start Pidgin on Windows startup" doesn't work.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
2 | * pidgin - Windows Pidgin Options Plugin |
| 14286 | 3 | * |
|
16792
6174b9ff9ac5
Fix #432 - "Start Pidgin on Windows startup" doesn't work.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
4 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 14286 | 5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 6 | * source distribution. | |
| 7 | * | |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19381
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 14286 | 21 | * |
| 22 | */ | |
| 23 | #include "internal.h" | |
| 24 | ||
| 25 | #include "gtkwin32dep.h" | |
| 26 | ||
| 27 | #include "core.h" | |
| 28 | #include "debug.h" | |
| 29 | #include "prefs.h" | |
| 30 | #include "signals.h" | |
| 31 | #include "version.h" | |
| 32 | ||
| 33 | #include "gtkappbar.h" | |
|
34708
dd67596485ca
Undo renames of UI blist headers back to gntblist.h and gtkblist.h
Ankit Vani <a@nevitus.org>
parents:
34706
diff
changeset
|
34 | #include "gtkblist.h" |
| 14286 | 35 | #include "gtkconv.h" |
| 36 | #include "gtkplugin.h" | |
| 37 | #include "gtkprefs.h" | |
| 38 | #include "gtkutils.h" | |
| 39 | ||
| 40 | /* | |
| 41 | * MACROS & DEFINES | |
| 42 | */ | |
| 43 | #define WINPREFS_PLUGIN_ID "gtk-win-prefs" | |
| 44 | ||
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
45 | #define RUNKEY "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run" |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
46 | |
| 14286 | 47 | /* |
| 48 | * LOCALS | |
| 49 | */ | |
| 50 | static const char *PREF_DBLIST_DOCKABLE = "/plugins/gtk/win32/winprefs/dblist_dockable"; | |
| 51 | static const char *PREF_DBLIST_DOCKED = "/plugins/gtk/win32/winprefs/dblist_docked"; | |
| 52 | static const char *PREF_DBLIST_HEIGHT = "/plugins/gtk/win32/winprefs/dblist_height"; | |
| 53 | static const char *PREF_DBLIST_SIDE = "/plugins/gtk/win32/winprefs/dblist_side"; | |
| 54 | static const char *PREF_BLIST_ON_TOP = "/plugins/gtk/win32/winprefs/blist_on_top"; | |
|
25544
afa0851cca1e
Remove the "Flash window when chat messages are received" pref from the winprefs
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
55 | /* Deprecated */ |
| 14286 | 56 | static const char *PREF_CHAT_BLINK = "/plugins/gtk/win32/winprefs/chat_blink"; |
| 57 | static const char *PREF_DBLIST_ON_TOP = "/plugins/gtk/win32/winprefs/dblist_on_top"; | |
| 58 | ||
| 15884 | 59 | static PurplePlugin *handle = NULL; |
| 14286 | 60 | static GtkAppBar *blist_ab = NULL; |
| 61 | static GtkWidget *blist = NULL; | |
| 62 | static guint blist_visible_cb_id = 0; | |
| 63 | ||
| 64 | enum { | |
| 65 | BLIST_TOP_NEVER = 0, | |
| 66 | BLIST_TOP_ALWAYS, | |
| 67 | BLIST_TOP_DOCKED, | |
| 68 | }; | |
| 69 | ||
| 70 | /* | |
| 71 | * CODE | |
| 72 | */ | |
| 73 | ||
| 74 | /* BLIST DOCKING */ | |
| 75 | ||
| 76 | static void blist_save_state() { | |
| 77 | if(blist_ab) { | |
| 15884 | 78 | if(purple_prefs_get_bool(PREF_DBLIST_DOCKABLE) && blist_ab->docked) { |
| 79 | purple_prefs_set_int(PREF_DBLIST_HEIGHT, blist_ab->undocked_height); | |
| 80 | purple_prefs_set_int(PREF_DBLIST_SIDE, blist_ab->side); | |
| 81 | purple_prefs_set_bool(PREF_DBLIST_DOCKED, blist_ab->docked); | |
| 14286 | 82 | } else |
| 15884 | 83 | purple_prefs_set_bool(PREF_DBLIST_DOCKED, FALSE); |
| 14286 | 84 | } |
| 85 | } | |
| 86 | ||
| 87 | static void blist_set_ontop(gboolean val) { | |
| 88 | if(!blist) | |
| 89 | return; | |
| 90 | ||
|
34726
af52ff6660c0
Replaced purple_get_blist() with purple_blist_get_buddy_list()
Ankit Vani <a@nevitus.org>
parents:
34708
diff
changeset
|
91 | gtk_window_set_keep_above(GTK_WINDOW(PIDGIN_BLIST(purple_blist_get_buddy_list())->window), val); |
| 14286 | 92 | } |
| 93 | ||
| 94 | static void blist_dock_cb(gboolean val) { | |
| 95 | if(val) { | |
| 15884 | 96 | purple_debug_info(WINPREFS_PLUGIN_ID, "Blist Docking...\n"); |
| 97 | if(purple_prefs_get_int(PREF_BLIST_ON_TOP) != BLIST_TOP_NEVER) | |
| 14286 | 98 | blist_set_ontop(TRUE); |
| 99 | } else { | |
| 15884 | 100 | purple_debug_info(WINPREFS_PLUGIN_ID, "Blist Undocking...\n"); |
|
28576
6ce76c426ce8
Add support for setting the multiple instances flag in the Windows Preferences plugin.
Daniel Atallah <datallah@pidgin.im>
parents:
27525
diff
changeset
|
101 | blist_set_ontop(purple_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_ALWAYS); |
| 14286 | 102 | } |
| 103 | } | |
| 104 | ||
| 105 | static void blist_set_dockable(gboolean val) { | |
| 106 | if(val) { | |
| 107 | if(blist_ab == NULL && blist != NULL) { | |
| 108 | blist_ab = gtk_appbar_add(blist); | |
| 109 | gtk_appbar_add_dock_cb(blist_ab, blist_dock_cb); | |
| 110 | } | |
| 111 | } else { | |
| 112 | if(blist_ab != NULL) { | |
| 113 | gtk_appbar_remove(blist_ab); | |
| 114 | blist_ab = NULL; | |
| 115 | } | |
| 116 | ||
|
28576
6ce76c426ce8
Add support for setting the multiple instances flag in the Windows Preferences plugin.
Daniel Atallah <datallah@pidgin.im>
parents:
27525
diff
changeset
|
117 | blist_set_ontop(purple_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_ALWAYS); |
| 14286 | 118 | } |
| 119 | } | |
| 120 | ||
| 121 | /* PLUGIN CALLBACKS */ | |
| 122 | ||
| 123 | /* We need this because the blist destroy cb won't be called before the | |
| 124 | plugin is unloaded, when quitting */ | |
| 15884 | 125 | static void purple_quit_cb() { |
| 126 | purple_debug_info(WINPREFS_PLUGIN_ID, "purple_quit_cb: removing appbar\n"); | |
| 14286 | 127 | blist_save_state(); |
| 128 | blist_set_dockable(FALSE); | |
| 129 | } | |
| 130 | ||
| 131 | /* Listen for the first time the window stops being withdrawn */ | |
| 15884 | 132 | static void blist_visible_cb(const char *pref, PurplePrefType type, |
| 14286 | 133 | gconstpointer value, gpointer user_data) { |
| 15884 | 134 | if(purple_prefs_get_bool(pref)) { |
| 14286 | 135 | gtk_appbar_dock(blist_ab, |
| 15884 | 136 | purple_prefs_get_int(PREF_DBLIST_SIDE)); |
| 14286 | 137 | |
| 15884 | 138 | if(purple_prefs_get_int(PREF_BLIST_ON_TOP) |
| 14286 | 139 | == BLIST_TOP_DOCKED) |
| 140 | blist_set_ontop(TRUE); | |
| 141 | ||
| 142 | /* We only need to be notified about this once */ | |
| 15884 | 143 | purple_prefs_disconnect_callback(blist_visible_cb_id); |
| 14286 | 144 | } |
| 145 | } | |
| 146 | ||
| 147 | /* This needs to be delayed otherwise, when the blist is originally created and | |
| 148 | * hidden, it'll trigger the blist_visible_cb */ | |
| 149 | static gboolean listen_for_blist_visible_cb(gpointer data) { | |
| 150 | if (handle != NULL) | |
| 151 | blist_visible_cb_id = | |
| 15884 | 152 | purple_prefs_connect_callback(handle, |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16073
diff
changeset
|
153 | PIDGIN_PREFS_ROOT "/blist/list_visible", |
| 14286 | 154 | blist_visible_cb, NULL); |
| 155 | ||
| 156 | return FALSE; | |
| 157 | } | |
| 158 | ||
| 15884 | 159 | static void blist_create_cb(PurpleBuddyList *purple_blist, void *data) { |
| 160 | purple_debug_info(WINPREFS_PLUGIN_ID, "buddy list created\n"); | |
| 14286 | 161 | |
| 15884 | 162 | blist = PIDGIN_BLIST(purple_blist)->window; |
| 14286 | 163 | |
| 15884 | 164 | if(purple_prefs_get_bool(PREF_DBLIST_DOCKABLE)) { |
| 14286 | 165 | blist_set_dockable(TRUE); |
| 15884 | 166 | if(purple_prefs_get_bool(PREF_DBLIST_DOCKED)) { |
| 167 | blist_ab->undocked_height = purple_prefs_get_int(PREF_DBLIST_HEIGHT); | |
| 14286 | 168 | if(!(gdk_window_get_state(blist->window) |
| 169 | & GDK_WINDOW_STATE_WITHDRAWN)) { | |
| 170 | gtk_appbar_dock(blist_ab, | |
| 15884 | 171 | purple_prefs_get_int(PREF_DBLIST_SIDE)); |
| 172 | if(purple_prefs_get_int(PREF_BLIST_ON_TOP) | |
| 14286 | 173 | == BLIST_TOP_DOCKED) |
| 174 | blist_set_ontop(TRUE); | |
| 175 | } else { | |
| 176 | g_idle_add(listen_for_blist_visible_cb, NULL); | |
| 177 | } | |
| 178 | } | |
| 179 | } | |
| 180 | ||
| 15884 | 181 | if(purple_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_ALWAYS) |
| 14286 | 182 | blist_set_ontop(TRUE); |
| 183 | ||
| 184 | } | |
| 185 | ||
| 186 | /* WIN PREFS GENERAL */ | |
| 187 | ||
| 188 | static void | |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
189 | winprefs_set_autostart(GtkWidget *w) { |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
190 | char *runval = NULL; |
| 14286 | 191 | |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
192 | if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) |
|
30876
cd041b5b7ceb
Quote the path for the windows "run at startup" registry key.
Daniel Atallah <datallah@pidgin.im>
parents:
28576
diff
changeset
|
193 | runval = g_strdup_printf("\"%s" G_DIR_SEPARATOR_S "pidgin.exe\"", wpurple_install_dir()); |
| 14286 | 194 | |
|
16792
6174b9ff9ac5
Fix #432 - "Start Pidgin on Windows startup" doesn't work.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
195 | if(!wpurple_write_reg_string(HKEY_CURRENT_USER, RUNKEY, "Pidgin", runval) |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
196 | /* For Win98 */ |
|
16792
6174b9ff9ac5
Fix #432 - "Start Pidgin on Windows startup" doesn't work.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
197 | && !wpurple_write_reg_string(HKEY_LOCAL_MACHINE, RUNKEY, "Pidgin", runval)) |
| 15884 | 198 | purple_debug_error(WINPREFS_PLUGIN_ID, "Could not set registry key value\n"); |
| 14286 | 199 | |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
200 | g_free(runval); |
| 14286 | 201 | } |
| 202 | ||
| 203 | static void | |
|
28576
6ce76c426ce8
Add support for setting the multiple instances flag in the Windows Preferences plugin.
Daniel Atallah <datallah@pidgin.im>
parents:
27525
diff
changeset
|
204 | winprefs_set_multiple_instances(GtkWidget *w) { |
|
6ce76c426ce8
Add support for setting the multiple instances flag in the Windows Preferences plugin.
Daniel Atallah <datallah@pidgin.im>
parents:
27525
diff
changeset
|
205 | wpurple_write_reg_string(HKEY_CURRENT_USER, "Environment", "PIDGIN_MULTI_INST", |
|
6ce76c426ce8
Add support for setting the multiple instances flag in the Windows Preferences plugin.
Daniel Atallah <datallah@pidgin.im>
parents:
27525
diff
changeset
|
206 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)) ? "1" : NULL); |
|
6ce76c426ce8
Add support for setting the multiple instances flag in the Windows Preferences plugin.
Daniel Atallah <datallah@pidgin.im>
parents:
27525
diff
changeset
|
207 | } |
|
6ce76c426ce8
Add support for setting the multiple instances flag in the Windows Preferences plugin.
Daniel Atallah <datallah@pidgin.im>
parents:
27525
diff
changeset
|
208 | |
|
6ce76c426ce8
Add support for setting the multiple instances flag in the Windows Preferences plugin.
Daniel Atallah <datallah@pidgin.im>
parents:
27525
diff
changeset
|
209 | static void |
| 15884 | 210 | winprefs_set_blist_dockable(const char *pref, PurplePrefType type, |
| 14286 | 211 | gconstpointer value, gpointer user_data) |
| 212 | { | |
| 213 | blist_set_dockable(GPOINTER_TO_INT(value)); | |
| 214 | } | |
| 215 | ||
| 216 | static void | |
| 15884 | 217 | winprefs_set_blist_ontop(const char *pref, PurplePrefType type, |
| 14286 | 218 | gconstpointer value, gpointer user_data) |
| 219 | { | |
| 15884 | 220 | gint setting = purple_prefs_get_int(PREF_BLIST_ON_TOP); |
| 14286 | 221 | if((setting == BLIST_TOP_DOCKED && blist_ab && blist_ab->docked) |
| 222 | || setting == BLIST_TOP_ALWAYS) | |
| 223 | blist_set_ontop(TRUE); | |
| 224 | else | |
| 225 | blist_set_ontop(FALSE); | |
| 226 | } | |
| 227 | ||
| 228 | /* | |
| 229 | * EXPORTED FUNCTIONS | |
| 230 | */ | |
| 231 | ||
| 15884 | 232 | static GtkWidget* get_config_frame(PurplePlugin *plugin) { |
|
30878
3edf77c86d98
Revert unrelated changes that snuck into aa3b95627
Daniel Atallah <datallah@pidgin.im>
parents:
30876
diff
changeset
|
233 | GtkWidget *ret; |
|
3edf77c86d98
Revert unrelated changes that snuck into aa3b95627
Daniel Atallah <datallah@pidgin.im>
parents:
30876
diff
changeset
|
234 | GtkWidget *vbox; |
|
3edf77c86d98
Revert unrelated changes that snuck into aa3b95627
Daniel Atallah <datallah@pidgin.im>
parents:
30876
diff
changeset
|
235 | GtkWidget *button; |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
236 | char *run_key_val; |
|
16073
e70e589dde54
more help for translators (I removed a few PIDGIN_NAME references
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
237 | char *tmp; |
| 14286 | 238 | |
| 239 | ret = gtk_vbox_new(FALSE, 18); | |
| 240 | gtk_container_set_border_width(GTK_CONTAINER(ret), 12); | |
| 241 | ||
| 242 | /* Autostart */ | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
243 | vbox = pidgin_make_frame(ret, _("Startup")); |
|
16073
e70e589dde54
more help for translators (I removed a few PIDGIN_NAME references
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
244 | tmp = g_strdup_printf(_("_Start %s on Windows startup"), PIDGIN_NAME); |
|
e70e589dde54
more help for translators (I removed a few PIDGIN_NAME references
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
245 | button = gtk_check_button_new_with_mnemonic(tmp); |
|
e70e589dde54
more help for translators (I removed a few PIDGIN_NAME references
Nathan Walp <nwalp@pidgin.im>
parents:
15884
diff
changeset
|
246 | g_free(tmp); |
| 14286 | 247 | gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); |
|
16792
6174b9ff9ac5
Fix #432 - "Start Pidgin on Windows startup" doesn't work.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
248 | if ((run_key_val = wpurple_read_reg_string(HKEY_CURRENT_USER, RUNKEY, "Pidgin")) |
|
6174b9ff9ac5
Fix #432 - "Start Pidgin on Windows startup" doesn't work.
Daniel Atallah <datallah@pidgin.im>
parents:
16751
diff
changeset
|
249 | || (run_key_val = wpurple_read_reg_string(HKEY_LOCAL_MACHINE, RUNKEY, "Pidgin"))) { |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
250 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); |
|
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14286
diff
changeset
|
251 | g_free(run_key_val); |
| 14286 | 252 | } |
| 253 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(winprefs_set_autostart), NULL); | |
| 254 | gtk_widget_show(button); | |
| 255 | ||
|
28576
6ce76c426ce8
Add support for setting the multiple instances flag in the Windows Preferences plugin.
Daniel Atallah <datallah@pidgin.im>
parents:
27525
diff
changeset
|
256 | button = gtk_check_button_new_with_mnemonic(_("Allow multiple instances")); |
|
6ce76c426ce8
Add support for setting the multiple instances flag in the Windows Preferences plugin.
Daniel Atallah <datallah@pidgin.im>
parents:
27525
diff
changeset
|
257 | gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); |
|
6ce76c426ce8
Add support for setting the multiple instances flag in the Windows Preferences plugin.
Daniel Atallah <datallah@pidgin.im>
parents:
27525
diff
changeset
|
258 | if ((run_key_val = wpurple_read_reg_string(HKEY_CURRENT_USER, "Environment", "PIDGIN_MULTI_INST"))) { |
|
6ce76c426ce8
Add support for setting the multiple instances flag in the Windows Preferences plugin.
Daniel Atallah <datallah@pidgin.im>
parents:
27525
diff
changeset
|
259 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); |
|
6ce76c426ce8
Add support for setting the multiple instances flag in the Windows Preferences plugin.
Daniel Atallah <datallah@pidgin.im>
parents:
27525
diff
changeset
|
260 | g_free(run_key_val); |
|
6ce76c426ce8
Add support for setting the multiple instances flag in the Windows Preferences plugin.
Daniel Atallah <datallah@pidgin.im>
parents:
27525
diff
changeset
|
261 | } |
|
6ce76c426ce8
Add support for setting the multiple instances flag in the Windows Preferences plugin.
Daniel Atallah <datallah@pidgin.im>
parents:
27525
diff
changeset
|
262 | g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(winprefs_set_multiple_instances), NULL); |
|
6ce76c426ce8
Add support for setting the multiple instances flag in the Windows Preferences plugin.
Daniel Atallah <datallah@pidgin.im>
parents:
27525
diff
changeset
|
263 | gtk_widget_show(button); |
|
6ce76c426ce8
Add support for setting the multiple instances flag in the Windows Preferences plugin.
Daniel Atallah <datallah@pidgin.im>
parents:
27525
diff
changeset
|
264 | |
| 14286 | 265 | /* Buddy List */ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
266 | vbox = pidgin_make_frame(ret, _("Buddy List")); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
267 | pidgin_prefs_checkbox(_("_Dockable Buddy List"), |
| 14286 | 268 | PREF_DBLIST_DOCKABLE, vbox); |
| 269 | ||
| 270 | /* Blist On Top */ | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15498
diff
changeset
|
271 | pidgin_prefs_dropdown(vbox, _("_Keep Buddy List window on top:"), |
| 15884 | 272 | PURPLE_PREF_INT, PREF_BLIST_ON_TOP, |
| 14286 | 273 | _("Never"), BLIST_TOP_NEVER, |
| 274 | _("Always"), BLIST_TOP_ALWAYS, | |
| 275 | /* XXX: Did this ever work? */ | |
| 276 | _("Only when docked"), BLIST_TOP_DOCKED, | |
| 277 | NULL); | |
| 278 | ||
| 279 | gtk_widget_show_all(ret); | |
| 280 | return ret; | |
| 281 | } | |
| 282 | ||
|
36771
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
283 | static PidginPluginInfo * |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
284 | plugin_query(GError **error) |
| 14286 | 285 | { |
|
36771
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
286 | const gchar * const authors[] = { |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
287 | "Herman Bloggs <hermanator12002@yahoo.com>", |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
288 | NULL |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
289 | }; |
|
16751
8e552dc2ef9f
20:06 < SimGuy> grim: add padding to the two win32 plugins while you're at it :P
Gary Kramlich <grim@reaperworld.com>
parents:
16123
diff
changeset
|
290 | |
|
36771
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
291 | return pidgin_plugin_info_new( |
|
36934
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36771
diff
changeset
|
292 | "id", WINPREFS_PLUGIN_ID, |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36771
diff
changeset
|
293 | "name", N_("Windows Pidgin Options"), |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36771
diff
changeset
|
294 | "version", DISPLAY_VERSION, |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36771
diff
changeset
|
295 | "category", N_("User interface"), |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36771
diff
changeset
|
296 | "summary", N_("Options specific to Pidgin for Windows."), |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36771
diff
changeset
|
297 | "description", N_("Provides options specific to Pidgin for " |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36771
diff
changeset
|
298 | "Windows, such as buddy list docking."), |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36771
diff
changeset
|
299 | "authors", authors, |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36771
diff
changeset
|
300 | "website", PURPLE_WEBSITE, |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36771
diff
changeset
|
301 | "abi-version", PURPLE_ABI_VERSION, |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36771
diff
changeset
|
302 | "pidgin-config-frame-cb", get_config_frame, |
|
36771
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
303 | NULL |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
304 | ); |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
305 | } |
| 14286 | 306 | |
|
36771
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
307 | static gboolean plugin_load(PurplePlugin *plugin, GError **error) { |
| 15884 | 308 | purple_prefs_add_none("/plugins/gtk"); |
| 309 | purple_prefs_add_none("/plugins/gtk/win32"); | |
| 310 | purple_prefs_add_none("/plugins/gtk/win32/winprefs"); | |
| 311 | purple_prefs_add_bool(PREF_DBLIST_DOCKABLE, FALSE); | |
| 312 | purple_prefs_add_bool(PREF_DBLIST_DOCKED, FALSE); | |
| 313 | purple_prefs_add_int(PREF_DBLIST_HEIGHT, 0); | |
| 314 | purple_prefs_add_int(PREF_DBLIST_SIDE, 0); | |
| 14286 | 315 | |
| 316 | /* Convert old preferences */ | |
| 15884 | 317 | if(purple_prefs_exists(PREF_DBLIST_ON_TOP)) { |
| 14286 | 318 | gint blist_top = BLIST_TOP_NEVER; |
| 15884 | 319 | if(purple_prefs_get_bool(PREF_BLIST_ON_TOP)) |
| 14286 | 320 | blist_top = BLIST_TOP_ALWAYS; |
| 15884 | 321 | else if(purple_prefs_get_bool(PREF_DBLIST_ON_TOP)) |
| 14286 | 322 | blist_top = BLIST_TOP_DOCKED; |
| 15884 | 323 | purple_prefs_remove(PREF_BLIST_ON_TOP); |
| 324 | purple_prefs_remove(PREF_DBLIST_ON_TOP); | |
| 325 | purple_prefs_add_int(PREF_BLIST_ON_TOP, blist_top); | |
| 14286 | 326 | } else |
| 15884 | 327 | purple_prefs_add_int(PREF_BLIST_ON_TOP, BLIST_TOP_NEVER); |
|
25544
afa0851cca1e
Remove the "Flash window when chat messages are received" pref from the winprefs
Daniel Atallah <datallah@pidgin.im>
parents:
20288
diff
changeset
|
328 | purple_prefs_remove(PREF_CHAT_BLINK); |
|
36771
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
329 | |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
330 | handle = plugin; |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
331 | |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
332 | /* blist docking init */ |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
333 | if(purple_blist_get_buddy_list() && PIDGIN_BLIST(purple_blist_get_buddy_list()) |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
334 | && PIDGIN_BLIST(purple_blist_get_buddy_list())->window) { |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
335 | blist_create_cb(purple_blist_get_buddy_list(), NULL); |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
336 | } |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
337 | |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
338 | /* This really shouldn't happen anymore generally, but if for some strange |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
339 | reason, the blist is recreated, we need to set it up again. */ |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
340 | purple_signal_connect(pidgin_blist_get_handle(), "gtkblist-created", |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
341 | plugin, PURPLE_CALLBACK(blist_create_cb), NULL); |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
342 | |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
343 | purple_signal_connect((void*)purple_get_core(), "quitting", plugin, |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
344 | PURPLE_CALLBACK(purple_quit_cb), NULL); |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
345 | |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
346 | purple_prefs_connect_callback(handle, PREF_BLIST_ON_TOP, |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
347 | winprefs_set_blist_ontop, NULL); |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
348 | purple_prefs_connect_callback(handle, PREF_DBLIST_DOCKABLE, |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
349 | winprefs_set_blist_dockable, NULL); |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
350 | |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
351 | return TRUE; |
| 14286 | 352 | } |
| 353 | ||
|
36771
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
354 | static gboolean plugin_unload(PurplePlugin *plugin, GError **error) { |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
355 | blist_set_dockable(FALSE); |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
356 | blist_set_ontop(FALSE); |
| 14286 | 357 | |
|
36771
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
358 | handle = NULL; |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
359 | |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
360 | return TRUE; |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
361 | } |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
362 | |
|
38865e7d8465
Added new API entry points for win32 pidgin plugins (not tested)
Ankit Vani <a@nevitus.org>
parents:
34726
diff
changeset
|
363 | PURPLE_PLUGIN_INIT(winprefs, plugin_query, plugin_load, plugin_unload); |