antiright-devel
[Top][All Lists]
Advanced

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

[Antiright-devel] antiright ACE-desktop/hacks/calculator.sh ACE-d...


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright ACE-desktop/hacks/calculator.sh ACE-d...
Date: Fri, 27 Aug 2010 20:35:24 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Changes by:     Jeffrey Bedard <jefbed> 10/08/27 20:35:23

Modified files:
        ACE-desktop/hacks: calculator.sh local_loads.sh 
                           simple_load_applet.sh 
        gtkshell       : add_options.c button.c callbacks.c 
                         command_shell.c command_shell.h form.c macros.h 
                         main.c module_includes.h option_options.c 
                         option_options.h options.c pane.c terminal.c 
                         terminal.h terminal_options.c 
                         terminal_options.h text.c updated_progress.c 
        xshell         : Makefile decoration.h events.c text.c widget.c 
                         xshell.c 

Log message:
        Only used command_shell.[ch] when VTE is not detected.  Use null option 
        callback on when command shell is used, to ensure functionality of
        scripts written for terminal code.  Conducted various code cleanups and
        optimizations, including removing several explicit gtk_show_widget
        invocations.  Refactor pane code to unify duplicated code.  Fixed
        command-initiated label/button code to prevent crash due to failure
        to increment argument counter.  

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/ACE-desktop/hacks/calculator.sh?cvsroot=antiright&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/antiright/ACE-desktop/hacks/local_loads.sh?cvsroot=antiright&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/antiright/ACE-desktop/hacks/simple_load_applet.sh?cvsroot=antiright&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/add_options.c?cvsroot=antiright&r1=1.65&r2=1.66
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/button.c?cvsroot=antiright&r1=1.66&r2=1.67
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/callbacks.c?cvsroot=antiright&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/command_shell.c?cvsroot=antiright&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/command_shell.h?cvsroot=antiright&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/form.c?cvsroot=antiright&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/macros.h?cvsroot=antiright&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/main.c?cvsroot=antiright&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/module_includes.h?cvsroot=antiright&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/option_options.c?cvsroot=antiright&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/option_options.h?cvsroot=antiright&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/options.c?cvsroot=antiright&r1=1.52&r2=1.53
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/pane.c?cvsroot=antiright&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/terminal.c?cvsroot=antiright&r1=1.43&r2=1.44
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/terminal.h?cvsroot=antiright&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/terminal_options.c?cvsroot=antiright&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/terminal_options.h?cvsroot=antiright&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/text.c?cvsroot=antiright&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/updated_progress.c?cvsroot=antiright&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/Makefile?cvsroot=antiright&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/decoration.h?cvsroot=antiright&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/events.c?cvsroot=antiright&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/text.c?cvsroot=antiright&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/widget.c?cvsroot=antiright&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/antiright/xshell/xshell.c?cvsroot=antiright&r1=1.10&r2=1.11

Patches:
Index: ACE-desktop/hacks/calculator.sh
===================================================================
RCS file: /sources/antiright/antiright/ACE-desktop/hacks/calculator.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ACE-desktop/hacks/calculator.sh     12 Nov 2007 11:30:46 -0000      1.1
+++ ACE-desktop/hacks/calculator.sh     27 Aug 2010 20:35:23 -0000      1.2
@@ -1,5 +1,5 @@
 #!/bin/sh
-TEMP=/tmp/ACE_Hack_calculator.$$
+TEMP=`mktemp`
 COMMAND=bc
 VERSION="calculator.sh 1.0"
 touch $TEMP

Index: ACE-desktop/hacks/local_loads.sh
===================================================================
RCS file: /sources/antiright/antiright/ACE-desktop/hacks/local_loads.sh,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- ACE-desktop/hacks/local_loads.sh    25 Aug 2010 20:50:49 -0000      1.3
+++ ACE-desktop/hacks/local_loads.sh    27 Aug 2010 20:35:23 -0000      1.4
@@ -19,18 +19,10 @@
 
 
 if [ "$1" = "--hostload" ]; then
