[uim-commit] r550 - trunk/helper

makeinu at freedesktop.org makeinu at freedesktop.org
Sat Feb 5 05:30:59 PST 2005


Author: makeinu
Date: 2005-02-05 05:30:53 -0800 (Sat, 05 Feb 2005)
New Revision: 550

Modified:
   trunk/helper/pref-gtk.c
Log:
* helper/pref-gtk.c
  - Sub group feature has been implemented, but still be commented out
    because of some reason. To debug it, please define USE_SUB_GROUP
    as 1.
  - (create_sub_group_widget): New function.
  - (create_group_widget): Use above function.


Modified: trunk/helper/pref-gtk.c
===================================================================
--- trunk/helper/pref-gtk.c	2005-02-05 12:13:55 UTC (rev 549)
+++ trunk/helper/pref-gtk.c	2005-02-05 13:30:53 UTC (rev 550)
@@ -43,6 +43,8 @@
 #include "uim/uim-custom.h"
 #include "uim/gettext.h"
 
+#define USE_SUB_GROUP 0
+
 static GtkWidget *pref_window = NULL;
 static GtkWidget *pref_tree_view = NULL;
 static GtkWidget *pref_hbox = NULL;
@@ -61,6 +63,10 @@
 					     gpointer data);
 static GtkWidget *create_pref_treeview(void);
 static GtkWidget *create_group_widget(const char *group_name);
+#if USE_SUB_GROUP
+static void create_sub_group_widget(GtkWidget *parent_widget,
+				    const char *parent_group);
+#endif
 
 static void
 save_confirm_dialog_response_cb(GtkDialog *dialog, gint arg, gpointer user_data)
@@ -327,7 +333,6 @@
   GtkWidget *group_label;
   GtkWidget *setting_button_box;
   struct uim_custom_group *group;
-  char **custom_syms, **custom_sym;
   char *label_text;
   vbox = gtk_vbox_new(FALSE, 8);
 
@@ -346,14 +351,21 @@
 
   gtk_box_pack_start (GTK_BOX(vbox), group_label, FALSE, TRUE, 8);
 
-  custom_syms = uim_custom_collect_by_group(group_name);
-  if (custom_syms) {
-    for (custom_sym = custom_syms; *custom_sym; custom_sym++) {
-      uim_pref_gtk_add_custom(vbox, *custom_sym);
+#if USE_SUB_GROUP
+  create_sub_group_widget(vbox, group_name);
+#else
+  {
+    char **custom_syms, **custom_sym;
+    custom_syms = uim_custom_collect_by_group(group_name);
+    if (custom_syms) {
+      for (custom_sym = custom_syms; *custom_sym; custom_sym++) {
+	uim_pref_gtk_add_custom(vbox, *custom_sym);
+      }
+      uim_custom_symbol_list_free(custom_syms);
     }
-    uim_custom_symbol_list_free(custom_syms);
   }
-  
+#endif
+
   uim_custom_group_free(group);
 
   setting_button_box = create_setting_button_box(group_name);
@@ -362,6 +374,46 @@
   return vbox;
 }
 
+#if USE_SUB_GROUP
+static void create_sub_group_widget(GtkWidget *parent_widget, const char *parent_group)
+{
+    char **sgrp_syms = uim_custom_group_subgroups(parent_group);
+    char **sgrp_sym;
+
+    for(sgrp_sym = sgrp_syms; *sgrp_sym; sgrp_sym++)
+    {
+        struct uim_custom_group *sgrp =  uim_custom_group_get(*sgrp_sym);
+	char **custom_syms, **custom_sym;
+	GtkWidget *frame;
+	GtkWidget *vbox;
+
+	if(sgrp == NULL)
+	  continue;
+
+	frame = gtk_frame_new(sgrp->label);
+	gtk_frame_set_label_align(GTK_FRAME(frame), 0.02, 0.5);
+	gtk_box_pack_start(GTK_BOX(parent_widget), frame, FALSE, FALSE, 0);
+
+	vbox = gtk_vbox_new(FALSE, 8);
+	gtk_container_add(GTK_CONTAINER(frame), vbox);
+
+	gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);
+
+	custom_syms = uim_custom_collect_by_group(*sgrp_sym);
+	if (custom_syms) {
+	  for (custom_sym = custom_syms; *custom_sym; custom_sym++) {
+	    uim_pref_gtk_add_custom(vbox, *custom_sym);
+	  }
+	  uim_custom_symbol_list_free(custom_syms);
+	}
+
+	uim_custom_group_free(sgrp);
+    }
+
+    uim_custom_symbol_list_free(sgrp_syms);
+}
+#endif
+
 static GtkWidget *
 create_pref_window(void)
 {



More information about the Uim-commit mailing list