antiright-devel
[Top][All Lists]
Advanced

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

[Antiright-devel] antiright Makefile configure gtkshell/about_dia...


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright Makefile configure gtkshell/about_dia...
Date: Sun, 22 Aug 2010 18:56:33 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Changes by:     Jeffrey Bedard <jefbed> 10/08/22 18:56:33

Modified files:
        .              : Makefile configure 
        gtkshell       : about_dialog.c about_dialog.h app_mode.c 
                         button.c callbacks.c containers.c gsh.h 
                         gtkshell.c guidl.y guidl_dialog.c 
                         guidl_options.c guidl_widgets.c label.c 
                         macros.h main.c options.c ptk-app-menu.c row.c 
                         row.h terminal.c terminal_struct.h text.c 
        libantiright   : pipe.c string.c string.h tuple.c tuple.h util.h 
        rootcat        : Makefile StringRenderer.c StringRenderer.h 
                         rootcat.c rootcat.h 

Log message:
        Refactored configuration script, removed esoteric options and automated 
checks
        further.  Switch to tabbed terminal by default.  Fix tab 
creation/deletion.
        Use SHELL environment variable in order to launch new terminal tab.
        Various optimizations and deferences to library functions.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/Makefile?cvsroot=antiright&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/antiright/configure?cvsroot=antiright&r1=1.124&r2=1.125
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/about_dialog.c?cvsroot=antiright&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/about_dialog.h?cvsroot=antiright&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/app_mode.c?cvsroot=antiright&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/button.c?cvsroot=antiright&r1=1.63&r2=1.64
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/callbacks.c?cvsroot=antiright&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/containers.c?cvsroot=antiright&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/gsh.h?cvsroot=antiright&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/gtkshell.c?cvsroot=antiright&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/guidl.y?cvsroot=antiright&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/guidl_dialog.c?cvsroot=antiright&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/guidl_options.c?cvsroot=antiright&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/guidl_widgets.c?cvsroot=antiright&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/label.c?cvsroot=antiright&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/macros.h?cvsroot=antiright&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/main.c?cvsroot=antiright&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/options.c?cvsroot=antiright&r1=1.49&r2=1.50
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/ptk-app-menu.c?cvsroot=antiright&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/row.c?cvsroot=antiright&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/row.h?cvsroot=antiright&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/terminal.c?cvsroot=antiright&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/terminal_struct.h?cvsroot=antiright&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/text.c?cvsroot=antiright&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/pipe.c?cvsroot=antiright&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/string.c?cvsroot=antiright&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/string.h?cvsroot=antiright&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/tuple.c?cvsroot=antiright&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/tuple.h?cvsroot=antiright&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/util.h?cvsroot=antiright&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/antiright/rootcat/Makefile?cvsroot=antiright&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/antiright/rootcat/StringRenderer.c?cvsroot=antiright&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/antiright/rootcat/StringRenderer.h?cvsroot=antiright&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/antiright/rootcat/rootcat.c?cvsroot=antiright&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/antiright/rootcat/rootcat.h?cvsroot=antiright&r1=1.1&r2=1.2

Patches:
Index: Makefile
===================================================================
RCS file: /sources/antiright/antiright/Makefile,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- Makefile    10 Nov 2008 22:04:36 -0000      1.27
+++ Makefile    22 Aug 2010 18:56:32 -0000      1.28
@@ -49,7 +49,7 @@
 endif
 
 distclean: clean
-       rm -rf config.mk tags */.\#* .\#* 
+       rm -rf config.mk tags *~ */.\#* .\#* 
 
 INSTALL=install
 INSTALL_PROGRAM=$(INSTALL) -c -s

Index: configure
===================================================================
RCS file: /sources/antiright/antiright/configure,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -b -r1.124 -r1.125
--- configure   17 Aug 2010 19:39:20 -0000      1.124
+++ configure   22 Aug 2010 18:56:32 -0000      1.125
@@ -24,52 +24,11 @@
 #
 ###############################################################################
 
-VERSION=3.8
+VERSION=3.9
 
 TRUE=0
 FALSE=1
 
-for ARG in $@; do
-       if [ "$ARG" = "-d" ]; then
-               echo 'Configuring with debug options...'
-               CFLAGS="-g3 -Wdisabled-optimization -DDEBUG -pg"
-                LDFLAGS="$LDFLAGS -pg"
-               CFLAGS="$CFLAGS -Wunreachable-code"
-               DEFS="$DEFS -DGC_DEBUG"
-               echo -n 'Checking for gdb...'
-               if [ "`which gdb`" != "" ]; then
-                       CFLAGS="$CFLAGS -ggdb"
-                       echo found
-               else
-                       echo not found
-               fi
-
-       elif [ "$ARG" = "-l" ]; then
-               PREFIX=/usr/local/packages/antiright
-       elif [ "$ARG" = "-s" ]; then
-               PREFIX=~/opt/stow/antiright
-       elif [ "$ARG" = "-S" ]; then
-               PREFIX=/usr/local/stow/antiright
-       elif [ "$ARG" = "--enable-ccache" ]; then
-               USE_CCACHE=YES
-       elif [ "$ARG" = "--enable-distcc" ]; then
-               USE_DISTCC=YES
-       elif [ "$ARG" = "--enable-boehmgc" ]; then
-               USE_BOEHMGC=YES
-       fi
-done
-
-# For development branch
-CFLAGS="$CFLAGS -Wall -W"
-
-DEFS="$DEFS -DPACKAGE_STRING='\"AntiRight_$VERSION\"'"
-
-if [ "$PREFIX" = "" ]; then
-       PREFIX=/usr/local
-fi
-DEFS="$DEFS -DPREFIX='\"$PREFIX\"'"
-
-
 check_component()
 {
        local COMPONENT=$1
@@ -98,10 +57,13 @@
        local ROOTPATHS="/ /usr/ /usr/local/ /usr/pkg/ /usr/X11R6/ /opt/"
 
        echo -n "Checking for $ITEM...  "
-
+       # Return faster if WHICH can find ITEM.
+       if [ "`which $ITEM 2> /dev/null`" != "" ]; then
+               echo found
+               return $TRUE
+       fi
        for ROOTPATH in $ROOTPATHS; do
                for SUBPATH in bin lib include; do
-#                      echo testing ${ROOTPATH}${SUBPATH}/$1
                        if [ -f "${ROOTPATH}${SUBPATH}/$1" ]; then
                                echo found
                                return $TRUE
@@ -112,27 +74,69 @@
        return $FALSE
 }
 
-echo "# Local Build Configuration" > config.mk
-
-CC=cc
-if check_path_for gcc; then
-       CC=gcc
-fi
+set_if_found()
+{
+       if check_path_for $1; then
+               if [ "$3" != "" ]; then
+                       local VAL="$3"
+               else
+                       local VAL="$1"
+               fi
+               export $2="$VAL"
+       fi
+}
 
-if [ "$USE_DISTCC" = "YES" ]; then
-       if check_path_for distcc; then
-               CC=distcc
+set_debugging_options()
+{
+       echo 'Configuring with debug options...'
+       CFLAGS="-g3 -DDEBUG -DG_DEBUG -pg"
+       LDFLAGS="$LDFLAGS -pg"
+       CFLAGS="$CFLAGS -Wunreachable-code"
+       DEFS="$DEFS -DGC_DEBUG"
+       if check_path_for gdb; then
+               CFLAGS="$CFLAGS -ggdb"
        fi
-fi
+}
+
+OPTS='dp:'
+print_usage()
+{
+       echo -e "Usage:  ./configure -[$OPTS]"
+       echo -e "\t-d\t\tEnable debugging options"
+       echo -e "\t-p\tPATH\tSet PATH for installation\n"
+       exit 1
+}
+
+# Handle command line arguments
+
+while getopts $OPTS opt; do
+       case "$opt" in
+               d)      set_debugging_options ;;
+               p)      PATH="$OPTARG" ;;
+               \?)     print_usage
+       esac
+done
+shift $(( $OPTIND - 1 ))
 
-if check_path_for ccache; then
-       CC="ccache $CC"
+# For development branch
+CFLAGS="$CFLAGS -Wall -W"
+
+DEFS="$DEFS -DPACKAGE_STRING='\"AntiRight_$VERSION\"'"
+
+if [ "$PREFIX" = "" ]; then
+       PREFIX=/usr/local
 fi
+DEFS="$DEFS -DPREFIX='\"$PREFIX\"'"
 
+echo "# Local Build Configuration" > config.mk
+
+CC=cc
+set_if_found cc CC
+set_if_found gcc CC
+set_if_found distcc CC "distcc $CC"
+set_if_found ccache CC "ccache $CC"
 MAKE=make
-if check_path_for gmake; then
-       MAKE=gmake
-fi
+set_if_found gmake MAKE
 
 if check_path_for libgc.a || check_path_for libgc.so\
        || check_path_for libgc.so.1; then
@@ -143,24 +147,18 @@
        fi
 fi
 
-LEX="$(which flex)"
-if [ "$LEX" = "" ]; then
-       LEX=lex
-fi
-YACC="$(which bison)"
-if [ "$YACC" = "" ]; then
-       YACC=yacc
-fi
+set_if_found lex LEX 
+set_if_found flex LEX 
+set_if_found yacc YACC
+set_if_found bison YACC
 
 check_component "gtk+-2.0" "GTK"
 check_component "vte" "VTE"
-#check_component "libpanelapplet-2.0" "PANEL_APPLET"
-
 
-AS=as
+set_if_found as AS "as"
 
 XSHELL_BUILD='cd xshell && $(MAKE)'
-OSNAME="$(uname | cut -d_ -f1)"
+OSNAME="`uname | cut -d_ -f1`"
 #if [ "$OSNAME" = "MINGW32" ] || [ "$OSNAME" = "CYGWIN" ]; then
 echo Building for $OSNAME.
 if [ "$OSNAME" = "CYGWIN" ]; then
@@ -174,8 +172,6 @@
        XSHELL_BUILD='echo xshell unsupported, not built'
 fi
 