-LOAD="$(uptime | tr ' ' '\n' | awk -F, 'BEGIN{is_load=0}\
-       /averages/{is_load=1} {{if((is_load>0)&&(++is_load > 2))\
-       {print($1); exit}}}')"
-       if [ "$2" = "-l" ]; then
-               echo $LOAD
-       else
-               SCALE="$(echo $LOAD | cut -d. -f1)"
-               echo "scale=2; $LOAD/($SCALE+1)" | bc -l
-       fi
+       LOAD="`uptime | cut -dg -f2 | cut -d, -f1 | cut -d: -f2`"
+       echo "3 k $LOAD 0.1 * p" | dc
 else
        nice -n 20 gtkshell -al "$(hostname)"\
-               -aul "echo -n 'Load:  ';\
-                       ACE -A Hack local_loads --hostload -l"\
-               -aup "ACE -A Hack local_loads --hostload"
+               -aul uptime\
+               -aup 'ACE -A Hack local_loads --hostload'
 fi

Index: ACE-desktop/hacks/simple_load_applet.sh
===================================================================
RCS file: /sources/antiright/antiright/ACE-desktop/hacks/simple_load_applet.sh,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- ACE-desktop/hacks/simple_load_applet.sh     25 Aug 2010 20:50:49 -0000      
1.2
+++ ACE-desktop/hacks/simple_load_applet.sh     27 Aug 2010 20:35:23 -0000      
1.3
@@ -17,5 +17,5 @@
 #     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
 
-gtkshell -on -og +0+0 -aul "uptime | cut -d: -f4 "
+gtkshell -on -og +0+0 -aul 'uptime'
 

Index: gtkshell/add_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/add_options.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -b -r1.65 -r1.66
--- gtkshell/add_options.c      26 Aug 2010 18:50:19 -0000      1.65
+++ gtkshell/add_options.c      27 Aug 2010 20:35:23 -0000      1.66
@@ -48,6 +48,7 @@
   gsh_setup_hpaned (gsh, argv[++(*counter)]);
 }
 
+#ifndef HAVE_VTE
 void
 gsh_add_command_cb (GSH * gsh, gint * counter, const gchar ** argv)
 {
@@ -60,6 +61,7 @@
   /* The command instance is not freed here, 
      as it is accessed by callbacks.  */
 }
+#endif /* not HAVE_VTE */
 
 void
 gsh_add_editor_cb (GSH * gsh, gint * counter, const gchar ** argv)
@@ -149,7 +151,7 @@
 {
   gchar *text;
 
-  text = antiright_pipe_read (argv[*counter]);
+  text = antiright_pipe_read (argv[++*counter]);
   function (gsh, text);
   g_free (text);
 }

Index: gtkshell/button.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/button.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- gtkshell/button.c   26 Aug 2010 18:50:19 -0000      1.66
+++ gtkshell/button.c   27 Aug 2010 20:35:23 -0000      1.67
@@ -47,10 +47,7 @@
       struct GSHCBData *cb;
 
       cb = ARNEW (gsh, GSHCBData, gsh, g_strdup (command));
-      (void) g_signal_connect (G_OBJECT (button),
-                              GTK_IS_MENU_ITEM (button)
-                              ? "activate" : "clicked",
-                              G_CALLBACK (cb->system), cb);
+      GSHSETCB(button, cb->system, cb);
     }
   else
     GSH_UNSET (GSH_MENU_BUTTON);
