[memprof: 40/76] Provide a GtkFileChooseButton to select the executable.



commit 0a212f22a6c53b6a4859b8bf239afc1978a89e30
Author: Holger Hans Peter Freyther <zecke selfish org>
Date:   Sun Oct 25 06:54:17 2009 +0100

    Provide a GtkFileChooseButton to select the executable.
    
    2009-10-24  Holger Hans Peter Freyther  <zecke selfish org>
    
            Provide a GtkFileChooseButton to select the executable after
            the gnomeui dependency has been removed and the GnomeFileChooser
            button has been removed.
    
            * memprof.glade:
            * src/main.c:
            (run_cb):

 memprof.glade |    9 ++++-----
 src/main.c    |   13 ++++++-------
 2 files changed, 10 insertions(+), 12 deletions(-)
---
diff --git a/memprof.glade b/memprof.glade
index 724b80a..4601e6b 100644
--- a/memprof.glade
+++ b/memprof.glade
@@ -150,14 +150,13 @@
           </packing>
         </child>
         <child>
-          <widget class="GtkEntry" id="RunDialog-entry">
+          <widget class="GtkFileChooserButton" id="RunDialog-chooser">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="invisible_char">&#x2022;</property>
+            <property name="orientation">vertical</property>
+            <property name="create_folders">False</property>
+            <property name="title" translatable="yes">Select an Executable</property>
           </widget>
           <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
             <property name="position">3</property>
           </packing>
         </child>
diff --git a/src/main.c b/src/main.c
index 230bb13..63a96c7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1053,17 +1053,13 @@ run_cb (GtkWidget *widget)
 {
        GladeXML *xml;
        GtkWidget *run_dialog;
-       GtkWidget *entry;
+       GtkWidget *filechooser;
 
        ProcessWindow *pwin = pwin_from_widget (widget);
        
        xml = glade_xml_new (glade_file, "RunDialog", NULL);
        run_dialog = get_widget (xml, "RunDialog");
-       entry = get_widget (xml, "RunDialog-entry");
-
-       g_signal_connect_swapped (entry, "activate",
-				 G_CALLBACK (gtk_widget_activate),
-				 get_widget (xml, "RunDialog-run"));
+       filechooser = get_widget (xml, "RunDialog-chooser");
 
        g_object_unref (G_OBJECT (xml));
 
@@ -1075,7 +1071,10 @@ run_cb (GtkWidget *widget)
 		       char *text;
 		       gboolean result;
 
-		       text = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
+		       text = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filechooser));
+		       if (!text)
+			       break;
+
 		       args = process_parse_exec (text);
 
 		       result = run_file (pwin, args);



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