graveman-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Graveman-cvs] Changes to graveman/current/src/charset.c


From: sylvain cresto
Subject: [Graveman-cvs] Changes to graveman/current/src/charset.c
Date: Sun, 27 Feb 2005 10:45:57 -0500

Index: graveman/current/src/charset.c
diff -u graveman/current/src/charset.c:1.1 graveman/current/src/charset.c:1.2
--- graveman/current/src/charset.c:1.1  Sun Feb 27 03:34:11 2005
+++ graveman/current/src/charset.c      Sun Feb 27 15:45:42 2005
@@ -194,8 +194,7 @@
         config_append_charset(Lfilename, (gchar 
*)gtk_entry_get_text(Lcharsetlabel));
 
         /* mise a jour de la liste des peripheriques */
-        charset_sort_list();
-        
remplirelistecharset(GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(sc_grave_get_widget(Lg,
 "charsetdata")))), FALSE);
+        update_charsets(Lg);
 
         Lmessage = gtk_message_dialog_new(GTK_WINDOW(Lparent),
                                      GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, 
GTK_BUTTONS_OK,
@@ -277,7 +276,7 @@
   gtk_widget_destroy(Lconfirm);
 
   if (Lrep == GTK_RESPONSE_YES) {
-    /* oui on supprime un device */
+    /* oui on supprime un charsets */
     GtkTreeView *Lliste = GTK_TREE_VIEW(sc_grave_get_widget(Lg, 
"charsetdata"));
     GtkTreeSelection *Lselection = 
gtk_tree_view_get_selection(GTK_TREE_VIEW(Lliste));
     GtkTreeIter Liter;
@@ -288,9 +287,11 @@
       gtk_tree_model_get(Ltreemodel, &Liter, 0, &Lnum, -1);
 
       _DEB("ON SUPRIMME LE CHARSET = %d\n", Lnum);
-      Glistdrives = g_slist_remove(Gcharsetlist, 
g_slist_nth_data(Gcharsetlist, Lnum));
+      Gcharsetlist = g_slist_remove(Gcharsetlist, 
g_slist_nth_data(Gcharsetlist, Lnum));
       gtk_list_store_remove(GTK_LIST_STORE(Ltreemodel), &Liter);
     } 
+
+    update_charsets(Lg);
   }
 }
 
@@ -359,6 +360,40 @@
   }
 }
 
+void selectcombocharset(GtkComboBox *Acombo, gchar *Avalue)
+{
+  GtkTreeModel *Lmodel = gtk_combo_box_get_model(Acombo);
+  gboolean Lselect = FALSE;
+  GtkTreeIter Liter;
+  gboolean Lstatus;
+  gchar *Lcode;
+  
+  for (Lstatus = gtk_tree_model_get_iter_first(Lmodel, &Liter); Lstatus == 
TRUE && Lselect == FALSE;
+      Lstatus = gtk_tree_model_iter_next(Lmodel, &Liter)) {
+    
+    gtk_tree_model_get(Lmodel, &Liter, 2, &Lcode, -1);
+    if (!strcmp(Lcode, Avalue)) {
+      gtk_combo_box_set_active_iter(Acombo, &Liter);
+      Lselect = TRUE;
+    }
+    g_free(Lcode);
+  }
+
+  if (Lselect == FALSE) {
+    gtk_combo_box_set_active(Acombo, 0);
+  }
+}
+
+void update_charsets(Tgrave *Ag)
+{
+  GtkComboBox *Lcombo = GTK_COMBO_BOX(sc_grave_get_widget(Ag, "inputcharset"));
+
+  charset_sort_list();
+  
remplirelistecharset(GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(sc_grave_get_widget(Ag,
 "charsetdata")))), FALSE);
+  remplirelistecharset(GTK_LIST_STORE(gtk_combo_box_get_model(Lcombo)), TRUE);
+  selectcombocharset(Lcombo, conf_get_string("charsetdata"));
+}
+
 /* operation de recherche des charsets */
 void cherchecharset(GtkWidget *Aobj, gpointer Adata)
 {
@@ -367,9 +402,8 @@
   GtkWidget *Lstatusbox;
 
   if (get_builtin_charset(Lg, NULL) == TRUE && GTK_IS_WIDGET(Aobj)) {
-    charset_sort_list();
-    
remplirelistecharset(GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(sc_grave_get_widget(Lg,
 "charsetdata")))), FALSE);
-    
+    update_charsets(Lg);
+
     /* boite de dialoge operation terminee */
     Lstatusbox = gtk_message_dialog_new(GTK_WINDOW(Lwindow1), 
GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK,
         _("configuration updated."));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]