@@ -70,11 +67,11 @@
 
   for (mapping_count = 0; mapping_count < mapping_size; mapping_count++)
     {
-      if (!strcmp (mapping[mapping_count].label,
-                  g_strstrip ((gchar *) label)))
+      if (!strncmp (mapping[mapping_count].label,
+                  g_strstrip ((gchar *) label), 2))
        {
-         gtk_widget_show (image = gsh_get_image (mapping[mapping_count].icon,
-                                                 GTK_ICON_SIZE_BUTTON));
+         image = gsh_get_image (mapping[mapping_count].icon, 
+                                 GTK_ICON_SIZE_BUTTON);
          gtk_widget_set_tooltip_text (image, label);
          break;
        }
@@ -121,14 +118,11 @@
   GtkWidget *toolitem;
   GtkWidget *toolbutton;
 
-  GSH_CREATE (toolitem, tool_item);
-  GSH_CREATE (toolbutton, button);
+  GSH_ADD_WIDGET(gsh->widgets.app.toolbar, toolitem, tool_item)
+  GSH_ADD_WIDGET(toolitem, toolbutton, button);
   setup_label_for_toolbutton (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 bool
@@ -163,9 +157,9 @@
       GtkWidget *vrow = gsh->rows->v;
       GtkWidget *button;
 
-      gtk_widget_show (button=gsh->widgets.button 
+      button=gsh->widgets.button 
                        = (!GTK_IS_MENU (vrow) && !GTK_IS_MENU_BAR (vrow)) 
-                       ? gtk_button_new () : gtk_image_menu_item_new ());
+        ? 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);

Index: gtkshell/callbacks.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/callbacks.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- gtkshell/callbacks.c        25 Aug 2010 20:50:49 -0000      1.42
+++ gtkshell/callbacks.c        27 Aug 2010 20:35:23 -0000      1.43
@@ -63,11 +63,12 @@
 static bool
 test_special_command (struct GSHCBData *cb)
 {
-  const gchar *command = cb->data;
+  const gchar *command = g_strstrip(cb->data);
   const size_t cmdsiz=strlen(command);
   struct GSH *gsh = cb->gsh;
 
 #define GSS(sig) gsh_send_signal(gsh->editor.widget, sig)
+#define TESTEDITOR() if(gsh->editor.widget) break
   if(command[cmdsiz-1] != '_')
     return FALSE; /* special commands end with _ */
   switch(tolower(command[0]))
@@ -76,6 +77,7 @@
       antiright_system ("gtkshell -da &");
       break;
     case 'c':
+      TESTEDITOR();
       if(tolower(command[1])=='u')
         GSS("cut-clipboard");
       else
@@ -85,12 +87,15 @@
       gtk_main_quit();
       break;
     case 'o':
+      TESTEDITOR();
       gsh_editor_open (gsh);
       break;
     case 'p':
+      TESTEDITOR();
         GSS("paste-clipboard");
       break;
     case 's':
+      TESTEDITOR();
       if((cmdsiz>5) && (tolower(command[5]) == 'a'))
         gsh_editor_save_as (gsh);
       else

Index: gtkshell/command_shell.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/command_shell.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- gtkshell/command_shell.c    26 Aug 2010 18:50:19 -0000      1.9
+++ gtkshell/command_shell.c    27 Aug 2010 20:35:23 -0000      1.10
@@ -19,7 +19,7 @@
   along with GUIShell; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
 */
-
+#ifndef HAVE_VTE
 #include "gtkshell.h"
 
 static void
@@ -123,3 +123,5 @@
 
   return shell;
 }
+#endif /* note HAVE_VTE */
+

Index: gtkshell/command_shell.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/command_shell.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- gtkshell/command_shell.h    25 Aug 2010 20:50:49 -0000      1.5
+++ gtkshell/command_shell.h    27 Aug 2010 20:35:23 -0000      1.6
@@ -22,6 +22,7 @@
 
 #ifndef GSH_CMDSHELL_H
 #define GSH_CMDSHELL_H
+#ifndef HAVE_VTE
 
 struct GSHCommandShell
 {
@@ -40,4 +41,5 @@
 
 GSHCommandShell *gsh_new_GSHCommandShell ();
 
-#endif /* GSH_CMDSHELL_H */
+#endif /* not HAVE_VTE */
+#endif /* not GSH_CMDSHELL_H */

Index: gtkshell/form.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/form.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- gtkshell/form.c     25 Aug 2010 20:50:50 -0000      1.4
+++ gtkshell/form.c     27 Aug 2010 20:35:23 -0000      1.5
@@ -50,11 +50,11 @@
   GtkWidget *controls;
   GtkWidget *button;
 
-  gtk_widget_show (controls = gtk_hbox_new (TRUE, 2));
-  gtk_widget_show (button = gtk_button_new_from_stock (GTK_STOCK_CLOSE));
+  controls = gtk_hbox_new (TRUE, 2);
+  button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
   GSHCONNECT (button, "clicked", gtk_main_quit, NULL);
   GSHCA (controls, button);
-  gtk_widget_show (button = gtk_button_new_from_stock (GTK_STOCK_OK));
+  button = gtk_button_new_from_stock (GTK_STOCK_OK);
   GSHCONNECT (button, "clicked", submit_cb, radio_base);
   GSHCA (controls, button);
   GSHCA (vertical, controls);
@@ -70,7 +70,6 @@
   element = g_strsplit (contents, ",", -1);
   assert (element[0]);
   radio_base = gtk_radio_button_new_with_label (NULL, element[0]);
-  gtk_widget_show (radio_base);
   GSHCA (vertical, radio_base);
   for (counter = 1; element[counter]; counter++)
     {
@@ -80,7 +79,6 @@
        gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON
                                                     (radio_base),
                                                     element[counter]);
-      gtk_widget_show (radio);
       GSHCA (vertical, radio);
     }
 

Index: gtkshell/macros.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/macros.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- gtkshell/macros.h   26 Aug 2010 18:50:19 -0000      1.28
+++ gtkshell/macros.h   27 Aug 2010 20:35:23 -0000      1.29
@@ -99,7 +99,11 @@
   ADD_STOCK_ITEM(button, cont, var, __VA_ARGS__)
 
 #define GSHCONNECT(widget, signal, cb, cbdata)\
-       g_signal_connect(G_OBJECT(widget), signal, G_CALLBACK(cb), cbdata);
+       g_signal_connect(G_OBJECT(widget), signal, G_CALLBACK(cb), cbdata)
+
+#define GSHSETCB(widget, cb, cbdata)\
+        GSHCONNECT(widget, (G_UNLIKELY(GTK_IS_MENU_ITEM(widget)) \
+                            ? "activate" : "clicked"), cb, cbdata)
 
 #define GSH_OPTION_FUNC_NAME(option, op) gsh_option_##op##_##option
 #define GSH_OPTION_PROTOTYPE(name)\

Index: gtkshell/main.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/main.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- gtkshell/main.c     26 Aug 2010 18:50:19 -0000      1.40
+++ gtkshell/main.c     27 Aug 2010 20:35:23 -0000      1.41
@@ -35,7 +35,6 @@
   gsh_GSH (gsh);
   $ (gsh, parse, (const gint) argc, (const gchar **) argv);
   $ (gsh, finalize);
-  //$ (argset, delete);
   if (gsh->command_dictionary)
     $ (gsh->command_dictionary, delete);
 #ifdef LIBGC

Index: gtkshell/module_includes.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/module_includes.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- gtkshell/module_includes.h  26 Aug 2010 18:50:19 -0000      1.19
+++ gtkshell/module_includes.h  27 Aug 2010 20:35:23 -0000      1.20
@@ -41,19 +41,25 @@
 #include "font.h"
 #include "dragdrop.h"
 #include "image_button.h"
+
+#ifdef HAVE_VTE
 #include "terminal_options.h"
 #include "terminal.h"
+#else /* not HAVE_VTE */
+#include "command_shell.h"
+#endif /* HAVE_VTE */
+
 #include "guidl_dictionary.h"
 #include "guidl_util.h"
-#include "about_dialog.h"
-#include "menu.h"
-#include "init.h"
 #include "guidl_dialog.h"
 #include "guidl_options.h"
 #include "guidl_widgets.h"
+
+#include "about_dialog.h"
+#include "menu.h"
+#include "init.h"
 #include "update_manager.h"
 #include "pane.h"
-#include "command_shell.h"
 #include "app_mode.h"
 #include "applets.h"
 #include "tree.h"

Index: gtkshell/option_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/option_options.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- gtkshell/option_options.c   25 Aug 2010 20:50:50 -0000      1.47
+++ gtkshell/option_options.c   27 Aug 2010 20:35:23 -0000      1.48
@@ -24,6 +24,13 @@
 #include "gtkshell.h"
 
 void
+gsh_option_null_cb (GSH * gsh __attribute__ ((unused)), 
+                    gint * counter __attribute__ ((unused)), 
+                    const gchar ** argv __attribute__ ((unused)))
+{
+}
+
+void
 gsh_option_app_mode_cb (GSH * gsh, gint * counter __attribute__ ((unused)),
                        const gchar ** argv __attribute__ ((unused)))
 {

Index: gtkshell/option_options.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/option_options.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- gtkshell/option_options.h   25 Aug 2010 20:50:50 -0000      1.16
+++ gtkshell/option_options.h   27 Aug 2010 20:35:23 -0000      1.17
@@ -23,6 +23,13 @@
 #ifndef GSH_OPTION_OPTIONS_H
 #define GSH_OPTION_OPTIONS_H
 
+#ifndef HAVE_VTE
+void
+gsh_option_null_cb (GSH * gsh __attribute__ ((unused)), 
+                    gint * counter __attribute__ ((unused)), 
+                    const gchar ** argv __attribute__ ((unused)));
+#endif /* not HAVE_VTE */
+
 void 
 gsh_option_app_mode_cb (GSH * gsh, gint * counter, const gchar ** argv);
 

Index: gtkshell/options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/options.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- gtkshell/options.c  26 Aug 2010 18:50:19 -0000      1.52
+++ gtkshell/options.c  27 Aug 2010 20:35:23 -0000      1.53
@@ -66,7 +66,6 @@
   common_guidl_handler (gsh);
 }
 
-
 static inline void
 add_to_usage (GSH * gsh, const gchar * key, const gchar * descr)
 {
@@ -96,7 +95,6 @@
   ARTDEF ("-ab", gsh_add_pane_cb, "add resizable pane");
   ARTDEF ("-acb", gsh_add_commanded_button_cb, "add commanded button");
   ARTDEF ("-acl", gsh_add_commanded_label_cb, "add commanded label");
-  ARTDEF ("-aC", gsh_add_command_cb, "add default command callback");
   ARTDEF ("-ae", gsh_add_editor_cb, "add editor");
   ARTDEF ("-af", gsh_add_form_cb, "add radio button form");
   ARTDEF ("-aL", gsh_add_list_cb, "add list");
@@ -105,11 +103,16 @@
   ARTDEF ("-ap", gsh_add_piped_label_cb, "add piped label from stdin");
   ARTDEF ("-ar", gsh_add_row_cb, "add new row");
   ARTDEF ("-aS", gsh_add_separator_cb, "add separator");
+#ifdef HAVE_VTE
   ARTDEF ("-as", gsh_add_shell_cb, "add terminal (VTE)");
+#else /* not HAVE_VTE */
+  ARTDEF ("-as", gsh_add_command_cb, "add command shell");
+#endif /* HAVE_VTE */
   ARTDEF ("-at", gsh_add_entry_cb, "add text entry");
   ARTDEF ("-aT", gsh_add_text_cb, "add text editor");
   ARTDEF ("-aw", gsh_add_window_cb, "add new window");
 
+
   /* Updating widgets */
   ARTDEF ("-aul", gsh_add_updating_label_cb, "add updating label");
   ARTDEF ("-aup", gsh_add_updating_progress_cb, "add updating progress bar");
@@ -136,6 +139,7 @@
   ARTDEF ("-oT", gsh_option_title_cb, "set window title");
   ARTDEF ("-ou", gsh_option_update_cb, "set update frequency");
 
+#ifdef HAVE_VTE
   /* Terminal options */
   ARTDEF ("-otf", gsh_option_terminal_font_cb, "set terminal font");
   ARTDEF ("-oth", gsh_option_terminal_height_cb, "set terminal height");
@@ -144,6 +148,14 @@
          "set not transparent");
   ARTDEF ("-ott", gsh_option_terminal_transparent_cb, "set transparent");
   ARTDEF ("-otw", gsh_option_terminal_width_cb, "set terminal width");
+#else /* not HAVE_VTE */
+  ARTDEF ("-otf", gsh_option_null_cb, "NOT SUPPORTED:  set terminal font");
+  ARTDEF ("-oth", gsh_option_null_cb, "NOT SUPPORTED:  set terminal height");
+  ARTDEF ("-otN", gsh_option_null_cb, "NOT SUPPORTED:  set terminal not tab");
+  ARTDEF ("-otT", gsh_option_null_cb, "NOT SUPPORTED:  set not transparent");
+  ARTDEF ("-ott", gsh_option_null_cb, "NOT SUPPORTED:  set transparent");
+  ARTDEF ("-otw", gsh_option_null_cb, "NOT SUPPORTED:  set terminal width");
+#endif /* HAVE_VTE */
 
   /* Dialog options */
   ARTDEF ("-da", gsh_dialog_about_cb, "show about dialog");

Index: gtkshell/pane.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/pane.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- gtkshell/pane.c     25 Aug 2010 20:50:50 -0000      1.9
+++ gtkshell/pane.c     27 Aug 2010 20:35:23 -0000      1.10
@@ -27,10 +27,10 @@
 void
 gsh_reparent_widget (GtkWidget * widget, GtkWidget * old, GtkWidget * new)
 {
-  gtk_widget_ref (widget);
+  g_object_ref (widget);
   gtk_container_remove (GTK_CONTAINER (old), widget);
   gtk_container_add (GTK_CONTAINER (new), widget);
-  gtk_widget_unref (widget);
+  g_object_unref (widget);
 }
 
 #define REPARENT_TO(new) gsh_reparent_widget(gsh->rows->v, gsh->rows->h, new)
@@ -47,57 +47,33 @@
 }
 
 static GtkWidget *
