[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Antiright-devel] antiright/gtkshell add_options.c arguments.c bu...
From: |
Jeffrey Bedard |
Subject: |
[Antiright-devel] antiright/gtkshell add_options.c arguments.c bu... |
Date: |
Sat, 05 May 2007 23:38:07 +0000 |
CVSROOT: /sources/antiright
Module name: antiright
Changes by: Jeffrey Bedard <jefbed> 07/05/05 23:38:07
Modified files:
gtkshell : add_options.c arguments.c button.c containers.c
dialog_options.c file_dialog.c geometry.c
gtkshell.c gtkshell.h image_button.c init.c
option_options.c
Added files:
gtkshell : module_includes.h
Log message:
Restructured GSH members by adding appropriate subcategories, widgets
and add. Stored include statements for all the files in
module_includes.h
to improve readability of gtkshell.h.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/add_options.c?cvsroot=antiright&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/arguments.c?cvsroot=antiright&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/button.c?cvsroot=antiright&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/containers.c?cvsroot=antiright&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/dialog_options.c?cvsroot=antiright&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/file_dialog.c?cvsroot=antiright&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/geometry.c?cvsroot=antiright&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/gtkshell.c?cvsroot=antiright&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/gtkshell.h?cvsroot=antiright&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/image_button.c?cvsroot=antiright&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/init.c?cvsroot=antiright&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/option_options.c?cvsroot=antiright&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/module_includes.h?cvsroot=antiright&rev=1.1
Patches:
Index: add_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/add_options.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- add_options.c 4 May 2007 00:59:58 -0000 1.28
+++ add_options.c 5 May 2007 23:38:07 -0000 1.29
@@ -24,7 +24,7 @@
#define ADD_PIPED_LABEL(gsh, output)\
- $(gsh, add_label, output)
+ $(gsh, add.label, output)
#define ADD_PIPED_TEXT(gsh, output)\
gsh_text_area_set_text(gsh_text_area(gsh), output)
@@ -44,7 +44,7 @@
static void
add_new_window(struct GSH * gsh)
{
- $(gsh, new_window);
+ $(gsh, add.window);
gsh->rows->current=1;
$(gsh, init);
}
@@ -56,6 +56,9 @@
? gtk_vseparator_new() : gtk_hseparator_new());
}
+#define GCA_WIDGET(func) \
+ GENERIC_COMMANDED_ADD(gsh, argv[*counter], func)
+
static void
handle_commanded_add_arguments(struct GSH * gsh, int argc, char **argv,
int *counter)
@@ -66,12 +69,10 @@
switch(argv[(*counter)-1][3])
{
case 'b':
- GENERIC_COMMANDED_ADD(gsh, argv[*counter],
- gsh->add_button);
+ GCA_WIDGET(gsh->add.button);
break;
case 'l':
- GENERIC_COMMANDED_ADD(gsh, argv[*counter],
- gsh->add_label);
+ GCA_WIDGET(gsh->add.label);
break;
}
}
@@ -88,27 +89,42 @@
#define REPARENT_TO(new) reparent(gsh->rows->v, gsh->rows->h, new)
static void
-setup_hpaned(struct GSH * gsh, const gchar * label_pair)
+setup_first_pane_half(struct GSH * gsh, const gchar ** pair, GtkWidget * pane)
{
- 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);
+}
+
+static void
+setup_second_pane_half(struct GSH * gsh, gchar ** pair, GtkWidget * pane)
+{
+ GtkWidget * second;
+
gtk_widget_show(second=gtk_frame_new(pair[1]));
g_strfreev(pair);
REPARENT_TO(second);
gtk_paned_add2(GTK_PANED(pane), second);
}
+static void
+setup_hpaned(struct GSH * gsh, const gchar * label_pair)
+{
+ GtkWidget * pane;
+ gchar **pair;
+
+ pair=g_strsplit(label_pair, ",", 2);
+ pane=gtk_hpaned_new();
+ setup_first_pane_half(gsh, (const gchar **)pair, pane);
+ /* PAIR freed here. */
+ setup_second_pane_half(gsh, pair, pane);
+}
+
void
gsh_handle_add_arguments(struct GSH * gsh, int argc, char **argv, int *counter)
{
@@ -129,7 +145,7 @@
case 'l':
GSH_COUNT(argc, counter);
- $(gsh, add_label, argv[(*counter)]);
+ $(gsh, add.label, argv[(*counter)]);
break;
case 'P':
Index: arguments.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/arguments.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- arguments.c 5 May 2007 22:33:06 -0000 1.22
+++ arguments.c 5 May 2007 23:38:07 -0000 1.23
@@ -32,7 +32,7 @@
tokens=g_strsplit(string, "::", SPLIT_ALL);
/* Determine if the button is a regular button or a menu button. */
- tokens[1] ? menubutton_parse(gsh, tokens) : $(gsh, add_button, string);
+ tokens[1] ? menubutton_parse(gsh, tokens) : $(gsh, add.button, string);
g_strfreev(tokens);
}
Index: button.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/button.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- button.c 5 May 2007 22:33:06 -0000 1.36
+++ button.c 5 May 2007 23:38:07 -0000 1.37
@@ -47,8 +47,8 @@
setup_callback(struct GSH * gsh, const gchar * command)
{
if(!GSH_FLAG(GSH_MENU_BUTTON))
- (void)g_signal_connect(G_OBJECT(gsh->button),
- GTK_IS_MENU_ITEM(gsh->button) ? "activate" : "clicked",
+ (void)g_signal_connect(G_OBJECT(gsh->widgets.button),
+ GTK_IS_MENU_ITEM(gsh->widgets.button) ? "activate" :
"clicked",
G_CALLBACK(gsh_system_cb),
ARNEW(gsh, GSH_CBData, gsh, g_strdup(command)));
else
@@ -59,16 +59,16 @@
create_button(struct GSH * gsh)
{
if(!GTK_IS_MENU(gsh->rows->v) && !GTK_IS_MENU_BAR(gsh->rows->v))
- gsh->button=gtk_button_new();
+ gsh->widgets.button=gtk_button_new();
else
- gtk_widget_show(gsh->button=gtk_menu_item_new());
+ gtk_widget_show(gsh->widgets.button=gtk_menu_item_new());
}
static void
setup_command_button(struct GSH * gsh, const gchar * command)
{
- setup_label(gsh->button, command);
- gsh_setup_drag_drop(gsh, gsh->button);
+ setup_label(gsh->widgets.button, command);
+ gsh_setup_drag_drop(gsh, gsh->widgets.button);
setup_callback(gsh, command);
}
@@ -99,7 +99,7 @@
create_button(gsh);
setup_command_button(gsh, command);
- gsh_manage(gsh, gsh->button);
+ gsh_manage(gsh, gsh->widgets.button);
}
/* This is just a wrapper around gsh_new_button(), to
@@ -110,6 +110,6 @@
if(!test_image_button(gsh, string))
gsh_command_button(gsh, string);
- return gsh->button;
+ return gsh->widgets.button;
}
Index: containers.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/containers.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- containers.c 5 May 2007 22:33:06 -0000 1.14
+++ containers.c 5 May 2007 23:38:07 -0000 1.15
@@ -26,24 +26,25 @@
scrolled_window_options(struct GSH * gsh)
{
gtk_scrolled_window_set_policy(
- GTK_SCROLLED_WINDOW(gsh->scrolled_window),
+ GTK_SCROLLED_WINDOW(gsh->widgets.scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type(
- GTK_SCROLLED_WINDOW(gsh->scrolled_window),
+ GTK_SCROLLED_WINDOW(gsh->widgets.scrolled_window),
GTK_SHADOW_OUT);
}
static void
gsh_setup_scrolled_window(struct GSH * gsh)
{
- gsh->scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+ gsh->widgets.scrolled_window = gtk_scrolled_window_new(NULL, NULL);
scrolled_window_options(gsh);
- gtk_container_add(GTK_CONTAINER(gsh->window),
- gsh->scrolled_window);
- gtk_widget_show(gsh->scrolled_window);
+ gtk_container_add(GTK_CONTAINER(gsh->widgets.window),
+ gsh->widgets.scrolled_window);
+ gtk_widget_show(gsh->widgets.scrolled_window);
gtk_scrolled_window_add_with_viewport(
- GTK_SCROLLED_WINDOW(gsh->scrolled_window), gsh->rows->h);
+ GTK_SCROLLED_WINDOW(gsh->widgets.scrolled_window),
+ gsh->rows->h);
}
static void
@@ -52,7 +53,7 @@
GtkWidget *frame;
gtk_widget_show(frame = gtk_frame_new(NULL));
- gtk_container_add(GTK_CONTAINER(gsh->window), frame);
+ gtk_container_add(GTK_CONTAINER(gsh->widgets.window), frame);
gtk_container_add(GTK_CONTAINER(frame), gsh->rows->h);
}
@@ -71,6 +72,7 @@
else if (!GSH_FLAG(GSH_NO_BASE_FRAME))
setup_framed(gsh);
else
- gtk_container_add(GTK_CONTAINER(gsh->window), gsh->rows->h);
+ gtk_container_add(GTK_CONTAINER(gsh->widgets.window),
+ gsh->rows->h);
}
Index: dialog_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/dialog_options.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- dialog_options.c 4 May 2007 00:59:58 -0000 1.15
+++ dialog_options.c 5 May 2007 23:38:07 -0000 1.16
@@ -44,7 +44,7 @@
{
GtkWidget *dialog;
- dialog = gtk_message_dialog_new(GTK_WINDOW(gsh->window),
+ dialog = gtk_message_dialog_new(GTK_WINDOW(gsh->widgets.window),
GTK_DIALOG_DESTROY_WITH_PARENT,
type,
GTK_BUTTONS_CLOSE,
Index: file_dialog.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/file_dialog.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- file_dialog.c 28 Feb 2007 03:53:51 -0000 1.5
+++ file_dialog.c 5 May 2007 23:38:07 -0000 1.6
@@ -31,7 +31,7 @@
dialog =
gtk_file_chooser_dialog_new(
"File Chooser",
- GTK_WINDOW(gsh->window),
+ GTK_WINDOW(gsh->widgets.window),
action,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
Index: geometry.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/geometry.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- geometry.c 5 May 2007 22:33:06 -0000 1.14
+++ geometry.c 5 May 2007 23:38:07 -0000 1.15
@@ -31,7 +31,7 @@
#endif /* DEBUG */
ARIFP(gsh->geometry)
{
- gtk_window_parse_geometry(GTK_WINDOW(gsh->window),
+ gtk_window_parse_geometry(GTK_WINDOW(gsh->widgets.window),
gsh->geometry);
g_free(gsh->geometry);
}
Index: gtkshell.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/gtkshell.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- gtkshell.c 3 May 2007 22:55:10 -0000 1.31
+++ gtkshell.c 5 May 2007 23:38:07 -0000 1.32
@@ -35,7 +35,7 @@
static GtkWidget *
gsh_GSH_new_window(struct GSH * gsh)
{
- return gsh->window=gsh_create_main_window();
+ return gsh->widgets.window=gsh_create_main_window();
}
static void
@@ -50,10 +50,11 @@
gsh->parse = &gsh_parse_arguments;
gsh->finalize = &gsh_GSH_finalize;
gsh->init = &gsh_setup_containers;
- gsh->window = (*(gsh->new_window = &gsh_GSH_new_window))(gsh);
- gsh->add_button=&gsh_add_button;
- gsh->add_label=&gsh_add_label;
gsh->manage=&gsh_manage;
+ gsh->add.window=&gsh_GSH_new_window;
+ gsh->add.button=&gsh_add_button;
+ gsh->add.label=&gsh_add_label;
+ $(gsh, add.window);
}
struct GSH *
Index: gtkshell.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/gtkshell.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- gtkshell.h 3 May 2007 22:55:10 -0000 1.40
+++ gtkshell.h 5 May 2007 23:38:07 -0000 1.41
@@ -37,7 +37,7 @@
#ifndef YYFILE
#include "y.tab.h"
-#endif /* !YYFILE */
+#endif /* not YYFILE */
#include "macros.h"
@@ -46,56 +46,44 @@
#include "updated.h"
#include "update_manager_struct.h"
+
struct GSH
{
- GtkWidget *window;
- GtkWidget *scrolled_window;
+ /* member data */
+ /address@hidden@*/ gchar *geometry;
+ Bitmask bflags;
+
+ /* member data categories */
+ struct
+ {
+ GtkWidget * window;
+ GtkWidget * scrolled_window;
+ GtkWidget * button;
+ } widgets;
+
+ /* member classes */
struct GSHRows * rows;
struct GSHUpdateManager * update;
struct GSH_Terminal * terminal;
- GtkWidget *button;
- /address@hidden@*/ gchar *geometry;
- Bitmask bflags;
+
+ /* methods */
void (*delete)(struct GSH *);
void (*parse)(struct GSH *, gint, gchar **);
void (*init)(struct GSH *);
void (*finalize)(struct GSH *);
void (*manage)(struct GSH *, GtkWidget *);
- GtkWidget * (*new_window)(struct GSH *);
- GtkWidget * (*add_button)(struct GSH *, const gchar *);
- GtkWidget * (*add_label)(struct GSH *, const gchar *);
+
+ /* method categories */
+ struct
+ {
+ GtkWidget * (*window)(struct GSH *);
+ GtkWidget * (*button)(struct GSH *, const gchar *);
+ GtkWidget * (*label)(struct GSH *, const gchar *);
+ } add;
+
};
-#include "arguments.h"
-#include "options.h"
-#include "callbacks.h"
-#include "label.h"
-#include "button.h"
-#include "text.h"
-#include "updated_label.h"
-#include "updated_progress.h"
-#include "option_options.h"
-#include "updated_options.h"
-#include "add_options.h"
-#include "dialog_options.h"
-#include "file_dialog.h"
-#include "row.h"
-#include "containers.h"
-#include "geometry.h"
-#include "font.h"
-#include "dragdrop.h"
-#include "image_button.h"
-#include "terminal_options.h"
-#include "terminal.h"
-#include "guidl_dictionary.h"
-#include "guidl_util.h"
-#include "about_dialog.h"
-#include "menu.h"
-#include "init.h"
-#include "guidl_dialog.h"
-#include "guidl_options.h"
-#include "guidl_widgets.h"
-#include "update_manager.h"
+#include "module_includes.h"
struct GSH *
gsh_new_GSH();
Index: image_button.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/image_button.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- image_button.c 3 May 2007 20:49:20 -0000 1.11
+++ image_button.c 5 May 2007 23:38:07 -0000 1.12
@@ -27,14 +27,14 @@
{
GtkWidget * label;
- label=gtk_bin_get_child(GTK_BIN(gsh->button));
+ label=gtk_bin_get_child(GTK_BIN(gsh->widgets.button));
gtk_widget_ref(label);
- gtk_container_remove(GTK_CONTAINER(gsh->button), label);
+ gtk_container_remove(GTK_CONTAINER(gsh->widgets.button), label);
{
GtkWidget * hrow;
hrow=gtk_hbox_new(FALSE, 2);
- gtk_container_add(GTK_CONTAINER(gsh->button), hrow);
+ gtk_container_add(GTK_CONTAINER(gsh->widgets.button), hrow);
gtk_box_pack_start(GTK_BOX(hrow), image, FALSE, FALSE, 0);
gtk_container_add(GTK_CONTAINER(hrow), label);
gtk_widget_show(hrow);
@@ -46,8 +46,9 @@
static void
set_button_image(struct GSH * gsh, GtkWidget * image)
{
- gtk_button_set_image(GTK_BUTTON(gsh->button), image);
- gtk_button_set_relief(GTK_BUTTON(gsh->button), GTK_RELIEF_NONE);
+ gtk_button_set_image(GTK_BUTTON(gsh->widgets.button), image);
+ gtk_button_set_relief(GTK_BUTTON(gsh->widgets.button),
+ GTK_RELIEF_NONE);
}
static void
Index: init.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/init.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- init.c 3 May 2007 21:23:07 -0000 1.4
+++ init.c 5 May 2007 23:38:07 -0000 1.5
@@ -57,6 +57,6 @@
* use a reasonable default. */
gsh_check_and_set_geometry(gsh);
/* Show everything when ready. */
- gtk_widget_show(gsh->window);
+ gtk_widget_show(gsh->widgets.window);
}
Index: option_options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/option_options.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- option_options.c 4 May 2007 00:59:58 -0000 1.23
+++ option_options.c 5 May 2007 23:38:07 -0000 1.24
@@ -29,18 +29,18 @@
set_no_decorations(struct GSH * gsh)
{
/* Recreate main window as popup type. */
- gsh->window=gtk_window_new(GTK_WINDOW_POPUP);
+ gsh->widgets.window=gtk_window_new(GTK_WINDOW_POPUP);
- gtk_window_set_type_hint(GTK_WINDOW(gsh->window),
+ gtk_window_set_type_hint(GTK_WINDOW(gsh->widgets.window),
GDK_WINDOW_TYPE_HINT_DESKTOP);
- gtk_window_set_decorated(GTK_WINDOW(gsh->window),
+ gtk_window_set_decorated(GTK_WINDOW(gsh->widgets.window),
FALSE);
- gtk_window_set_skip_taskbar_hint(GTK_WINDOW(gsh->window),
+ gtk_window_set_skip_taskbar_hint(GTK_WINDOW(gsh->widgets.window),
TRUE);
/* Show window on all desktops. */
- gtk_window_stick(GTK_WINDOW(gsh->window));
+ gtk_window_stick(GTK_WINDOW(gsh->widgets.window));
- gtk_window_set_accept_focus(GTK_WINDOW(gsh->window),
+ gtk_window_set_accept_focus(GTK_WINDOW(gsh->widgets.window),
TRUE);
}
@@ -114,7 +114,7 @@
case 'T': /* Set the window title. */
GSH_COUNT(argc, counter);
- gtk_window_set_title(GTK_WINDOW(gsh->window), argv[*counter]);
+ gtk_window_set_title(GTK_WINDOW(gsh->widgets.window),
argv[*counter]);
break;
case 't':
Index: module_includes.h
===================================================================
RCS file: module_includes.h
diff -N module_includes.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ module_includes.h 5 May 2007 23:38:07 -0000 1.1
@@ -0,0 +1,57 @@
+/*
+ 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_MODULE_INCLUDES_H
+#define GSH_MODULE_INCLUDES_H
+
+#include "arguments.h"
+#include "options.h"
+#include "callbacks.h"
+#include "label.h"
+#include "button.h"
+#include "text.h"
+#include "updated_label.h"
+#include "updated_progress.h"
+#include "option_options.h"
+#include "updated_options.h"
+#include "add_options.h"
+#include "dialog_options.h"
+#include "file_dialog.h"
+#include "row.h"
+#include "containers.h"
+#include "geometry.h"
+#include "font.h"
+#include "dragdrop.h"
+#include "image_button.h"
+#include "terminal_options.h"
+#include "terminal.h"
+#include "guidl_dictionary.h"
+#include "guidl_util.h"
+#include "about_dialog.h"
+#include "menu.h"
+#include "init.h"
+#include "guidl_dialog.h"
+#include "guidl_options.h"
+#include "guidl_widgets.h"
+#include "update_manager.h"
+
+#endif /* not GSH_MODULE_INCLUDES_H */