antiright-devel
[Top][All Lists]
Advanced

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

[Antiright-devel] antiright gtkshell/add_options.c gtkshell/gsh.h...


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright gtkshell/add_options.c gtkshell/gsh.h...
Date: Fri, 07 Dec 2007 20:00:26 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Changes by:     Jeffrey Bedard <jefbed> 07/12/07 20:00:26

Modified files:
        gtkshell       : add_options.c gsh.h gtkshell.c main.c 
                         option_options.c swallow.c terminal.c text.c 
        libantiright   : system.c 

Log message:
        Add the ability to specify the color of text and clock widgets.  

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/add_options.c?cvsroot=antiright&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/gsh.h?cvsroot=antiright&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/gtkshell.c?cvsroot=antiright&r1=1.46&r2=1.47
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/main.c?cvsroot=antiright&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/option_options.c?cvsroot=antiright&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/swallow.c?cvsroot=antiright&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/terminal.c?cvsroot=antiright&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/text.c?cvsroot=antiright&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/system.c?cvsroot=antiright&r1=1.8&r2=1.9

Patches:
Index: gtkshell/add_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/add_options.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- gtkshell/add_options.c      29 Nov 2007 18:22:44 -0000      1.51
+++ gtkshell/add_options.c      7 Dec 2007 20:00:25 -0000       1.52
@@ -127,7 +127,7 @@
 }
 
 static void
-handle_applet_arguments(GSH * gsh, const gint argc, const gchar ** argv,
+handle_applet_arguments(GSH * gsh, const gchar ** argv,
        gint * counter)
 {
        const gchar * current_arg = argv[*counter];
@@ -151,7 +151,7 @@
        switch (argv[(*counter)][2])
        {
        case 'A': /* Add an internally updated applet.  */
-               handle_applet_arguments(gsh, argc, argv, counter);
+               handle_applet_arguments(gsh, argv, counter);
                break;
 
        case 'b': /* Add a horizontal pane between previous widgets
@@ -246,7 +246,7 @@
                add_new_window(gsh);
                break;
        case 'X':
-               gsh_add_embedded(gsh, argv[++(*counter)]);
+               gsh_add_embedded(gsh, (gchar *)argv[++(*counter)]);
                break;
        default:
                ARWARN("invalid add option");

Index: gtkshell/gsh.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/gsh.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- gtkshell/gsh.h      25 Oct 2007 01:02:41 -0000      1.1
+++ gtkshell/gsh.h      7 Dec 2007 20:00:25 -0000       1.2
@@ -57,6 +57,8 @@
        {
                gchar * filename;
                GtkWidget * widget;
+               gchar * bgcolor;
+               gchar * fgcolor;
        } editor;
 
        /* member classes */

Index: gtkshell/gtkshell.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/gtkshell.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- gtkshell/gtkshell.c 12 Nov 2007 10:28:58 -0000      1.46
+++ gtkshell/gtkshell.c 7 Dec 2007 20:00:25 -0000       1.47
@@ -101,6 +101,8 @@
 {
        gsh->editor.widget=NULL;
        gsh->editor.filename=NULL;
+       gsh->editor.fgcolor=NULL;
+       gsh->editor.bgcolor=NULL;
 }
 
 static void

Index: gtkshell/main.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/main.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- gtkshell/main.c     4 Dec 2007 23:45:30 -0000       1.30
+++ gtkshell/main.c     7 Dec 2007 20:00:25 -0000       1.31
@@ -46,7 +46,7 @@
 int
 main(int argc, char ** argv)
 {
-       guint counter;
+       gint counter;
        struct ARArguments * argset;
        GSH * gsh;
 
@@ -57,7 +57,7 @@
 
        //threads=malloc(sizeof(pthread_t));
 
-       for(counter=1; counter<argc; counter++)
+       for(counter=1; (int)counter<argc; counter++)
        {
                /* Use '---' as thread separator.  */
                if(!strncmp(argv[counter], "---", 3))

Index: gtkshell/option_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/option_options.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- gtkshell/option_options.c   6 Dec 2007 14:40:50 -0000       1.36
+++ gtkshell/option_options.c   7 Dec 2007 20:00:25 -0000       1.37
@@ -96,6 +96,13 @@
                   displaying an item for it.  */
                GSH_SET(GSH_CHECK_COMMANDS);
                break;
+       case 'c':
+               /* Set text widget background and foreground colors.  */
+               GSH_COUNT(argc, counter);
+               gsh->editor.bgcolor=argv[*counter];
+               GSH_COUNT(argc, counter);
+               gsh->editor.fgcolor=argv[*counter];
+               break;
        case 'D':
                /* Do not insert the dummy "guidl" string before the
                   arguments passed by means of a guidl definition.  

Index: gtkshell/swallow.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/swallow.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- gtkshell/swallow.c  29 Nov 2007 18:22:44 -0000      1.3
+++ gtkshell/swallow.c  7 Dec 2007 20:00:25 -0000       1.4
@@ -181,14 +181,15 @@
        GdkNativeWindow window_id;
 };
 
-static void
-swallow_app(gpointer client_data, gpointer user_data)
+static gboolean
+swallow_app(gpointer client_data)
 {
        struct SwallowData * swallow_manager = client_data;
 
        gtk_socket_steal(swallow_manager->swallower, 
                swallow_manager->window_id);
-//     g_free(swallow_manager);
+/*     g_free(swallow_manager); */
+       return FALSE;
 }
 
 void

Index: gtkshell/terminal.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/terminal.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- gtkshell/terminal.c 4 Dec 2007 23:45:30 -0000       1.32
+++ gtkshell/terminal.c 7 Dec 2007 20:00:25 -0000       1.33
@@ -70,7 +70,7 @@
        return shell ? shell : (const gchar *)GSH_DEFAULT_SHELL;
 }
 
-#if 0
+#ifdef USE_TABS
 static void
 handle_child_exited(GtkWidget * widget, gpointer user_data)
 {
@@ -79,7 +79,8 @@
 
        gtk_notebook_remove_page(notebook, gtk_notebook_page_num(notebook, 
widget));
 }
-#endif /* 0 */
+#endif /* USE_TABS */
+
 static void
 gsh_terminal_run(struct GSH_Terminal * term, const gchar * command)
 {
@@ -117,11 +118,11 @@
        g_free(height);
        g_free(width);
 
-#if 0
+#ifdef USE_TABS
        /* Handle terminal exit.  */
        g_signal_connect(G_OBJECT(term->widget), "child-exited", 
                handle_child_exited, term);
-#endif
+#endif /* USE_TABS */
 }
 
 static void
@@ -134,6 +135,10 @@
         * reference counting.  */
 }
 
+#ifndef HAVE_VTE
+#define GSH_TERMINAL_TITLE "Terminal"
+#endif /* !HAVE_VTE */
+
 static void
 title_change_cb(GtkWidget * widget, gpointer data)
 {
@@ -148,7 +153,7 @@
 #ifdef HAVE_VTE
                        vte_terminal_get_window_title(VTE_TERMINAL(widget))
 #else /* not HAVE_VTE */
-                       "Terminal"
+                       GSH_TERMINAL_TITLE
 #endif /* HAVE_VTE */
                        );
 }
@@ -169,7 +174,7 @@
 #ifdef HAVE_VTE
                        vte_terminal_get_status_line(VTE_TERMINAL(widget))
 #else /* not HAVE_VTE */
-                       "terminal"
+                       GSH_TERMINAL_TITLE
 #endif /* HAVE_VTE */
                        );
 }
