[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Antiright-devel] antiright/gtkshell about_dialog.c about_dialog....
From: |
Jeffrey Bedard |
Subject: |
[Antiright-devel] antiright/gtkshell about_dialog.c about_dialog.... |
Date: |
Fri, 04 May 2007 00:59:58 +0000 |
CVSROOT: /sources/antiright
Module name: antiright
Changes by: Jeffrey Bedard <jefbed> 07/05/04 00:59:58
Modified files:
gtkshell : about_dialog.c about_dialog.h add_options.c
button.c dialog_options.c guidl_widgets.c
menu.c option_options.c options.c options.h
terminal_options.c updated_options.c
Log message:
Added vertical pane support. Changed gsh_count to the macro GSH_COUNT.
Use preprocessor macros and standard constant string concatenation
to set about dialog text fields. Added a widget reparenting procedure.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/about_dialog.c?cvsroot=antiright&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/about_dialog.h?cvsroot=antiright&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/add_options.c?cvsroot=antiright&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/button.c?cvsroot=antiright&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/dialog_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.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/menu.c?cvsroot=antiright&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/option_options.c?cvsroot=antiright&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/options.c?cvsroot=antiright&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/options.h?cvsroot=antiright&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/terminal_options.c?cvsroot=antiright&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/updated_options.c?cvsroot=antiright&r1=1.13&r2=1.14
Patches:
Index: about_dialog.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/about_dialog.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- about_dialog.c 28 Apr 2007 22:26:23 -0000 1.2
+++ about_dialog.c 4 May 2007 00:59:58 -0000 1.3
@@ -22,87 +22,45 @@
#include "gtkshell.h"
-static gchar *
-get_license_filename()
-{
- gchar * filename;
-
- ar_asprintf(&filename, "%s/%s/antiright/COPYING",
- PREFIX, "share/doc");
-
- return filename;
-}
-
-static gchar *
-get_license_text()
-{
- gchar * filename;
-
- filename=get_license_filename();
- {
- gchar * text;
-
- text=antiright_read_named_file(filename);
- g_free(filename);
-
- return text;
- }
-}
-
static void
setup_about_license(GtkWidget * dialog)
{
gchar * text;
- text=get_license_text();
gtk_about_dialog_set_license(GTK_ABOUT_DIALOG(dialog),
- text);
+ text=antiright_read_named_file(GSH_LICENSE_FILE));
g_free(text);
}
static void
setup_authors_field(GtkWidget * dialog)
{
- const gchar *authors[] =
- {
- "Jeffrey E. Bedard <address@hidden>",
- NULL
- };
+ const gchar *authors[] = GSH_AUTHORS;
- gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(dialog),
- authors);
+ gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(dialog), authors);
}
-static void
+static GtkWidget *
setup_about_fields(GtkWidget * dialog)
{
setup_authors_field(dialog);
-
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog),
PACKAGE_STRING);
-
gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(dialog),
- "Copyright 2002-2007, Jeffrey E. Bedard");
-
+ GSH_COPYRIGHT);
gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dialog),
- "http://www.nongnu.org/antiright");
-
+ GSH_WEBSITE);
setup_about_license(dialog);
-
-
gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog),
- "The desktop scripting environment.");
+ GSH_COMMENTS);
+
+ return dialog;
}
void
gsh_about_dialog()
{
- GtkWidget * dialog;
-
- dialog = gtk_about_dialog_new();
- setup_about_fields(dialog);
- gtk_dialog_run(GTK_DIALOG(dialog));
-
+ gtk_dialog_run(GTK_DIALOG(setup_about_fields(gtk_about_dialog_new())));
exit(0);
}
Index: about_dialog.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/about_dialog.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- about_dialog.h 2 Apr 2007 18:31:41 -0000 1.1
+++ about_dialog.h 4 May 2007 00:59:58 -0000 1.2
@@ -23,6 +23,18 @@
#ifndef GSH_ABOUT_DIALOG_H
#define GSH_ABOUT_DIALOG_H
+#define GSH_LICENSE_FILE PREFIX "/share/doc/antiright/COPYING"
+
+#define GSH_AUTHORS \
+{\
+ "Jeffrey E. Bedard <address@hidden>",\
+ NULL\
+}
+
+#define GSH_COPYRIGHT "Copyright 2002-2007, Jeffrey E. Bedard"
+#define GSH_WEBSITE "http://www.nongnu.org/antiright"
+#define GSH_COMMENTS "This is the desktop scripting environment."
+
void
gsh_about_dialog() __attribute__((noreturn));
Index: add_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/add_options.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- add_options.c 3 May 2007 22:55:10 -0000 1.27
+++ add_options.c 4 May 2007 00:59:58 -0000 1.28
@@ -56,16 +56,13 @@
? gtk_vseparator_new() : gtk_hseparator_new());
}
-void
-gsh_handle_add_arguments(struct GSH * gsh, int argc, char **argv, int *counter)
+static void
+handle_commanded_add_arguments(struct GSH * gsh, int argc, char **argv,
+ int *counter)
{
- g_assert(strlen(argv[(*counter)]) > 1);
- switch (argv[(*counter)][2])
- {
- case 'c':
if(!argv[*counter] || !argv[(*counter)+1])
- break;
- gsh_count(argc, counter);
+ return;
+ GSH_COUNT(argc, counter);
switch(argv[(*counter)-1][3])
{
case 'b':
@@ -75,15 +72,63 @@
case 'l':
GENERIC_COMMANDED_ADD(gsh, argv[*counter],
gsh->add_label);
+ break;
}
+}
+
+static void
+reparent(GtkWidget * widget, GtkWidget * old, GtkWidget * new)
+{
+ gtk_widget_ref(widget);
+ gtk_container_remove(GTK_CONTAINER(old), widget);
+ gtk_container_add(GTK_CONTAINER(new), widget);
+ gtk_widget_unref(widget);
+}
+
+#define REPARENT_TO(new) reparent(gsh->rows->v, gsh->rows->h, new)
+
+static void
+setup_hpaned(struct GSH * gsh, const gchar * label_pair)
+{
+ GtkWidget * pane;
+ GtkWidget * first;
+ GtkWidget * second;
+ gchar **pair;
+
+ pair=g_strsplit(label_pair, ",", 2);
+ pane=gtk_hpaned_new();
+ gtk_widget_show(first=gtk_frame_new(pair[0]));
+ REPARENT_TO(first);
+ gtk_paned_add1(GTK_PANED(pane), first);
+ $(gsh->rows, new);
+ $(gsh, manage, pane);
+ $(gsh->rows, new);
+ gtk_widget_show(second=gtk_frame_new(pair[1]));
+ g_strfreev(pair);
+ REPARENT_TO(second);
+ gtk_paned_add2(GTK_PANED(pane), second);
+}
+
+void
+gsh_handle_add_arguments(struct GSH * gsh, int argc, char **argv, int *counter)
+{
+ g_assert(strlen(argv[(*counter)]) > 1);
+ switch (argv[(*counter)][2])
+ {
+ case 'b':
+ GSH_COUNT(argc, counter);
+ setup_hpaned(gsh, argv[*counter]);
+ break;
+ case 'c':
+ handle_commanded_add_arguments(gsh, argc, argv, counter);
break;
case 'e':
- gsh_count(argc, counter);
+ GSH_COUNT(argc, counter);
gsh_text_editor(gsh, argv[*counter]);
break;
case 'l':
- gsh_count(argc, counter);
+ GSH_COUNT(argc, counter);
$(gsh, add_label, argv[(*counter)]);
break;
@@ -104,13 +149,13 @@
break;
case 's': /* Add a shell. */
- gsh_count(argc, counter);
+ GSH_COUNT(argc, counter);
$(gsh, manage, $(gsh->terminal, add, argv[*counter]));
break;
case 't':
if (argc != *counter)
- gsh_count(argc, counter);
+ GSH_COUNT(argc, counter);
gsh_setup_command_entry(gsh, argv[(*counter)]);
Index: button.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/button.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- button.c 3 May 2007 22:55:10 -0000 1.34
+++ button.c 4 May 2007 00:59:58 -0000 1.35
@@ -58,9 +58,10 @@
static void
create_button(struct GSH * gsh)
{
- gsh->button=(!GTK_IS_MENU(gsh->rows->v)
- && !GTK_IS_MENU_BAR(gsh->rows->v)) ?
- gtk_button_new() : gtk_menu_item_new();
+ if(!GTK_IS_MENU(gsh->rows->v) && !GTK_IS_MENU_BAR(gsh->rows->v))
+ gsh->button=gtk_button_new();
+ else
+ gtk_widget_show(gsh->button=gtk_menu_item_new());
}
static void
Index: dialog_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/dialog_options.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- dialog_options.c 2 Apr 2007 18:42:52 -0000 1.14
+++ dialog_options.c 4 May 2007 00:59:58 -0000 1.15
@@ -58,7 +58,7 @@
gsh_setup_message_dialog(struct GSH * gsh, int argc, char **argv,
int *counter, GtkMessageType type)
{
- gsh_count(argc, counter);
+ GSH_COUNT(argc, counter);
gsh_message_dialog(gsh, type, argv[(*counter)]);
}
Index: guidl_widgets.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/guidl_widgets.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- guidl_widgets.c 3 May 2007 22:55:10 -0000 1.6
+++ guidl_widgets.c 4 May 2007 00:59:58 -0000 1.7
@@ -45,6 +45,7 @@
DEF("text", "-aT");
DEF("system label", "-acl");
DEF("system button", "-acb");
+ DEF("vertical pane", "-ab");
}
void
Index: menu.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/menu.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- menu.c 2 May 2007 14:55:31 -0000 1.6
+++ menu.c 4 May 2007 00:59:58 -0000 1.7
@@ -34,9 +34,10 @@
#ifdef DEBUG
ARPASSERT(command);
+ ARPASSERT(pair[0]);
#endif /* DEBUG */
- if(ARPBOOL(pair[0]) && ARPBOOL(pair[1]))
+ if(pair[1])
gsh_image_button(gsh, pair[0], pair[1]);
else
gsh_command_button(gsh, pair[0]);
Index: option_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/option_options.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- option_options.c 2 May 2007 14:55:31 -0000 1.22
+++ option_options.c 4 May 2007 00:59:58 -0000 1.23
@@ -77,7 +77,7 @@
break;
case 'g':
- gsh_count(argc, counter);
+ GSH_COUNT(argc, counter);
ARIFP(gsh->geometry)
free(gsh->geometry);
@@ -104,7 +104,7 @@
break;
case 'r': /* Set number of rows per column. */
- gsh_count(argc, counter);
+ GSH_COUNT(argc, counter);
gsh->rows->total=(unsigned int)atoi(argv[(*counter)]);
break;
@@ -113,7 +113,7 @@
break;
case 'T': /* Set the window title. */
- gsh_count(argc, counter);
+ GSH_COUNT(argc, counter);
gtk_window_set_title(GTK_WINDOW(gsh->window), argv[*counter]);
break;
@@ -122,7 +122,7 @@
break;
case 'u': /* Set time for updating widgets' timer, in miliseconds. */
- gsh_count(argc, counter);
+ GSH_COUNT(argc, counter);
gsh->update->period = atoi(argv[*counter]);
break;
}
Index: options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/options.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- options.c 3 May 2007 21:23:07 -0000 1.20
+++ options.c 4 May 2007 00:59:58 -0000 1.21
@@ -25,16 +25,6 @@
extern FILE *yyin, *yyout;
extern struct GDLEnvironment * gsh_guidl_env;
-#ifdef _GNU_SOURCE
-inline
-#endif /* _GNU_SOURCE */
-void
-gsh_count(int argc, int *counter)
-{
- (*counter)++;
- g_assert((*counter) <= argc);
-}
-
#ifdef DEBUG
static void
print_arguments(gint argc, gchar ** argv)
@@ -91,7 +81,7 @@
gsh_handle_dialog_arguments(gsh, argc, argv, counter);
break;
case 'f':
- gsh_count(argc, counter);
+ GSH_COUNT(argc, counter);
guidl_handler_for_file(gsh, argv[*counter]);
break;
case 'o':
Index: options.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/options.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- options.h 28 Feb 2007 03:53:51 -0000 1.4
+++ options.h 4 May 2007 00:59:58 -0000 1.5
@@ -25,10 +25,21 @@
#include "gtkshell.h"
-void
- gsh_count(int argc, int *counter);
+#ifdef DEBUG
+#define GSH_COUNT(argc, counter) \
+{\
+ (*counter)++;\
+ g_assert((*counter) <= argc);\
+}
+#else /* not DEBUG */
+#define GSH_COUNT(argc, counter) \
+{\
+ (*counter)++;\
+}
+#endif /* DEBUG */
void
- gsh_handle_switch_arguments(struct GSH * gsh, int argc, char **argv, int
*counter);
+gsh_handle_switch_arguments(struct GSH * gsh, int argc, char **argv,
+ int *counter);
-#endif
+#endif /* not GSH_OPTIONS_H */
Index: terminal_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/terminal_options.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- terminal_options.c 2 May 2007 14:55:31 -0000 1.2
+++ terminal_options.c 4 May 2007 00:59:58 -0000 1.3
@@ -31,15 +31,15 @@
switch(argv[(*counter)][3])
{
case 'f': /* Set font for terminal widget. */
- gsh_count(argc, counter);
+ GSH_COUNT(argc, counter);
gsh->terminal->font=argv[*counter];
break;
case 'h': /* Set terminal widget height. */
- gsh_count(argc, counter);
+ GSH_COUNT(argc, counter);
gsh->terminal->height=atoi(argv[*counter]);
break;
case 'w': /* Set terminal widget width. */
- gsh_count(argc, counter);
+ GSH_COUNT(argc, counter);
gsh->terminal->width=atoi(argv[*counter]);
break;
default: /* Error message. */
Index: updated_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/updated_options.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- updated_options.c 3 May 2007 04:36:18 -0000 1.13
+++ updated_options.c 4 May 2007 00:59:58 -0000 1.14
@@ -39,7 +39,7 @@
static void
gsh_updater_argument_generic(struct GSH * gsh, int argc, int *counter)
{
- gsh_count(argc, counter);
+ GSH_COUNT(argc, counter);
gsh_test_updating(gsh);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Antiright-devel] antiright/gtkshell about_dialog.c about_dialog....,
Jeffrey Bedard <=