src/win32/wspell.c

Tue, 21 Mar 2006 01:15:50 +0000

author
Richard Laager <rlaager@pidgin.im>
date
Tue, 21 Mar 2006 01:15:50 +0000
changeset 13539
8036a635a316
parent 11561
5ee24c739c7e
permissions
-rw-r--r--

[gaim-migrate @ 15915]
Change "Clear formatting" to "Reset formatting". This is more clear (no
pun intended), and helps to remove ambiguity with the "Clear scrollback"
option in the Conversation menu. I've also noted the mnemonic on this entry
in the right-click menu in conversations.

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

mercurial