[uim-commit] r3132 - in trunk: doc helper scm

yamaken at freedesktop.org yamaken at freedesktop.org
Mon Feb 20 07:38:49 PST 2006


Author: yamaken
Date: 2006-02-20 07:38:43 -0800 (Mon, 20 Feb 2006)
New Revision: 3132

Modified:
   trunk/doc/HELPER-PROTOCOL
   trunk/helper/toolbar-common-gtk.c
   trunk/scm/im-switcher.scm
Log:
* This commit fix the corrupted menu labels of the action-based IM
  switcher. Thanks Etsushi

* scm/im-switcher.scm
  - (imsw-actions): Remove inappropriate sender-side message translations
* helper/toolbar-common-gtk.c
  - (safe_gettext): New static function
  - (helper_toolbar_prop_list_update): Translate iconic_label, label
    and tooltip_str by safe_gettext()
* doc/HELPER-PROTOCOL
  - Describe about message translation for prop_list_get


Modified: trunk/doc/HELPER-PROTOCOL
===================================================================
--- trunk/doc/HELPER-PROTOCOL	2006-02-20 11:35:16 UTC (rev 3131)
+++ trunk/doc/HELPER-PROTOCOL	2006-02-20 15:38:43 UTC (rev 3132)
@@ -171,9 +171,6 @@
     of leaves. A branch represents a property which is shown as (popup) menu
     for user, and a leaf represents a menu item of the branch.
 
-    iconic_label is a very short string typically 1 character to be used as
-    icon. For example, "a" means 'direct input'.
-
     indication_id is an identifier that specifies visual appearance of the
     item. The ID roughly considerable as "icon name", and so the message
     receiver can use it to form filename for the corresponding icon
@@ -182,11 +179,17 @@
     toolkit-native separator. But it is not necessary since the "separator"
     appears as dummy item with no action if the receiver is not aware of it.
 
+    iconic_label is a very short string typically 1 character to be used as
+    icon. For example, "a" means 'direct input'. This field should be
+    translated with gettext(3) or equivalent. See safe_gettext() of
+    toolbar-common-gtk.c.
+
     label_string is a short string to be shown in the menu, or used as tooltip
-    of the button.
+    of the button. This field should be translated with gettext(3) or
+    equivalent.
 
     short_desc is a short description string usually used as tooltip of the
-    menu item.
+    menu item. This field should be translated with gettext(3) or equivalent.
 
     action_id is an identifier of the menu item. This will be
     notified to other processes by prop_activate when this menu item has been

Modified: trunk/helper/toolbar-common-gtk.c
===================================================================
--- trunk/helper/toolbar-common-gtk.c	2006-02-20 11:35:16 UTC (rev 3131)
+++ trunk/helper/toolbar-common-gtk.c	2006-02-20 15:38:43 UTC (rev 3132)
@@ -34,6 +34,7 @@
 #include "config.h"
 
 #include <gtk/gtk.h>
+#include <ctype.h>
 #include <string.h>
 #include <stdlib.h>
 
@@ -144,9 +145,21 @@
 static GtkIconFactory *uim_factory;
 static GList *uim_icon_list;
 
+static const char *safe_gettext(const char *msgid);
+static gboolean has_n_strs(gchar **str_list, guint n);
 static gboolean register_icon(const gchar *name);
-static gboolean has_n_strs(gchar **str_list, guint n);
 
+static const char *
+safe_gettext(const char *msgid)
+{
+  const char *p;
+
+  for (p = msgid; *p && isascii(*p); p++)
+    continue;
+
+  return (*p) ? msgid : gettext(msgid);
+}
+
 static gboolean
 has_n_strs(gchar **str_list, guint n)
 {
@@ -529,8 +542,8 @@
   guint i;
   gchar **cols;
   gchar *charset;
-  gchar *indication_id, *iconic_label, *label, *tooltip_str;
-  gchar *action_id, *is_selected;
+  const gchar *indication_id, *iconic_label, *label, *tooltip_str;
+  const gchar *action_id, *is_selected;
   GList *prop_buttons, *tool_buttons;
   GtkSizeGroup *sg;
 
@@ -572,9 +585,9 @@
 	append_prop_button(widget, button);
       } else if (!strcmp("leaf", cols[0]) && has_n_strs(cols, 7)) {
 	indication_id = cols[1];
-	iconic_label  = cols[2];
-	label         = cols[3];
-	tooltip_str   = cols[4];
+	iconic_label  = safe_gettext(cols[2]);
+	label         = safe_gettext(cols[3]);
+	tooltip_str   = safe_gettext(cols[4]);
 	action_id     = cols[5];
 	is_selected   = cols[6];
 	prop_button_append_menu(button,

Modified: trunk/scm/im-switcher.scm
===================================================================
--- trunk/scm/im-switcher.scm	2006-02-20 11:35:16 UTC (rev 3131)
+++ trunk/scm/im-switcher.scm	2006-02-20 15:38:43 UTC (rev 3132)
@@ -70,12 +70,10 @@
      (map (lambda (im)
 	    (let* ((idname (im-name im))
 		   (act-name (symbolconc 'action_imsw_ idname))
-		   (label (ugettext (im-name-label im)))
-		   (desc (ugettext (im-short-desc im)))
 		   (indication (list (imsw-indication-id idname)
 				     (imsw-iconic-label idname)
-				     label
-				     desc)))
+				     (im-name-label im)
+				     (im-short-desc im))))
 	      (register-action act-name
 			       (lambda (ctx) ;; indication handler
 				 indication)



More information about the uim-commit mailing list