[uim-commit] r548 - trunk/helper

makeinu at freedesktop.org makeinu at freedesktop.org
Sat Feb 5 03:52:37 PST 2005


Author: makeinu
Date: 2005-02-05 03:52:33 -0800 (Sat, 05 Feb 2005)
New Revision: 548

Modified:
   trunk/helper/pref-gtk-custom-widgets.c
Log:
* helper/pref-gtk-custom-widgets.c
  - (update_custom_type_olist_cb): New function.
  - (add_custom_type_orderedlist):
    Set callback for custom type ordered list.
  - (update_custom_type_key_cb): Simplified.
  - (sync_value_olist): Rename from olit_pref_entry_set_value.
  - (sync_value_key): Rename from key_pref_entry_set_value.


Modified: trunk/helper/pref-gtk-custom-widgets.c
===================================================================
--- trunk/helper/pref-gtk-custom-widgets.c	2005-02-05 11:52:27 UTC (rev 547)
+++ trunk/helper/pref-gtk-custom-widgets.c	2005-02-05 11:52:33 UTC (rev 548)
@@ -573,7 +573,7 @@
 }
 
 static void
-olist_pref_entry_set_value(GtkEntry *entry)
+sync_value_olist(GtkEntry *entry)
 {
   const char *custom_sym;
   struct uim_custom *custom;
@@ -817,7 +817,7 @@
 			       FALSE, 0.0, 0.0);
   gtk_tree_path_free(path);
   set_olist_buttons_sensitive(olist_entry);
-  olist_pref_entry_set_value(GTK_ENTRY(olist_entry));
+  sync_value_olist(GTK_ENTRY(olist_entry));
 
 ERROR:
   uim_custom_free(custom);
@@ -896,7 +896,7 @@
 			       FALSE, 0.0, 0.0);
   gtk_tree_path_free(path);
   set_olist_buttons_sensitive(olist_entry);
-  olist_pref_entry_set_value(GTK_ENTRY(olist_entry));
+  sync_value_olist(GTK_ENTRY(olist_entry));
 
 ERROR:
   uim_custom_free(custom);
@@ -975,7 +975,7 @@
   urv = uim_custom_set(custom);
 
   if (urv != UIM_FALSE) {
-    olist_pref_entry_set_value(GTK_ENTRY(olist_entry));
+    sync_value_olist(GTK_ENTRY(olist_entry));
     olist_pref_tree_view_set_value(GTK_ENTRY(olist_entry), TRUE, TRUE);
     uim_pref_gtk_value_changed = TRUE;
   } else {
@@ -1042,7 +1042,7 @@
   urv = uim_custom_set(custom);
 
   if (urv != UIM_FALSE) {
-    olist_pref_entry_set_value(GTK_ENTRY(olist_entry));
+    sync_value_olist(GTK_ENTRY(olist_entry));
     olist_pref_tree_view_set_value(GTK_ENTRY(olist_entry), TRUE, TRUE);
     uim_pref_gtk_value_changed = TRUE;
     /* FIXME! reset the selection */
@@ -1243,6 +1243,12 @@
 }
 
 static void
+update_custom_type_olist_cb(void *ptr, const char *custom_sym)
+{
+  sync_value_olist(GTK_ENTRY(ptr));
+}
+
+static void
 add_custom_type_orderedlist(GtkWidget *vbox, struct uim_custom *custom)
 {
   GtkWidget *hbox;
@@ -1265,10 +1271,11 @@
 			 OBJECT_DATA_UIM_CUSTOM_SYM, g_strdup(custom->symbol),
 			 (GDestroyNotify) g_free);
 
-  olist_pref_entry_set_value(GTK_ENTRY(entry));
+  sync_value_olist(GTK_ENTRY(entry));
 
   g_signal_connect(G_OBJECT(button), "clicked",
 		   G_CALLBACK(choose_olist_clicked_cb), entry);
+  uim_custom_cb_add(custom->symbol, entry, update_custom_type_olist_cb);
 }
 
 
@@ -1480,7 +1487,7 @@
 }
 
 static void
-key_pref_entry_set_value(GtkEntry *entry)
+sync_value_key(GtkEntry *entry)
 {
   GString *str;
   const char *custom_sym;
@@ -1569,7 +1576,7 @@
     gtk_list_store_set(GTK_LIST_STORE(model), &iter,
 		       0, str->str,
 		       -1);
-    key_pref_entry_set_value(key_entry);
+    sync_value_key(key_entry);
   } else {
     g_printerr("Failed to set key value for \"%s\".\n", custom->symbol);
   }
@@ -1630,7 +1637,7 @@
       uim_pref_gtk_value_changed = TRUE;
       gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
 
-      key_pref_entry_set_value(key_entry);
+      sync_value_key(key_entry);
     } else {
       g_printerr("Failed to set key value for \"%s\".\n", custom->symbol);
     }
@@ -1818,15 +1825,7 @@
 static void
 update_custom_type_key_cb(void *ptr, const char *custom_sym)
 {
-  struct uim_custom *custom = uim_custom_get(custom_sym);
-  GtkWidget *entry = GTK_WIDGET(ptr);
-
-  if (!custom || custom->type != UCustom_Key)
-    return;
-  
-  gtk_widget_set_sensitive(entry, custom->is_active);
-
-  uim_custom_free(custom);
+  sync_value_key(GTK_ENTRY(ptr));
 }
 
 static void
@@ -1846,7 +1845,7 @@
 			 (GDestroyNotify) g_free);
   gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
 
-  key_pref_entry_set_value(GTK_ENTRY(entry));
+  sync_value_key(GTK_ENTRY(entry));
 
   button = gtk_button_new_with_label(_("Choose..."));
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
@@ -2008,10 +2007,10 @@
     sync_value_choice(GTK_COMBO_BOX(widget));
     break;
   case UCustom_OrderedList:
-    olist_pref_entry_set_value(GTK_ENTRY(widget));
+    sync_value_olist(GTK_ENTRY(widget));
     break;
   case UCustom_Key:
-    key_pref_entry_set_value(GTK_ENTRY(widget));
+    sync_value_key(GTK_ENTRY(widget));
     break;
   default:
     return;



More information about the Uim-commit mailing list