Pull accelerator key from the stock item if stock_id is given, but
Wed Dec 31 02:05:39 2003 Matthias Clasen <maclas@gmx.de> * gtk/gtkactiongroup.c (gtk_action_group_add_actions_full): (gtk_action_group_add_toggle_actions_full): (gtk_action_group_add_radio_actions_full): Pull accelerator key from the stock item if stock_id is given, but accelerator not. (Noticed by Jeff Franks and Jody Goldberg) * tests/testmerge.c: Remove the accelerator from the "Open" entry to test the above change.
This commit is contained in:
committed by
Matthias Clasen
parent
cf60a59874
commit
e902118f0f
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
Wed Dec 31 02:05:39 2003 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
* gtk/gtkactiongroup.c (gtk_action_group_add_actions_full):
|
||||||
|
(gtk_action_group_add_toggle_actions_full):
|
||||||
|
(gtk_action_group_add_radio_actions_full): Pull accelerator key
|
||||||
|
from the stock item if stock_id is given, but accelerator
|
||||||
|
not. (Noticed by Jeff Franks and Jody Goldberg)
|
||||||
|
|
||||||
|
* tests/testmerge.c: Remove the accelerator from the "Open" entry
|
||||||
|
to test the above change.
|
||||||
|
|
||||||
2003-12-29 Federico Mena Quintero <federico@ximian.com>
|
2003-12-29 Federico Mena Quintero <federico@ximian.com>
|
||||||
|
|
||||||
Make show_all() work for the extra and preview widgets; reported
|
Make show_all() work for the extra and preview widgets; reported
|
||||||
|
|||||||
@ -1,3 +1,14 @@
|
|||||||
|
Wed Dec 31 02:05:39 2003 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
* gtk/gtkactiongroup.c (gtk_action_group_add_actions_full):
|
||||||
|
(gtk_action_group_add_toggle_actions_full):
|
||||||
|
(gtk_action_group_add_radio_actions_full): Pull accelerator key
|
||||||
|
from the stock item if stock_id is given, but accelerator
|
||||||
|
not. (Noticed by Jeff Franks and Jody Goldberg)
|
||||||
|
|
||||||
|
* tests/testmerge.c: Remove the accelerator from the "Open" entry
|
||||||
|
to test the above change.
|
||||||
|
|
||||||
2003-12-29 Federico Mena Quintero <federico@ximian.com>
|
2003-12-29 Federico Mena Quintero <federico@ximian.com>
|
||||||
|
|
||||||
Make show_all() work for the extra and preview widgets; reported
|
Make show_all() work for the extra and preview widgets; reported
|
||||||
|
|||||||
@ -1,3 +1,14 @@
|
|||||||
|
Wed Dec 31 02:05:39 2003 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
* gtk/gtkactiongroup.c (gtk_action_group_add_actions_full):
|
||||||
|
(gtk_action_group_add_toggle_actions_full):
|
||||||
|
(gtk_action_group_add_radio_actions_full): Pull accelerator key
|
||||||
|
from the stock item if stock_id is given, but accelerator
|
||||||
|
not. (Noticed by Jeff Franks and Jody Goldberg)
|
||||||
|
|
||||||
|
* tests/testmerge.c: Remove the accelerator from the "Open" entry
|
||||||
|
to test the above change.
|
||||||
|
|
||||||
2003-12-29 Federico Mena Quintero <federico@ximian.com>
|
2003-12-29 Federico Mena Quintero <federico@ximian.com>
|
||||||
|
|
||||||
Make show_all() work for the extra and preview widgets; reported
|
Make show_all() work for the extra and preview widgets; reported
|
||||||
|
|||||||
@ -1,3 +1,14 @@
|
|||||||
|
Wed Dec 31 02:05:39 2003 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
* gtk/gtkactiongroup.c (gtk_action_group_add_actions_full):
|
||||||
|
(gtk_action_group_add_toggle_actions_full):
|
||||||
|
(gtk_action_group_add_radio_actions_full): Pull accelerator key
|
||||||
|
from the stock item if stock_id is given, but accelerator
|
||||||
|
not. (Noticed by Jeff Franks and Jody Goldberg)
|
||||||
|
|
||||||
|
* tests/testmerge.c: Remove the accelerator from the "Open" entry
|
||||||
|
to test the above change.
|
||||||
|
|
||||||
2003-12-29 Federico Mena Quintero <federico@ximian.com>
|
2003-12-29 Federico Mena Quintero <federico@ximian.com>
|
||||||
|
|
||||||
Make show_all() work for the extra and preview widgets; reported
|
Make show_all() work for the extra and preview widgets; reported
|
||||||
|
|||||||
@ -1,3 +1,14 @@
|
|||||||
|
Wed Dec 31 02:05:39 2003 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
* gtk/gtkactiongroup.c (gtk_action_group_add_actions_full):
|
||||||
|
(gtk_action_group_add_toggle_actions_full):
|
||||||
|
(gtk_action_group_add_radio_actions_full): Pull accelerator key
|
||||||
|
from the stock item if stock_id is given, but accelerator
|
||||||
|
not. (Noticed by Jeff Franks and Jody Goldberg)
|
||||||
|
|
||||||
|
* tests/testmerge.c: Remove the accelerator from the "Open" entry
|
||||||
|
to test the above change.
|
||||||
|
|
||||||
2003-12-29 Federico Mena Quintero <federico@ximian.com>
|
2003-12-29 Federico Mena Quintero <federico@ximian.com>
|
||||||
|
|
||||||
Make show_all() work for the extra and preview widgets; reported
|
Make show_all() work for the extra and preview widgets; reported
|
||||||
|
|||||||
@ -31,6 +31,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "gtkactiongroup.h"
|
#include "gtkactiongroup.h"
|
||||||
|
#include "gtkstock.h"
|
||||||
#include "gtktoggleaction.h"
|
#include "gtktoggleaction.h"
|
||||||
#include "gtkradioaction.h"
|
#include "gtkradioaction.h"
|
||||||
#include "gtkaccelmap.h"
|
#include "gtkaccelmap.h"
|
||||||
@ -395,6 +396,10 @@ gtk_action_group_add_actions_full (GtkActionGroup *action_group,
|
|||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GDestroyNotify destroy)
|
GDestroyNotify destroy)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* Keep this in sync with the other
|
||||||
|
* gtk_action_group_add_..._actions_full() functions.
|
||||||
|
*/
|
||||||
guint i;
|
guint i;
|
||||||
GtkTranslateFunc translate_func;
|
GtkTranslateFunc translate_func;
|
||||||
gpointer translate_data;
|
gpointer translate_data;
|
||||||
@ -408,6 +413,9 @@ gtk_action_group_add_actions_full (GtkActionGroup *action_group,
|
|||||||
{
|
{
|
||||||
GtkAction *action;
|
GtkAction *action;
|
||||||
gchar *accel_path;
|
gchar *accel_path;
|
||||||
|
guint accel_key = 0;
|
||||||
|
GdkModifierType accel_mods;
|
||||||
|
GtkStockItem stock_item;
|
||||||
gchar *label;
|
gchar *label;
|
||||||
gchar *tooltip;
|
gchar *tooltip;
|
||||||
|
|
||||||
@ -437,17 +445,19 @@ gtk_action_group_add_actions_full (GtkActionGroup *action_group,
|
|||||||
/* set the accel path for the menu item */
|
/* set the accel path for the menu item */
|
||||||
accel_path = g_strconcat ("<Actions>/", action_group->private_data->name, "/",
|
accel_path = g_strconcat ("<Actions>/", action_group->private_data->name, "/",
|
||||||
entries[i].name, NULL);
|
entries[i].name, NULL);
|
||||||
if (entries[i].accelerator)
|
|
||||||
{
|
|
||||||
guint accel_key = 0;
|
|
||||||
GdkModifierType accel_mods;
|
|
||||||
|
|
||||||
gtk_accelerator_parse (entries[i].accelerator, &accel_key,
|
if (entries[i].accelerator)
|
||||||
&accel_mods);
|
gtk_accelerator_parse (entries[i].accelerator, &accel_key, &accel_mods);
|
||||||
if (accel_key)
|
else if (entries[i].stock_id &&
|
||||||
gtk_accel_map_add_entry (accel_path, accel_key, accel_mods);
|
gtk_stock_lookup (entries[i].stock_id, &stock_item))
|
||||||
|
{
|
||||||
|
accel_key = stock_item.keyval;
|
||||||
|
accel_mods = stock_item.modifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (accel_key)
|
||||||
|
gtk_accel_map_add_entry (accel_path, accel_key, accel_mods);
|
||||||
|
|
||||||
gtk_action_set_accel_path (action, accel_path);
|
gtk_action_set_accel_path (action, accel_path);
|
||||||
g_free (accel_path);
|
g_free (accel_path);
|
||||||
|
|
||||||
@ -504,6 +514,9 @@ gtk_action_group_add_toggle_actions_full (GtkActionGroup *action_group,
|
|||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GDestroyNotify destroy)
|
GDestroyNotify destroy)
|
||||||
{
|
{
|
||||||
|
/* Keep this in sync with the other
|
||||||
|
* gtk_action_group_add_..._actions_full() functions.
|
||||||
|
*/
|
||||||
guint i;
|
guint i;
|
||||||
GtkTranslateFunc translate_func;
|
GtkTranslateFunc translate_func;
|
||||||
gpointer translate_data;
|
gpointer translate_data;
|
||||||
@ -517,6 +530,9 @@ gtk_action_group_add_toggle_actions_full (GtkActionGroup *action_group,
|
|||||||
{
|
{
|
||||||
GtkAction *action;
|
GtkAction *action;
|
||||||
gchar *accel_path;
|
gchar *accel_path;
|
||||||
|
guint accel_key = 0;
|
||||||
|
GdkModifierType accel_mods;
|
||||||
|
GtkStockItem stock_item;
|
||||||
gchar *label;
|
gchar *label;
|
||||||
gchar *tooltip;
|
gchar *tooltip;
|
||||||
|
|
||||||
@ -549,17 +565,19 @@ gtk_action_group_add_toggle_actions_full (GtkActionGroup *action_group,
|
|||||||
/* set the accel path for the menu item */
|
/* set the accel path for the menu item */
|
||||||
accel_path = g_strconcat ("<Actions>/", action_group->private_data->name, "/",
|
accel_path = g_strconcat ("<Actions>/", action_group->private_data->name, "/",
|
||||||
entries[i].name, NULL);
|
entries[i].name, NULL);
|
||||||
if (entries[i].accelerator)
|
|
||||||
{
|
|
||||||
guint accel_key = 0;
|
|
||||||
GdkModifierType accel_mods;
|
|
||||||
|
|
||||||
gtk_accelerator_parse (entries[i].accelerator, &accel_key,
|
if (entries[i].accelerator)
|
||||||
&accel_mods);
|
gtk_accelerator_parse (entries[i].accelerator, &accel_key, &accel_mods);
|
||||||
if (accel_key)
|
else if (entries[i].stock_id &&
|
||||||
gtk_accel_map_add_entry (accel_path, accel_key, accel_mods);
|
gtk_stock_lookup (entries[i].stock_id, &stock_item))
|
||||||
|
{
|
||||||
|
accel_key = stock_item.keyval;
|
||||||
|
accel_mods = stock_item.modifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (accel_key)
|
||||||
|
gtk_accel_map_add_entry (accel_path, accel_key, accel_mods);
|
||||||
|
|
||||||
gtk_action_set_accel_path (action, accel_path);
|
gtk_action_set_accel_path (action, accel_path);
|
||||||
g_free (accel_path);
|
g_free (accel_path);
|
||||||
|
|
||||||
@ -626,6 +644,9 @@ gtk_action_group_add_radio_actions_full (GtkActionGroup *action_group,
|
|||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GDestroyNotify destroy)
|
GDestroyNotify destroy)
|
||||||
{
|
{
|
||||||
|
/* Keep this in sync with the other
|
||||||
|
* gtk_action_group_add_..._actions_full() functions.
|
||||||
|
*/
|
||||||
guint i;
|
guint i;
|
||||||
GtkTranslateFunc translate_func;
|
GtkTranslateFunc translate_func;
|
||||||
gpointer translate_data;
|
gpointer translate_data;
|
||||||
@ -641,6 +662,9 @@ gtk_action_group_add_radio_actions_full (GtkActionGroup *action_group,
|
|||||||
{
|
{
|
||||||
GtkAction *action;
|
GtkAction *action;
|
||||||
gchar *accel_path;
|
gchar *accel_path;
|
||||||
|
guint accel_key = 0;
|
||||||
|
GdkModifierType accel_mods;
|
||||||
|
GtkStockItem stock_item;
|
||||||
gchar *label;
|
gchar *label;
|
||||||
gchar *tooltip;
|
gchar *tooltip;
|
||||||
|
|
||||||
@ -676,17 +700,19 @@ gtk_action_group_add_radio_actions_full (GtkActionGroup *action_group,
|
|||||||
accel_path = g_strconcat ("<Actions>/",
|
accel_path = g_strconcat ("<Actions>/",
|
||||||
action_group->private_data->name, "/",
|
action_group->private_data->name, "/",
|
||||||
entries[i].name, NULL);
|
entries[i].name, NULL);
|
||||||
if (entries[i].accelerator)
|
|
||||||
{
|
|
||||||
guint accel_key = 0;
|
|
||||||
GdkModifierType accel_mods;
|
|
||||||
|
|
||||||
gtk_accelerator_parse (entries[i].accelerator, &accel_key,
|
if (entries[i].accelerator)
|
||||||
&accel_mods);
|
gtk_accelerator_parse (entries[i].accelerator, &accel_key, &accel_mods);
|
||||||
if (accel_key)
|
else if (entries[i].stock_id &&
|
||||||
gtk_accel_map_add_entry (accel_path, accel_key, accel_mods);
|
gtk_stock_lookup (entries[i].stock_id, &stock_item))
|
||||||
|
{
|
||||||
|
accel_key = stock_item.keyval;
|
||||||
|
accel_mods = stock_item.modifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (accel_key)
|
||||||
|
gtk_accel_map_add_entry (accel_path, accel_key, accel_mods);
|
||||||
|
|
||||||
gtk_action_set_accel_path (action, accel_path);
|
gtk_action_set_accel_path (action, accel_path);
|
||||||
g_free (accel_path);
|
g_free (accel_path);
|
||||||
|
|
||||||
|
|||||||
@ -138,7 +138,7 @@ static GtkActionEntry entries[] = {
|
|||||||
{ "QuitAction", GTK_STOCK_QUIT, NULL, "<control>q", "Quit", G_CALLBACK (gtk_main_quit) },
|
{ "QuitAction", GTK_STOCK_QUIT, NULL, "<control>q", "Quit", G_CALLBACK (gtk_main_quit) },
|
||||||
{ "NewAction", GTK_STOCK_NEW, NULL, "<control>n", "Create something", G_CALLBACK (activate_action) },
|
{ "NewAction", GTK_STOCK_NEW, NULL, "<control>n", "Create something", G_CALLBACK (activate_action) },
|
||||||
{ "New2Action", GTK_STOCK_NEW, NULL, "<control>m", "Create something else", G_CALLBACK (activate_action) },
|
{ "New2Action", GTK_STOCK_NEW, NULL, "<control>m", "Create something else", G_CALLBACK (activate_action) },
|
||||||
{ "OpenAction", GTK_STOCK_OPEN, NULL, "<control>o", "Open it", G_CALLBACK (activate_action) },
|
{ "OpenAction", GTK_STOCK_OPEN, NULL, NULL, "Open it", G_CALLBACK (activate_action) },
|
||||||
{ "CutAction", GTK_STOCK_CUT, NULL, "<control>x", "Knive", G_CALLBACK (activate_action) },
|
{ "CutAction", GTK_STOCK_CUT, NULL, "<control>x", "Knive", G_CALLBACK (activate_action) },
|
||||||
{ "CopyAction", GTK_STOCK_COPY, NULL, "<control>c", "Copy", G_CALLBACK (activate_action) },
|
{ "CopyAction", GTK_STOCK_COPY, NULL, "<control>c", "Copy", G_CALLBACK (activate_action) },
|
||||||
{ "PasteAction", GTK_STOCK_PASTE, NULL, "<control>v", "Paste", G_CALLBACK (activate_action) },
|
{ "PasteAction", GTK_STOCK_PASTE, NULL, "<control>v", "Paste", G_CALLBACK (activate_action) },
|
||||||
|
|||||||
Reference in New Issue
Block a user