@@ -203,6 +208,7 @@
 #endif /* USE_TABS */
        connect_terminal_signals_with_data(gsh, widget);
 }
+
 #ifdef USE_TABS
 
 static void

Index: gtkshell/text.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/text.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- gtkshell/text.c     15 Nov 2007 03:17:38 -0000      1.42
+++ gtkshell/text.c     7 Dec 2007 20:00:25 -0000       1.43
@@ -82,11 +82,29 @@
 }
 
 static void
-set_options(GtkWidget * text_widget)
+set_options(GSH * gsh, GtkWidget * text_widget)
 {
        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 */
+               gsh_widget_set_color(text_widget, gsh->editor.fgcolor, TRUE);
+#ifdef DEBUG
+               fprintf(stderr, "bgcolor: %s\n", gsh->editor.bgcolor);
+#endif /* DEBUG */
+       }
 }
 
 
@@ -109,7 +127,7 @@
        ARPASSERT(gsh);
 #endif /* DEBUG */
        gtk_widget_show(text=gsh->editor.widget=gtk_text_view_new());
-       set_options(text);
+       set_options(gsh, text);
        setup_text_scroller(gsh, text);
        setup_undo(gsh);
 

Index: libantiright/system.c
===================================================================
RCS file: /sources/antiright/antiright/libantiright/system.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- libantiright/system.c       10 Apr 2007 22:48:29 -0000      1.8
+++ libantiright/system.c       7 Dec 2007 20:00:25 -0000       1.9
@@ -51,10 +51,11 @@
        ARIFP(field_string)
        {
                char *command;
+               GError *error=NULL;
 
                command = get_command_string(field_string);
 
-               if (system(command) == 0)
+               if (g_spawn_command_line_async(command, &error))
                {
                        g_free(command);
 
@@ -63,7 +64,7 @@
                else
                {
                        g_free(command);
-                       ARWARN("command could not be executed");
+                       ARWARN(error->message);
 
                        return EXIT_FAILURE;
                }




reply via email to

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