antiright-devel
[Top][All Lists]
Advanced

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

[Antiright-devel] antiright/gtkshell callbacks.c text.c


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright/gtkshell callbacks.c text.c
Date: Mon, 02 Apr 2007 15:37:14 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Changes by:     Jeffrey Bedard <jefbed> 07/04/02 15:37:14

Modified files:
        gtkshell       : callbacks.c text.c 

Log message:
        Switched text field to combo box text entry, in order to preserve
        a history of entered commands.  */

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/callbacks.c?cvsroot=antiright&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/text.c?cvsroot=antiright&r1=1.17&r2=1.18

Patches:
Index: callbacks.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/callbacks.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- callbacks.c 24 Mar 2007 04:17:13 -0000      1.16
+++ callbacks.c 2 Apr 2007 15:37:14 -0000       1.17
@@ -68,8 +68,11 @@
 
        ARWIFNP(widget)
        {
-               input = gtk_entry_get_text(GTK_ENTRY(widget));
-
+               GtkWidget * combo_box;
+               combo_box=gtk_widget_get_ancestor(widget, GTK_TYPE_COMBO_BOX);
+               input = gtk_combo_box_get_active_text(
+                               GTK_COMBO_BOX(combo_box));
+               ARPASSERT(input);
                ARWIFNP(cb)
                {
                        if((cb->gsh->bflags & GSH_PROMPT_ECHOES)
@@ -80,8 +83,10 @@
                                        (char *) input);
 
                        gsh_test_exit(cb->gsh);
+                       gtk_combo_box_prepend_text(GTK_COMBO_BOX(combo_box),
+                                                  (gchar *)input);
                }
 
-               gtk_entry_set_text(GTK_ENTRY(widget), "");      /* Clear.  */
+               //gtk_entry_set_text(GTK_ENTRY(widget), "");    /* Clear.  */
        }
 }

Index: text.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/text.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- text.c      7 Mar 2007 06:44:47 -0000       1.17
+++ text.c      2 Apr 2007 15:37:14 -0000       1.18
@@ -34,10 +34,6 @@
        cb = (struct GSH_CBData *) xmalloc(sizeof(struct GSH_CBData));
        cb->gsh = gsh;
 
-       /*
-        * ARIFP(command) asprintf ((char **) &cb->data, "%s",
-        * command); else asprintf ((char **) &cb->data, "echo");
-        */
        ARIFP(command)
                cb->data = command;     /* Static storage, will not
                                         * pass out of scope.  */
@@ -45,12 +41,19 @@
        cb->data = (gpointer)"echo";    /* Literal */
 
        /* Create widget.  */
-       entry = gtk_entry_new();
+       entry = gtk_combo_box_entry_new_text();
+       /* Some sample entries to use when history is not useful, such as a
+        * dialog presentation of this field, where the window displaying the
+        * field closes on the first activation.  */
+       gtk_combo_box_prepend_text(GTK_COMBO_BOX(entry), "ACE -A Terminal");
+       gtk_combo_box_prepend_text(GTK_COMBO_BOX(entry), "ACE");
+       {
+               GtkWidget * field;
 
-       /* @null */
-       (void) g_signal_connect(G_OBJECT(entry), "activate",
+               field=gtk_bin_get_child(GTK_BIN(entry));
+               (void) g_signal_connect(G_OBJECT(field), "activate",
                                G_CALLBACK(entry_cb), (gpointer) cb);
-
+       }
        /* Do not fill remaining container area.  */
        gsh_manage_unexpanded(gsh, entry);
 




reply via email to

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