[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Antiright-devel] antiright/gtkshell add_options.c
From: |
Jeffrey Bedard |
Subject: |
[Antiright-devel] antiright/gtkshell add_options.c |
Date: |
Mon, 05 Mar 2007 01:12:46 +0000 |
CVSROOT: /sources/antiright
Module name: antiright
Changes by: Jeffrey Bedard <jefbed> 07/03/05 01:12:46
Modified files:
gtkshell : add_options.c
Log message:
Used function pointer specified generic to eliminate duplicate code.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/add_options.c?cvsroot=antiright&r1=1.15&r2=1.16
Patches:
Index: add_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/add_options.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- add_options.c 5 Mar 2007 01:05:42 -0000 1.15
+++ add_options.c 5 Mar 2007 01:12:46 -0000 1.16
@@ -32,27 +32,28 @@
}
static void
-add_piped_label(struct GSH * gsh)
+add_piped_label(struct GSH * gsh, gchar * output)
{
- gchar * output;
-
- output=antiright_read_file(stdin);
gsh_add_label(gsh, output);
- g_free(output);
}
static void
-add_piped_text(struct GSH * gsh)
+add_piped_text(struct GSH * gsh, gchar * output)
{
- gchar * output;
GtkWidget * widget;
widget=gsh_text_area(gsh);
- output=antiright_read_file(stdin);
gsh_text_area_set_text(widget, output);
- g_free(output);
}
+static void
+add_piped_generic(struct GSH * gsh, void (*add)(struct GSH *, gchar *))
+{
+ gchar *output;
+ output=antiright_read_file(stdin);
+ (*add)(gsh, output);
+ g_free(output);
+}
void
gsh_handle_add_arguments(struct GSH * gsh, int argc, char **argv, int *counter)
@@ -70,10 +71,10 @@
gsh_add_label(gsh, argv[(*counter)]);
break;
case 'P':
- add_piped_text(gsh);
+ add_piped_generic(gsh, &add_piped_text);
break;
case 'p':
- add_piped_label(gsh);
+ add_piped_generic(gsh, &add_piped_label);
break;
case 'r': /* Force creation of a new row. */
- [Antiright-devel] antiright/gtkshell add_options.c,
Jeffrey Bedard <=