[uim-commit] r2431 - trunk/helper

ekato at freedesktop.org ekato at freedesktop.org
Thu Dec 8 01:44:41 PST 2005


Author: ekato
Date: 2005-12-08 01:44:32 -0800 (Thu, 08 Dec 2005)
New Revision: 2431

Modified:
   trunk/helper/dict-anthy.c
   trunk/helper/dict-main-gtk.c
   trunk/helper/dict-word-list-win-gtk.c
Log:
* helper/dict-main-gtk.c (create_window_anthy) : Return NULL if
  uim_dict_open() failed.
* helper/dict-word-list-win-gtk.c (warn_dic_open) : New.
(word_list_window_init) : Show warning and exit if uim_dict_open()
failed.
* helper/dict-anthy.c : Support darwin's dynamic library for
  anthydic.
(uim_dict_anthy_open) : Check return value of dict_anthy_init().


Modified: trunk/helper/dict-anthy.c
===================================================================
--- trunk/helper/dict-anthy.c	2005-12-08 08:53:46 UTC (rev 2430)
+++ trunk/helper/dict-anthy.c	2005-12-08 09:44:32 UTC (rev 2431)
@@ -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: trunk/helper/dict-main-gtk.c
===================================================================
--- trunk/helper/dict-main-gtk.c	2005-12-08 08:53:46 UTC (rev 2430)
+++ trunk/helper/dict-main-gtk.c	2005-12-08 09:44:32 UTC (rev 2431)
@@ -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: trunk/helper/dict-word-list-win-gtk.c
===================================================================
--- trunk/helper/dict-word-list-win-gtk.c	2005-12-08 08:53:46 UTC (rev 2430)
+++ trunk/helper/dict-word-list-win-gtk.c	2005-12-08 09:44:32 UTC (rev 2431)
@@ -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