annotate plugins/win32/winprefs/winprefs.c @ 4134:c0f4c664e3ba

[gaim-migrate @ 4352] Initial import committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Tue, 24 Dec 2002 19:46:01 +0000
parents
children 864518c3767d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
1 /*
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
2 * winprefs.c
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
3 *
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
4 * copyright (c) 1998-2002, Herman Bloggs <hermanator12002@yahoo.com>
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
5 *
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
6 * this program is free software; you can redistribute it and/or modify
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
7 * it under the terms of the gnu general public license as published by
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
8 * the free software foundation; either version 2 of the license, or
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
9 * (at your option) any later version.
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
10 *
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
11 * this program is distributed in the hope that it will be useful,
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
12 * but without any warranty; without even the implied warranty of
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
13 * merchantability or fitness for a particular purpose. see the
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
14 * gnu general public license for more details.
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
15 *
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
16 * you should have received a copy of the gnu general public license
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
17 * along with this program; if not, write to the free software
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
18 * foundation, inc., 59 temple place, suite 330, boston, ma 02111-1307 usa
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
19 *
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
20 */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
21 #define GAIM_PLUGINS
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
22 #include <windows.h>
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
23 #include <winreg.h>
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
24 #include <winerror.h>
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
25 #include <gtk/gtk.h>
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
26 #include <gdk/gdkwin32.h>
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
27 #include "gaim.h"
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
28 #include "win32dep.h"
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
29
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
30 /*
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
31 * MACROS & DEFINES
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
32 */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
33 #define WINPREFS_VERSION 1
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
34
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
35 /* Plugin options */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
36 #define OPT_WGAIM_AUTOSTART 0x00000001
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
37
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
38 /*
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
39 * LOCALS
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
40 */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
41 guint winprefs_options=0;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
42
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
43 /*
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
44 * PROTOS
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
45 */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
46 extern GtkWidget *gaim_button(const char*, guint*, int, GtkWidget*);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
47
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
48 /*
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
49 * CODE
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
50 */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
51
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
52 static void write_options(FILE *f) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
53 fprintf(f, "options {\n");
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
54 fprintf(f, "\twinprefs_options { %u }\n", winprefs_options);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
55 fprintf(f, "}\n");
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
56 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
57
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
58 static void save_winprefs_prefs() {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
59 FILE *f;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
60 char buf[1024];
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
61
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
62 if (gaim_home_dir()) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
63 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S ".gaim" G_DIR_SEPARATOR_S "winprefsrc", gaim_home_dir());
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
64 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
65 else
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
66 return;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
67
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
68 if ((f = fopen(buf, "w"))) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
69 fprintf(f, "# winprefsrc v%d\n", WINPREFS_VERSION);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
70 write_options(f);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
71 fclose(f);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
72 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
73 else
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
74 debug_printf("Error opening wintransrc\n");
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
75 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
76
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
77 static int open_run_key(PHKEY phKey, REGSAM samDesired) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
78 /* First try current user key (for WinNT & Win2k +), fall back to local machine */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
79 if(ERROR_SUCCESS == RegOpenKeyEx(HKEY_CURRENT_USER,
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
80 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
81 0, samDesired, phKey));
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
82 else if(ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE,
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
83 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
84 0, samDesired, phKey));
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
85 else {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
86 debug_printf("open_run_key: Could not open key for writing value\n");
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
87 return 0;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
88 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
89 return 1;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
90 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
91
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
92 static void set_winprefs_option(GtkWidget *w, int option) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
93 winprefs_options ^= option;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
94 save_winprefs_prefs();
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
95
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
96 if(option == OPT_WGAIM_AUTOSTART) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
97 HKEY hKey;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
98
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
99 if(!open_run_key(&hKey, KEY_SET_VALUE))
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
100 return;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
101 if(winprefs_options & OPT_WGAIM_AUTOSTART) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
102 char buffer[1024];
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
103 DWORD size;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
104
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
105 if((size = GetModuleFileName(wgaim_hinstance(),
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
106 (LPBYTE)buffer,
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
107 sizeof(buffer)))==0) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
108 debug_printf("GetModuleFileName Error.. Could not set Gaim autostart.\n");
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
109 RegCloseKey(hKey);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
110 return;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
111 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
112 /* Now set value of new key */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
113 if(ERROR_SUCCESS != RegSetValueEx(hKey,
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
114 "Gaim",
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
115 0,
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
116 REG_SZ,
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
117 buffer,
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
118 size))
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
119 debug_printf("Could not set registry key value\n");
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
120 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
121 else {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
122 if(ERROR_SUCCESS != RegDeleteValue(hKey, "Gaim"))
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
123 debug_printf("Could not delete registry key value\n");
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
124 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
125 RegCloseKey(hKey);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
126 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
127 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
128
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
129 /*
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
130 * EXPORTED FUNCTIONS
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
131 */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
132
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
133 G_MODULE_EXPORT char *gaim_plugin_init(GModule *handle) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
134 return NULL;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
135 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
136
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
137 G_MODULE_EXPORT void gaim_plugin_remove() {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
138 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
139
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
140 struct gaim_plugin_description desc;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
141
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
142 G_MODULE_EXPORT struct gaim_plugin_description *gaim_plugin_desc() {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
143 desc.api_version = PLUGIN_API_VERSION;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
144 desc.name = g_strdup(_("WinGaim Options"));
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
145 desc.version = g_strdup(VERSION);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
146 desc.description = g_strdup(_("Options specific to Windows Gaim."));
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
147 desc.authors = g_strdup(_("Herman Bloggs &lt;hermanator12002@yahoo.com&gt;"));
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
148 desc.url = g_strdup(WEBSITE);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
149 return &desc;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
150 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
151
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
152 G_MODULE_EXPORT char *name() {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
153 return _("WinGaim Options");
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
154 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
155
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
156 G_MODULE_EXPORT char *description() {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
157 return _("Options specific to Windows Gaim.");
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
158 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
159
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
160 G_MODULE_EXPORT GtkWidget *gaim_plugin_config_gtk() {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
161 GtkWidget *ret;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
162 GtkWidget *button;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
163 GtkWidget *vbox;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
164 HKEY hKey;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
165
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
166 ret = gtk_vbox_new(FALSE, 18);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
167 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
168
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
169 /* IM Convo trans options */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
170 vbox = make_frame (ret, _("Startup"));
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
171 button = gaim_button(_("_Start Gaim on Windows startup"), &winprefs_options, OPT_WGAIM_AUTOSTART, vbox);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
172 /* Set initial value */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
173 if(open_run_key(&hKey, KEY_QUERY_VALUE)) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
174 if(ERROR_SUCCESS == RegQueryValueEx(hKey, "Gaim", 0, NULL, NULL, NULL)) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
175 winprefs_options ^= OPT_WGAIM_AUTOSTART;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
176 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
177 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
178 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
179 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_winprefs_option), (int *)OPT_WGAIM_AUTOSTART);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
180
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
181 gtk_widget_show_all(ret);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
182 return ret;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
183 }