-
-
 INCLUDE="$INCLUDE -I/usr/pkg/include -I/usr/local/include -I/usr/X11R6/include"
 LIBDIR="$LIBDIR -L/usr/pkg/lib -L/usr/local/lib -L/usr/X11R6/lib"
 ARDATADIR=$PREFIX/share/antiright

Index: gtkshell/about_dialog.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/about_dialog.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- gtkshell/about_dialog.c     16 Aug 2010 11:51:21 -0000      1.13
+++ gtkshell/about_dialog.c     22 Aug 2010 18:56:32 -0000      1.14
@@ -1,6 +1,6 @@
 /*
   AntiRight
-  (c) 2007 Jeffrey Bedard
+  (c) 2007-2010 Jeffrey Bedard
   address@hidden
 
   This file is part of AntiRight.
@@ -41,28 +41,18 @@
   gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (dialog), authors);
 }
 
-#define SET_WEBSITE(dialog)\
-       gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dialog), GSH_WEBSITE);
-
-#define SET_COMMENTS(dialog)\
-       gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog), GSH_COMMENTS);
-
-#define SET_COPYRIGHT(dialog)\
-       gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(dialog),\
-               GSH_COPYRIGHT);
-
-#define SET_VERSION(dialog)\
-       gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), PACKAGE_STRING);
 
 static void
 setup_logo (GtkAboutDialog * dialog)
 {
   GtkWidget *image;
+  GdkPixbuf *pb;
 
   image = gtk_image_new_from_file (ARDATADIR "/icons/ACE_32.png");
   gtk_widget_show (image);
   gtk_about_dialog_set_logo (dialog,
-                            gtk_image_get_pixbuf (GTK_IMAGE (image)));
+                            pb=gtk_image_get_pixbuf (GTK_IMAGE (image)));
+  g_object_unref(pb);
 }
 
 static GtkWidget *
@@ -70,11 +60,13 @@
 {
   setup_authors_field (dialog);
   setup_about_license (dialog);
-  setup_logo (GTK_ABOUT_DIALOG (dialog));
-  SET_WEBSITE (dialog);
-  SET_COMMENTS (dialog);
-  SET_COPYRIGHT (dialog);
-  SET_VERSION (dialog);
+#define adialog GTK_ABOUT_DIALOG(dialog)
+  setup_logo (adialog);
+#define GADS(i, v) gtk_about_dialog_set_##i(adialog, v)
+  GADS(website, GSH_WEBSITE);
+  GADS(comments, GSH_COMMENTS);
+  GADS(copyright, GSH_COPYRIGHT);
+  GADS(version, PACKAGE_STRING);
 
   return dialog;
 }
@@ -83,5 +75,6 @@
 gsh_about_dialog ()
 {
   gtk_dialog_run (GTK_DIALOG (setup_about_fields (gtk_about_dialog_new ())));
-  exit (0);
+  exit(0);
 }
+

Index: gtkshell/about_dialog.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/about_dialog.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- gtkshell/about_dialog.h     16 Aug 2010 11:51:21 -0000      1.5
+++ gtkshell/about_dialog.h     22 Aug 2010 18:56:32 -0000      1.6
@@ -31,7 +31,7 @@
         NULL\
 }
 
-#define GSH_COPYRIGHT "Copyright 2002-2007, Jeffrey E. Bedard"
+#define GSH_COPYRIGHT "Copyright 2002-2010, Jeffrey E. Bedard"
 #define GSH_WEBSITE "http://www.nongnu.org/antiright";
 #define GSH_COMMENTS "This is the desktop scripting environment."
 

Index: gtkshell/app_mode.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/app_mode.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- gtkshell/app_mode.c 16 Aug 2010 11:51:21 -0000      1.5
+++ gtkshell/app_mode.c 22 Aug 2010 18:56:32 -0000      1.6
@@ -38,9 +38,7 @@
 {
   GtkWidget *toolbar;
 
-
   GSH_SHOW_CREATE (toolbar = GWA.toolbar, toolbar);
-  gtk_toolbar_set_tooltips (GTK_TOOLBAR (toolbar), TRUE);
   gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
   GSHCA_TIGHT (GWA.row, toolbar);
 }
@@ -52,6 +50,11 @@
   GSHCA (GWA.row, GWA.frame);
 }
 
+static void
+setup_row(struct GSH * gsh)
+{
+}
+
 void
 gsh_setup_app_mode (struct GSH *gsh)
 {

Index: gtkshell/button.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/button.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- gtkshell/button.c   17 Aug 2010 19:17:24 -0000      1.63
+++ gtkshell/button.c   22 Aug 2010 18:56:32 -0000      1.64
@@ -24,26 +24,18 @@
 #include <glib/gstdio.h>
 
 static void
-create_label_in_menu_item (GtkWidget * widget, const gchar * formatted)
+setup_label (GtkWidget * widget, const gchar * command)
 {
+  gchar *formatted = antiright_beautified_label(command);
+  if(GTK_IS_MENU_ITEM(widget))
+    {
   GtkWidget *label;
 
-  gtk_container_add (GTK_CONTAINER (widget),
-                    label = gtk_label_new (formatted));
+      GSH_ADD_WIDGET(widget, label, label, formatted);
   gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
-  gtk_widget_show (label);
-}
-
-static void
-setup_label (GtkWidget * widget, const gchar * command)
-{
-  gchar *formatted;
-  gchar *tmp = g_strdup (command);
-
-  formatted = antiright_beautified_label (tmp);
-  g_free (tmp);
-  GTK_IS_MENU_ITEM (widget) ? create_label_in_menu_item (widget, formatted)
-    : gtk_button_set_label (GTK_BUTTON (widget), formatted);
+    }
+  else
+      gtk_button_set_label (GTK_BUTTON (widget), formatted);
   g_free (formatted);
 }
 
@@ -64,21 +56,6 @@
     GSH_UNSET (GSH_MENU_BUTTON);
 }
 
-static void
-create_button (struct GSH *gsh)
-{
-  gtk_widget_show (gsh->widgets.button = (!GTK_IS_MENU (gsh->rows->v)
-                                         && !GTK_IS_MENU_BAR (gsh->rows->v))
-                  ? gtk_button_new () : gtk_image_menu_item_new ());
-}
-
-static void
-common_button_setup (GSH * gsh, GtkWidget * button, const gchar * command)
-{
-  gsh_setup_drag_drop (gsh, button);
-  setup_callback (gsh, button, command);
-}
-
 static GtkWidget *
 label_to_icon_translation (const gchar * label)
 {
@@ -98,9 +75,7 @@
        {
          gtk_widget_show (image = gsh_get_image (mapping[mapping_count].icon,
                                                  GTK_ICON_SIZE_BUTTON));
-#if GTK_MINOR_VERSION >= 12
          gtk_widget_set_tooltip_text (image, label);
-#endif
          break;
        }
     }
@@ -125,18 +100,22 @@
 static void
 setup_label_for_toolbutton (GtkWidget * toolbutton, const gchar * command)
 {
-  gchar *label_text;
-  gchar *tmp = g_strdup (command);
-  label_text = antiright_beautified_label (tmp);
-  g_free (tmp);
-  gtk_button_set_label (GTK_BUTTON (toolbutton), label_text);
-  if (setup_icon_for_toolbutton (toolbutton, label_text)
+  gchar *label_text=antiright_beautified_label((gchar*)command);
+  gtk_button_set_label(GTK_BUTTON(toolbutton), 
+                       (setup_icon_for_toolbutton (toolbutton, label_text) 
       && (gsh_is_menubar_item (label_text) == GMT_NONE))
-    gtk_button_set_label (GTK_BUTTON (toolbutton), "");
+                       ? "" : label_text);
   g_free (label_text);
 }
 
 static void
+setup_common(GSH *gsh, GtkWidget *button, const gchar *command)
+{
+  gsh_setup_drag_drop (gsh, button);
+  setup_callback (gsh, button, command);
+}
+
+static void
 setup_toolbutton_from_command_button (GSH * gsh, const gchar * command)
 {
   GtkWidget *toolitem;
@@ -145,45 +124,33 @@
   GSH_SHOW_CREATE (toolitem, tool_item);
   GSH_SHOW_CREATE (toolbutton, button);
   setup_label_for_toolbutton (toolbutton, command);
-  common_button_setup (gsh, toolbutton, command);
+  setup_common(gsh, toolbutton, command);
   gtk_button_set_relief (GTK_BUTTON (toolbutton), GTK_RELIEF_NONE);
   GSHCA (toolitem, toolbutton);
   GSHCA (gsh->widgets.app.toolbar, toolitem);
 
 }
 
-static void
-setup_command_button (struct GSH *gsh, const gchar * command)
+static bool
+is_toolbutton(GSH *gsh, const gchar *command)
 {
-  GtkWidget *button;
-
-  setup_label (button = gsh->widgets.button, command);
-  common_button_setup (gsh, button, command);
-  /* Test if a toolbutton should be created.  */
-  if (GSH_FLAG (GSH_APP_MODE)
+  return (GSH_FLAG (GSH_APP_MODE) 
       && gsh->widgets.app.toolbar
       && GTK_IS_MENU_ITEM (gsh->widgets.button)
-      && (gsh_is_menubar_item (command) == GMT_NONE))
-    {
-      setup_toolbutton_from_command_button (gsh, command);
-    }
-  /* Set button widget options.  */
-  if (GTK_IS_BUTTON (button))
-    gtk_button_set_alignment (GTK_BUTTON (button), 0.0, 0.5);
+          && (gsh_is_menubar_item (command) == GMT_NONE));
 }
 
 static bool