-setup_first_pane_half (struct GSH *gsh, const gchar ** pair)
+setup_pane_half(GSH * gsh, const gchar *label)
 {
-  GtkWidget *first;
+  GtkWidget *frame;
 
-  gtk_widget_show (first = gtk_frame_new (pair[0]));
-  REPARENT_TO (first);
+  frame=gtk_frame_new(label);
+  REPARENT_TO(frame);
 
-  return first;
-}
-
-static GtkWidget *
-setup_second_pane_half (struct GSH *gsh, gchar ** pair)
-{
-  GtkWidget *second;
-
-  gtk_widget_show (second = gtk_frame_new (pair[1]));
-  g_strfreev (pair);
-  REPARENT_TO (second);
-
-  return second;
-}
-
-static void
-assign_pane_sections (GtkWidget * pane, GtkWidget * first, GtkWidget * second)
-{
-  gtk_paned_add1 (GTK_PANED (pane), first);
-  gtk_paned_add2 (GTK_PANED (pane), second);
+  return frame;
 }
 
 void
 gsh_setup_hpaned (struct GSH *gsh, const gchar * label_pair)
 {
   GtkWidget *pane;
+
   pane = gtk_hpaned_new ();
   {
     gchar **pair;
 
     pair = g_strsplit (label_pair, ",", 2);
-    {
-      GtkWidget *first;
-
-      first = setup_first_pane_half (gsh, (const gchar **) pair);
+    /* assign pane sections */
+    gtk_paned_add1 (GTK_PANED (pane), 
+                    setup_pane_half(gsh, (const gchar *)pair[0]));
       split_columns_for_pane (gsh, pane);
-      {
-       GtkWidget *second;
-
-       /* PAIR freed here.  */
-       second = setup_second_pane_half (gsh, pair);
-       assign_pane_sections (pane, first, second);
-      }
-    }
+    gtk_paned_add2 (GTK_PANED (pane), 
+                    setup_pane_half(gsh, (const gchar *)pair[1]));
+    g_strfreev(pair);
   }
 }
 
