Code

- Fix bug #396322: "Spell checker crashes the OS X package"
authormjwybrow <mjwybrow@users.sourceforge.net>
Tue, 7 Jul 2009 06:00:38 +0000 (06:00 +0000)
committermjwybrow <mjwybrow@users.sourceforge.net>
Tue, 7 Jul 2009 06:00:38 +0000 (06:00 +0000)
     -  Include the aspell dictionary files in the app bundle.
     -  Show an error if at least the en dictionary files are not available.
     -  Replace the GtkOptionMenu (for selecting which dictionary to add
extra words to) with a GtkComboBox since this one behaves correctly
when it is insensitive.  GtkOptionMenu is deprecated and the menu
would appear when clicking on the insensitive widget and then could
not be closed.

packaging/macosx/Resources/bin/inkscape
packaging/macosx/osx-app.sh
src/dialogs/spellcheck.cpp

index 480414c41a670a27c58dad57ebd2e5fe29767d36..2aa2e723be46168bac9f9cae7d6fc7e3d1698ed6 100755 (executable)
@@ -41,6 +41,7 @@ export GTK_EXE_PREFIX="$TOP"
 export GNOME_VFS_MODULE_CONFIG_PATH="$TOP/etc/gnome-vfs-2.0/modules"
 export GNOME_VFS_MODULE_PATH="$TOP/lib/gnome-vfs-2.0/modules"
 export XDG_DATA_DIRS="$TOP/share"
+export ASPELL_CONF="prefix $TOP;"
 
 export INKSCAPE_SHAREDIR="$TOP"
 # TODO: move the share directory to a its own folder to make things a bit cleaner in the app bundle
index 9c157b522e81eba1e34ce6a1a5d3a7b82ba2fa56..f28b9c4bf145ff2b5daeb27c597c4dd9f9e1edf3 100755 (executable)
@@ -126,6 +126,17 @@ if [ ! -e "$LIBPREFIX/share/themes/Clearlooks-Quicksilver" ]; then
        exit 1
 fi
 
+if [ ! -e "$LIBPREFIX/lib/gnome-vfs-2.0" ]; then
+       echo "Missing gnome-vfs -- please install gnome-vfs and try again." >&2
+       exit 1
+fi
+
+if [ ! -e "$LIBPREFIX/lib/aspell-0.60/en.dat" ]; then
+       echo "Missing aspell en dictionary -- please install at least 'aspell-dict-en', but" >&2
+       echo "preferably all dictionaries ('aspell-dict-*') and try again." >&2
+       exit 1
+fi
+
 if [ ! -f "$binary" ]; then
        echo "Need Inkscape binary" >&2
        exit 1
@@ -224,16 +235,16 @@ cp -v "$binary" "$binpath"
 # TODO Add a "$verbose" variable and command line switch, which sets wether these commands are verbose or not
 
 # Share files
