Mon, 11 Aug 2003 19:56:57 +0000
[gaim-migrate @ 6938]
Actually, Etan pointed this out. The other thing doesn't even compile.
Why would he point *that* out?
| 4134 | 1 | /* |
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
2 | * gaim - WinGaim Options Plugin |
| 4134 | 3 | * |
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
4 | * File: winprefs.c |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
5 | * Date: December 12, 2002 |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
6 | * Description: Gaim Plugin interface |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
7 | * |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
8 | * copyright (c) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com> |
| 4134 | 9 | * |
| 10 | * this program is free software; you can redistribute it and/or modify | |
| 11 | * it under the terms of the gnu general public license as published by | |
| 12 | * the free software foundation; either version 2 of the license, or | |
| 13 | * (at your option) any later version. | |
| 14 | * | |
| 15 | * this program is distributed in the hope that it will be useful, | |
| 16 | * but without any warranty; without even the implied warranty of | |
| 17 | * merchantability or fitness for a particular purpose. see the | |
| 18 | * gnu general public license for more details. | |
| 19 | * | |
| 20 | * you should have received a copy of the gnu general public license | |
| 21 | * along with this program; if not, write to the free software | |
| 22 | * foundation, inc., 59 temple place, suite 330, boston, ma 02111-1307 usa | |
| 23 | * | |
| 24 | */ | |
| 25 | #include <windows.h> | |
| 26 | #include <winreg.h> | |
| 27 | #include <winerror.h> | |
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
28 | #include <gdk/gdkwin32.h> |
|
5912
32619a71edd2
[gaim-migrate @ 6344]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
29 | |
|
32619a71edd2
[gaim-migrate @ 6344]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
30 | #include "internal.h" |
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
31 | #include "gtkinternal.h" |
|
5912
32619a71edd2
[gaim-migrate @ 6344]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
32 | |
|
32619a71edd2
[gaim-migrate @ 6344]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
33 | #include "prefs.h" |
|
32619a71edd2
[gaim-migrate @ 6344]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
34 | #include "debug.h" |
|
32619a71edd2
[gaim-migrate @ 6344]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
35 | |
|
5224
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
36 | #include "gtkplugin.h" |
|
5912
32619a71edd2
[gaim-migrate @ 6344]
Herman Bloggs <herman@bluedigits.com>
parents:
5854
diff
changeset
|
37 | #include "gtkutils.h" |
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
38 | #include "gtkblist.h" |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
39 | #include "gtkappbar.h" |
| 4134 | 40 | |
| 41 | /* | |
| 42 | * MACROS & DEFINES | |
| 43 | */ | |
| 5854 | 44 | #define WINPREFS_PLUGIN_ID "gtk-win-prefs" |
| 4134 | 45 | |
| 46 | /* | |
| 47 | * LOCALS | |
| 48 | */ | |
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
49 | static const char *OPT_WINPREFS_DBLIST_DOCKABLE = "/plugins/gtk/win32/winprefs/dblist_dockable"; |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
50 | static const char *OPT_WINPREFS_DBLIST_DOCKED = "/plugins/gtk/win32/winprefs/dblist_docked"; |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
51 | static const char *OPT_WINPREFS_DBLIST_HEIGHT = "/plugins/gtk/win32/winprefs/dblist_height"; |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
52 | static const char *OPT_WINPREFS_DBLIST_SIDE = "/plugins/gtk/win32/winprefs/dblist_side"; |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
53 | static GaimPlugin *plugin_id = NULL; |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
54 | static GtkAppBar *blist_ab = NULL; |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
55 | static GtkWidget *blist = NULL; |
| 4134 | 56 | |
| 57 | /* | |
| 58 | * PROTOS | |
| 59 | */ | |
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
60 | static void blist_create_cb(); |
| 4134 | 61 | |
| 62 | /* | |
| 63 | * CODE | |
| 64 | */ | |
| 65 | ||
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
66 | /* UTIL */ |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
67 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
68 | static GtkWidget *wgaim_button(const char *text, GtkWidget *page) { |
| 5795 | 69 | GtkWidget *button; |
|
5749
538a4a7b41ad
[gaim-migrate @ 6174]
Herman Bloggs <herman@bluedigits.com>
parents:
5224
diff
changeset
|
70 | button = gtk_check_button_new_with_mnemonic(text); |
| 5795 | 71 | gtk_box_pack_start(GTK_BOX(page), button, FALSE, FALSE, 0); |
|
5749
538a4a7b41ad
[gaim-migrate @ 6174]
Herman Bloggs <herman@bluedigits.com>
parents:
5224
diff
changeset
|
72 | gtk_widget_show(button); |
| 5795 | 73 | return button; |
| 4134 | 74 | } |
| 75 | ||
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
76 | /* BLIST DOCKING */ |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
77 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
78 | static void blist_save_state() { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
79 | if(blist_ab && gaim_prefs_get_bool(OPT_WINPREFS_DBLIST_DOCKABLE)) { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
80 | if(blist_ab->docked) { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
81 | gaim_prefs_set_int(OPT_WINPREFS_DBLIST_HEIGHT, blist_ab->undocked_height); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
82 | gaim_prefs_set_int(OPT_WINPREFS_DBLIST_SIDE, blist_ab->side); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
83 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
84 | gaim_prefs_set_bool(OPT_WINPREFS_DBLIST_DOCKED, blist_ab->docked); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
85 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
86 | else |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
87 | gaim_prefs_set_bool(OPT_WINPREFS_DBLIST_DOCKED, FALSE); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
88 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
89 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
90 | static void blist_set_dockable(gboolean val) { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
91 | if(val) { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
92 | if(!blist_ab && blist) |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
93 | blist_ab = gtk_appbar_add(blist); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
94 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
95 | else { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
96 | gtk_appbar_remove(blist_ab); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
97 | blist_ab = NULL; |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
98 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
99 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
100 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
101 | static void gaim_quit_cb() { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
102 | gaim_debug(GAIM_DEBUG_INFO, WINPREFS_PLUGIN_ID, "gaim_quit_cb: removing appbar\n"); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
103 | blist_save_state(); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
104 | blist_set_dockable(FALSE); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
105 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
106 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
107 | static gboolean blist_create_cb_remove(gpointer data) { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
108 | gaim_signal_disconnect(plugin_id, event_signon, blist_create_cb); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
109 | return FALSE; |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
110 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
111 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
112 | static void blist_create_cb() { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
113 | gaim_debug(GAIM_DEBUG_INFO, WINPREFS_PLUGIN_ID, "event_signon\n"); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
114 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
115 | blist = GAIM_GTK_BLIST(gaim_get_blist())->window; |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
116 | if(gaim_prefs_get_bool(OPT_WINPREFS_DBLIST_DOCKABLE)) { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
117 | blist_set_dockable(TRUE); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
118 | if(gaim_prefs_get_bool(OPT_WINPREFS_DBLIST_DOCKED)) { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
119 | blist_ab->undocked_height = gaim_prefs_get_int(OPT_WINPREFS_DBLIST_HEIGHT); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
120 | gtk_appbar_dock(blist_ab, |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
121 | gaim_prefs_get_int(OPT_WINPREFS_DBLIST_SIDE)); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
122 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
123 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
124 | /* removing here will cause a crash when going to next cb |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
125 | in the gaim signal cb loop.. so process delayed. */ |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
126 | g_idle_add(blist_create_cb_remove, NULL); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
127 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
128 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
129 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
130 | /* AUTOSTART */ |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
131 | |
| 4134 | 132 | static int open_run_key(PHKEY phKey, REGSAM samDesired) { |
| 5795 | 133 | /* First try current user key (for WinNT & Win2k +), fall back to local machine */ |
| 134 | if(ERROR_SUCCESS == RegOpenKeyEx(HKEY_CURRENT_USER, | |
| 4134 | 135 | "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", |
| 136 | 0, samDesired, phKey)); | |
| 137 | else if(ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, | |
| 138 | "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", | |
| 139 | 0, samDesired, phKey)); | |
| 140 | else { | |
| 5854 | 141 | gaim_debug(GAIM_DEBUG_ERROR, WINPREFS_PLUGIN_ID, "open_run_key: Could not open key for writing value\n"); |
| 4134 | 142 | return 0; |
| 143 | } | |
| 144 | return 1; | |
| 145 | } | |
| 146 | ||
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
147 | /* WIN PREFS GENERAL */ |
| 4134 | 148 | |
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
149 | static void winprefs_set_autostart(GtkWidget *w) { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
150 | HKEY hKey; |
| 4134 | 151 | |
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
152 | if(!open_run_key(&hKey, KEY_SET_VALUE)) |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
153 | return; |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
154 | if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
155 | char buffer[1024]; |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
156 | DWORD size; |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
157 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
158 | if((size = GetModuleFileName(wgaim_hinstance(), |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
159 | (LPBYTE)buffer, |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
160 | sizeof(buffer)))==0) { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
161 | gaim_debug(GAIM_DEBUG_ERROR, WINPREFS_PLUGIN_ID, "GetModuleFileName Error.. Could not set Gaim autostart.\n"); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
162 | RegCloseKey(hKey); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
163 | return; |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
164 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
165 | /* Now set value of new key */ |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
166 | if(ERROR_SUCCESS != RegSetValueEx(hKey, |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
167 | "Gaim", |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
168 | 0, |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
169 | REG_SZ, |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
170 | buffer, |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
171 | size)) |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
172 | gaim_debug(GAIM_DEBUG_ERROR, WINPREFS_PLUGIN_ID, "Could not set registry key value\n"); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
173 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
174 | else { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
175 | if(ERROR_SUCCESS != RegDeleteValue(hKey, "Gaim")) |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
176 | gaim_debug(GAIM_DEBUG_ERROR, WINPREFS_PLUGIN_ID, "Could not delete registry key value\n"); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
177 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
178 | RegCloseKey(hKey); |
| 4134 | 179 | } |
| 180 | ||
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
181 | static void winprefs_set_blist_dockable(GtkWidget *w) { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
182 | gaim_prefs_set_bool(OPT_WINPREFS_DBLIST_DOCKABLE, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
183 | gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)) ? blist_set_dockable(TRUE) : blist_set_dockable(FALSE); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
184 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
185 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
186 | |
| 4134 | 187 | /* |
| 188 | * EXPORTED FUNCTIONS | |
| 189 | */ | |
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
190 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
191 | gboolean plugin_load(GaimPlugin *plugin) { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
192 | plugin_id = plugin; |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
193 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
194 | /* blist docking init */ |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
195 | if(!blist && gaim_get_blist() && GAIM_GTK_BLIST(gaim_get_blist())) { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
196 | blist = GAIM_GTK_BLIST(gaim_get_blist())->window; |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
197 | if(gaim_prefs_get_bool(OPT_WINPREFS_DBLIST_DOCKABLE)) |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
198 | blist_set_dockable(TRUE); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
199 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
200 | else |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
201 | gaim_signal_connect(plugin, event_signon, blist_create_cb, NULL); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
202 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
203 | gaim_signal_connect(plugin, event_quit, gaim_quit_cb, NULL); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
204 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
205 | return TRUE; |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
206 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
207 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
208 | gboolean plugin_unload(GaimPlugin *plugin) { |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
209 | blist_set_dockable(FALSE); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
210 | return TRUE; |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
211 | } |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
212 | |
|
5224
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
213 | static GtkWidget* get_config_frame(GaimPlugin *plugin) { |
| 4134 | 214 | GtkWidget *ret; |
| 215 | GtkWidget *button; | |
| 216 | GtkWidget *vbox; | |
| 217 | HKEY hKey; | |
| 218 | ||
| 219 | ret = gtk_vbox_new(FALSE, 18); | |
| 220 | gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
| 221 | ||
|
5749
538a4a7b41ad
[gaim-migrate @ 6174]
Herman Bloggs <herman@bluedigits.com>
parents:
5224
diff
changeset
|
222 | vbox = gaim_gtk_make_frame (ret, _("Startup")); |
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
223 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
224 | /* Autostart */ |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
225 | button = wgaim_button(_("_Start Gaim on Windows startup"), vbox); |
| 4134 | 226 | if(open_run_key(&hKey, KEY_QUERY_VALUE)) { |
| 227 | if(ERROR_SUCCESS == RegQueryValueEx(hKey, "Gaim", 0, NULL, NULL, NULL)) { | |
| 228 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); | |
| 229 | } | |
| 230 | } | |
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
231 | gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(winprefs_set_autostart), NULL); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
232 | |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
233 | /* Dockable Blist */ |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
234 | button = wgaim_button(_("_Dockable Buddy List"), vbox); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
235 | gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(winprefs_set_blist_dockable), NULL); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
236 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), gaim_prefs_get_bool(OPT_WINPREFS_DBLIST_DOCKABLE)); |
| 4134 | 237 | |
| 238 | gtk_widget_show_all(ret); | |
| 239 | return ret; | |
| 240 | } | |
|
5224
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
241 | |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
242 | static GaimGtkPluginUiInfo ui_info = |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
243 | { |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
244 | get_config_frame |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
245 | }; |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
246 | |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
247 | static GaimPluginInfo info = |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
248 | { |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
249 | 2, |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
250 | GAIM_PLUGIN_STANDARD, |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
251 | GAIM_GTK_PLUGIN_TYPE, |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
252 | 0, |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
253 | NULL, |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
254 | GAIM_PRIORITY_DEFAULT, |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
255 | WINPREFS_PLUGIN_ID, |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
256 | N_("WinGaim Options"), |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
257 | VERSION, |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
258 | N_("Options specific to Windows Gaim."), |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
259 | N_("Options specific to Windows Gaim."), |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
260 | "Herman Bloggs <hermanator12002@yahoo.com>", |
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
261 | GAIM_WEBSITE, |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
262 | plugin_load, |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
263 | plugin_unload, |
|
5224
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
264 | NULL, |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
265 | &ui_info, |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
266 | NULL |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
267 | }; |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
268 | |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
269 | static void |
|
5798
d60e39f7fa1d
[gaim-migrate @ 6223]
Christian Hammond <chipx86@chipx86.com>
parents:
5795
diff
changeset
|
270 | init_plugin(GaimPlugin *plugin) |
|
5224
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
271 | { |
|
6409
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
272 | gaim_prefs_add_none("/plugins/gtk/win32"); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
273 | gaim_prefs_add_none("/plugins/gtk/win32/winprefs"); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
274 | gaim_prefs_add_bool(OPT_WINPREFS_DBLIST_DOCKABLE, FALSE); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
275 | gaim_prefs_add_bool(OPT_WINPREFS_DBLIST_DOCKED, FALSE); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
276 | gaim_prefs_add_int(OPT_WINPREFS_DBLIST_HEIGHT, 0); |
|
ea9ba622db3f
[gaim-migrate @ 6915]
Herman Bloggs <herman@bluedigits.com>
parents:
6063
diff
changeset
|
277 | gaim_prefs_add_int(OPT_WINPREFS_DBLIST_SIDE, 0); |
|
5224
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
278 | } |
|
8cb89f5b912a
[gaim-migrate @ 5594]
Herman Bloggs <herman@bluedigits.com>
parents:
4606
diff
changeset
|
279 | |
| 6063 | 280 | GAIM_INIT_PLUGIN(winprefs, init_plugin, info) |