[Top][All Lists]
[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: |
Mon, 19 Feb 2007 01:43:10 +0000 |
CVSROOT: /sources/antiright
Module name: antiright
Changes by: Jeffrey Bedard <jefbed> 07/02/19 01:43:09
Modified files:
. : configure
gtkshell : add_options.c dialog_options.c gtkshell.h
option_options.c text.c text.h
Log message:
Bumped version to 2.99.8. Removed icon box stub. Added about dialog.
Check gsh->geometry before setting, to avoid memory leak. Added
text file viewer.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/configure?cvsroot=antiright&r1=1.75&r2=1.76
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/add_options.c?cvsroot=antiright&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/dialog_options.c?cvsroot=antiright&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/gtkshell.h?cvsroot=antiright&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/option_options.c?cvsroot=antiright&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/text.c?cvsroot=antiright&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/text.h?cvsroot=antiright&r1=1.2&r2=1.3
Patches:
Index: configure
===================================================================
RCS file: /sources/antiright/antiright/configure,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -b -r1.75 -r1.76
--- configure 17 Feb 2007 23:13:55 -0000 1.75
+++ configure 19 Feb 2007 01:43:09 -0000 1.76
@@ -24,7 +24,7 @@
#
###############################################################################
-VERSION=2.99.7
+VERSION=2.99.8
for ARG in $@; do
if [ "$ARG" = "-d" ]; then
Index: gtkshell/add_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/add_options.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- gtkshell/add_options.c 12 Feb 2007 16:36:56 -0000 1.3
+++ gtkshell/add_options.c 19 Feb 2007 01:43:09 -0000 1.4
@@ -23,29 +23,39 @@
#include "gtkshell.h"
void
+gsh_handle_add_image_button(
+ struct GSH *gsh, int argc, char **argv, int *counter)
+{
+ gsh_count(argc, counter);
+ gsh_image_button(gsh, argv[(*counter)],
+ argv[(*counter)+1]);
+ gsh_count(argc, counter);
+}
+void
+gsh_handle_add_unlabeled_image_button(
+ struct GSH *gsh, int argc, char **argv, int *counter)
+{
+ gsh_handle_add_image_button(gsh, argc, argv, counter);
+ gtk_button_set_label( GTK_BUTTON(gsh->button), "");
+}
+
+void
gsh_handle_add_arguments(struct GSH *gsh, int argc, char **argv, int *counter)
{
- assert(strlen(argv[(*counter)])>1);
+ g_assert(strlen(argv[(*counter)])>1);
switch(argv[(*counter)][2])
{
- case 'b': /* FIXME: not really implemented. */
+ case 'e':
gsh_count(argc, counter);
- {
- GtkWidget *icon_view;
- icon_view=gtk_icon_view_new();
- /* has to be managed. */
- }
+ gsh_text_editor(gsh, argv[*counter]);
break;
case 'I':
- gsh_count(argc, counter);
- gsh_image_button(gsh, argv[*counter], argv[*counter+1]);
- gsh_count(argc, counter);
- gtk_button_set_label(GTK_BUTTON(gsh->button), "");
+ gsh_handle_add_unlabeled_image_button(
+ gsh, argc, argv, counter);
break;
case 'i':
- gsh_count(argc, counter);
- gsh_image_button(gsh, argv[(*counter)], argv[(*counter)+1]);
- gsh_count(argc, counter);
+ gsh_handle_add_image_button(
+ gsh, argc, argv, counter);
break;
case 'l':
gsh_count(argc, counter);
@@ -53,7 +63,8 @@
break;
case 'p':
gsh_count(argc, counter);
- gsh_setup_prompt_command_entry(gsh, argv[(*counter)]);
+ gsh_setup_prompt_command_entry(
+ gsh, argv[(*counter)]);
break;
case 't':
gsh_count(argc, counter);
@@ -63,7 +74,8 @@
gsh_text_area(gsh);
break;
case 'u':
- gsh_handle_updated_arguments(gsh, argc, argv, counter);
+ gsh_handle_updated_arguments(
+ gsh, argc, argv, counter);
break;
}
}
Index: gtkshell/dialog_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/dialog_options.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- gtkshell/dialog_options.c 18 Feb 2007 22:43:25 -0000 1.4
+++ gtkshell/dialog_options.c 19 Feb 2007 01:43:09 -0000 1.5
@@ -85,12 +85,48 @@
}
void
+gsh_about_dialog()
+{
+ GtkWidget *dialog;
+ const gchar *authors[]=
+ {"Jeffrey E. Bedard <address@hidden>",
+ NULL};
+
+ dialog=gtk_about_dialog_new();
+
+ 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");
+
+ gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dialog),
+ "http://www.nongnu.org/antiright");
+
+ gtk_about_dialog_set_license(GTK_ABOUT_DIALOG(dialog),
+ "This software is licensed under the terms"
+ " of the GNU General Public License.");
+
+ gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(dialog),
+ authors);
+
+ gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog),
+ "The desktop scripting environment.");
+
+ gtk_dialog_run(GTK_DIALOG(dialog));
+
+ exit(0);
+}
+
+void
gsh_handle_dialog_arguments(struct GSH *gsh, int argc, char **argv,
int *counter)
{
assert(strlen(argv[(*counter)])>2);
switch(argv[(*counter)][2])
{
+ case 'a':
+ gsh_about_dialog();
case 'c': /* Color Selection */
gsh_color_dialog();
break;
Index: gtkshell/gtkshell.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/gtkshell.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- gtkshell/gtkshell.h 17 Feb 2007 23:32:39 -0000 1.9
+++ gtkshell/gtkshell.h 19 Feb 2007 01:43:09 -0000 1.10
@@ -47,7 +47,6 @@
unsigned int period;
GSList *list;
};
-
struct GSH
{
GtkWidget *window;
Index: gtkshell/option_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/option_options.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- gtkshell/option_options.c 17 Feb 2007 23:34:23 -0000 1.4
+++ gtkshell/option_options.c 19 Feb 2007 01:43:09 -0000 1.5
@@ -32,13 +32,18 @@
break;
case 'g':
gsh_count(argc, counter);
+
+ if(gsh->geometry)
+ free(gsh->geometry);
+
asprintf(&gsh->geometry, "%s", argv[(*counter)]);
break;
case 'h':
gsh->flags.horizontal_labels=TRUE;
break;
case 'n':
- gtk_window_set_decorated(GTK_WINDOW(gsh->window),
FALSE);
+ gtk_window_set_decorated(GTK_WINDOW(gsh->window),
+ FALSE);
gtk_window_set_skip_taskbar_hint(
GTK_WINDOW(gsh->window), TRUE);
break;
Index: gtkshell/text.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/text.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- gtkshell/text.c 13 Feb 2007 03:23:28 -0000 1.3
+++ gtkshell/text.c 19 Feb 2007 01:43:09 -0000 1.4
@@ -47,12 +47,46 @@
G_CALLBACK(gtk_main_quit), NULL);
}
-void
+GtkWidget *
gsh_text_area(struct GSH *gsh)
{
GtkWidget *text;
text=gtk_text_view_new();
gsh_manage(gsh, text);
+
+ return text;
+}
+
+/* This is currently just a text file viewer. */
+void
+gsh_text_editor(struct GSH *gsh, char *filename)
+{
+ GtkWidget *text;
+ GtkTextBuffer *buffer;
+ GtkTextIter iter;
+ PangoFontDescription *font_desc;
+ size_t read;
+ FILE *file;
+ char buf[BUFSIZ];
+
+ text=gsh_text_area(gsh);
+ buffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+
+
+ file=fopen(filename, "r");
+ while(read=fread(buf, sizeof(char), BUFSIZ, file))
+ {
+ gtk_text_buffer_get_end_iter(buffer, &iter);
+ gtk_text_buffer_insert(buffer, &iter, buf, read);
+ }
+ fclose(file);
+
+ if(!gsh->geometry)
+ asprintf(&gsh->geometry, "775x700");
+
+ font_desc=pango_font_description_from_string("Mono 14");
+ gtk_widget_modify_font(text, font_desc);
+ pango_font_description_free(font_desc);
}
Index: gtkshell/text.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/text.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- gtkshell/text.h 13 Feb 2007 03:23:28 -0000 1.2
+++ gtkshell/text.h 19 Feb 2007 01:43:09 -0000 1.3
@@ -29,7 +29,10 @@
void
gsh_setup_prompt_command_entry(struct GSH *gsh, char *command);
+GtkWidget *
+gsh_text_area(struct GSH *gsh);
+
void
-gsh_text_area();
+gsh_text_editor(struct GSH *gsh, char *filename);
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Antiright-devel] antiright configure gtkshell/add_options.c gtks...,
Jeffrey Bedard <=