-test_image_button (struct GSH *gsh, const gchar * string)
+is_image_button(GSH *gsh, const gchar *command)
 {
-  gchar **pair;
-  bool return_value;
+  bool ret;
+  gchar **pair=g_strsplit(command, ",", 2);
 
-  pair = g_strsplit (string, ",", 2);
-  if ((return_value = (pair[1] != NULL)))
-    gsh_image_button (gsh, pair[0], pair[1]);
-  g_strfreev (pair);
+  if((ret=pair[1]))
+      gsh_image_button(gsh, pair[0], pair[1]);
+  g_strfreev(pair);
 
-  return return_value;
+  return ret;
 }
 
 /* This is just a wrapper around gsh_new_button(), to
@@ -191,12 +158,23 @@
 GtkWidget *
 gsh_add_button (struct GSH * gsh, const gchar * command)
 {
-  if (!test_image_button (gsh, command))
+  if(!is_image_button(gsh, command))
     {
-      create_button (gsh);
-      setup_command_button (gsh, command);
-      $ (gsh, manage, gsh->widgets.button);
-    }
+      GtkWidget *vrow = gsh->rows->v;
+      GtkWidget *button;
 
+      gtk_widget_show (button=gsh->widgets.button 
+                       = (!GTK_IS_MENU (vrow) && !GTK_IS_MENU_BAR (vrow)) 
+                       ? gtk_button_new () : gtk_image_menu_item_new ());
+      setup_label (button = gsh->widgets.button, command);
+      gsh_setup_drag_drop (gsh, button);
+      setup_callback (gsh, button, command);
+      if(is_toolbutton(gsh, command))
+        setup_toolbutton_from_command_button (gsh, command);
+      /* Set button widget options.  */
+      if (GTK_IS_BUTTON (button))
+        gtk_button_set_alignment (GTK_BUTTON (button), 0.0, 0.5);
+      $ (gsh, manage, button);
+    }
   return gsh->widgets.button;
 }

Index: gtkshell/callbacks.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/callbacks.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- gtkshell/callbacks.c        17 Aug 2010 19:17:24 -0000      1.40
+++ gtkshell/callbacks.c        22 Aug 2010 18:56:32 -0000      1.41
@@ -22,108 +22,91 @@
 
 #include "gtkshell.h"
 
-void
-gsh_send_signal (GtkWidget * widget, const gchar * signal_name)
-{
-  g_signal_emit_by_name (widget, signal_name);
-}
+#define gsh_send_signal g_signal_emit_by_name
 
 static void
 gsh_delete_GSHCBData (struct GSHCBData *cb)
 {
   g_free (cb->data);
-  g_free (cb);
+  arfree (cb);
 }
 
 static void
 terminal_feed (gchar * command, GtkWidget * terminal)
 {
-  gchar **split_command;
-  gchar *feed_command;
-
   if (!terminal)
     {
-      ARWARN ("terminal command requires a terminal" "to have been created");
+      ARWARN ("terminal command requires a terminal to have been created");
       return;
     }
 
   command += 6;
+    {
+      gchar *feed_command;
+      {
+        gchar **split_command;
+
   split_command = g_strsplit (command, "#", 2);
   feed_command = g_strconcat (split_command[0], "\n", NULL);
   g_strfreev (split_command);
+      }
 #ifdef HAVE_VTE
   vte_terminal_feed_child (VTE_TERMINAL (terminal),
                           feed_command, strlen (feed_command));
 #endif /* HAVE_VTE */
   g_free (feed_command);
+    }
 }
 
-
-#define MATCH(str) !strncmp(command, str, strlen(str))
-
-static bool
-test_special_text_editor_command (struct GSH *gsh, const gchar * command)
-{
-  if (MATCH ("Save_As...___"))
-    gsh_editor_save_as (gsh);
-  else if (MATCH ("Save___"))
-    gsh_editor_save (gsh);
-  else if (MATCH ("Open...___"))
-    gsh_editor_open (gsh);
-  else if (MATCH ("Cut___"))
-    gsh_send_signal (gsh->editor.widget, "cut-clipboard");
-  else if (MATCH ("Copy___"))
-    gsh_send_signal (gsh->editor.widget, "copy-clipboard");
-  else if (MATCH ("Paste___"))
-    gsh_send_signal (gsh->editor.widget, "paste-clipboard");
-  else
-    return FALSE;
-
-  /* A special command match was found.  */
-  return TRUE;
-}
+#include <ctype.h>
 
 static bool
 test_special_command (struct GSHCBData *cb)
 {
   const gchar *command = cb->data;
+  const size_t cmdsiz=strlen(command);
   struct GSH *gsh = cb->gsh;
 
-
-  if (MATCH ("Exit__"))
-    {
-      /* GSH is cleaned up when this causes 
-       * a return back to main().  */
-      gtk_main_quit ();
-    }
-  else if (MATCH ("TERM__"))
-    {
-      terminal_feed ((gchar *) command, gsh->terminal->widget);
-    }
-  else if (MATCH ("About__"))
+#define GSS(sig) gsh_send_signal(gsh->editor.widget, sig)
+  if(command[cmdsiz-1] != '_')
+    return FALSE; /* special commands end with _ */
+  switch(tolower(command[0]))
     {
+    case 'a':
       antiright_system ("gtkshell -da &");
-    }
+      break;
+    case 'c':
+      if(tolower(command[1])=='u')
+        GSS("cut-clipboard");
   else
-    {
-      /* Test other special command(s).  */
-      if (!test_special_text_editor_command (gsh, command))
-       {
-         /* No special command found.  */
+        GSS("copy-clipboard");
+      break;
+    case 'e':
+      gtk_main_quit();
+      break;
+    case 'o':
+      gsh_editor_open (gsh);
+      break;
+    case 'p':
+        GSS("paste-clipboard");
+      break;
+    case 's':
+      if((cmdsiz>5) && (tolower(command[5]) == 'a'))
+        gsh_editor_save_as (gsh);
+      else
+        gsh_editor_save (gsh);
+      break;
+    case 't':
+      terminal_feed ((gchar *) command, gsh->terminal->widget);
+      break;
+    default:
          return FALSE;
        }
-    }
-
-  /* Special command handled.  */
+  /* A special command match was found.  */
   return TRUE;
 }
 
-static void
-test_exit (struct GSH *gsh)
-{
-  if (GSH_FLAG (GSH_CBEXIT))
-    gtk_main_quit ();
-}
+#define test_exit(gsh) if(gsh->bflags & GSH_CBEXIT) gtk_main_quit()
 
 static void
 gsh_system_cb (GtkWidget * widget __attribute__ ((unused)), gpointer data)
@@ -198,3 +181,4 @@
 
   return cb;
 }
+

