annotate plugins/win32/winprefs/winprefs.c @ 11170:0e9e2b923d09

[gaim-migrate @ 13271] Fixed some bugs and made some additions to the XSUBS. Added some of my test scripts which are incomplete, but mostly functional. GaimPluginPrefs and GaimGtkPluginPrefs--using evals to do the Gtk widgets with gtk2-perl--work. Plugin actions can now be added, but only one for now. committer: Tailor Script <tailor@pidgin.im>
author John H. Kelm <johnkelm@gmail.com>
date Fri, 29 Jul 2005 13:38:00 +0000
parents 50224ac8184d
children bb0d7b719af2
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 /*
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
2 * gaim - WinGaim Options Plugin
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
3 *
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
4 * Gaim is the legal property of its developers, whose names are too numerous
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
6 * source distribution.
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
7 *
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
8 * This program is free software; you can redistribute it and/or modify
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
9 * it under the terms of the GNU General Public License as published by
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
11 * (at your option) any later version.
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
12 *
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
13 * This program is distributed in the hope that it will be useful,
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
16 * GNU General Public License for more details.
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
17 *
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
18 * You should have received a copy of the GNU General Public License
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
19 * along with this program; if not, write to the Free Software
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
21 *
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
22 */
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
23
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
24 #include <gdk/gdkwin32.h>
5912
b3c412884a22 [gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5854
diff changeset
25
b3c412884a22 [gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5854
diff changeset
26 #include "internal.h"
b3c412884a22 [gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5854
diff changeset
27
6494
4f93f10ddc75 [gaim-migrate @ 7009]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6436
diff changeset
28 #include "core.h"
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
29 #include "debug.h"
5912
b3c412884a22 [gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5854
diff changeset
30 #include "prefs.h"
8760
16d91ca1a353 [gaim-migrate @ 9515]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 8749
diff changeset
31 #include "signals.h"
9954
a9fb4493ae22 [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9795
diff changeset
32 #include "version.h"
5912
b3c412884a22 [gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5854
diff changeset
33
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
34 #include "gtkappbar.h"
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
35 #include "gtkblist.h"
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
36 #include "gtkconv.h"
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
37 #include "gtkplugin.h"
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
38 #include "gtkprefs.h"
5912
b3c412884a22 [gaim-migrate @ 6344]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5854
diff changeset
39 #include "gtkutils.h"
4134
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 /*
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
42 * MACROS & DEFINES
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
43 */
5854
14891982dbee [gaim-migrate @ 6285]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5798
diff changeset
44 #define WINPREFS_PLUGIN_ID "gtk-win-prefs"
4134
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 /*
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
47 * LOCALS
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
48 */
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
49 static const char *PREF_DBLIST_DOCKABLE = "/plugins/gtk/win32/winprefs/dblist_dockable";
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
50 static const char *PREF_DBLIST_DOCKED = "/plugins/gtk/win32/winprefs/dblist_docked";
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
51 static const char *PREF_DBLIST_HEIGHT = "/plugins/gtk/win32/winprefs/dblist_height";
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
52 static const char *PREF_DBLIST_SIDE = "/plugins/gtk/win32/winprefs/dblist_side";
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
53 static const char *PREF_BLIST_ON_TOP = "/plugins/gtk/win32/winprefs/blist_on_top";
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
54 static const char *PREF_IM_BLINK = "/plugins/gtk/win32/winprefs/im_blink";
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
55 /* Deprecated */
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
56 static const char *PREF_DBLIST_ON_TOP = "/plugins/gtk/win32/winprefs/dblist_on_top";
6436
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
57
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
58 static GaimPlugin *handle = NULL;
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
59 static GtkAppBar *blist_ab = NULL;
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
60 static GtkWidget *blist = NULL;
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
61
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
62 /* flash info */
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
63
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
64 struct _WGAIM_FLASH_INFO {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
65 guint t_handle;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
66 guint sig_handler;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
67 };
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
68
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
69 enum {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
70 BLIST_TOP_NEVER = 0,
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
71 BLIST_TOP_ALWAYS,
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
72 BLIST_TOP_DOCKED,
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
73 };
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
74
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
75 typedef struct _WGAIM_FLASH_INFO WGAIM_FLASH_INFO;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
76
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
77 typedef BOOL (CALLBACK* LPFNFLASHWINDOWEX)(PFLASHWINFO);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
78
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
79 static LPFNFLASHWINDOWEX MyFlashWindowEx = NULL;
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
80
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
81 /*
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
82 * CODE
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
83 */
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
84
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
85 /* BLIST DOCKING */
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
86
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
87 static void blist_save_state() {
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
88 if(blist_ab) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
89 if(gaim_prefs_get_bool(PREF_DBLIST_DOCKABLE) && blist_ab->docked) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
90 gaim_prefs_set_int(PREF_DBLIST_HEIGHT, blist_ab->undocked_height);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
91 gaim_prefs_set_int(PREF_DBLIST_SIDE, blist_ab->side);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
92 gaim_prefs_set_bool(PREF_DBLIST_DOCKED, blist_ab->docked);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
93 } else
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
94 gaim_prefs_set_bool(PREF_DBLIST_DOCKED, FALSE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
95 }
6436
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
96 }
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
97
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
98 static void blist_set_ontop(gboolean val) {
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
99 if (!blist)
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
100 return;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
101
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
102 if (val == TRUE)
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
103 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
104 else
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
105 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
106
6436
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
107 }
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
108
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
109 static void blist_dock_cb(gboolean val) {
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
110 if (val == TRUE) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
111 gaim_debug_info(WINPREFS_PLUGIN_ID, "Blist Docking..\n");
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
112 if (gaim_prefs_get_int(PREF_BLIST_ON_TOP) != BLIST_TOP_NEVER)
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
113 blist_set_ontop(TRUE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
114 } else {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
115 gaim_debug_info(WINPREFS_PLUGIN_ID, "Blist Undocking..\n");
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
116 if (gaim_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_ALWAYS)
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
117 blist_set_ontop(TRUE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
118 else
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
119 blist_set_ontop(FALSE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
120 }
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
121 }
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
122
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
123 static void blist_set_dockable(gboolean val) {
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
124 if (val == TRUE) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
125 if (blist_ab == NULL && blist != NULL) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
126 blist_ab = gtk_appbar_add(blist);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
127 gtk_appbar_add_dock_cb(blist_ab, blist_dock_cb);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
128 }
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
129 } else {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
130 if (blist_ab != NULL) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
131 gtk_appbar_remove(blist_ab);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
132 blist_ab = NULL;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
133 }
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
134
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
135 if (gaim_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_ALWAYS)
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
136 blist_set_ontop(TRUE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
137 else
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
138 blist_set_ontop(FALSE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
139 }
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
140 }
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
141
6436
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
142 /* PLUGIN CALLBACKS */
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
143
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
144 /* We need this because the blist destroy cb won't be called before the
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
145 plugin is unloaded, when quitting */
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
146 static void gaim_quit_cb() {
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
147 gaim_debug_info(WINPREFS_PLUGIN_ID, "gaim_quit_cb: removing appbar\n");
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
148 blist_save_state();
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
149 blist_set_dockable(FALSE);
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
150 }
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
151
10530
a1eddb973f42 [gaim-migrate @ 11856]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 9954
diff changeset
152 static void blist_create_cb(GaimBuddyList *gaim_blist, void *data) {
a1eddb973f42 [gaim-migrate @ 11856]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 9954
diff changeset
153 gaim_debug_info(WINPREFS_PLUGIN_ID, "buddy list created\n");
6436
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
154
10530
a1eddb973f42 [gaim-migrate @ 11856]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 9954
diff changeset
155 blist = GAIM_GTK_BLIST(gaim_blist)->window;
6436
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
156
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
157 if (gaim_prefs_get_bool(PREF_DBLIST_DOCKABLE)) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
158 blist_set_dockable(TRUE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
159 if (gaim_prefs_get_bool(PREF_DBLIST_DOCKED)) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
160 blist_ab->undocked_height = gaim_prefs_get_int(PREF_DBLIST_HEIGHT);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
161 gtk_appbar_dock(blist_ab,
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
162 gaim_prefs_get_int(PREF_DBLIST_SIDE));
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
163 if (gaim_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_DOCKED)
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
164 blist_set_ontop(TRUE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
165 }
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
166 }
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
167
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
168 if (gaim_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_ALWAYS)
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
169 blist_set_ontop(TRUE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
170
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
171 }
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
172
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
173 /* AUTOSTART */
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
174
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
175 static int open_run_key(PHKEY phKey, REGSAM samDesired) {
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
176 /* First try current user key (for WinNT & Win2k +), fall back to local machine */
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
177 if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CURRENT_USER,
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
178 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
179 0, samDesired, phKey));
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
180 else if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE,
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
181 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
182 0, samDesired, phKey));
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
183 else {
8760
16d91ca1a353 [gaim-migrate @ 9515]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 8749
diff changeset
184 gaim_debug_error(WINPREFS_PLUGIN_ID, "open_run_key: Could not open key for writing value\n");
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
185 return 0;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
186 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
187 return 1;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
188 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
189
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
190 /* WIN PREFS GENERAL */
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
191
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
192 static void
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
193 winprefs_set_autostart(GtkWidget *w)
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
194 {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
195 HKEY hKey;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
196
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
197 if (!open_run_key(&hKey, KEY_SET_VALUE))
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
198 return;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
199 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
200 char buffer[1024];
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
201 DWORD size;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
202
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
203 if ((size = GetModuleFileName(wgaim_hinstance(),
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
204 (LPBYTE)buffer, sizeof(buffer)))==0) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
205 gaim_debug_error(WINPREFS_PLUGIN_ID, "GetModuleFileName Error.. Could not set Gaim autostart.\n");
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
206 RegCloseKey(hKey);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
207 return;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
208 }
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
209
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
210 /* Now set value of new key */
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
211 if (ERROR_SUCCESS != RegSetValueEx(hKey, "Gaim", 0, REG_SZ, buffer, size))
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
212 gaim_debug_error(WINPREFS_PLUGIN_ID, "Could not set registry key value\n");
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
213 } else {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
214 if (ERROR_SUCCESS != RegDeleteValue(hKey, "Gaim"))
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
215 gaim_debug_error(WINPREFS_PLUGIN_ID, "Could not delete registry key value\n");
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
216 }
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
217 RegCloseKey(hKey);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
218 }
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
219
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
220 static void
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
221 winprefs_set_blist_dockable (const char *pref, GaimPrefType type,
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
222 gpointer value, gpointer user_data)
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
223 {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
224 blist_set_dockable(GPOINTER_TO_INT(value));
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
225 }
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
226
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
227 static void
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
228 winprefs_set_blist_ontop (const char *pref, GaimPrefType type,
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
229 gpointer value, gpointer user_data)
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
230 {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
231 gint setting = gaim_prefs_get_int(PREF_BLIST_ON_TOP);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
232 if ((setting == BLIST_TOP_DOCKED && blist_ab && blist_ab->docked)
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
233 || setting == BLIST_TOP_ALWAYS)
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
234 blist_set_ontop(TRUE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
235 else
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
236 blist_set_ontop(FALSE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
237 }
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
238
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
239 static void load_winver_specific_procs (void) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
240 /* Used for Win98+ and WinNT5+ */
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
241 MyFlashWindowEx = (LPFNFLASHWINDOWEX)wgaim_find_and_loadproc("user32.dll", "FlashWindowEx" );
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
242 }
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
243
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
244 /* Window flasher */
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
245 static gboolean flash_window_cb (gpointer data) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
246 FlashWindow((HWND)data, TRUE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
247 return TRUE;
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
248 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
249
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
250 static int
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
251 halt_flash_filter (GtkWidget *widget, GdkEventFocus *event, gpointer data)
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
252 {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
253 if (MyFlashWindowEx) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
254 HWND hWnd = data;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
255 FLASHWINFO info;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
256
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
257 if (!IsWindow(hWnd))
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
258 return 0;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
259
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
260 memset(&info, 0, sizeof(FLASHWINFO));
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
261 info.cbSize = sizeof(FLASHWINFO);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
262 info.hwnd = hWnd;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
263 info.dwFlags = FLASHW_STOP;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
264 info.dwTimeout = 0;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
265 MyFlashWindowEx(&info);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
266
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
267 } else {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
268 WGAIM_FLASH_INFO *finfo = data;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
269 /* Stop flashing and remove filter */
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
270 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "Removing timeout\n");
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
271 gaim_timeout_remove(finfo->t_handle);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
272 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "Disconnecting signal handler\n");
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
273 g_signal_handler_disconnect(G_OBJECT(widget),finfo->sig_handler);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
274 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "done\n");
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
275 g_free(finfo);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
276 }
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
277 return 0;
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
278 }
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
279
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
280 /* FlashWindowEx is only supported by Win98+ and WinNT5+. If it's
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
281 not supported we do it our own way */
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
282 static void
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
283 wgaim_conv_im_blink (GaimAccount *account, char *sender, char *message, int flags)
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
284 {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
285 if (gaim_prefs_get_bool(PREF_IM_BLINK) == FALSE)
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
286 return;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
287
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
288 GaimConversation *conv = gaim_find_conversation_with_account(GAIM_CONV_IM, sender, account);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
289 if (conv == NULL) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
290 gaim_debug_info("winprefs", "gar!\n");
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
291 return;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
292 }
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
293 GaimConvWindow *win = gaim_conversation_get_window(conv);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
294 if (win == NULL) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
295 gaim_debug_info("winprefs", "gar2!\n");
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
296 return;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
297 }
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
298 GtkWidget *window = GAIM_GTK_WINDOW(win)->window;
6436
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
299
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
300 if (MyFlashWindowEx) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
301 FLASHWINFO info;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
302 if (GetForegroundWindow() == GDK_WINDOW_HWND(window->window))
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
303 return;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
304
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
305 memset(&info, 0, sizeof(FLASHWINFO));
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
306 info.cbSize = sizeof(FLASHWINFO);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
307 info.hwnd = GDK_WINDOW_HWND(window->window);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
308 info.dwFlags = FLASHW_ALL | FLASHW_TIMER;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
309 info.dwTimeout = 0;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
310 MyFlashWindowEx(&info);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
311 /* Stop flashing when window receives focus */
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
312 g_signal_connect(G_OBJECT(window), "focus-in-event",
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
313 G_CALLBACK(halt_flash_filter), info.hwnd);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
314 } else {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
315 WGAIM_FLASH_INFO *finfo = g_new0(WGAIM_FLASH_INFO, 1);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
316
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
317 /* Start Flashing window */
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
318 finfo->t_handle = gaim_timeout_add(1000, flash_window_cb,
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
319 GDK_WINDOW_HWND(window->window));
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
320 finfo->sig_handler = g_signal_connect(G_OBJECT(window),
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
321 "focus-in-event",
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
322 G_CALLBACK(halt_flash_filter), finfo);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
323 }
6436
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
324 }
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
325
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
326
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
327 /*
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
328 * EXPORTED FUNCTIONS
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
329 */
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
330
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
331 gboolean plugin_load(GaimPlugin *plugin) {
11033
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11003
diff changeset
332 gaim_debug_register_category("gtkappbar");
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11003
diff changeset
333 gaim_debug_register_category(WINPREFS_PLUGIN_ID);
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11003
diff changeset
334
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
335 /* Find out how to go blinky */
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
336 load_winver_specific_procs();
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
337
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
338 handle = plugin;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
339
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
340 /* blist docking init */
10530
a1eddb973f42 [gaim-migrate @ 11856]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 9954
diff changeset
341 if (gaim_get_blist() && GAIM_GTK_BLIST(gaim_get_blist()) && GAIM_GTK_BLIST(gaim_get_blist())->window) {
a1eddb973f42 [gaim-migrate @ 11856]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 9954
diff changeset
342 blist_create_cb(gaim_get_blist(), NULL);
a1eddb973f42 [gaim-migrate @ 11856]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 9954
diff changeset
343 }
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
344
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
345 /* This really shouldn't happen anymore generally, but if for some strange
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
346 reason, the blist is recreated, we need to set it up again. */
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
347 gaim_signal_connect(gaim_gtk_blist_get_handle(), "gtkblist-created", plugin, GAIM_CALLBACK(blist_create_cb), NULL);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
348
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
349 gaim_signal_connect(gaim_conversations_get_handle(), "received-im-msg", plugin, GAIM_CALLBACK(wgaim_conv_im_blink), NULL);
6436
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
350
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
351 gaim_signal_connect((void*)gaim_get_core(), "quitting", plugin, GAIM_CALLBACK(gaim_quit_cb), NULL);
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
352
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
353 gaim_prefs_connect_callback(handle, PREF_BLIST_ON_TOP,
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
354 winprefs_set_blist_ontop, NULL);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
355 gaim_prefs_connect_callback(handle, PREF_DBLIST_DOCKABLE,
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
356 winprefs_set_blist_dockable, NULL);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
357
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
358 return TRUE;
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
359 }
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
360
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
361 gboolean plugin_unload(GaimPlugin *plugin) {
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
362 blist_set_dockable(FALSE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
363 blist_set_ontop(FALSE);
11033
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11003
diff changeset
364
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11003
diff changeset
365 gaim_debug_unregister_category("gtkappbar");
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11003
diff changeset
366 gaim_debug_unregister_category(WINPREFS_PLUGIN_ID);
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11003
diff changeset
367
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
368 return TRUE;
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
369 }
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
370
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
371 static GtkWidget* get_config_frame(GaimPlugin *plugin) {
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
372 GtkWidget *ret;
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
373 GtkWidget *vbox;
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
374 GtkWidget *button;
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
375 char* gtk_version = NULL;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
376 HKEY hKey = HKEY_CURRENT_USER;
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
377
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
378 ret = gtk_vbox_new(FALSE, 18);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
379 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
380
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
381 while(hKey) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
382 char version[25];
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
383 DWORD vlen = 25;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
384 if(wgaim_read_reg_string(hKey, "SOFTWARE\\GTK\\2.0", "Version", (LPBYTE)&version, &vlen)) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
385 char revision[25];
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
386 DWORD rlen = 25;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
387 gboolean gotrev = FALSE;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
388 if(wgaim_read_reg_string(hKey, "SOFTWARE\\GTK\\2.0", "Revision", (LPBYTE)&revision, &rlen)) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
389 revision[0] = g_ascii_toupper(revision[0]);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
390 revision[1] = '\0';
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
391 gotrev = TRUE;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
392 }
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
393 gtk_version = g_strdup_printf("%s%s%s", version,
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
394 (gotrev ? " Revision " : ""),
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
395 (gotrev ? revision : ""));
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
396 hKey = 0;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
397 }
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
398 if(hKey == HKEY_CURRENT_USER)
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
399 hKey = HKEY_LOCAL_MACHINE;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
400 else if(hKey == HKEY_LOCAL_MACHINE)
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
401 hKey = 0;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
402 }
6436
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
403
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
404 /* Display Installed GTK+ Runtime Version */
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
405 if(gtk_version) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
406 GtkWidget *label;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
407 vbox = gaim_gtk_make_frame(ret, _("GTK+ Runtime Version"));
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
408 label = gtk_label_new(gtk_version);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
409 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
410 gtk_widget_show(label);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
411 g_free(gtk_version);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
412 }
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
413
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
414 /* Autostart */
6436
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
415 vbox = gaim_gtk_make_frame (ret, _("Startup"));
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
416 button = gtk_check_button_new_with_mnemonic(_("_Start Gaim on Windows startup"));
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
417 gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
418 if(open_run_key(&hKey, KEY_QUERY_VALUE)) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
419 if(ERROR_SUCCESS == RegQueryValueEx(hKey, "Gaim", 0, NULL, NULL, NULL)) {
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
420 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
421 }
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
422 }
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
423 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(winprefs_set_autostart), NULL);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
424 gtk_widget_show(button);
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
425
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
426 /* Buddy List */
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
427 vbox = gaim_gtk_make_frame (ret, _("Buddy List"));
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
428 gaim_gtk_prefs_checkbox(_("_Dockable Buddy List"),
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
429 PREF_DBLIST_DOCKABLE, vbox);
6436
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
430
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
431 /* Blist On Top */
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
432 gaim_gtk_prefs_dropdown(vbox, _("_Keep Buddy List window on top:"),
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
433 GAIM_PREF_INT, PREF_BLIST_ON_TOP,
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
434 _("Never"), BLIST_TOP_NEVER,
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
435 _("Always"), BLIST_TOP_ALWAYS,
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
436 /* XXX: Did this ever work? */
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
437 _("Only when docked"), BLIST_TOP_DOCKED,
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
438 NULL);
6436
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
439
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
440 /* Conversations */
6436
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
441 vbox = gaim_gtk_make_frame (ret, _("Conversations"));
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
442 gaim_gtk_prefs_checkbox(_("_Flash window when messages are received"),
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
443 PREF_IM_BLINK, vbox);
6436
759a81390b36 [gaim-migrate @ 6944]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6409
diff changeset
444
4134
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
445 gtk_widget_show_all(ret);
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
446 return ret;
c0f4c664e3ba [gaim-migrate @ 4352]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
447 }
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
448
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
449 static GaimGtkPluginUiInfo ui_info =
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
450 {
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
451 get_config_frame
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
452 };
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
453
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
454 static GaimPluginInfo info =
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
455 {
9954
a9fb4493ae22 [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9795
diff changeset
456 GAIM_PLUGIN_MAGIC,
a9fb4493ae22 [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9795
diff changeset
457 GAIM_MAJOR_VERSION,
a9fb4493ae22 [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9795
diff changeset
458 GAIM_MINOR_VERSION,
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
459 GAIM_PLUGIN_STANDARD,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
460 GAIM_GTK_PLUGIN_TYPE,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
461 0,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
462 NULL,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
463 GAIM_PRIORITY_DEFAULT,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
464 WINPREFS_PLUGIN_ID,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
465 N_("WinGaim Options"),
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
466 VERSION,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
467 N_("Options specific to Windows Gaim."),
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
468 N_("Provides options specific to Windows Gaim, such as buddy list docking and conversation flashing."),
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
469 "Herman Bloggs <hermanator12002@yahoo.com>",
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
470 GAIM_WEBSITE,
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
471 plugin_load,
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
472 plugin_unload,
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
473 NULL,
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
474 &ui_info,
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8772
diff changeset
475 NULL,
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8772
diff changeset
476 NULL,
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
477 NULL
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
478 };
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
479
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
480 static void
5798
217d24d11b6e [gaim-migrate @ 6223]
Christian Hammond <chipx86@chipx86.com>
parents: 5795
diff changeset
481 init_plugin(GaimPlugin *plugin)
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
482 {
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
483 gaim_prefs_add_none("/plugins/gtk");
6409
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
484 gaim_prefs_add_none("/plugins/gtk/win32");
752d0600b514 [gaim-migrate @ 6915]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6063
diff changeset
485 gaim_prefs_add_none("/plugins/gtk/win32/winprefs");
11003
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
486 gaim_prefs_add_bool(PREF_DBLIST_DOCKABLE, FALSE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
487 gaim_prefs_add_bool(PREF_DBLIST_DOCKED, FALSE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
488 gaim_prefs_add_int(PREF_DBLIST_HEIGHT, 0);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
489 gaim_prefs_add_int(PREF_DBLIST_SIDE, 0);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
490 gaim_prefs_add_bool(PREF_IM_BLINK, TRUE);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
491
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
492 /* Convert old preferences */
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
493 if (gaim_prefs_exists(PREF_DBLIST_ON_TOP)) {
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
494 gint blist_top = BLIST_TOP_NEVER;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
495 if (gaim_prefs_get_bool(PREF_BLIST_ON_TOP))
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
496 blist_top = BLIST_TOP_ALWAYS;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
497 else if (gaim_prefs_get_bool(PREF_DBLIST_ON_TOP))
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
498 blist_top = BLIST_TOP_DOCKED;
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
499 gaim_prefs_remove(PREF_BLIST_ON_TOP);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
500 gaim_prefs_remove(PREF_DBLIST_ON_TOP);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
501 gaim_prefs_add_int(PREF_BLIST_ON_TOP, blist_top);
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
502 } else
2b772e7094ef [gaim-migrate @ 12858]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10530
diff changeset
503 gaim_prefs_add_int(PREF_BLIST_ON_TOP, BLIST_TOP_NEVER);
5224
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
504 }
5160333a80df [gaim-migrate @ 5594]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4606
diff changeset
505
6063
5239a3b4ab33 [gaim-migrate @ 6513]
Nathan Walp <nwalp@pidgin.im>
parents: 5912
diff changeset
506 GAIM_INIT_PLUGIN(winprefs, init_plugin, info)