@@ -110,13 +86,9 @@
 
   pane = gtk_vpaned_new ();
   prev_frame = gtk_frame_new (NULL);
-#ifdef DEBUG
-  ARPASSERT (gsh->widgets.last_managed);
-#endif /* DEBUG */
   gsh_reparent_widget (gsh->widgets.last_managed, gsh->rows->v, prev_frame);
-  assign_pane_sections (pane, prev_frame, target);
-  gtk_widget_show (prev_frame);
-  gtk_widget_show (target);
+  gtk_paned_add1(GTK_PANED(pane), prev_frame);
+  gtk_paned_add2(GTK_PANED(pane), target);
   GSH_UNSET (GSH_PANE_NEXT);
   $ (gsh, manage, pane);
 }

Index: gtkshell/terminal.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/terminal.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- gtkshell/terminal.c 26 Aug 2010 18:50:20 -0000      1.43
+++ gtkshell/terminal.c 27 Aug 2010 20:35:23 -0000      1.44
@@ -24,6 +24,7 @@
 
 #include <vte/reaper.h>
 
+#ifdef HAVE_VTE
 static void
 set_terminal_options (GSHTerminal *term)
 {
@@ -261,6 +262,7 @@
 setup_notebook(GSHTerminal *term)
 {
   GtkWidget *notebook;
+
   GSH_CREATE(notebook=term->__notebook, notebook);
   setup_action_widgets(term);
   GSHCONNECT (notebook, "change-current-page", change_page_cb, term);
@@ -276,6 +278,7 @@
   GtkWidget *term_widget;
 
   term_widget = term->widget = vte_terminal_new ();
+  gtk_widget_show(term_widget);
   gtk_notebook_set_current_page(notebook, 
                                 gtk_notebook_append_page (notebook, 
                                                           term_widget, 
@@ -327,3 +330,5 @@
   return term;
 }
 
+#endif /* HAVE_VTE */
+

Index: gtkshell/terminal.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/terminal.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- gtkshell/terminal.h 25 Aug 2010 20:50:50 -0000      1.11
+++ gtkshell/terminal.h 27 Aug 2010 20:35:23 -0000      1.12
@@ -22,6 +22,7 @@
 
 #ifndef GSH_TERMINAL_H
 #define GSH_TERMINAL_H
+#ifdef HAVE_VTE
 
 #include "terminal_struct.h"
 
@@ -29,4 +30,6 @@
 
 GSHTerminal *gsh_new_GSH_Terminal (GSH * gsh);
 
-#endif
+#endif /* HAVE_VTE */
+#endif /* not GSH_TERMINAL_H */
+

Index: gtkshell/terminal_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/terminal_options.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- gtkshell/terminal_options.c 25 Aug 2010 20:50:50 -0000      1.14
+++ gtkshell/terminal_options.c 27 Aug 2010 20:35:23 -0000      1.15
@@ -21,6 +21,8 @@
   Boston, MA  02110-1301  USA
 */
 
+#ifdef HAVE_VTE
+
 #include "gtkshell.h"
 #define CHECKTERM if(!(gsh->terminal))\
   gsh->terminal = ARNEW (gsh, GSH_Terminal, gsh);
@@ -71,3 +73,5 @@
 {
   gsh->terminal = NULL;
 }
+
+#endif /* HAVE_VTE */

Index: gtkshell/terminal_options.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/terminal_options.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- gtkshell/terminal_options.h 25 Aug 2010 20:50:50 -0000      1.7
+++ gtkshell/terminal_options.h 27 Aug 2010 20:35:23 -0000      1.8
@@ -23,6 +23,7 @@
 
 #ifndef GSH_TERMINAL_OPTIONS_H
 #define GSH_TERMINAL_OPTIONS_H
+#ifdef HAVE_VTE
 
 void
 gsh_option_terminal_width_cb (GSH * gsh, gint * counter, const gchar ** argv);
@@ -46,4 +47,5 @@
 gsh_option_terminal_not_tab_cb (GSH * gsh,
                                gint * counter, const gchar ** argv);
 
+#endif /* HAVE_VTE */
 #endif /* not GSH_TERMINAL_OPTIONS_H */

Index: gtkshell/text.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/text.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- gtkshell/text.c     26 Aug 2010 18:50:20 -0000      1.50
+++ gtkshell/text.c     27 Aug 2010 20:35:23 -0000      1.51
@@ -291,3 +291,4 @@
       add_to_recent_files (gsh, gsh->editor.filename);
     }
 }
+

Index: gtkshell/updated_progress.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/updated_progress.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- gtkshell/updated_progress.c 25 Aug 2010 20:50:51 -0000      1.20
+++ gtkshell/updated_progress.c 27 Aug 2010 20:35:23 -0000      1.21
@@ -22,16 +22,26 @@
 
 #include "gtkshell.h"
 
+static gdouble
+get_command_val (const gchar * command)
+{
+  gchar *output;
+  gdouble result;
+
+  output=antiright_pipe_read(command);
+  result=g_strtod(output, NULL);
+  g_free(output);
+  if(result>1)
+    result=1;
+
+  return result;
+}
+
 static void
 gsh_update_progress (const gchar * command, gpointer widget)
 {
-  gchar *results;
-
-  gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR ((GtkWidget *) widget),
-                                g_strtod (results =
-                                          antiright_pipe_read (command),
-                                          NULL));
-  g_free (results);
+  gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (widget), 
+                                 get_command_val(command));
 }
 
 void