Index: gtkshell/containers.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/containers.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- gtkshell/containers.c       17 Aug 2010 19:17:24 -0000      1.28
+++ gtkshell/containers.c       22 Aug 2010 18:56:32 -0000      1.29
@@ -57,9 +57,10 @@
 gsh_setup_base_container (struct GSH *gsh)
 {
 #define GWA gsh->widgets.app
-  if (GWA.frame)
+#define FRAME GWA.frame
+  if (FRAME)
     {                          /* setup app mode frame */
-      GSHCA (GWA.frame, gsh->rows->h);
+      GSHCA (FRAME, gsh->rows->h);
       gsh->rows->h = GWA.row;
     }
   if (GSH_FLAG (GSH_SCROLL))

Index: gtkshell/gsh.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/gsh.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- gtkshell/gsh.h      17 Aug 2010 19:17:24 -0000      1.6
+++ gtkshell/gsh.h      22 Aug 2010 18:56:32 -0000      1.7
@@ -1,6 +1,6 @@
 /*
   AntiRight
-  (c) 2002-2007 Jeffrey Bedard
+  (c) 2002-2010 Jeffrey Bedard
   address@hidden
 
   This file is part of AntiRight.

Index: gtkshell/gtkshell.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/gtkshell.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- gtkshell/gtkshell.c 17 Aug 2010 19:17:24 -0000      1.54
+++ gtkshell/gtkshell.c 22 Aug 2010 18:56:32 -0000      1.55
@@ -32,6 +32,43 @@
   ARDELETE (gsh->rows);
   ARDELETE (gsh->terminal);
   ARDELETE (gsh->update);
+  arfree(gsh);
+}
+
+static inline void
+gsh_manage_generic (GSH * gsh, GtkWidget * widget)
+{
+  gtk_widget_show (widget);
+  gsh->rows->current++;
+  gsh->widgets.last_managed = widget;
+}
+
+static void
+gsh_manage (GSH * gsh, GtkWidget * widget)
+{
+  if (G_LIKELY (!GSH_FLAG (GSH_PANE_NEXT)))
+    {
+      struct GSHRows *rows = gsh->rows;
+      GtkWidget *container = rows->v;
+
+      if (GTK_IS_MENU (container) || GTK_IS_MENU_BAR (container)
+         || GTK_IS_MENU_ITEM (container))
+       {
+         gtk_menu_shell_append (GTK_MENU_SHELL (container), widget);
+         return;
+       }
+      gsh_manage_generic (gsh, widget);
+      $ (rows, check);
+      if (GSH_FLAG (GSH_NO_EXPAND))
+       GSHCA_TIGHT (container, widget);
+      else
+       GSHCA (container, widget);
+    }
+  else
+    {
+      gsh_pane_previous (gsh, widget);
+      gsh_manage_generic (gsh, widget);
+    }
 }
 
 void
@@ -54,10 +91,11 @@
   gsh->add.label = &gsh_add_label;
   /* setup app mode fields */
 #define GWA gsh->widgets.app
+  GWA.menubar=GWA.toolbar=GWA.status=GWA.frame=GWA.row=NULL;
 #define GWAM GWA.menus
-  gsh->widgets.last_managed = GWA.menubar = GWA.toolbar = GWAM.file
-    = GWAM.edit = GWAM.view = GWAM.tools = GWAM.help = GWA.frame
-    = GWA.status = gsh->editor.widget = NULL;
+  GWAM.file=GWAM.edit=GWAM.view=GWAM.tools=GWAM.help=NULL;
+  gsh->widgets.last_managed = NULL;
+  gsh->editor.widget=NULL;
   gsh->command_dictionary = NULL;
   gsh->editor.fgcolor = gsh->editor.bgcolor = gsh->editor.filename
     = gsh->geometry = gsh->usage = (gchar *) NULL;

Index: gtkshell/guidl.y
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/guidl.y,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- gtkshell/guidl.y    17 Aug 2010 12:57:12 -0000      1.26
+++ gtkshell/guidl.y    22 Aug 2010 18:56:32 -0000      1.27
@@ -2,7 +2,7 @@
 
 /*
   AntiRight
-  (c) 2007 Jeffrey Bedard
+  (c) 2007-2010 Jeffrey Bedard
   address@hidden
 
   This file is part of AntiRight.
@@ -27,21 +27,12 @@
 #include "gtkshell.h"
 
 void
-yyerror(const char *string);
-
-int
-yywrap();
-
-void
-yyunput();
-
-void
 yyerror(const char *string)
 {
        g_error("error:  %s\n", string);
 }
 
-int
+inline guint8
 yywrap()
 {
        return 1;

Index: gtkshell/guidl_dialog.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/guidl_dialog.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- gtkshell/guidl_dialog.c     16 Aug 2010 11:51:21 -0000      1.13
+++ gtkshell/guidl_dialog.c     22 Aug 2010 18:56:32 -0000      1.14
@@ -21,18 +21,19 @@
 */
 
 /* Set the dictionary to use for this definition file.  */
-#define DICT gsh_guidl_env->dictionaries->dialog
 #include "gtkshell.h"
 
 extern struct GDLEnvironment *gsh_guidl_env;
 
-#define DEF(a, b) GSH_GUIDL_DEFINE(DICT, a, b)
 
 static void
 setup_dictionary ()
 {
-  DICT = ARNEW (ar, ARTupleVector);
+  ARTupleVector * dict;
+
+  dict = ARNEW (ar, ARTupleVector);
   /* Begin adding mappings between keys and values.  */
+#define DEF(a, b) GSH_GUIDL_DEFINE(dict, a, b)
   DEF ("file", "-df");
   DEF ("font", "-dF");
   DEF ("about", "-da");
@@ -43,6 +44,8 @@
   DEF ("info", "-di");
   DEF ("warning", "-dw");
   DEF ("error", "-de");
+#define DICT gsh_guidl_env->dictionaries->dialog
+  DICT=dict;
 }
 
 /* Generate public function to access these definitions.  */

Index: gtkshell/guidl_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/guidl_options.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- gtkshell/guidl_options.c    16 Aug 2010 11:51:21 -0000      1.14
+++ gtkshell/guidl_options.c    22 Aug 2010 18:56:32 -0000      1.15
@@ -20,17 +20,18 @@
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
 */
 
-#define DICT gsh_guidl_env->dictionaries->option
 #include "gtkshell.h"
 
 extern struct GDLEnvironment *gsh_guidl_env;
 
-#define DEF(a, b) GSH_GUIDL_DEFINE(DICT, a, b);
 
 static void
 setup_dictionary ()
 {
-  DICT = ARNEW (ar, ARTupleVector);
+  ARTupleVector *dict;
+
+  dict= ARNEW (ar, ARTupleVector);
+#define DEF(a, b) GSH_GUIDL_DEFINE(dict, a, b);
   DEF ("framed labels", "-of");
   DEF ("undecorated", "-on");
   DEF ("exit on activate", "-oe");
@@ -52,6 +53,8 @@
   DEF ("pane next", "-op");
   DEF ("check commands", "-oC");
   DEF ("horizontal clock", "-oH");
+#define DICT gsh_guidl_env->dictionaries->option
+  DICT=dict;
 }
 
 GSH_GUIDL_ITEM_FUNC (option, DICT);

Index: gtkshell/guidl_widgets.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/guidl_widgets.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- gtkshell/guidl_widgets.c    16 Aug 2010 11:51:21 -0000      1.15
+++ gtkshell/guidl_widgets.c    22 Aug 2010 18:56:32 -0000      1.16
@@ -20,19 +20,17 @@
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
 */
 
-#define DICT gsh_guidl_env->dictionaries->widget
 #include "gtkshell.h"
 
 extern struct GDLEnvironment *gsh_guidl_env;
 
-
-#define DEF(a, b)\
-       GSH_GUIDL_DEFINE(DICT, a, b)
-
 static void
 setup_dictionary ()
 {
-  DICT = ARNEW (ar, ARTupleVector);
+  ARTupleVector *dict;
+
+  dict = ARNEW (ar, ARTupleVector);
+#define DEF(a, b) GSH_GUIDL_DEFINE(dict, a, b)
   DEF ("label", "-al");
   DEF ("prompt", "-at");
   DEF ("terminal", "-as");
@@ -50,6 +48,9 @@
   DEF ("clock applet", "-aAc");
   DEF ("app menu", "-aAm");
   DEF ("embedded", "-aX");
+#define DICT gsh_guidl_env->dictionaries->widget
+  DICT=dict;
 }
 
 GSH_GUIDL_ITEM_FUNC (widget, DICT);
+

Index: gtkshell/label.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/label.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- gtkshell/label.c    16 Aug 2010 11:51:21 -0000      1.25
+++ gtkshell/label.c    22 Aug 2010 18:56:32 -0000      1.26
@@ -53,7 +53,7 @@
 
   label = gtk_label_new (text);
   set_options (gsh, label);
-  gsh_manage (gsh, GSH_FLAG (GSH_FRAMED_LABELS)
+  $(gsh, manage, GSH_FLAG (GSH_FRAMED_LABELS) 
              ? make_framed_label (label) : label);
 
   return label;

Index: gtkshell/macros.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/macros.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- gtkshell/macros.h   17 Aug 2010 19:17:24 -0000      1.24
+++ gtkshell/macros.h   22 Aug 2010 18:56:32 -0000      1.25
@@ -102,4 +102,6 @@
        GSH_OPTION_FUNCTION(GSH_OPTION_FUNC_NAME(option, GSH_UNSET),\
                option, GSH_UNSET)
 
+#define GSH_STOCK_ITEM(item, id) GTK_WIDGET(gtk_##item##_new_from_stock(id))
+
 #endif /* not GSH_MACROS_H */

Index: gtkshell/main.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/main.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- gtkshell/main.c     17 Aug 2010 19:17:24 -0000      1.37
+++ gtkshell/main.c     22 Aug 2010 18:56:32 -0000      1.38
@@ -1,6 +1,6 @@
 /*
   AntiRight
-  (c) 2002-2007 Jeffrey Bedard
+  (c) 2002-2010 Jeffrey Bedard
   address@hidden
 
   This file is part of AntiRight.
@@ -28,7 +28,8 @@
   gint counter;
   struct ARArguments *argset;
   GSH *gsh = alloca (sizeof (GSH));
-
+//  printf("size:  %d\n", sizeof(GSH));
+  fflush(stdout);
   gtk_init (&argc, &argv);
 
   argset = ARNEW (ar, ARArguments);

Index: gtkshell/options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/options.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- gtkshell/options.c  17 Aug 2010 19:17:25 -0000      1.49
+++ gtkshell/options.c  22 Aug 2010 18:56:32 -0000      1.50
@@ -44,12 +44,13 @@
   gsh_guidl_env = NULL;
 }
 
+__attribute__ ((noreturn))
 static void
 gsh_invalid_option (GSH * gsh, const gchar ** argv, const gint option)
 {
   g_warning ("%s:  %s undefined\n", argv[0], argv[option]);
   if (gsh->usage)
-    fprintf (stderr, "%s\n", gsh->usage);
+    g_message("%s\n", gsh->usage);
   exit (1);
 }
 

Index: gtkshell/ptk-app-menu.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/ptk-app-menu.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- gtkshell/ptk-app-menu.c     17 Aug 2010 19:17:25 -0000      1.10
+++ gtkshell/ptk-app-menu.c     22 Aug 2010 18:56:32 -0000      1.11
@@ -289,9 +289,10 @@
 static inline int
 find_menu_item_by_name (gpointer a, gpointer name)
 {
-  return strcmp (((PtkAppMenuItem *) g_object_get_qdata (G_OBJECT (a),
-                                                        
PTK_APP_MENU_ITEM_ID))->
-                name, (char *) name);
+  return strncmp (((PtkAppMenuItem *) 
+                  g_object_get_qdata (G_OBJECT (a), 
+                                      PTK_APP_MENU_ITEM_ID))->name, 
+                 (char *) name, 3);
 }
 
 static char *
@@ -300,9 +301,11 @@
   char *ret = NULL;
   char *fn = g_strconcat ("desktop-directories/", inf->directory_file,
                          ".directory", NULL);
+
   if (g_key_file_load_from_data_dirs (kf, fn, NULL, 0, NULL))
     ret = g_key_file_get_locale_string (kf, desktop_ent, "Name", NULL, NULL);
   g_free (fn);
+
   return ret;
 }
 
@@ -324,10 +327,9 @@
                     gpointer user_data)
 {
   PtkAppMenuItem *data = (PtkAppMenuItem *) user_data;
-  if ((!data)
+  if (!((!data)
       || (!GTK_IS_IMAGE_MENU_ITEM (item))
-      || (gtk_image_menu_item_get_image ((GtkImageMenuItem *) item)))
-    return FALSE;
+      || (gtk_image_menu_item_get_image ((GtkImageMenuItem *) item))))
   gtk_image_menu_item_set_image ((GtkImageMenuItem *) item,
                                 gsh_get_image (data->icon, ICON_SIZE));
   return FALSE;
@@ -340,15 +342,6 @@
   antiright_system (data->exec);
 }
 
-static void
-ptk_app_menu_item_free (PtkAppMenuItem * data)
-{
-  if (data)
-    {
-      g_slice_free (PtkAppMenuItem, data);
-    }
-}
-
 #define SETUP_MENU_ITEM_SIGNALS(menu_item, data)\
 {\
   GSHCONNECT (menu_item, "expose-event", on_menu_item_expose, data);\
@@ -474,7 +467,7 @@
          GSHCONNECT (menu_item, "activate", on_app_menu_item_activate, data);
          g_object_set_qdata_full (G_OBJECT (menu_item),
                                   PTK_APP_MENU_ITEM_ID, data,
-                                  (GDestroyNotify) ptk_app_menu_item_free);
+                                   NULL);
          sub_menu = g_list_insert_sorted (sub_menu,
                                           (gpointer) menu_item,
                                           (GCompareFunc)
@@ -640,7 +633,7 @@
       data = alloca (sizeof (PtkAppMenuItem));
       data->icon = g_strdup (known_cats[i].icon);
       g_object_set_qdata_full (G_OBJECT (menu_item), PTK_APP_MENU_ITEM_ID,
-                              data, (GDestroyNotify) ptk_app_menu_item_free);
+                              data, NULL);
 
       SETUP_MENU_ITEM_SIGNALS (menu_item, data);
       on_menu_item_expose (menu_item, NULL, data);
@@ -712,10 +705,9 @@
 {
   GtkWidget *menu_button_item;
 
-  menu_button_item = gtk_image_menu_item_new ();
+  GSH_SHOW_CREATE(menu_button_item, image_menu_item);
   setup_app_menu_icon (gsh, menu_button_item);
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_button_item), app_menu);
-  gtk_widget_show (menu_button_item);
 
   return menu_button_item;
 }

Index: gtkshell/row.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/row.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- gtkshell/row.c      17 Aug 2010 19:17:25 -0000      1.30
+++ gtkshell/row.c      22 Aug 2010 18:56:32 -0000      1.31
@@ -38,12 +38,13 @@
     $ (this, new);
 }
 
-static inline void
+static void
 GSHRows_delete (struct GSHRows *rows)
 {
-  gtk_widget_destroy (rows->v);
-  gtk_widget_destroy (rows->h);
-  g_free (rows);
+#define KILLWIDGET(x) if(GTK_IS_WIDGET(x)) gtk_widget_destroy(x)
+  KILLWIDGET(rows->v);
+  KILLWIDGET(rows->h);
+  arfree (rows);
 }
 
 struct GSHRows *
@@ -64,38 +65,5 @@
   return this;
 }
 
-static inline void
-gsh_manage_generic (GSH * gsh, GtkWidget * widget)
-{
-  gtk_widget_show (widget);
-  gsh->rows->current++;
-  gsh->widgets.last_managed = widget;
-}
 
-void
-gsh_manage (GSH * gsh, GtkWidget * widget)
-{
-  if (G_LIKELY (!GSH_FLAG (GSH_PANE_NEXT)))
-    {
-      struct GSHRows *rows = gsh->rows;
-      GtkWidget *container = rows->v;
-
-      if (GTK_IS_MENU (container) || GTK_IS_MENU_BAR (container)
-         || GTK_IS_MENU_ITEM (container))
-       {
-         gtk_menu_shell_append (GTK_MENU_SHELL (container), widget);
-         return;
-       }
-      gsh_manage_generic (gsh, widget);
-      $ (rows, check);
-      if (GSH_FLAG (GSH_NO_EXPAND))
-       GSHCA_TIGHT (container, widget);
-      else
-       GSHCA (container, widget);
-    }
-  else
-    {
-      gsh_pane_previous (gsh, widget);
-      gsh_manage_generic (gsh, widget);
-    }
-}
+

Index: gtkshell/row.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/row.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- gtkshell/row.h      16 Aug 2010 11:51:22 -0000      1.12
+++ gtkshell/row.h      22 Aug 2010 18:56:32 -0000      1.13
@@ -23,10 +23,6 @@
 #ifndef GSH_ROW_H
 #define GSH_ROW_H
 
-void gsh_manage (struct GSH *gsh, GtkWidget * widget);
-
-void gsh_check_row (struct GSH *gsh);
-
 struct GSHRows *gsh_new_GSHRows ();
 
 #endif /* GSH_ROW_H */

Index: gtkshell/terminal.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/terminal.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- gtkshell/terminal.c 17 Aug 2010 19:17:25 -0000      1.38
+++ gtkshell/terminal.c 22 Aug 2010 18:56:33 -0000      1.39
@@ -24,6 +24,7 @@
 
 /* Uncomment to use experimental tabbed terminal.  */
 /*     # USE_TABS */
+#define USE_TABS
 
 #ifdef HAVE_VTE
 #include <vte/reaper.h>
@@ -72,10 +73,11 @@
 
 #ifdef USE_TABS
 static void
-handle_child_exited (GtkWidget * widget, gpointer user_data)
+handle_child_exited (GtkWidget * widget, gpointer term)
 {
-  struct GSH_Terminal *term = user_data;
-  GtkNotebook *notebook = GTK_NOTEBOOK (term->__notebook);
+  //struct GSH_Terminal *term = user_data;
+  GtkNotebook *notebook 
+    = GTK_NOTEBOOK (((struct GSH_Terminal *)term)->__notebook);
 
   gtk_notebook_remove_page (notebook,
                            gtk_notebook_page_num (notebook, widget));
@@ -122,15 +124,18 @@
 
 #ifdef USE_TABS
   /* Handle terminal exit.  */
-  g_signal_connect (G_OBJECT (term->widget), "child-exited",
-                   handle_child_exited, term);
+  GSHCONNECT(term->widget, "child-exited", handle_child_exited, term);
+/*  g_signal_connect (G_OBJECT (term->widget), "child-exited",
+                   handle_child_exited, term);*/
 #endif /* USE_TABS */
 }
 
 static void
 gsh_delete_GSH_Terminal (struct GSH_Terminal *term)
 {
-  g_free (term);
+  if(term->__tab_command)
+    g_free(term->__tab_command);
+  arfree (term);
   /* Freeing the terminal font causes a segmentation fault under
    * linux, so likely a double free.  */
   /* The terminal widget itself is freed by gobject system
@@ -212,16 +217,14 @@
 #ifdef USE_TABS
 
 static void
-tab_button_close_cb (GtkWidget * button, gpointer data)
+tab_button_close_cb (GtkWidget * button __attribute__ ((unused)), 
+                     gpointer data)
 {
   struct GSH_Terminal *term = data;
-  GtkWidget *terminal;
   GtkNotebook *notebook = GTK_NOTEBOOK (term->__notebook);
-  const gint tab_id = term->__notebook_page;
+  const gint current_page=gtk_notebook_get_current_page(notebook);
 
-  terminal = gtk_notebook_get_nth_page (notebook, tab_id);
-  gtk_widget_destroy (terminal);
-  gtk_notebook_remove_page (notebook, tab_id);
+  gtk_widget_destroy(gtk_notebook_get_nth_page (notebook, current_page));
 }
 
 static void
@@ -233,60 +236,60 @@
 }
 
 static void
-tab_button_callback (GtkWidget * button, gpointer data)
+tab_button_callback (GtkWidget * button __attribute__ ((unused)), 
+                     gpointer data)
 {
-  struct GSH_Terminal *term = data;
-  $ (term, add, term->__tab_command);
+  struct GSH_Terminal *term = (struct GSH_Terminal *)data;
+  $ (term, add, getenv("SHELL"));
 }
 
 static void
-make_tab_label (struct GSH_Terminal *term, const gchar * command,
-               GtkWidget * hbox, gint tab_id)
+page_removed_cb (GtkNotebook *notebook, 
+                 GtkWidget *child __attribute__ ((unused)),
+                 guint page_num __attribute__ ((unused)),
+                 gpointer user_data __attribute__ ((unused)))
 {
-  GtkWidget *button;
-  GtkWidget *close_button;
-  GtkWidget *label;
-  GtkWidget *new_image;
-  GtkWidget *close_image;
-
-  term->__notebook_page = tab_id;
-  gtk_widget_show (label = gtk_label_new (command));
-  GSHCA (hbox, label);
-  gtk_widget_show (new_image = gtk_image_new_from_stock ("gtk-new",
-                                                        GTK_ICON_SIZE_MENU));
-  gtk_widget_show (button = gtk_button_new ());
-  gtk_button_set_image (GTK_BUTTON (button), new_image);
-  close_button = gtk_button_new ();
-  close_image = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (close_image);
-  gtk_button_set_image (GTK_BUTTON (close_button), close_image);
-  gtk_widget_show (close_button);
-  GSHCA (hbox, close_button);
-  GSHCONNECT (close_button, "clicked", tab_button_close_cb, term);
-
-  gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE);
-  gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
-
-  term->__tab_command = (gchar *) command;
-  GSHCONNECT (button, "clicked", tab_button_callback, term);
-  GSHCA (hbox, button);
+  if(gtk_notebook_get_n_pages(notebook)==0)
+    exit(0);
 }
-#endif /* USE_TABS */
 
-#ifdef USE_TABS
 static void
-new_terminal_tab (struct GSH_Terminal *term, const gchar * command)
+new_terminal_tab (struct GSH_Terminal *term, gchar * command)
 {
-  GtkWidget *hbox;
+  GtkNotebook *notebook = GTK_NOTEBOOK(term->__notebook);
+  GtkWidget *term_widget;
+  GtkWidget *label;
   gint tab_id;
 
-  gtk_widget_show (hbox = gtk_hbox_new (FALSE, 0));
-  gtk_widget_show (term->widget = vte_terminal_new ());
+  assert(command);
+  puts(command);
+  if((term->__tab_command))
+    g_free(term->__tab_command);
+  term->__tab_command=command;
+
+  GSH_SHOW_CREATE(label, label, command);
+  gtk_widget_show (term_widget = term->widget = vte_terminal_new ());
   tab_id = term->__notebook_page
-    = gtk_notebook_append_page (GTK_NOTEBOOK (term->__notebook),
-                               term->widget, hbox);
-  GSHCONNECT (term->__notebook, "change-current-page", change_page_cb, term);
-  make_tab_label (term, command, hbox, tab_id);
+    = gtk_notebook_append_page (notebook, term_widget, label);
+  GSHCONNECT (notebook, "change-current-page", change_page_cb, term);
+  GSHCONNECT (notebook, "page-removed", page_removed_cb, term);
+//  make_tab_label (term, command, hbox, tab_id);
+  if(!gtk_notebook_get_action_widget(notebook, GTK_PACK_START))
+    {
+      GtkWidget *new;
+      gtk_widget_show(new=gtk_button_new_from_stock("gtk-new"));
+      GSHCONNECT (new, "clicked", tab_button_callback, term);
+      gtk_notebook_set_action_widget(notebook, new, GTK_PACK_START);
+    }
+  if(!gtk_notebook_get_action_widget(notebook, GTK_PACK_END))
+    {
+      GtkWidget *close;
+      gtk_widget_show(close=gtk_button_new_from_stock("gtk-close"));
+      GSHCONNECT (close, "clicked", tab_button_close_cb, term);
+      gtk_notebook_set_action_widget(notebook, close, GTK_PACK_END);
+    }
+  gtk_notebook_set_current_page(notebook, tab_id);
+  gtk_widget_grab_focus(term_widget);
 }
 #endif /* USE_TABS */
 
@@ -303,7 +306,7 @@
     gtk_widget_show (term->__notebook = gtk_notebook_new ());
   else
     original_tab = FALSE;
-  new_terminal_tab (term, command);
+  new_terminal_tab (term, g_strdup(command));
 #else /* ! USE_TABS */
   gtk_widget_show (term->widget = vte_terminal_new ());
 #endif /* USE_TABS */
@@ -336,6 +339,7 @@
   term->dimensions.height = 24;
 #ifdef USE_TABS
   term->__notebook = NULL;
+  term->__tab_command = NULL;
 #endif /* USE_TABS */
 }
 
@@ -357,3 +361,4 @@
 
   return term;
 }
+

Index: gtkshell/terminal_struct.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/terminal_struct.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- gtkshell/terminal_struct.h  16 Aug 2010 11:51:22 -0000      1.14
+++ gtkshell/terminal_struct.h  22 Aug 2010 18:56:33 -0000      1.15
@@ -22,7 +22,7 @@
 
 #ifndef GSH_TERMINAL_STRUCT_H
 #define GSH_TERMINAL_STRUCT_H
-
+#define USE_TABS
 struct GSH_Terminal
 {
   GtkWidget *widget;

Index: gtkshell/text.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/text.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- gtkshell/text.c     16 Aug 2010 11:51:22 -0000      1.47
+++ gtkshell/text.c     22 Aug 2010 18:56:33 -0000      1.48
@@ -25,8 +25,6 @@
 
 static void setup_undo (GSH * gsh);
 
-#define ADD_ENTRY(widget, str)\
-       gtk_combo_box_prepend_text(GTK_COMBO_BOX(widget), str)
 
 /* Some sample entries to use when history is not useful, such as a
  * dialog presentation of this field, where the window displaying the
@@ -34,10 +32,12 @@
 static void
 append_sample_entries (GtkWidget * widget)
 {
-  ADD_ENTRY (widget, "ACE -A Terminal");
-  ADD_ENTRY (widget, "ACE -A Settings");
-  ADD_ENTRY (widget, "ACE -A IDE");
-  ADD_ENTRY (widget, "ACE");
+#define ADD_ENTRY(str)\
+       gtk_combo_box_prepend_text(GTK_COMBO_BOX(widget), str)
+  ADD_ENTRY ("ACE -A Terminal");
+  ADD_ENTRY ("ACE -A Settings");
+  ADD_ENTRY ("ACE -A IDE");
+  ADD_ENTRY ("ACE");
 }
 
 static void
@@ -47,10 +47,8 @@
 
   if (gsh && entry && command)
     {
-      cb = ARNEW (gsh, GSHCBData, gsh,
-                 (gpointer) (command ? command : "echo"));
-      g_signal_connect (G_OBJECT (gtk_bin_get_child (GTK_BIN (entry))),
-                       "activate", G_CALLBACK (cb->entry), (gpointer) cb);
+      cb = ARNEW (gsh, GSHCBData, gsh, (gpointer)(command ? command : "echo"));
+      GSHCONNECT(gtk_bin_get_child(GTK_BIN(entry)), "activate", cb->entry, cb);
     }
 }
 
@@ -59,14 +57,10 @@
 {
   GtkWidget *entry;
 
-#ifdef DEBUG
-  ARPASSERT (gsh);
-#endif /* DEBUG */
-
   /* Create widget and assign callback.  */
   setup_entry_cb (gsh, entry = gtk_combo_box_entry_new_text (), command);
   append_sample_entries (entry);
-  gsh_manage (gsh, entry);
+  $(gsh, manage, entry);
 
   return entry;
 }
@@ -76,24 +70,12 @@
 {
   gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_widget), GTK_WRAP_WORD);
   gsh_widget_set_font (text_widget, NULL);
