[uim-commit] r2432 - branches/1.0/helper

ekato at freedesktop.org ekato at freedesktop.org
Thu Dec 8 01:48:52 PST 2005


Author: ekato
Date: 2005-12-08 01:48:45 -0800 (Thu, 08 Dec 2005)
New Revision: 2432

Modified:
   branches/1.0/helper/dict-anthy.c
   branches/1.0/helper/dict-main-gtk.c
   branches/1.0/helper/dict-word-list-win-gtk.c
Log:
* helper/dict-anthy.c
* helper/dict-word-list-win-gtk.c
* helper/dict-main-gtk.c
  - Port r2431 from trunk.


Modified: branches/1.0/helper/dict-anthy.c
===================================================================
--- branches/1.0/helper/dict-anthy.c	2005-12-08 09:44:32 UTC (rev 2431)
+++ branches/1.0/helper/dict-anthy.c	2005-12-08 09:48:45 UTC (rev 2432)
@@ -97,10 +97,15 @@
 static struct _anthy_dic_api anthy_dic_api;
 static void *anthy_dic_lib;
 
+#ifdef __APPLE__
+  #define ANTHYDIC_DYLIB	"libanthydic.0.dylib"
+#else
+  #define ANTHYDIC_DYLIB	"libanthydic.so.0"
+#endif
 static int
 get_anthydic_api()
 {
-    anthy_dic_lib = dlopen("libanthydic.so.0", RTLD_GLOBAL |RTLD_NOW);
+    anthy_dic_lib = dlopen(ANTHYDIC_DYLIB, RTLD_GLOBAL |RTLD_NOW);
     if (anthy_dic_lib == NULL) {
 	return -1;
     }
@@ -215,7 +220,8 @@
 {
   uim_dict *dict;
 
-  dict_anthy_init();
+  if (dict_anthy_init() == -1)
+    return NULL;
 
   if (identifier == NULL)
     return NULL;

Modified: branches/1.0/helper/dict-main-gtk.c
===================================================================
--- branches/1.0/helper/dict-main-gtk.c	2005-12-08 09:44:32 UTC (rev 2431)
+++ branches/1.0/helper/dict-main-gtk.c	2005-12-08 09:48:45 UTC (rev 2432)
@@ -159,6 +159,8 @@
     window = word_list_window_new();
   } else {
     dict = uim_dict_open(N_("Anthy private dictionary"));
+    if (!dict)
+      return NULL;
     window = word_window_new(WORD_WINDOW_MODE_ADD, dict);
     uim_dict_unref(dict);
   }

Modified: branches/1.0/helper/dict-word-list-win-gtk.c
===================================================================
--- branches/1.0/helper/dict-word-list-win-gtk.c	2005-12-08 09:44:32 UTC (rev 2431)
+++ branches/1.0/helper/dict-word-list-win-gtk.c	2005-12-08 09:48:45 UTC (rev 2432)
@@ -196,6 +196,22 @@
 }
 
 static void
+warn_dict_open()
+{
+  GtkWidget *dialog;
+  const gchar *message;
+
+  message = N_("Couldn't open a library for manipulating the dictionaly.\n");
+  dialog = gtk_message_dialog_new(NULL,
+		  		  GTK_DIALOG_MODAL,
+				  GTK_MESSAGE_WARNING,
+				  GTK_BUTTONS_OK,
+				  _(message));
+  gtk_dialog_run(GTK_DIALOG(dialog));
+  gtk_widget_destroy(GTK_WIDGET(dialog));
+}
+
+static void
 word_list_window_init (WordListWindow *window)
 {
   GtkWidget *word_list, *vbox, *statusbar;
@@ -253,6 +269,10 @@
 
 #if 1 /* FIXME! currently the identifier of Anthy is hard coded */
   dict = uim_dict_open(N_("Anthy private dictionary"));
+  if (!dict) {
+    warn_dict_open();
+    exit(1);
+  }
 #endif
   word_list_view_set_dict(WORD_LIST_VIEW(word_list), dict);
 



More information about the uim-commit mailing list