@@ -42,3 +52,4 @@
   $ (gsh, manage, progress = gtk_progress_bar_new ());
   GSH_NEW_UPDATER_WITH_COMMAND (gsh, gsh_update_progress, progress, command);
 }
+

Index: xshell/Makefile
===================================================================
RCS file: /sources/antiright/antiright/xshell/Makefile,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- xshell/Makefile     26 Aug 2010 18:50:20 -0000      1.13
+++ xshell/Makefile     27 Aug 2010 20:35:23 -0000      1.14
@@ -37,7 +37,7 @@
 CFLAGS+=-DXSH_DECORATE
 # For use with patched version of evilwm
 # CFLAGS+=-DEVILWM_HACK_HACK
-#CFLAGS+=-DXSH_USE_GRADIENT
+CFLAGS+=-DXSH_USE_GRADIENT
 #CFLAGS+=-DXSH_USE_INDICATORS
 #CFLAGS+=-DDEBUG -g3 -Wall -W -Werror
 #CFLAGS+=-DDEBUG_EVENTS

Index: xshell/decoration.h
===================================================================
RCS file: /sources/antiright/antiright/xshell/decoration.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- xshell/decoration.h 25 Aug 2010 20:50:51 -0000      1.9
+++ xshell/decoration.h 27 Aug 2010 20:35:23 -0000      1.10
@@ -36,8 +36,10 @@
 void
 xsh_decorate(XWidget * widget, int order);
 
