antiright-devel
[Top][All Lists]
Advanced

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

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


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright/gtkshell gtkshell.c text.c
Date: Mon, 12 Nov 2007 10:28:58 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Changes by:     Jeffrey Bedard <jefbed> 07/11/12 10:28:58

Modified files:
        gtkshell       : gtkshell.c text.c 

Log message:
        Implement undo feature.  

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/gtkshell.c?cvsroot=antiright&r1=1.45&r2=1.46
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/text.c?cvsroot=antiright&r1=1.39&r2=1.40

Patches:
Index: gtkshell.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/gtkshell.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- gtkshell.c  22 Jul 2007 19:07:32 -0000      1.45
+++ gtkshell.c  12 Nov 2007 10:28:58 -0000      1.46
@@ -83,6 +83,7 @@
 setup_widget_app_member_fields(GSH * gsh)
 {
        GWA.menubar=NULL;
+       GWA.toolbar=NULL;
        setup_app_menus(gsh);
        GWA.frame=NULL;
        GWA.status=NULL;

Index: text.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/text.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- text.c      12 Nov 2007 01:21:33 -0000      1.39
+++ text.c      12 Nov 2007 10:28:58 -0000      1.40
@@ -146,16 +146,34 @@
 
        GtkWidget * redo_button;
        GtkWidget * undo_button;
-       /*gsh->rows->total=1;
-       $(gsh->rows, check);
-       gsh->rows->total=8;
-       redo_button=$(gsh, add.button, "Undo,gtk-undo");
-       undo_button=$(gsh, add.button, "Redo,gtk-redo"); */
-       redo_button=gtk_button_new_with_label("Undo");
-       undo_button=gtk_button_new_with_label("Redo"); 
-       $(gsh, manage, redo_button);
-       $(gsh, manage, undo_button);
+
+       /* The undo and redo names are swapped within undo.c somehow,
+          so a hack is to simply rename the buttons.  */
+       gtk_widget_show(redo_button=gtk_button_new_with_label("Redo"));
+       gtk_widget_show(undo_button=gtk_button_new_with_label("Undo")); 
+       if(gsh->widgets.app.toolbar)
+       {
+               GtkWidget * toolbar=gsh->widgets.app.toolbar;
+               gtk_container_add(GTK_CONTAINER(toolbar), undo_button);
+               gtk_container_add(GTK_CONTAINER(toolbar), redo_button);
+       }
+       else
+       {
+               GtkWidget * hbox;
+               
+               GSH_SET(GSH_NO_EXPAND);
+               GSH_SHOW_CREATE(hbox, hbox, TRUE, 0);
+               GSHCA(hbox, undo_button);
+               GSHCA(hbox, redo_button);
+               $(gsh, manage, hbox);
+       }
        undo_init(text_widget, undo_button, redo_button);
+       g_signal_connect_swapped(G_OBJECT(undo_button), "clicked", 
+               (GCallback)undo_undo,
+               gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_widget)));
+       g_signal_connect_swapped(G_OBJECT(redo_button), "clicked", 
+               (GCallback)undo_redo,
+               gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_widget)));
 }
 
 /* This is currently just a text file viewer.  */




reply via email to

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