[uim-commit] r124 - trunk/helper

tkng@freedesktop.org tkng@freedesktop.org
Wed Jan 5 01:22:18 PST 2005


Author: tkng
Date: 2005-01-05 01:22:09 -0800 (Wed, 05 Jan 2005)
New Revision: 124

Modified:
   trunk/helper/pref-gtk.c
Log:
* helper/pref-gtk.c: Implemented filename specify dialog.
 -(custom_pathname_button_clicked_cb): New function.


Modified: trunk/helper/pref-gtk.c
===================================================================
--- trunk/helper/pref-gtk.c	2005-01-05 09:12:27 UTC (rev 123)
+++ trunk/helper/pref-gtk.c	2005-01-05 09:22:09 UTC (rev 124)
@@ -216,7 +216,29 @@
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
 }
 
+static void
+custom_pathname_button_clicked_cb(GtkWidget *button, GtkWidget *entry)
+{
+  GtkWidget *dialog;
+  dialog = gtk_file_chooser_dialog_new ("Specify file",
+					NULL,
+					GTK_FILE_CHOOSER_ACTION_OPEN,
+					GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+					GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+					NULL);
+  
+  if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
+    char *filename;    
+    filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+    if(filename) {
+      gtk_entry_set_text(entry, filename);
+      g_free (filename);
+    }
+  }
 
+  gtk_widget_destroy (dialog);
+}
+
 static void
 add_custom_type_pathname(GtkWidget *vbox, const struct uim_custom *custom)
 {
@@ -237,6 +259,9 @@
 
   button = gtk_button_new_with_label("File");
 
+  g_signal_connect(G_OBJECT(button), "clicked",
+		   G_CALLBACK(custom_pathname_button_clicked_cb), entry);
+
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
 
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);



More information about the Uim-commit mailing list