+#if 0
 void
 xsh_setup_gradients(XShell * xsh);
+#endif
 
 #ifdef XSH_USE_INDICATORS
 #define XSH_INDICATE_ERROR     0

Index: xshell/events.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/events.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- xshell/events.c     25 Aug 2010 20:50:52 -0000      1.6
+++ xshell/events.c     27 Aug 2010 20:35:23 -0000      1.7
@@ -85,30 +85,27 @@
 xsh_event_loop(XShell * xsh)
 {
        XEvent event;
-       Display *dpy;
-
-       XFlush(xsh->gui.display);
+       Display *dpy=xsh->gui.display;
        
        for(dpy=xsh->gui.display;;XNextEvent(dpy, &event))      
        {
-               if(event.type==ConfigureNotify)
+          switch(event.type)
                {
+            case ConfigureNotify:
 #ifdef DEBUG_EVENTS
                        XMSG("ConfigureNotify");
 #endif /* DEBUG_EVENTS */
-                       xsh->gui.widgets->geometry.width
-                               =event.xconfigure.width;
-               /*      xsh->gui.widgets->geometry.height
-                               =event.xconfigure.height; */
+             xsh->gui.widgets->geometry.width=event.xconfigure.width;
                        if(event.xany.window == xsh->gui.widgets->window)
-                               xsh->gui.widgets->geometry.height
-                                               =event.xconfigure.height; 
+                xsh->gui.widgets->geometry.height=event.xconfigure.height; 
                        xsh_layout_widgets(xsh);
-               }
-               else
+              break;
+            case DestroyNotify:
+              exit(0);
+              break;
+            default:
                        xshell_foreach_XWidget(xsh->gui.widgets, &event);
-                       
-               XFlush(dpy);
+            }
        }
 }
 

