[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Antiright-devel] antiright/gtkshell Makefile add_options.c gshte...
From: |
Jeffrey Bedard |
Subject: |
[Antiright-devel] antiright/gtkshell Makefile add_options.c gshte... |
Date: |
Mon, 09 Jul 2007 02:12:26 +0000 |
CVSROOT: /sources/antiright
Module name: antiright
Changes by: Jeffrey Bedard <jefbed> 07/07/09 02:12:26
Modified files:
gtkshell : Makefile add_options.c gshterm
module_includes.h
Added files:
gtkshell : form.c form.h
Log message:
Added radio button selection support (option -af).
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/Makefile?cvsroot=antiright&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/add_options.c?cvsroot=antiright&r1=1.43&r2=1.44
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/gshterm?cvsroot=antiright&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/module_includes.h?cvsroot=antiright&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/form.c?cvsroot=antiright&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/form.h?cvsroot=antiright&rev=1.1
Patches:
Index: Makefile
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/Makefile,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- Makefile 20 Jun 2007 13:37:18 -0000 1.40
+++ Makefile 9 Jul 2007 02:12:25 -0000 1.41
@@ -38,7 +38,7 @@
image_button.o terminal.o terminal_options.o menu.o updated.o\
guidl_util.o about_dialog.o init.o guidl_dialog.o guidl_dictionary.o\
guidl_options.o guidl_widgets.o update_manager.o pane.o\
- command_shell.o app_mode.o clock.o tree.o
+ command_shell.o app_mode.o clock.o tree.o form.o
program=main.o
Index: add_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/add_options.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- add_options.c 11 Jun 2007 21:32:37 -0000 1.43
+++ add_options.c 9 Jul 2007 02:12:25 -0000 1.44
@@ -164,6 +164,11 @@
gsh_text_editor(gsh, argv[*counter]);
break;
+ case 'f': /* Add a form with check boxes or radio buttons. */
+ GSH_COUNT(argc, counter);
+ gsh_add_form(gsh, argv[(*counter)]);
+ break;
+
case 'l':
GSH_COUNT(argc, counter);
$(gsh, add.label, argv[(*counter)]);
Index: gshterm
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/gshterm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- gshterm 10 Jun 2007 21:18:31 -0000 1.6
+++ gshterm 9 Jul 2007 02:12:25 -0000 1.7
@@ -10,7 +10,7 @@
COMMAND=""
DEBUG="FALSE"
APP_MODE=""
-TRANSPARENT=""
+TRANSPARENT="-ott"
while [ $# -gt 0 ]; do
case "$1" in
@@ -39,7 +39,8 @@
shift
;;
-t)
- TRANSPARENT="-ott"
+ #TRANSPARENT="-ott"
+ TRANSPARENT=""
break
;;
esac
@@ -48,13 +49,18 @@
ARGS=""
+
+if [ "$TRANSPARENT" != "" ]; then
+ ARGS="$ARGS $TRANSPARENT"
+fi
+
if [ "$GEOMETRY" != "" ]; then
ARGS="$ARGS -og $GEOMETRY"
fi
if [ "$FONT" != "" ]; then
ARGS="$ARGS -otf \"$FONT\""
else
- ARGS="$ARGS -otf 'Mono 12'"
+ ARGS="$ARGS -otf 'Mono 14'"
fi
#echo $*
Index: module_includes.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/module_includes.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- module_includes.h 11 Jun 2007 21:32:43 -0000 1.7
+++ module_includes.h 9 Jul 2007 02:12:26 -0000 1.8
@@ -58,5 +58,6 @@
#include "app_mode.h"
#include "applets.h"
#include "tree.h"
+#include "form.h"
#endif /* not GSH_MODULE_INCLUDES_H */
Index: form.c
===================================================================
RCS file: form.c
diff -N form.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ form.c 9 Jul 2007 02:12:25 -0000 1.1
@@ -0,0 +1,98 @@
+/*
+ AntiRight
+ (c) 2002-2007 Jeffrey Bedard
+ address@hidden
+
+ This file is part of AntiRight.
+
+ AntiRight is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ AntiRight is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with AntiRight; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
+*/
+
+#include "gtkshell.h"
+
+static void
+test_checked(gpointer element_data, gpointer user_data)
+{
+ GtkWidget * radio_button;
+
+ radio_button=(GtkWidget *)element_data;
+ if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_button)))
+ puts(gtk_button_get_label(GTK_BUTTON(radio_button)));
+}
+
+static void
+submit_cb(GtkWidget * button, gpointer cb_data)
+{
+ GtkWidget * radio_base = (GtkWidget *)cb_data;
+ GSList * radio_group;
+
+ radio_group=gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio_base));
+ g_slist_foreach(radio_group, test_checked, NULL);
+ exit(0);
+}
+
+static void
+setup_controls(GtkWidget * vertical, GtkWidget * radio_base)
+{
+ 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));
+ GSHCONNECT(button, "clicked", gtk_main_quit, NULL);
+ GSHCA(controls, button);
+ gtk_widget_show(button=gtk_button_new_from_stock(GTK_STOCK_OK));
+ GSHCONNECT(button, "clicked", submit_cb, radio_base);
+ GSHCA(controls, button);
+ GSHCA(vertical, controls);
+}
+
+static GtkWidget *
+setup_contents(const gchar * contents, GtkWidget * vertical)
+{
+ GtkWidget * radio_base;
+ gchar ** element;
+ unsigned int counter;
+
+ 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++)
+ {
+ GtkWidget * radio;
+
+ radio=gtk_radio_button_new_with_label_from_widget(
+ GTK_RADIO_BUTTON(radio_base), element[counter]);
+ gtk_widget_show(radio);
+ GSHCA(vertical, radio);
+ }
+
+ return radio_base;
+}
+
+void
+gsh_add_form(GSH * gsh, const gchar * contents)
+{
+ GtkWidget * vertical;
+ GtkWidget * radio_base;
+
+ vertical=gtk_vbox_new(TRUE, 1);
+ radio_base=setup_contents(contents, vertical);
+ setup_controls(vertical, radio_base);
+ $(gsh, manage, vertical);
+}
+
Index: form.h
===================================================================
RCS file: form.h
diff -N form.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ form.h 9 Jul 2007 02:12:25 -0000 1.1
@@ -0,0 +1,32 @@
+/*
+ AntiRight
+ (c) 2002-2007 Jeffrey Bedard
+ address@hidden
+
+ This file is part of AntiRight.
+
+ AntiRight is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ AntiRight is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with AntiRight; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
+*/
+
+
+#ifndef GSH_FORM_H
+#define GSH_FORM_H
+
+void
+gsh_add_form(GSH * gsh, const gchar * contents);
+
+
+#endif /* GSH_FORM_H */
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Antiright-devel] antiright/gtkshell Makefile add_options.c gshte...,
Jeffrey Bedard <=