-
   /* Set background color, if specified.  */
   if (gsh->editor.bgcolor)
-    {
       gsh_widget_set_color (text_widget, gsh->editor.bgcolor, FALSE);
-#ifdef DEBUG
-      fprintf (stderr, "bgcolor: %s\n", gsh->editor.bgcolor);
-#endif /* DEBUG */
-    }
   /* Set background color, if specified.  */
-  if (gsh->editor.fgcolor)
-    {
-      /* TRUE for foreground */
+  if (gsh->editor.fgcolor) /* TRUE for foreground */
       gsh_widget_set_color (text_widget, gsh->editor.fgcolor, TRUE);
-#ifdef DEBUG
-      fprintf (stderr, "bgcolor: %s\n", gsh->editor.bgcolor);
-#endif /* DEBUG */
-    }
 }
 
 
@@ -102,19 +84,15 @@
 {
   GtkWidget *scroller;
 
-  GSH_SHOW_CREATE (scroller, scrolled_window, NULL, NULL);
+  GSH_ADD_MANAGED(gsh, scroller, scrolled_window, NULL, NULL);
   GSHCA (scroller, text);
-  $ (gsh, manage, scroller);
 }
 
 GtkWidget *
-gsh_text_area (struct GSH *gsh)
+gsh_text_area (GSH *gsh)
 {
   GtkWidget *text;
 
-#ifdef DEBUG
-  ARPASSERT (gsh);
-#endif /* DEBUG */
   GSH_SHOW_CREATE (text = gsh->editor.widget, text_view);
   set_options (gsh, text);
   setup_text_scroller (gsh, text);
@@ -123,12 +101,6 @@
   return text;
 }
 
