Sat, 18 Nov 2006 05:30:57 +0000
[gaim-migrate @ 17774]
The data for "plugin_action" is set with a destructor function. So freeing it
twice would cause a crash. The reason it's not crashing is, the children of the
container are not the menuitems, but GtkAccelLabel (or some such thing). So all
we are doing is freeing null. Also, when the menu is destroyed, all the
menuitems are also destroyed anyway. So get rid of the unrequired loop.
Also, isdigit expects a character, not a string.
| 4862 | 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 | 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" |
| 33 | ||
| 34 | /* GTKSPELL DUMMY FUNCS */ | |
| 35 | GtkSpell* wgtkspell_new_attach(GtkTextView *view, | |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
36 | const gchar *lang, |
| 4862 | 37 | GError **error) {return NULL;} |
| 38 | GtkSpell* wgtkspell_get_from_text_view(GtkTextView *view) {return NULL;} | |
| 39 | void wgtkspell_detach(GtkSpell *spell) {} | |
| 40 | gboolean wgtkspell_set_language(GtkSpell *spell, | |
| 41 | const gchar *lang, | |
| 42 | GError **error) {return 0;} | |
| 43 | void wgtkspell_recheck_all(GtkSpell *spell) {} | |
| 44 | ||
| 45 | /* GTKSPELL PROTOS */ | |
| 46 | GtkSpell* (*wgaim_gtkspell_new_attach) (GtkTextView *, | |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
47 | const gchar *, |
| 4862 | 48 | GError **) = wgtkspell_new_attach; |
| 49 | ||
| 50 | GtkSpell* (*wgaim_gtkspell_get_from_text_view) (GtkTextView*) = wgtkspell_get_from_text_view; | |
| 51 | ||
| 52 | void (*wgaim_gtkspell_detach) (GtkSpell*) = wgtkspell_detach; | |
| 53 | ||
| 54 | gboolean (*wgaim_gtkspell_set_language) (GtkSpell*, | |
| 55 | const gchar*, | |
| 56 | GError**) = wgtkspell_set_language; | |
| 57 | ||
| 58 | void (*wgaim_gtkspell_recheck_all) (GtkSpell*) = wgtkspell_recheck_all; | |
| 59 | ||
| 60 | static void load_gtkspell() { | |
| 61 | wgaim_gtkspell_new_attach = (void*)wgaim_find_and_loadproc("libgtkspell.dll", "gtkspell_new_attach" ); | |
| 62 | wgaim_gtkspell_get_from_text_view = (void*)wgaim_find_and_loadproc("libgtkspell.dll", "gtkspell_get_from_text_view"); | |
| 63 | wgaim_gtkspell_detach = (void*)wgaim_find_and_loadproc("libgtkspell.dll", "gtkspell_detach"); | |
| 64 | wgaim_gtkspell_set_language = (void*)wgaim_find_and_loadproc("libgtkspell.dll", "gtkspell_set_language"); | |
| 65 | wgaim_gtkspell_recheck_all = (void*)wgaim_find_and_loadproc("libgtkspell.dll", "gtkspell_recheck_all"); | |
| 66 | } | |
| 67 | ||
|
10878
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
68 | static char* lookup_aspell_path() { |
|
11561
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
69 | const char *tmp; |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
70 | |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
71 | if ((tmp = g_getenv("GAIM_ASPELL_DIR"))) |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
72 | return g_strdup(tmp); |
|
5ee24c739c7e
[gaim-migrate @ 13825]
Daniel Atallah <datallah@pidgin.im>
parents:
11256
diff
changeset
|
73 | |
|
14334
aec64dbd9564
[gaim-migrate @ 16957]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
74 | return wgaim_read_reg_string(HKEY_LOCAL_MACHINE, "Software\\Aspell", "Path"); |
| 4862 | 75 | } |
|
10878
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 | void wgaim_gtkspell_init() { |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
78 | char *aspell_path = lookup_aspell_path(); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
79 | |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
80 | if (aspell_path != NULL) { |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
81 | char *tmp = g_strconcat(aspell_path, "\\aspell-15.dll", NULL); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
82 | if (g_file_test(tmp, G_FILE_TEST_EXISTS)) { |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
83 | const char *path = g_getenv("PATH"); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
84 | gaim_debug_info("wspell", "Found Aspell in %s\n", aspell_path); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
85 | |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
86 | g_free(tmp); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
87 | |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
88 | tmp = g_strdup_printf("%s%s%s", (path ? path : ""), |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
89 | (path ? G_SEARCHPATH_SEPARATOR_S : ""), |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
90 | aspell_path); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
91 | |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
92 | g_setenv("PATH", tmp, TRUE); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
93 | |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
94 | load_gtkspell(); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
95 | } else { |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
96 | gaim_debug_warning("wspell", "Couldn't find aspell-15.dll\n"); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
97 | } |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
98 | |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
99 | g_free(tmp); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
100 | g_free(aspell_path); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
101 | } else { |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
102 | gaim_debug_warning("wspell", "Couldn't find path for Aspell\n"); |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
103 | } |
|
b6489f938a86
[gaim-migrate @ 12571]
Daniel Atallah <datallah@pidgin.im>
parents:
6425
diff
changeset
|
104 | } |