Sun, 22 Jul 2007 08:14:16 +0000
revert 'no visible tabs when only one conversation' as it proved unpopular. Made tabs only fill the entire width of the notebook when there's only one tab to avoid http://pidgin.im/~deryni/that_just_looks_dumb.png
| 4862 | 1 | /* |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
2 | * pidgin |
|
5913
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 |
| 15884 | 6 | * Description: Windows Purple gtkspell interface. |
|
5913
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 | 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 | 24 | */ |
| 25 | #include <windows.h> | |
| 26 | #include <string.h> | |
| 27 | #include <stdlib.h> | |
| 28 | #include <glib.h> | |
| 29 | #include <gtk/gtk.h> | |
| 30 | #include <gtkspell/gtkspell.h> | |
|
6425
3e86c949c98a
[gaim-migrate @ 6933]
Herman Bloggs <herman@bluedigits.com>
parents:
5913
diff
changeset
|
31 | #include "debug.h" |
| 4862 | 32 | #include "win32dep.h" |
|
15697
78ddac185d80
winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
33 | #include "wspell.h" |
| 4862 | 34 | |
| 35 | /* GTKSPELL DUMMY FUNCS */ | |
|
15697
78ddac185d80
winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
36 | static GtkSpell* wgtkspell_new_attach(GtkTextView *view, const gchar *lang, GError **error) {return NULL;} |
|
78ddac185d80
winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
37 | static GtkSpell* wgtkspell_get_from_text_view(GtkTextView *view) {return NULL;} |
|
78ddac185d80
winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
38 | static void wgtkspell_detach(GtkSpell *spell) {} |
|
78ddac185d80
winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
39 | static gboolean wgtkspell_set_language(GtkSpell *spell, const gchar *lang, GError **error) {return FALSE;} |
|
78ddac185d80
winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
40 | static void wgtkspell_recheck_all(GtkSpell *spell) {} |
| 4862 | 41 | |
| 42 | /* GTKSPELL PROTOS */ | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
43 | GtkSpell* (*wpidginspell_new_attach) (GtkTextView *, |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
44 | const gchar *, |
| 4862 | 45 | GError **) = wgtkspell_new_attach; |
| 46 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
47 | GtkSpell* (*wpidginspell_get_from_text_view) (GtkTextView*) = wgtkspell_get_from_text_view; |
| 4862 | 48 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
49 | void (*wpidginspell_detach) (GtkSpell*) = wgtkspell_detach; |
| 4862 | 50 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
51 | gboolean (*wpidginspell_set_language) (GtkSpell*, |
| 4862 | 52 | const gchar*, |
| 53 | GError**) = wgtkspell_set_language; | |
| 54 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
55 | void (*wpidginspell_recheck_all) (GtkSpell*) = wgtkspell_recheck_all; |
| 4862 | 56 | |
| 57 | static void load_gtkspell() { | |
| 15884 | 58 | wpidginspell_new_attach = (void*) wpurple_find_and_loadproc("libgtkspell.dll", "gtkspell_new_attach" ); |
| 59 | wpidginspell_get_from_text_view = (void*) wpurple_find_and_loadproc("libgtkspell.dll", "gtkspell_get_from_text_view"); | |
| 60 | wpidginspell_detach = (void*) wpurple_find_and_loadproc("libgtkspell.dll", "gtkspell_detach"); | |
| 61 | wpidginspell_set_language = (void*) wpurple_find_and_loadproc("libgtkspell.dll", "gtkspell_set_language"); | |
| 62 | wpidginspell_recheck_all = (void*) wpurple_find_and_loadproc("libgtkspell.dll", "gtkspell_recheck_all"); | |
| 4862 | 63 | } |
| 64 | ||
|
10878
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
65 | static char* lookup_aspell_path() { |
|
11561
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
66 | const char *tmp; |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
67 | |
|
17072
bc1afb8032d0
Fix spellchecking in pidgin-portable.
Daniel Atallah <datallah@pidgin.im>
parents:
15931
diff
changeset
|
68 | if ((tmp = g_getenv("PIDGIN_ASPELL_DIR"))) |
|
11561
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
69 | return g_strdup(tmp); |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
70 | |
| 15884 | 71 | return wpurple_read_reg_string(HKEY_LOCAL_MACHINE, "Software\\Aspell", "Path"); |
| 4862 | 72 | } |
|
10878
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
73 | |
|
15697
78ddac185d80
winpidgin warning fixes
Daniel Atallah <datallah@pidgin.im>
parents:
15562
diff
changeset
|
74 | void winpidgin_spell_init() { |
|
10878
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
75 | char *aspell_path = lookup_aspell_path(); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
76 | |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
77 | if (aspell_path != NULL) { |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
78 | char *tmp = g_strconcat(aspell_path, "\\aspell-15.dll", NULL); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
79 | if (g_file_test(tmp, G_FILE_TEST_EXISTS)) { |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
80 | const char *path = g_getenv("PATH"); |
| 15884 | 81 | purple_debug_info("wspell", "Found Aspell in %s\n", aspell_path); |
|
10878
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
82 | |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
83 | g_free(tmp); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
84 | |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
85 | tmp = g_strdup_printf("%s%s%s", (path ? path : ""), |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
86 | (path ? G_SEARCHPATH_SEPARATOR_S : ""), |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
87 | aspell_path); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
88 | |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
89 | g_setenv("PATH", tmp, TRUE); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
90 | |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
91 | load_gtkspell(); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
92 | } else { |
| 15884 | 93 | purple_debug_warning("wspell", "Couldn't find aspell-15.dll\n"); |
|
10878
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 | |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
96 | g_free(tmp); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
97 | g_free(aspell_path); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
98 | } else { |
| 15884 | 99 | purple_debug_warning("wspell", "Couldn't find path for Aspell\n"); |
|
10878
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
100 | } |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
101 | } |