-#define CHECK_GEOMETRY(gsh)\
-{\
-       ARIFNP(gsh->geometry)\
-               gsh->geometry=g_strdup("775x700");\
-}
-
 GtkTextBuffer *
 gsh_text_area_set_text (GtkWidget * widget, const gchar * text)
 {
@@ -140,47 +112,45 @@
   return buffer;
 }
 
+static GtkWidget *
+setup_unredo_button(GtkWidget *destination, const bool has_toolbar,
+                  const gchar *stock, GCallback cb, GtkWidget * text_widget)
+{
+  GtkWidget *button;
+
+  button=has_toolbar 
+    ? GSH_STOCK_ITEM(tool_button, stock) 
+    : GSH_STOCK_ITEM(button, stock);
+  GSHCA(destination, button);
+  gtk_widget_show(button);
+  g_signal_connect_swapped (G_OBJECT (button), "clicked",
+                           (GCallback) cb,
+                           gtk_text_view_get_buffer (GTK_TEXT_VIEW
+                                                     (text_widget)));
+
+  return button;
+}
+
 static void
 setup_undo (GSH * gsh)
 {
   GtkWidget *text_widget = gsh->editor.widget;
-  GtkWidget *redo_button;
-  GtkWidget *undo_button;
   GtkWidget *destination;
+  const bool has_toolbar=(gsh->widgets.app.toolbar);
 
-  /* The undo and redo names are swapped within undo.c somehow,
-     so a hack is to simply rename the buttons.  */
-  if (gsh->widgets.app.toolbar)
-    {
-      GtkWidget *separator;
-
-      redo_button = GTK_WIDGET (gtk_tool_button_new_from_stock ("gtk-redo"));
-      undo_button = GTK_WIDGET (gtk_tool_button_new_from_stock ("gtk-undo"));
+  if(has_toolbar)
       destination = gsh->widgets.app.toolbar;
-      GSH_ADD_WIDGET (destination, separator, separator_tool_item);
-    }
   else
-    {
-      redo_button = gtk_button_new_from_stock ("gtk-redo");
-      undo_button = gtk_button_new_from_stock ("gtk-undo");
-      /* Set up a horizontal container 
+    { /* Set up a horizontal container 
          for undo and redo buttons.  */
       GSH_SET (GSH_NO_EXPAND);
       GSH_ADD_MANAGED (gsh, destination, hbox, TRUE, 0);
     }
-  gtk_widget_show (undo_button);
-  gtk_widget_show (redo_button);
-  GSHCA (destination, undo_button);
-  GSHCA (destination, redo_button);
-  gsh_undo_init (text_widget, undo_button, redo_button);
-  g_signal_connect_swapped (G_OBJECT (undo_button), "clicked",
-                           (GCallback) gsh_undo_undo,
-                           gtk_text_view_get_buffer (GTK_TEXT_VIEW
-                                                     (text_widget)));
-  g_signal_connect_swapped (G_OBJECT (redo_button), "clicked",
-                           (GCallback) gsh_undo_redo,
-                           gtk_text_view_get_buffer (GTK_TEXT_VIEW
-                                                     (text_widget)));
+  gsh_undo_init(text_widget, 
+                setup_unredo_button(destination, has_toolbar, "gtk-undo", 
+                                    (GCallback)gsh_undo_undo, text_widget), 
+                setup_unredo_button(destination, has_toolbar, "gtk-redo", 
+                                    (GCallback)gsh_undo_redo, text_widget));
 }
 
 static void open_gsh_file_in_editor (GSH * gsh);
@@ -191,7 +161,8 @@
   gsh_text_area (gsh);
   gsh->editor.filename = (gchar *) filename;
   open_gsh_file_in_editor (gsh);
