annotate plugins/win32/winprefs/winprefs.c @ 5224:5160333a80df

[gaim-migrate @ 5594] Update for new plugin api committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Sat, 26 Apr 2003 14:55:40 +0000
parents 864518c3767d
children 6d6ae91c5de7
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 #include <windows.h>
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
22 #include <winreg.h>
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
23 #include <winerror.h>
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
24 #include "gaim.h"
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
25 #include "gtkplugin.h"
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
26 #include "win32dep.h"
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
27
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
28 /*
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
29 * MACROS & DEFINES
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
30 */
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
31 #define WINPREFS_PLUGIN_ID "gaim-winprefs"
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
32 #define WINPREFS_VERSION 1
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
33
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
34 /* Plugin options */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
35 #define OPT_WGAIM_AUTOSTART 0x00000001
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
36
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 * LOCALS
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
39 */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
40 guint winprefs_options=0;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
41
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 * PROTOS
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
44 */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
45 extern GtkWidget *gaim_button(const char*, guint*, int, GtkWidget*);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
46
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 * CODE
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
49 */
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 static void write_options(FILE *f) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
52 fprintf(f, "options {\n");
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
53 fprintf(f, "\twinprefs_options { %u }\n", winprefs_options);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
54 fprintf(f, "}\n");
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
55 }
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 static void save_winprefs_prefs() {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
58 FILE *f;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
59 char buf[1024];
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
60
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
61 if (gaim_home_dir()) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
62 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
63 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
64 else
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
65 return;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
66
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
67 if ((f = fopen(buf, "w"))) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
68 fprintf(f, "# winprefsrc v%d\n", WINPREFS_VERSION);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
69 write_options(f);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
70 fclose(f);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
71 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
72 else
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
73 debug_printf("Error opening wintransrc\n");
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
74 }
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 static int open_run_key(PHKEY phKey, REGSAM samDesired) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
77 /* 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
78 if(ERROR_SUCCESS == RegOpenKeyEx(HKEY_CURRENT_USER,
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
79 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
80 0, samDesired, phKey));
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
81 else if(ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE,
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
82 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
83 0, samDesired, phKey));
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
84 else {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
85 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
86 return 0;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
87 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
88 return 1;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
89 }
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 static void set_winprefs_option(GtkWidget *w, int option) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
92 winprefs_options ^= option;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
93 save_winprefs_prefs();
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
94
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
95 if(option == OPT_WGAIM_AUTOSTART) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
96 HKEY hKey;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
97
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
98 if(!open_run_key(&hKey, KEY_SET_VALUE))
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
99 return;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
100 if(winprefs_options & OPT_WGAIM_AUTOSTART) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
101 char buffer[1024];
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
102 DWORD size;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
103
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
104 if((size = GetModuleFileName(wgaim_hinstance(),
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
105 (LPBYTE)buffer,
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
106 sizeof(buffer)))==0) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
107 debug_printf("GetModuleFileName Error.. Could not set Gaim autostart.\n");
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
108 RegCloseKey(hKey);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
109 return;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
110 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
111 /* Now set value of new key */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
112 if(ERROR_SUCCESS != RegSetValueEx(hKey,
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
113 "Gaim",
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
114 0,
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
115 REG_SZ,
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
116 buffer,
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
117 size))
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
118 debug_printf("Could not set registry key value\n");
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
119 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
120 else {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
121 if(ERROR_SUCCESS != RegDeleteValue(hKey, "Gaim"))
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
122 debug_printf("Could not delete registry key value\n");
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
123 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
124 RegCloseKey(hKey);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
125 }
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 * EXPORTED FUNCTIONS
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
130 */
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
131 static GtkWidget* get_config_frame(GaimPlugin *plugin) {
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
132 GtkWidget *ret;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
133 GtkWidget *button;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
134 GtkWidget *vbox;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
135 HKEY hKey;
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 ret = gtk_vbox_new(FALSE, 18);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
138 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
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 /* IM Convo trans options */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
141 vbox = make_frame (ret, _("Startup"));
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
142 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
143 /* Set initial value */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
144 if(open_run_key(&hKey, KEY_QUERY_VALUE)) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
145 if(ERROR_SUCCESS == RegQueryValueEx(hKey, "Gaim", 0, NULL, NULL, NULL)) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
146 winprefs_options ^= OPT_WGAIM_AUTOSTART;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
147 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
148 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
149 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
150 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
151
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
152 gtk_widget_show_all(ret);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
153 return ret;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
154 }
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
155
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
156 static GaimGtkPluginUiInfo ui_info =
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
157 {
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
158 get_config_frame
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
159 };
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
160
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
161 static GaimPluginInfo info =
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
162 {
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
163 2,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
164 GAIM_PLUGIN_STANDARD,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
165 GAIM_GTK_PLUGIN_TYPE,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
166 0,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
167 NULL,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
168 GAIM_PRIORITY_DEFAULT,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
169 WINPREFS_PLUGIN_ID,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
170 N_("WinGaim Options"),
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
171 VERSION,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
172 N_("Options specific to Windows Gaim."),
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
173 N_("Options specific to Windows Gaim."),
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
174 "Herman Bloggs <hermanator12002@yahoo.com>",
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
175 WEBSITE,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
176 NULL,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
177 NULL,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
178 NULL,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
179 &ui_info,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
180 NULL
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
181 };
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
182
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
183 static void
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
184 __init_plugin(GaimPlugin *plugin)
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
185 {
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
186 }
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
187
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
188 GAIM_INIT_PLUGIN(winprefs, __init_plugin, info);