[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Antiright-devel] antiright/gtkshell button.c menu.c menu.h text.c
From: |
Jeffrey Bedard |
Subject: |
[Antiright-devel] antiright/gtkshell button.c menu.c menu.h text.c |
Date: |
Thu, 15 Nov 2007 03:17:38 +0000 |
CVSROOT: /sources/antiright
Module name: antiright
Changes by: Jeffrey Bedard <jefbed> 07/11/15 03:17:38
Modified files:
gtkshell : button.c menu.c menu.h text.c
Log message:
Remove labels from toolbar items. Split menubar menu
detection code from menu pointer assignment, export
detection. Use detection for not removing labels from
buttons considered for toolbar addition, in case one
happens to be the menubar button. This prevents the
menubar button from being added as a toolbar button.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/button.c?cvsroot=antiright&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/menu.c?cvsroot=antiright&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/menu.h?cvsroot=antiright&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/text.c?cvsroot=antiright&r1=1.41&r2=1.42
Patches:
Index: button.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/button.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- button.c 8 Nov 2007 06:41:53 -0000 1.54
+++ button.c 15 Nov 2007 03:17:38 -0000 1.55
@@ -129,14 +129,19 @@
GTK_STOCK_EXECUTE, GTK_ICON_SIZE_SMALL_TOOLBAR);
}
-static void
+static gboolean
setup_icon_for_toolbutton(GtkWidget * toolbutton, gchar * label_text)
{
GtkWidget * icon;
icon = label_to_icon_translation(label_text);
if(icon)
+ {
gtk_button_set_image(GTK_BUTTON(toolbutton), icon);
+ return TRUE;
+ }
+ else
+ return FALSE;
}
static void
@@ -146,7 +151,9 @@
label_text=antiright_beautified_label(command);
gtk_button_set_label(GTK_BUTTON(toolbutton), label_text);
- setup_icon_for_toolbutton(toolbutton, label_text);
+ if(setup_icon_for_toolbutton(toolbutton, label_text)
+ && (gsh_is_menubar_item(label_text)==GMT_NONE))
+ gtk_button_set_label(GTK_BUTTON(toolbutton), "");
g_free(label_text);
}
Index: menu.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/menu.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- menu.c 8 Nov 2007 06:41:54 -0000 1.26
+++ menu.c 15 Nov 2007 03:17:38 -0000 1.27
@@ -199,21 +199,47 @@
return GWA.menubar;
}
-static void
-test_for_main_app_menus(GSH * gsh, GtkWidget * menu, const gchar * label)
+GSHMenuType
+gsh_is_menubar_item(const gchar * label)
{
-#define GSHMENUS GWA.menus
if(!strcmp(label, "File"))
- GSHMENUS.file=menu;
+ return GMT_FILE;
else if(!strcmp(label, "Edit"))
- GSHMENUS.edit=menu;
+ return GMT_EDIT;
else if(!strcmp(label, "Tools"))
- GSHMENUS.tools=menu;
+ return GMT_TOOLS;
else if(!strcmp(label, "View"))
- GSHMENUS.view=menu;
+ return GMT_VIEW;
else if(!strcmp(label, "Help"))
+ return GMT_HELP;
+ else return GMT_NONE;
+}
+
+static void
+test_for_main_app_menus(GSH * gsh, GtkWidget * menu, const gchar * label)
+{
+#define GSHMENUS GWA.menus
+ switch(gsh_is_menubar_item(label))
+ {
+ case GMT_FILE:
+ GSHMENUS.file=menu;
+ break;
+ case GMT_EDIT:
+ GSHMENUS.edit=menu;
+ break;
+ case GMT_VIEW:
+ GSHMENUS.view=menu;
+ break;
+ case GMT_TOOLS:
+ GSHMENUS.tools=menu;
+ break;
+ case GMT_HELP:
GSHMENUS.help=menu;
+ break;
+ case GMT_NONE:
+ break;
+ }
}
static GtkWidget *
Index: menu.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/menu.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- menu.h 11 Jun 2007 21:32:43 -0000 1.4
+++ menu.h 15 Nov 2007 03:17:38 -0000 1.5
@@ -24,6 +24,19 @@
#ifndef GSH_MENU_H
#define GSH_MENU_H
+typedef enum
+{
+ GMT_NONE,
+ GMT_FILE,
+ GMT_EDIT,
+ GMT_TOOLS,
+ GMT_VIEW,
+ GMT_HELP
+} GSHMenuType;
+
+GSHMenuType
+gsh_is_menubar_item(const gchar * label);
+
void
gsh_menubutton_parse(struct GSH * gsh, gchar **tokens);
Index: text.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/text.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- text.c 12 Nov 2007 10:51:22 -0000 1.41
+++ text.c 15 Nov 2007 03:17:38 -0000 1.42
@@ -29,7 +29,7 @@
#define ADD_ENTRY(widget, str)\
gtk_combo_box_prepend_text(GTK_COMBO_BOX(widget), str)
-/* Some sample entries to use when history is not useful, such as a
+/* Some sample entries to use when history is not usefu, such as a
* dialog presentation of this field, where the window displaying the
* field closes on the first activation. */
static void
@@ -147,33 +147,26 @@
setup_undo(GSH * gsh)
{
GtkWidget * text_widget=gsh->editor.widget;
-
GtkWidget * redo_button;
GtkWidget * undo_button;
+ GtkWidget * destination;
/* The undo and redo names are swapped within undo.c somehow,
so a hack is to simply rename the buttons. */
- gtk_widget_show(redo_button=gtk_button_new_with_label("Redo"));
- gtk_widget_show(undo_button=gtk_button_new_with_label("Undo"));
+ gtk_widget_show(redo_button=gtk_button_new_from_stock("gtk-redo"));
+ gtk_widget_show(undo_button=gtk_button_new_from_stock("gtk-undo"));
if(gsh->widgets.app.toolbar)
- {
- GtkWidget * toolbar=gsh->widgets.app.toolbar;
- GSHCA(toolbar, undo_button);
- GSHCA(toolbar, redo_button);
-#ifdef DEBUG
- ARBUG("toolbar defined");
-#endif /* DEBUG */
- }
+ destination=gsh->widgets.app.toolbar;
else
{
- GtkWidget * hbox;
-
+ /* Set up a horizontal container
+ for undo and redo buttons. */
GSH_SET(GSH_NO_EXPAND);
- GSH_SHOW_CREATE(hbox, hbox, TRUE, 0);
- GSHCA(hbox, undo_button);
- GSHCA(hbox, redo_button);
- $(gsh, manage, hbox);
+ GSH_SHOW_CREATE(destination, hbox, TRUE, 0);
+ $(gsh, manage, destination);
}
+ GSHCA(destination, undo_button);
+ GSHCA(destination, redo_button);
undo_init(text_widget, undo_button, redo_button);
g_signal_connect_swapped(G_OBJECT(undo_button), "clicked",
(GCallback)undo_undo,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Antiright-devel] antiright/gtkshell button.c menu.c menu.h text.c,
Jeffrey Bedard <=