-  CHECK_GEOMETRY (gsh);
+  if(!(gsh->geometry))
+    gsh->geometry=g_strdup("640x480");
 }
 
 /* Check that the editor widget has been initialized.  */

Index: libantiright/pipe.c
===================================================================
RCS file: /sources/antiright/antiright/libantiright/pipe.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- libantiright/pipe.c 17 Aug 2010 12:57:13 -0000      1.14
+++ libantiright/pipe.c 22 Aug 2010 18:56:33 -0000      1.15
@@ -69,7 +69,6 @@
        
        g_spawn_command_line_sync(command_string, &command_stdout, NULL,
                        NULL, NULL);
-
-       return g_strchomp(command_stdout);
+        return command_stdout ? g_strchomp(command_stdout) : g_strdup("");
 }
 

Index: libantiright/string.c
===================================================================
RCS file: /sources/antiright/antiright/libantiright/string.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- libantiright/string.c       17 Aug 2010 12:57:13 -0000      1.12
+++ libantiright/string.c       22 Aug 2010 18:56:33 -0000      1.13
@@ -21,21 +21,12 @@
 */
 
 #include "library.h"
-
-static inline guint
-get_last_space(const gchar * text)
-{
-       guint i;
-       const size_t length=strlen(text);
-
-       for(i = 0; (i < length) && (*(text+length-i) != ' '); i++);
-
-       return length - i;
-}
+#include <strings.h>
 
 static inline gchar*
-substitute(gchar *s)
+substitute(const gchar *c)
 {
+        gchar *s=strdup(c);
        guint i;
        const size_t l = strlen(s);
 
@@ -46,17 +37,17 @@
                        case '@': s[i]='_'; break;
                }
 
-       return g_strdup(s);
+       return s;
 }
 
 
 /* Free the returned value!  */
 gchar *
-antiright_beautified_label(gchar *text)
+antiright_beautified_label(const gchar *text)
 {
-       text += get_last_space(text);
+  const char *nospace=strrchr(text, ' ');
 
-       return(substitute(text));
+  return substitute(nospace?nospace:text);
 }
 
 gchar *
@@ -64,7 +55,7 @@
 {
        gchar *s=g_malloc(G_ASCII_DTOSTR_BUF_SIZE);
 
-       g_ascii_dtostr(s,G_ASCII_DTOSTR_BUF_SIZE, d);
+       g_ascii_dtostr(s, G_ASCII_DTOSTR_BUF_SIZE, d);
 
        return s;
 }

Index: libantiright/string.h
===================================================================
RCS file: /sources/antiright/antiright/libantiright/string.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- libantiright/string.h       17 Aug 2010 12:57:13 -0000      1.7
+++ libantiright/string.h       22 Aug 2010 18:56:33 -0000      1.8
@@ -26,7 +26,7 @@
 #include <glib/gprintf.h>
 
 gchar *
-antiright_beautified_label(gchar *text);
+antiright_beautified_label(const gchar *text);
 
 gchar *
 ar_dtostr(const gdouble d);

Index: libantiright/tuple.c
===================================================================
RCS file: /sources/antiright/antiright/libantiright/tuple.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- libantiright/tuple.c        26 Oct 2008 00:02:38 -0000      1.4
+++ libantiright/tuple.c        22 Aug 2010 18:56:33 -0000      1.5
@@ -22,38 +22,25 @@
 
 #include "library.h"
 
-struct ARTupleVector *
-ar_new_ARTupleVector()
-{
-       struct ARTupleVector * vector;
 
-       vector=g_malloc(sizeof(struct ARTupleVector));
-       vector->__hash=g_hash_table_new(&g_str_hash, &g_str_equal);
-       vector->add=&ar_add_ARTupleVector;
-       vector->find=&ar_find_ARTupleVector;
-       vector->delete=&ar_delete_ARTupleVector;
-
-       return vector;
-}
-
-void
+static void
 ar_delete_ARTupleVector(struct ARTupleVector * vector)
 {
 #if !defined(WIN32) & !defined(CYGWIN)
        g_hash_table_remove_all(vector->__hash);
 #endif
        g_hash_table_destroy(vector->__hash);
-       g_free(vector);
+       arfree(vector);
 }
 
-void
+static void
 ar_add_ARTupleVector(struct ARTupleVector * vector,
                     const gchar * key, const gchar * value)
 {
        g_hash_table_insert(vector->__hash, (gpointer)key, (gpointer)value);
 }
 
-const gchar *
+static const gchar *
 ar_find_ARTupleVector(struct ARTupleVector * vector,
                      const gchar * term)
 {
@@ -61,3 +48,17 @@
                                                  (gconstpointer)term);
 }
 
+struct ARTupleVector *
+ar_new_ARTupleVector()
+{
+       struct ARTupleVector * vector;
+
+       vector=armalloc(sizeof(struct ARTupleVector));
+       vector->__hash=g_hash_table_new(&g_str_hash, &g_str_equal);
+       vector->add=&ar_add_ARTupleVector;
+       vector->find=&ar_find_ARTupleVector;
+       vector->delete=&ar_delete_ARTupleVector;
+
+       return vector;
+}
+

Index: libantiright/tuple.h
===================================================================
RCS file: /sources/antiright/antiright/libantiright/tuple.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libantiright/tuple.h        11 Dec 2007 20:31:32 -0000      1.3
+++ libantiright/tuple.h        22 Aug 2010 18:56:33 -0000      1.4
@@ -36,16 +36,5 @@
 struct ARTupleVector *
 ar_new_ARTupleVector();
 
-void
-ar_delete_ARTupleVector(struct ARTupleVector * vector);
-
-void
-ar_add_ARTupleVector(struct ARTupleVector * vector,
-                    const gchar * key, const gchar * value);
-
-const gchar *
-ar_find_ARTupleVector(struct ARTupleVector * vector,
-                     const gchar * term);
-
 #endif /* AR_TUPLE_H */
 

Index: libantiright/util.h
===================================================================
RCS file: /sources/antiright/antiright/libantiright/util.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- libantiright/util.h 17 Aug 2010 19:39:20 -0000      1.16
+++ libantiright/util.h 22 Aug 2010 18:56:33 -0000      1.17
@@ -27,12 +27,23 @@
        g_file_set_contents(filename, text, strlen(text), NULL)
 
 #ifdef LIBGC
-#define armalloc(size) GC_MALLOC(size);
-#define arfree(data)    GC_FREE(data);
+#define armalloc(size) GC_MALLOC(size)
+#define arfree(data)    GC_FREE(data)
 #else /* not LIBGC */
-#define armalloc(size)  g_malloc(size);
-#define arfree(data)    g_free(data);
-#endif
+#if GLIB_CHECK_VERSION(2, 10, 0)
+#define armalloc(size)  g_slice_alloc(size)
+#define arfree(ptr)    g_slice_free1(sizeof(*ptr), ptr)
+#else /* glib is less than 2.10.0 */
+#define armalloc(size)  g_malloc(size)
+#define arfree(data)    g_free(data)
+#endif /* GLIB_CHECK_VERSION */
+#endif /* LIBGC */
+
+#include <sys/mman.h>
+#include <unistd.h>
+#define ARMMAP(size) mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_PRIVATE, -1,\
+                          sysconf(_SC_PAGE_SIZE))
+#define ARMUNMAP(addr, size) munmap(addr, size)
 
 typedef void(*ARActionFunction)(gint *, gchar **);
 

Index: rootcat/Makefile
===================================================================
RCS file: /sources/antiright/antiright/rootcat/Makefile,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- rootcat/Makefile    15 Aug 2010 22:23:29 -0000      1.5
+++ rootcat/Makefile    22 Aug 2010 18:56:33 -0000      1.6
@@ -45,4 +45,7 @@
        rm -f $(objs) $(PROG) *.core
 install:
        $(INSTALL) -sc $(PROG) $(PREFIX)/bin
+indent: 
+       indent *.[ch]
+       rm *~
 

Index: rootcat/StringRenderer.c
===================================================================
RCS file: /sources/antiright/antiright/rootcat/StringRenderer.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- rootcat/StringRenderer.c    15 Aug 2010 22:23:29 -0000      1.1
+++ rootcat/StringRenderer.c    22 Aug 2010 18:56:33 -0000      1.2
@@ -23,43 +23,43 @@
 #include "rootcat.h"
 
 static void
-StringRenderer_clear(StringRenderer * rc)
+StringRenderer_clear (StringRenderer * rc)
 {
-       XClearWindow(rc->dpy, rc->window);
+  XClearWindow (rc->dpy, rc->window);
 }
 
 static unsigned int
-StringRenderer_get_line_height(StringRenderer * rc, const char * string)
+StringRenderer_get_line_height (StringRenderer * rc, const char *string)
 {
        XGlyphInfo extents;
 
-       XftTextExtentsUtf8(rc->dpy, rc->font, 
-               (FcChar8 *)string, strlen(string),
-               &extents);
+  XftTextExtentsUtf8 (rc->dpy, rc->font,
+                     (FcChar8 *) string, strlen (string), &extents);
 
        return extents.height;
 }
 
 /* Returns the number of lines printed.  */
 static unsigned int
-StringRenderer_draw(StringRenderer * rc, 
-       const int x, const int y, const char * string)
+StringRenderer_draw (StringRenderer * rc,
+                    const int x, const int y, const char *string)
 {
-       char * iter = (char*)string;
-       const int max_length=strlen(string);
-       int total_length=0;
-       register int length=0;
-       int lines=0;
+  char *iter = (char *) string;
+  const int max_length = strlen (string);
+  int total_length = 0;
+  register int length = 0;
+  int lines = 0;
 
-       for(total_length=0; total_length<=max_length; total_length+=length)
+  for (total_length = 0; total_length <= max_length; total_length += length)
        {
-               for(length=0;iter[length] != '\0' 
-                       && iter[length] !='\n';length++);
+      for (length = 0; iter[length] != '\0'
+          && iter[length] != '\n'; length++);
                length++;
-               XftDrawStringUtf8(rc->__draw, &(rc->color), rc->font,
-                       x, y+lines*LINE_SPACING*$(rc, get_line_height, iter), 
-                       (FcChar8*)iter, length-1);
-               iter+=length;
+      XftDrawStringUtf8 (rc->__draw, &(rc->color), rc->font,
+                        x, y + lines * LINE_SPACING * $ (rc, get_line_height,
+                                                         iter),
+                        (FcChar8 *) iter, length - 1);
+      iter += length;
                lines++;
        }
 
@@ -67,65 +67,62 @@
 }
 
 static void
