antiright-devel
[Top][All Lists]
Advanced

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

[Antiright-devel] antiright configure gtkshell/add_options.c gtks...


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright configure gtkshell/add_options.c gtks...
Date: Thu, 17 May 2007 16:04:36 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Changes by:     Jeffrey Bedard <jefbed> 07/05/17 16:04:36

Modified files:
        .              : configure 
        gtkshell       : add_options.c terminal.c 

Log message:
        Added checking for presence of VTE, to allow gtkshell to be compiled 
where
        VTE is not supported, such as cygwin.  

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/configure?cvsroot=antiright&r1=1.93&r2=1.94
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/add_options.c?cvsroot=antiright&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/terminal.c?cvsroot=antiright&r1=1.22&r2=1.23

Patches:
Index: configure
===================================================================
RCS file: /sources/antiright/antiright/configure,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -b -r1.93 -r1.94
--- configure   16 May 2007 20:39:43 -0000      1.93
+++ configure   17 May 2007 16:04:35 -0000      1.94
@@ -89,6 +89,14 @@
        fi
 fi
 
+echo -n 'Checking for VTE...  '
+if pkg-config --exists vte; then
+       echo found
+       DEFS="$DEFS -DHAVE_VTE"
+else
+       echo not found
+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"
 

Index: gtkshell/add_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/add_options.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- gtkshell/add_options.c      16 May 2007 20:39:44 -0000      1.34
+++ gtkshell/add_options.c      17 May 2007 16:04:35 -0000      1.35
@@ -104,6 +104,19 @@
        $(gsh, manage, (GtkWidget *)terminal);
 }
 
+static void
+add_command_shell(GSH * gsh, const gchar * command)
+{
+       GSHCommandShell * shell; 
+
+       shell = ARNEW(gsh, GSHCommandShell);
+       $(gsh, manage, $(shell, get));
+       if(command)
+               $(shell, run, command);
+       /* The command instance is not freed here,
+        * as it is accessed by callbacks.  */
+}
+
 void
 gsh_handle_add_arguments(GSH * gsh, const gint argc, const gchar **argv, 
        gint *counter)
@@ -117,14 +130,7 @@
                break;
 
        case 'C':
-               {
-                       GSHCommandShell * command;
-
-                       command = ARNEW(gsh, GSHCommandShell);
-                       $(gsh, manage, $(command, get));
-                       /* The command instance is not freed here,
-                        * as it is accessed by callbacks.  */
-               }
+               add_command_shell(gsh, NULL);
                break;
 
        case 'c':
@@ -159,7 +165,11 @@
 
        case 's': /* Add a shell.  */
                GSH_COUNT(argc, counter);
+#ifdef HAVE_VTE
                add_shell(gsh, argv[*counter]);
+#else /* not HAVE_VTE */
+               add_command_shell(gsh, argc[*counter]);
+#endif /* HAVE_VTE */
                break;
 
        case 't':

Index: gtkshell/terminal.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/terminal.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- gtkshell/terminal.c 17 May 2007 04:32:20 -0000      1.22
+++ gtkshell/terminal.c 17 May 2007 16:04:35 -0000      1.23
@@ -22,15 +22,19 @@
 
 #include "gtkshell.h"
 
-
+#ifdef HAVE_VTE
 #define VSET(element, widget, ...)\
        vte_terminal_set_##element(VTE_TERMINAL(widget), __VA_ARGS__)
+#endif /* HAVE_VTE */
 
 #define GT term
 
+#ifdef HAVE_VTE
 #define VSETW(element, ...)\
        VSET(element, term->widget, __VA_ARGS__)
+#endif /* HAVE_VTE */
 
+#ifdef HAVE_VTE
 static void
 set_vte_specific_terminal_options(struct GSH_Terminal * term)
 {
@@ -45,11 +49,15 @@
                term->transparent=FALSE;
        }
 }
+#endif /* HAVE_VTE */
 
 static void
 set_terminal_options(struct GSH_Terminal * term)
 {
+#ifdef HAVE_VTE
        set_vte_specific_terminal_options(term);
+#endif /* HAVE_VTE */
+       if(term->widget)
        gsh_widget_set_font(term->widget, term->font);
 }
 
@@ -74,8 +82,10 @@
                const gchar *argv[] = { shell, "-c", command, NULL };
 
                /* Start the command in the terminal.  */
+#ifdef HAVE_VTE
                vte_terminal_fork_command(VTE_TERMINAL(term->widget), shell, 
                        (char **)argv, (char **)envv, NULL, TRUE, TRUE, TRUE);
+#endif /* HAVE_VTE */
        }
        /* Free after use.  */
        g_free(height);
@@ -85,7 +95,7 @@
 static void
 gsh_delete_GSH_Terminal(struct GSH_Terminal * term)
 {
-       UNUSED(term);
+       g_free(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
@@ -93,7 +103,7 @@
 }
 
 static void
-title_change_cb(VteTerminal * widget, gpointer data)
+title_change_cb(GtkWidget * widget, gpointer data)
 {
        struct GSHCBData * cb;
        GSH * gsh;
@@ -102,12 +112,17 @@
        cb=(struct GSHCBData *)data;
        gsh=cb->gsh;
        window=GTK_WINDOW(gsh->widgets.window);
-
-       gtk_window_set_title(window, vte_terminal_get_window_title(widget));
+       gtk_window_set_title(window, 
+#ifdef HAVE_VTE
+                       vte_terminal_get_window_title(VTE_TERMINAL(widget))
+#else /* not HAVE_VTE */
+                       "Terminal"
+#endif /* HAVE_VTE */
+                       );
 }
 
 static void
-status_changed_cb(VteTerminal * widget, gpointer data)
+status_changed_cb(GtkWidget * widget, gpointer data)
 {
        struct GSHCBData * cb;
        GSH * gsh;
@@ -118,7 +133,13 @@
        if((status=gsh->widgets.app.status))
                gtk_statusbar_push(GTK_STATUSBAR(status),
                        gtk_statusbar_get_context_id(GTK_STATUSBAR(status), 
-                       "terminal"), vte_terminal_get_status_line(widget));
+                       "terminal"), 
+#ifdef HAVE_VTE
+                       vte_terminal_get_status_line(VTE_TERMINAL(widget))
+#else /* not HAVE_VTE */
+                       "terminal"
+#endif /* HAVE_VTE */
+                       );
 }
 
 static void
@@ -129,6 +150,9 @@
 
        gsh=(GSH *)term->gsh;
        widget=term->widget;
+       /* Return if no widget was created.  */
+       if(!widget)
+               return;
        /* Exit from the application if the terminal process dies.  */
        GSHCONNECT(widget, "child-exited", gtk_main_quit, NULL);
        {
@@ -146,7 +170,11 @@
 gsh_GSH_Terminal_add(struct GSH_Terminal * term, const gchar * command)
 {
        /* Create and set properties of the VTE-based terminal.  */
+#ifdef HAVE_VTE
        term->widget = vte_terminal_new();
+#else /* not HAVE_VTE */
+       term->widget = NULL;
+#endif /* HAVE_VTE */
        setup_terminal_signals(term);
        set_terminal_options(term);
        gsh_terminal_run(term, command);




reply via email to

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