annotate src/win32/wspell.c @ 11433:0cad723a5a1b

[gaim-migrate @ 13670] from patch #1264246: Comment By: Luke Schierer (lschiere) what name should the copyright assignment go to here? Comment By: Zmitrok (zmitrok) Sony Computer Entertainment America, Inc. committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sat, 03 Sep 2005 14:07:47 +0000
parents bb0d7b719af2
children 71945305a87e
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;
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
70 HKEY reg_key;
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
71 DWORD type;
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
72 DWORD nbytes;
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
73 gboolean found_reg_key;
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
74 LPCTSTR subkey = NULL;
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
75 if (G_WIN32_HAVE_WIDECHAR_API ()) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
76 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Aspell", 0,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
77 KEY_QUERY_VALUE,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
78 &reg_key) == ERROR_SUCCESS) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
79 subkey = (LPCTSTR) L"Path";
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
80 if (!(found_reg_key = RegQueryValueExW(reg_key,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
81 (WCHAR*) subkey, NULL,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
82 &type, NULL, &nbytes
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
83 ) == ERROR_SUCCESS)) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
84 subkey = NULL;
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
85 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 }
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
90 if (found_reg_key) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
91 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
92 RegQueryValueExW(reg_key, (WCHAR*) subkey,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
93 NULL, &type, (LPBYTE) wc_temp,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
94 &nbytes);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
95 wc_temp[nbytes / 2] = '\0';
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
96 path = g_utf16_to_utf8(
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
97 wc_temp, -1, NULL, NULL, NULL);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
98 g_free (wc_temp);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
99 }
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
100 }
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
101 } else {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
102 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Aspell", 0,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
103 KEY_QUERY_VALUE, &reg_key
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
104 ) == ERROR_SUCCESS) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
105 subkey = "Path";
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
106 if (!(found_reg_key = RegQueryValueExA(reg_key, subkey,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
107 NULL, &type, NULL,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
108 &nbytes
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 = NULL;
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
111 found_reg_key = (RegQueryValueExA(reg_key,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
112 subkey, NULL, &type,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
113 NULL, &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 }
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
116 if (found_reg_key) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
117 char *cp_temp = g_malloc (nbytes + 1);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
118 RegQueryValueExA(reg_key, subkey, NULL, &type,
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
119 cp_temp, &nbytes);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
120 cp_temp[nbytes] = '\0';
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
121 path = g_locale_to_utf8(
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
122 cp_temp, -1, NULL, NULL, NULL);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
123 g_free (cp_temp);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
124 }
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
125 }
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
126 }
4862
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
127
10878
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
128 if (reg_key != NULL) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
129 RegCloseKey(reg_key);
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
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
132 return path;
4862
0fe2ffdb7906 [gaim-migrate @ 5189]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff changeset
133 }
10878
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
134
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
135 void wgaim_gtkspell_init() {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
136 char *aspell_path = lookup_aspell_path();
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
137
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
138 if (aspell_path != NULL) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
139 char *tmp = g_strconcat(aspell_path, "\\aspell-15.dll", NULL);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
140 if (g_file_test(tmp, G_FILE_TEST_EXISTS)) {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
141 const char *path = g_getenv("PATH");
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
142 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
143
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
144 g_free(tmp);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
145
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
146 tmp = g_strdup_printf("%s%s%s", (path ? path : ""),
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
147 (path ? G_SEARCHPATH_SEPARATOR_S : ""),
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
148 aspell_path);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
149
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
150 g_setenv("PATH", tmp, TRUE);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
151
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
152 load_gtkspell();
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
153 } else {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
154 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
155 }
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 g_free(tmp);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
158 g_free(aspell_path);
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
159 } else {
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
160 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
161 }
da36acb8442c [gaim-migrate @ 12571]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 6425
diff changeset
162 }