-delete_StringRenderer(StringRenderer * rc)
+delete_StringRenderer (StringRenderer * rc)
 {
-       Display * dpy = rc->dpy;
-       const int screen = DefaultScreen(dpy);
+  Display *dpy = rc->dpy;
+  const int screen = DefaultScreen (dpy);
 
-       XftColorFree(dpy, DefaultVisual(dpy, screen), 
-               DefaultColormap(dpy, screen), &(rc->color));
-       XftFontClose(dpy, rc->font);
-       XftDrawDestroy(rc->__draw);
-       XCloseDisplay(dpy);
-       free(rc);
+  XftColorFree (dpy, DefaultVisual (dpy, screen),
+               DefaultColormap (dpy, screen), &(rc->color));
+  XftFontClose (dpy, rc->font);
+  XftDrawDestroy (rc->__draw);
+  XCloseDisplay (dpy);
+  free (rc);
 }
 
 StringRenderer *
-new_StringRenderer(Display * dpy, Window w, 
-       const char * font, const char * color)
+new_StringRenderer (Display * dpy, Window w,
+                   const char *font, const char *color)
 {
        /* Validate inputs.  */
-       if(!dpy)
+  if (!dpy)
        {
-               dpy = XOpenDisplay(getenv("DISPLAY"));
-               if(!dpy)
+      dpy = XOpenDisplay (getenv ("DISPLAY"));
+      if (!dpy)
                {
-                       perror("cannot open DISPLAY");
-                       exit(1);
+         perror ("cannot open DISPLAY");
+         exit (1);
                }
        }
-       if(!font)
-               font=SR_DEFAULT_FONT;
-       if(!color)
-               color=SR_DEFAULT_COLOR;
-       if(w==0)
-               w=DefaultRootWindow(dpy);
+  if (!font)
+    font = SR_DEFAULT_FONT;
+  if (!color)
+    color = SR_DEFAULT_COLOR;
+  if (w == 0)
+    w = DefaultRootWindow (dpy);
 
        /* Allocate class.  */
-       StringRenderer * rc = malloc(sizeof(StringRenderer));
-       assert(rc);
+  StringRenderer *rc = malloc (sizeof (StringRenderer));
+  assert (rc);
 
-       rc->delete=&delete_StringRenderer;
-       rc->draw=&StringRenderer_draw;
-       rc->get_line_height=&StringRenderer_get_line_height;
-       rc->clear = &StringRenderer_clear;
+  rc->delete = (&delete_StringRenderer);
+  rc->draw = (&StringRenderer_draw);
+  rc->get_line_height = (&StringRenderer_get_line_height);
+  rc->clear = (&StringRenderer_clear);
 
-       rc->dpy=dpy;
-       rc->window=w;
+  rc->dpy = dpy;
+  rc->window = w;
        {
-               const int screen=DefaultScreen(dpy);
+    const int screen = DefaultScreen (dpy);
                {
-                       const Colormap cmap=DefaultColormap(dpy, screen);
-                       const Visual * visual=DefaultVisual(dpy, screen);
+      const Colormap cmap = DefaultColormap (dpy, screen);
+      const Visual *visual = DefaultVisual (dpy, screen);
 
-                       rc->__draw=XftDrawCreate(dpy, w, 
-                               (Visual*)visual, cmap);
-                       XftColorAllocName(dpy, visual,
-                               cmap, color, &(rc->color));
+      rc->__draw = XftDrawCreate (dpy, w, (Visual *) visual, cmap);
+      XftColorAllocName (dpy, visual, cmap, color, &(rc->color));
                }
-               rc->font=XftFontOpenName(dpy, screen, font);
+    rc->font = XftFontOpenName (dpy, screen, font);
        }
 
        return rc;
 }
-

Index: rootcat/StringRenderer.h
===================================================================
RCS file: /sources/antiright/antiright/rootcat/StringRenderer.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- rootcat/StringRenderer.h    15 Aug 2010 22:23:29 -0000      1.1
+++ rootcat/StringRenderer.h    22 Aug 2010 18:56:33 -0000      1.2
@@ -25,25 +25,22 @@
 
 typedef struct _StringRenderer
 {
-       Display * dpy;
+  Display *dpy;
        Window window;
-       XftDraw * __draw;
+  XftDraw *__draw;
        XftColor color;
-       XftFont * font;
+  XftFont *font;
 
-       void (*delete)(struct _StringRenderer *);
-       unsigned int (*draw)(struct _StringRenderer *, 
+  void (*delete) (struct _StringRenderer *);
+  unsigned int (*draw) (struct _StringRenderer *,
                const int, const int, const char *);
-       void (*clear)(struct _StringRenderer *);
-       unsigned int (*get_line_height)(struct _StringRenderer *,       
-               const char *);
+  void (*clear) (struct _StringRenderer *);
+  unsigned int (*get_line_height) (struct _StringRenderer *, const char *);
 } StringRenderer;
 
-StringRenderer *
-new_StringRenderer(Display * dpy, Window w, 
-       const char * font, const char * color);
+StringRenderer *new_StringRenderer (Display * dpy, Window w,
+                                   const char *font, const char *color);
 
 #define new_StringRenderer_root(f,c) new_StringRenderer(NULL, 0, f, c)
 
 #endif /* __STRINGRENDERER_H__ */
-

Index: rootcat/rootcat.c
===================================================================
RCS file: /sources/antiright/antiright/rootcat/rootcat.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- rootcat/rootcat.c   15 Aug 2010 22:23:29 -0000      1.6
+++ rootcat/rootcat.c   22 Aug 2010 18:56:33 -0000      1.7
@@ -25,88 +25,88 @@
 
 
 static inline void
-rootcat_end(StringRenderer * rc, int exit_code)
+rootcat_end (StringRenderer * rc, int exit_code)
 {
-       $(rc, delete);
-       exit(exit_code);
+  $ (rc, delete);
+  exit (exit_code);
 }
 
-static void clear()
+static void
+clear ()
 {
-       StringRenderer * rc;
+  StringRenderer *rc;
 
-       rc=new_StringRenderer_root(NULL, NULL);
-       $(rc, clear);
-       $(rc, delete);
+  rc = new_StringRenderer_root (NULL, NULL);
+  $ (rc, clear);
+  $ (rc, delete);
 }
 
-static void print_usage(const char * app_name, int exit_code)
+static void
+print_usage (const char *app_name, int exit_code)
 {
-       if(exit_code!=0)
-               fprintf(stderr, "%s:  Invalid argument\n", app_name);
-       printf("USAGE %s [-CFcf] [string] ...\n", app_name);
-       exit(exit_code);
+  if (exit_code != 0)
+    fprintf (stderr, "%s:  Invalid argument\n", app_name);
+  printf ("USAGE %s [-CFcf] [string] ...\n", app_name);
+  exit (exit_code);
 }
 
-int main(int argc, char ** argv)
+int
+main (int argc, char **argv)
 {
-       StringRenderer *rc=NULL;
-       int counter=0;
-       int line=0;
-       char * color=NULL;
-       char * font=NULL;
+  StringRenderer *rc = NULL;
+  int counter = 0;
+  int line = 0;
+  char *color = NULL;
+  char *font = NULL;
 
-       while(++counter<argc) 
+  while (++counter < argc)
        {
-               const char * string = argv[counter];
+      const char *string = argv[counter];
 
-               if(string[0]=='-')
+      if (string[0] == '-')
                {
-                       switch(string[1])
+         switch (string[1])
                        {
                        case 'C': /* Set color */
                                counter++;
-                               if(argv[counter])
-                                       color=argv[counter];
+             if (argv[counter])
+               color = argv[counter];
                                else
-                                       print_usage(argv[0], 1);
+               print_usage (argv[0], 1);
                                break;
                        case 'c': /* Clean up previous invocations.  */
-                               clear();
+             clear ();
                                break;
                        case 'F': /* Set font */
                                counter++;
-                               if(argv[counter])
-                                       font=argv[counter];
+             if (argv[counter])
+               font = argv[counter];
                                else
-                                       print_usage(argv[0], 1);
+               print_usage (argv[0], 1);
                                break;
                        case 'h':
-                               print_usage(argv[0], 0);
+             print_usage (argv[0], 0);
                        default:
-                               print_usage(argv[0], 1);
+             print_usage (argv[0], 1);
                        }
                }
                else
                {
-                       if(!rc)
+         if (!rc)
                        {
-                               rc=new_StringRenderer_root( 
-                                       font, color);
-                               $(rc, clear);
+             rc = new_StringRenderer_root (font, color);
+             $ (rc, clear);
                        }
                        {
-                               unsigned int height
-                                       =$(rc, get_line_height, string);
+           unsigned int height = $ (rc, get_line_height, string);
                                
-                               $(rc, draw, (height/2), 
-                                       ((++line)*LINE_SPACING*height), 
-                                       string);
+           $ (rc, draw, (height / 2),
+              ((++line) * LINE_SPACING * height), string);
                        }
                }
        }
-       if(rc) $(rc, delete);
+  if (rc)
+    $ (rc, delete);
 
        return 0;
 }
-

Index: rootcat/rootcat.h
===================================================================
RCS file: /sources/antiright/antiright/rootcat/rootcat.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- rootcat/rootcat.h   15 Aug 2010 22:23:29 -0000      1.1
+++ rootcat/rootcat.h   22 Aug 2010 18:56:33 -0000      1.2
@@ -43,4 +43,3 @@
 #include "StringRenderer.h"
 
 #endif /* __ROOTCAT_H__ */
-



reply via email to

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