Index: xshell/text.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/text.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- xshell/text.c       25 Aug 2010 20:50:52 -0000      1.11
+++ xshell/text.c       27 Aug 2010 20:35:23 -0000      1.12
@@ -40,6 +40,7 @@
                unsigned int line_length;
 
                end=strchr(text, '\n');
+                if(end)
                *end='\0';
        
                line_length=(length=strlen(text)) < columns ? length : columns;

Index: xshell/widget.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/widget.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- xshell/widget.c     25 Aug 2010 20:50:52 -0000      1.5
+++ xshell/widget.c     27 Aug 2010 20:35:23 -0000      1.6
@@ -64,7 +64,7 @@
        long event_mask;
 
        event_mask = ButtonPressMask | ButtonReleaseMask
-               | ExposureMask | KeyPressMask;
+               | ExposureMask | KeyPressMask | StructureNotifyMask;
        if(widget->window == xsh->gui.widgets->window)
                event_mask |= StructureNotifyMask; 
        XSelectInput(xsh->gui.display, widget->window, event_mask);

Index: xshell/xshell.c
===================================================================
RCS file: /sources/antiright/antiright/xshell/xshell.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- xshell/xshell.c     25 Aug 2010 20:50:52 -0000      1.10
+++ xshell/xshell.c     27 Aug 2010 20:35:23 -0000      1.11
@@ -131,13 +131,10 @@
                exit(1);
        }
        setup_main_window(&xsh);
-#ifdef XSH_USE_GRADIENT
-       xsh_setup_gradients(&xsh);
-#endif /* XSH_USE_GRADIENT */
        xsh_parse_arguments(&xsh, argc, argv);
-       show_main_window(&xsh);
        xsh_layout_widgets(&xsh);
        apply_toplevel_geometry(&xsh);
+       show_main_window(&xsh);
        xsh_event_loop(&xsh);
        cleanup(&xsh);
 



reply via email to

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