-rsync -av "$binary_dir/../share/$binary_name"/* "$package/Contents/Resources/"
+rsync -av "$binary_dir/../share/$binary_name"/* "$pkgresources/"
 cp "$plist" "$package/Contents/Info.plist"
-rsync -av "$binary_dir/../share/locale"/* "$package/Contents/Resources/locale"
+rsync -av "$binary_dir/../share/locale"/* "$pkgresources/locale"
 
 # Copy GTK shared mime information
 mkdir -p "$pkgresources/share"
 cp -rp "$LIBPREFIX/share/mime" "$pkgresources/share/"
 
 # Icons and the rest of the script framework
-rsync -av --exclude ".svn" "$resdir"/Resources/* "$package"/Contents/Resources/
+rsync -av --exclude ".svn" "$resdir"/Resources/* "$pkgresources/"
 
 # Add python modules if requested
 if [ ${add_python} = "true" ]; then
@@ -283,6 +294,10 @@ cp -r $LIBPREFIX/lib/gtk-2.0/$gtk_version/* $pkglib/gtk-2.0/$gtk_version/
 mkdir -p $pkglib/gnome-vfs-2.0/modules
 cp $LIBPREFIX/lib/gnome-vfs-2.0/modules/*.so $pkglib/gnome-vfs-2.0/modules/
 
+# Copy aspell dictionary files:
+cp -r "$LIBPREFIX/lib/aspell-0.60" "$pkglib/"
+cp -r "$LIBPREFIX/share/aspell" "$pkgresources/share/"
+
 # Find out libs we need from fink, darwinports, or from a custom install
 # (i.e. $LIBPREFIX), then loop until no changes.
 a=1
index a617aebf21150fe5a2212424b03d5a32cc8d81c3..1645218c63a5a2514c1f983a044e928870607322 100644 (file)
@@ -812,19 +812,18 @@ void
 sp_spellcheck_add (GObject */*obj*/, GObject */*dlg*/)
 {
     _adds++;
-    GtkMenu *m =
-        GTK_MENU(gtk_object_get_data (GTK_OBJECT (dlg), "addto_langs"));
-    GtkWidget *mi = gtk_menu_get_active (m);
-    unsigned int num = GPOINTER_TO_UINT(gtk_object_get_data (GTK_OBJECT (mi), "number"));
+    GtkComboBox *cbox =
+        GTK_COMBO_BOX(gtk_object_get_data (GTK_OBJECT (dlg), "addto_langs"));
+    gint num = gtk_combo_box_get_active(cbox);
     switch (num) {
-        case 1:
+        case 0:
             aspell_speller_add_to_personal(_speller, _word.c_str(), -1);
             break;
-        case 2:
+        case 1:
             if (_speller2)
                 aspell_speller_add_to_personal(_speller2, _word.c_str(), -1);
             break;
-        case 3:
+        case 2:
             if (_speller3)
                 aspell_speller_add_to_personal(_speller3, _word.c_str(), -1);
             break;
@@ -978,27 +977,18 @@ sp_spellcheck_dialog (void)
             GtkWidget *hb = gtk_hbox_new (FALSE, 0);
             sp_spellcheck_new_button (dlg, hb, _("A_dd to dictionary:"), tt, _("Add this word to the chosen dictionary"),
                                       sp_spellcheck_add, "b_add");
-            GtkWidget *cbox = gtk_menu_new ();
-            {
-                GtkWidget *mi = gtk_menu_item_new_with_label(_lang);
-                g_object_set_data (G_OBJECT (mi), "number", GUINT_TO_POINTER (1));
-                gtk_menu_append (GTK_MENU (cbox), mi);
-            }
+            GtkComboBox *cbox = GTK_COMBO_BOX (gtk_combo_box_new_text());
+            gtk_combo_box_append_text (cbox,  _lang);
             if (_lang2) {
-                GtkWidget *mi = gtk_menu_item_new_with_label(_lang2);
-                g_object_set_data (G_OBJECT (mi), "number", GUINT_TO_POINTER (2));
-                gtk_menu_append (GTK_MENU (cbox), mi);
+                gtk_combo_box_append_text (cbox, _lang2);
             }
             if (_lang3) {
-                GtkWidget *mi = gtk_menu_item_new_with_label(_lang3);
-                g_object_set_data (G_OBJECT (mi), "number", GUINT_TO_POINTER (3));
-                gtk_menu_append (GTK_MENU (cbox), mi);
+                gtk_combo_box_append_text (cbox, _lang3);
             }
-            gtk_widget_show_all (cbox);
-            GtkWidget *mnu = gtk_option_menu_new();
-            gtk_option_menu_set_menu(GTK_OPTION_MENU(mnu), cbox);
+            gtk_combo_box_set_active (cbox, 0);
+            gtk_widget_show_all (GTK_WIDGET(cbox));
             g_object_set_data (G_OBJECT (dlg), "addto_langs", cbox);
-            gtk_box_pack_start (GTK_BOX (hb), mnu, TRUE, TRUE, 0);
+            gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(cbox), TRUE, TRUE, 0);
             gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0);
         }