annotate src/win32/wspell.c @ 11755:50496ebef401

[gaim-migrate @ 14046] This change allows text input in the gtkstatusbox whenever you select a status that has a "message" attribute on any of your enabled accounts. This allows you to enter available messages from AIM and Bonjour. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 23 Oct 2005 16:28:31 +0000
parents 71945305a87e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4862
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
1 /*
5913
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
2 * gaim
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
3 *
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
4 * File: wspell.c
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
5 * Date: March, 2003
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
6 * Description: Windows Gaim gtkspell interface.
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
7 *
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
8 * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com>
4862
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
9 *
5913
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
10 * This program is free software; you can redistribute it and/or modify
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
11 * it under the terms of the GNU General Public License as published by
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
13 * (at your option) any later version.
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
14 *
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
15 * This program is distributed in the hope that it will be useful,
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
18 * GNU General Public License for more details.
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
19 *
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
20 * You should have received a copy of the GNU General Public License
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
21 * along with this program; if not, write to the Free Software
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9657e243d001 [gaim-migrate @ 6345]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5084
diff changeset
23 *
4862
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
24 */
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
25 #include <windows.h>
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
26 #include <string.h>
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
27 #include <stdlib.h>
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
28 #include <glib.h>
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
29 #include <gtk/gtk.h>
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
30 #include <gtkspell/gtkspell.h>
6425
26b739bc9f1a [gaim-migrate @ 6933]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 5913
diff changeset
31 #include "debug.h"
4862
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
32 #include "win32dep.h"
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
33
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
34 /* GTKSPELL DUMMY FUNCS */
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
35 GtkSpell* wgtkspell_new_attach(GtkTextView *view,
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
36 const gchar *lang,
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
37 GError **error) {return NULL;}
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
38 GtkSpell* wgtkspell_get_from_text_view(GtkTextView *view) {return NULL;}
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
39 void wgtkspell_detach(GtkSpell *spell) {}
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
40 gboolean wgtkspell_set_language(GtkSpell *spell,
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
41 const gchar *lang,
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
42 GError **error) {return 0;}
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
43 void wgtkspell_recheck_all(GtkSpell *spell) {}
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
44
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
45 /* GTKSPELL PROTOS */
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
46 GtkSpell* (*wgaim_gtkspell_new_attach) (GtkTextView *,
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
47 const gchar *,
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
48 GError **) = wgtkspell_new_attach;
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
49
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
50 GtkSpell* (*wgaim_gtkspell_get_from_text_view) (GtkTextView*) = wgtkspell_get_from_text_view;
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
51
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
52 void (*wgaim_gtkspell_detach) (GtkSpell*) = wgtkspell_detach;
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
53
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
54 gboolean (*wgaim_gtkspell_set_language) (GtkSpell*,
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
55 const gchar*,
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
56 GError**) = wgtkspell_set_language;
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
57
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
58 void (*wgaim_gtkspell_recheck_all) (GtkSpell*) = wgtkspell_recheck_all;
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
59
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
60 static void load_gtkspell() {
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
61 wgaim_gtkspell_new_attach = (void*)wgaim_find_and_loadproc("libgtkspell.dll", "gtkspell_new_attach" );
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
62 wgaim_gtkspell_get_from_text_view = (void*)wgaim_find_and_loadproc("libgtkspell.dll", "gtkspell_get_from_text_view");
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
63 wgaim_gtkspell_detach = (void*)wgaim_find_and_loadproc("libgtkspell.dll", "gtkspell_detach");
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
64 wgaim_gtkspell_set_language = (void*)wgaim_find_and_loadproc("libgtkspell.dll", "gtkspell_set_language");
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
65 wgaim_gtkspell_recheck_all = (void*)wgaim_find_and_loadproc("libgtkspell.dll", "gtkspell_recheck_all");
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
66 }
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
67
10878
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
68 static char* lookup_aspell_path() {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
69 char *path = NULL;
11561
71945305a87e [gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
70 const char *tmp;
10878
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
71 HKEY reg_key;
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
72 DWORD type;
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
73 DWORD nbytes;
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
74 gboolean found_reg_key;
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
75 LPCTSTR subkey = NULL;
11561
71945305a87e [gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
76
71945305a87e [gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
77 if ((tmp = g_getenv("GAIM_ASPELL_DIR")))
71945305a87e [gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
78 return g_strdup(tmp);
71945305a87e [gaim-migrate @ 13825]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11256
diff changeset
79
10878
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
80 if (G_WIN32_HAVE_WIDECHAR_API ()) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
81 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Aspell", 0,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
82 KEY_QUERY_VALUE,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
83 &reg_key) == ERROR_SUCCESS) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
84 subkey = (LPCTSTR) L"Path";
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
85 if (!(found_reg_key = RegQueryValueExW(reg_key,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
86 (WCHAR*) subkey, NULL,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
87 &type, NULL, &nbytes
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
88 ) == ERROR_SUCCESS)) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
89 subkey = NULL;
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
90 found_reg_key = (RegQueryValueExW(reg_key,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
91 (WCHAR*) subkey, NULL,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
92 &type, NULL, &nbytes
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
93 ) == ERROR_SUCCESS);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
94 }
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
95 if (found_reg_key) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
96 wchar_t *wc_temp = g_new (wchar_t, (nbytes + 1) / 2 + 1);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
97 RegQueryValueExW(reg_key, (WCHAR*) subkey,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
98 NULL, &type, (LPBYTE) wc_temp,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
99 &nbytes);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
100 wc_temp[nbytes / 2] = '\0';
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
101 path = g_utf16_to_utf8(
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
102 wc_temp, -1, NULL, NULL, NULL);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
103 g_free (wc_temp);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
104 }
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
105 }
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
106 } else {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
107 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Aspell", 0,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
108 KEY_QUERY_VALUE, &reg_key
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
109 ) == ERROR_SUCCESS) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
110 subkey = "Path";
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
111 if (!(found_reg_key = RegQueryValueExA(reg_key, subkey,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
112 NULL, &type, NULL,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
113 &nbytes
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
114 ) == ERROR_SUCCESS)) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
115 subkey = NULL;
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
116 found_reg_key = (RegQueryValueExA(reg_key,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
117 subkey, NULL, &type,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
118 NULL, &nbytes
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
119 ) == ERROR_SUCCESS);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
120 }
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
121 if (found_reg_key) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
122 char *cp_temp = g_malloc (nbytes + 1);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
123 RegQueryValueExA(reg_key, subkey, NULL, &type,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
124 cp_temp, &nbytes);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
125 cp_temp[nbytes] = '\0';
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
126 path = g_locale_to_utf8(
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
127 cp_temp, -1, NULL, NULL, NULL);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
128 g_free (cp_temp);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
129 }
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
130 }
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
131 }
4862
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
132
10878
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
133 if (reg_key != NULL) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
134 RegCloseKey(reg_key);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
135 }
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
136
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
137 return path;
4862
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
138 }
10878
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
139
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
140 void wgaim_gtkspell_init() {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
141 char *aspell_path = lookup_aspell_path();
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
142
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
143 if (aspell_path != NULL) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
144 char *tmp = g_strconcat(aspell_path, "\\aspell-15.dll", NULL);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
145 if (g_file_test(tmp, G_FILE_TEST_EXISTS)) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
146 const char *path = g_getenv("PATH");
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
147 gaim_debug_info("wspell", "Found Aspell in %s\n", aspell_path);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
148
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
149 g_free(tmp);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
150
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
151 tmp = g_strdup_printf("%s%s%s", (path ? path : ""),
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
152 (path ? G_SEARCHPATH_SEPARATOR_S : ""),
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
153 aspell_path);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
154
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
155 g_setenv("PATH", tmp, TRUE);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
156
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
157 load_gtkspell();
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
158 } else {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
159 gaim_debug_warning("wspell", "Couldn't find aspell-15.dll\n");
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
160 }
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
161
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
162 g_free(tmp);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
163 g_free(aspell_path);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
164 } else {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
165 gaim_debug_warning("wspell", "Couldn't find path for Aspell\n");
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
166 }
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
167 }