forked from AuroraMiddleware/gtk
Test buttons and toggle buttons as proxies.
2003-09-04 Matthias Clasen <maclas@gmx.de> * tests/testmerge.c: Test buttons and toggle buttons as proxies. * gtk/gtktoggleaction.c (connect_proxy): (gtk_toggle_action_real_toggled): Support toggle buttons as proxies. Note that a "draw_as_radio" property is needed for check buttons similar to check menu items, in order to fully support button proxies for radio actions. * gtk/gtkaction.c (connect_proxy): Allow buttons as proxies.
This commit is contained in:
parent
02a963e15b
commit
9ae676b06b
@ -1,5 +1,14 @@
|
||||
2003-09-04 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* tests/testmerge.c: Test buttons and toggle buttons as proxies.
|
||||
|
||||
* gtk/gtktoggleaction.c (connect_proxy):
|
||||
(gtk_toggle_action_real_toggled): Support toggle buttons as proxies. Note
|
||||
that a "draw_as_radio" property is needed for check buttons similar to
|
||||
check menu items, in order to fully support button proxies for radio actions.
|
||||
|
||||
* gtk/gtkaction.c (connect_proxy): Allow buttons as proxies.
|
||||
|
||||
* tests/testmerge.c (toggle_dynamic): Test gtk_ui_manager_add_ui().
|
||||
|
||||
* gtk/gtkuimanager.h: Add GtkUIManagerItemType enum which is needed for the
|
||||
|
@ -1,5 +1,14 @@
|
||||
2003-09-04 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* tests/testmerge.c: Test buttons and toggle buttons as proxies.
|
||||
|
||||
* gtk/gtktoggleaction.c (connect_proxy):
|
||||
(gtk_toggle_action_real_toggled): Support toggle buttons as proxies. Note
|
||||
that a "draw_as_radio" property is needed for check buttons similar to
|
||||
check menu items, in order to fully support button proxies for radio actions.
|
||||
|
||||
* gtk/gtkaction.c (connect_proxy): Allow buttons as proxies.
|
||||
|
||||
* tests/testmerge.c (toggle_dynamic): Test gtk_ui_manager_add_ui().
|
||||
|
||||
* gtk/gtkuimanager.h: Add GtkUIManagerItemType enum which is needed for the
|
||||
|
@ -1,5 +1,14 @@
|
||||
2003-09-04 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* tests/testmerge.c: Test buttons and toggle buttons as proxies.
|
||||
|
||||
* gtk/gtktoggleaction.c (connect_proxy):
|
||||
(gtk_toggle_action_real_toggled): Support toggle buttons as proxies. Note
|
||||
that a "draw_as_radio" property is needed for check buttons similar to
|
||||
check menu items, in order to fully support button proxies for radio actions.
|
||||
|
||||
* gtk/gtkaction.c (connect_proxy): Allow buttons as proxies.
|
||||
|
||||
* tests/testmerge.c (toggle_dynamic): Test gtk_ui_manager_add_ui().
|
||||
|
||||
* gtk/gtkuimanager.h: Add GtkUIManagerItemType enum which is needed for the
|
||||
|
@ -1,5 +1,14 @@
|
||||
2003-09-04 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* tests/testmerge.c: Test buttons and toggle buttons as proxies.
|
||||
|
||||
* gtk/gtktoggleaction.c (connect_proxy):
|
||||
(gtk_toggle_action_real_toggled): Support toggle buttons as proxies. Note
|
||||
that a "draw_as_radio" property is needed for check buttons similar to
|
||||
check menu items, in order to fully support button proxies for radio actions.
|
||||
|
||||
* gtk/gtkaction.c (connect_proxy): Allow buttons as proxies.
|
||||
|
||||
* tests/testmerge.c (toggle_dynamic): Test gtk_ui_manager_add_ui().
|
||||
|
||||
* gtk/gtkuimanager.h: Add GtkUIManagerItemType enum which is needed for the
|
||||
|
@ -1,5 +1,14 @@
|
||||
2003-09-04 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* tests/testmerge.c: Test buttons and toggle buttons as proxies.
|
||||
|
||||
* gtk/gtktoggleaction.c (connect_proxy):
|
||||
(gtk_toggle_action_real_toggled): Support toggle buttons as proxies. Note
|
||||
that a "draw_as_radio" property is needed for check buttons similar to
|
||||
check menu items, in order to fully support button proxies for radio actions.
|
||||
|
||||
* gtk/gtkaction.c (connect_proxy): Allow buttons as proxies.
|
||||
|
||||
* tests/testmerge.c (toggle_dynamic): Test gtk_ui_manager_add_ui().
|
||||
|
||||
* gtk/gtkuimanager.h: Add GtkUIManagerItemType enum which is needed for the
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "gtkaction.h"
|
||||
#include "gtkbutton.h"
|
||||
#include "gtktoolbutton.h"
|
||||
#include "gtkmenuitem.h"
|
||||
#include "gtkimagemenuitem.h"
|
||||
@ -629,6 +630,23 @@ connect_proxy (GtkAction *action,
|
||||
G_CALLBACK (gtk_action_create_menu_proxy),
|
||||
action, 0);
|
||||
|
||||
g_signal_connect_object (proxy, "clicked",
|
||||
G_CALLBACK (gtk_action_activate), action,
|
||||
G_CONNECT_SWAPPED);
|
||||
}
|
||||
else if (GTK_IS_BUTTON (proxy))
|
||||
{
|
||||
/* button specific synchronisers ... */
|
||||
|
||||
/* synchronise the label */
|
||||
g_object_set (G_OBJECT (proxy),
|
||||
"label", action->private_data->short_label,
|
||||
"use_underline", TRUE,
|
||||
NULL);
|
||||
g_signal_connect_object (action, "notify::short_label",
|
||||
G_CALLBACK (gtk_action_sync_short_label),
|
||||
proxy, 0);
|
||||
|
||||
g_signal_connect_object (proxy, "clicked",
|
||||
G_CALLBACK (gtk_action_activate), action,
|
||||
G_CONNECT_SWAPPED);
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "gtktoggleaction.h"
|
||||
#include "gtktoggleactionprivate.h"
|
||||
#include "gtktoggletoolbutton.h"
|
||||
#include "gtktogglebutton.h"
|
||||
#include "gtkcheckmenuitem.h"
|
||||
|
||||
enum
|
||||
@ -152,6 +153,9 @@ gtk_toggle_action_real_toggled (GtkToggleAction *action)
|
||||
else if (GTK_IS_TOGGLE_TOOL_BUTTON (proxy))
|
||||
gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (proxy),
|
||||
action->private_data->active);
|
||||
else if (GTK_IS_TOGGLE_BUTTON (proxy))
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (proxy),
|
||||
action->private_data->active);
|
||||
else {
|
||||
g_warning ("Don't know how to toggle `%s' widgets",
|
||||
G_OBJECT_TYPE_NAME (proxy));
|
||||
@ -175,6 +179,9 @@ connect_proxy (GtkAction *action,
|
||||
else if (GTK_IS_TOGGLE_TOOL_BUTTON (proxy))
|
||||
gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (proxy),
|
||||
toggle_action->private_data->active);
|
||||
else if (GTK_IS_TOGGLE_BUTTON (proxy))
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (proxy),
|
||||
toggle_action->private_data->active);
|
||||
|
||||
(* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ toggle_action (GtkAction *action)
|
||||
const gchar *name = gtk_action_get_name (action);
|
||||
const gchar *typename = G_OBJECT_TYPE_NAME (action);
|
||||
|
||||
g_message ("Action %s (type=%s) activated (active=%d)", name, typename,
|
||||
g_message ("ToggleAction %s (type=%s) toggled (active=%d)", name, typename,
|
||||
gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ toggle_action (GtkAction *action)
|
||||
static void
|
||||
radio_action_changed (GtkAction *action, GtkRadioAction *current)
|
||||
{
|
||||
g_message ("Action %s (type=%s) activated (active=%d) (value %d)",
|
||||
g_message ("RadioAction %s (type=%s) activated (active=%d) (value %d)",
|
||||
gtk_action_get_name (GTK_ACTION (current)),
|
||||
G_OBJECT_TYPE_NAME (GTK_ACTION (current)),
|
||||
gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current)),
|
||||
@ -126,6 +126,7 @@ static GtkActionEntry entries[] = {
|
||||
{ "CopyAction", GTK_STOCK_COPY, NULL, "<control>c", NULL, G_CALLBACK (activate_action) },
|
||||
{ "PasteAction", GTK_STOCK_PASTE, NULL, "<control>v", NULL, G_CALLBACK (activate_action) },
|
||||
{ "AboutAction", NULL, "_About", NULL, NULL, G_CALLBACK (activate_action) },
|
||||
{ "BoldAction", GTK_STOCK_BOLD, "_Bold", "<control>b", NULL, G_CALLBACK (toggle_action), TRUE },
|
||||
};
|
||||
static guint n_entries = G_N_ELEMENTS (entries);
|
||||
|
||||
@ -470,6 +471,18 @@ main (int argc, char **argv)
|
||||
gtk_box_pack_end (GTK_BOX (menu_box), area, FALSE, FALSE, 0);
|
||||
gtk_widget_show (area);
|
||||
|
||||
button = gtk_button_new ();
|
||||
gtk_box_pack_end (GTK_BOX (menu_box), button, FALSE, FALSE, 0);
|
||||
gtk_action_connect_proxy (gtk_action_group_get_action (action_group, "AboutAction"),
|
||||
button);
|
||||
gtk_widget_show (button);
|
||||
merge = gtk_ui_manager_new ();
|
||||
|
||||
button = gtk_check_button_new ();
|
||||
gtk_box_pack_end (GTK_BOX (menu_box), button, FALSE, FALSE, 0);
|
||||
gtk_action_connect_proxy (gtk_action_group_get_action (action_group, "BoldAction"),
|
||||
button);
|
||||
gtk_widget_show (button);
|
||||
merge = gtk_ui_manager_new ();
|
||||
|
||||
g_signal_connect (area, "button_press_event",
|
||||
|
Loading…
Reference in New Issue
Block a user