[gimp] Bug 736746 - Alt+Number only switches to lower-numbered windows
- From: Kristian Rietveld <kristian src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 736746 - Alt+Number only switches to lower-numbered windows
- Date: Fri, 9 Jan 2015 22:04:42 +0000 (UTC)
commit dd7d332fb832193271af7c534e6db326289718eb
Author: Kristian Rietveld <kris loopnest org>
Date: Fri Jan 9 22:53:19 2015 +0100
Bug 736746 - Alt+Number only switches to lower-numbered windows
Add "action-group" signal to GimpActionGroup, such that we can
properly set the accel group and connect the accelerator on actions
that are created after the initial setup of the menus.
app/widgets/gimpactiongroup.c | 24 ++++++++++++++++++++++++
app/widgets/gimpactiongroup.h | 4 ++++
app/widgets/gimpmenufactory.c | 13 +++++++++++++
3 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/app/widgets/gimpactiongroup.c b/app/widgets/gimpactiongroup.c
index f540d14..0437be1 100644
--- a/app/widgets/gimpactiongroup.c
+++ b/app/widgets/gimpactiongroup.c
@@ -29,6 +29,7 @@
#include "widgets-types.h"
#include "core/gimp.h"
+#include "core/gimpmarshal.h"
#include "core/gimpviewable.h"
#include "gimpactiongroup.h"
@@ -41,6 +42,11 @@
#include "gimp-intl.h"
+enum
+{
+ ACTION_ADDED,
+ LAST_SIGNAL
+};
enum
{
@@ -66,6 +72,8 @@ static void gimp_action_group_get_property (GObject *object,
G_DEFINE_TYPE (GimpActionGroup, gimp_action_group, GTK_TYPE_ACTION_GROUP)
+static guint signals[LAST_SIGNAL] = { 0, };
+
#define parent_class gimp_action_group_parent_class
@@ -102,6 +110,16 @@ gimp_action_group_class_init (GimpActionGroupClass *klass)
G_PARAM_CONSTRUCT_ONLY));
klass->groups = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+ signals[ACTION_ADDED] =
+ g_signal_new ("action-added",
+ G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GimpActionGroupClass, action_added),
+ NULL, NULL,
+ gimp_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ GTK_TYPE_ACTION);
}
static void
@@ -367,6 +385,7 @@ gimp_action_group_add_actions (GimpActionGroup *group,
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
+ g_signal_emit (group, signals[ACTION_ADDED], 0, action);
if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,
@@ -422,6 +441,7 @@ gimp_action_group_add_toggle_actions (GimpActionGroup *group,
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
+ g_signal_emit (group, signals[ACTION_ADDED], 0, action);
if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,
@@ -484,6 +504,7 @@ gimp_action_group_add_radio_actions (GimpActionGroup *group,
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
+ g_signal_emit (group, signals[ACTION_ADDED], 0, action);
if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,
@@ -547,6 +568,7 @@ gimp_action_group_add_enum_actions (GimpActionGroup *group,
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
+ g_signal_emit (group, signals[ACTION_ADDED], 0, action);
if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,
@@ -602,6 +624,7 @@ gimp_action_group_add_string_actions (GimpActionGroup *group,
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
+ g_signal_emit (group, signals[ACTION_ADDED], 0, action);
if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,
@@ -643,6 +666,7 @@ gimp_action_group_add_plug_in_actions (GimpActionGroup *group,
gtk_action_group_add_action_with_accel (GTK_ACTION_GROUP (group),
GTK_ACTION (action),
entries[i].accelerator);
+ g_signal_emit (group, signals[ACTION_ADDED], 0, action);
if (entries[i].help_id)
g_object_set_qdata_full (G_OBJECT (action), GIMP_HELP_ID,
diff --git a/app/widgets/gimpactiongroup.h b/app/widgets/gimpactiongroup.h
index 2ffc500..298ce87 100644
--- a/app/widgets/gimpactiongroup.h
+++ b/app/widgets/gimpactiongroup.h
@@ -50,6 +50,10 @@ struct _GimpActionGroupClass
GtkActionGroupClass parent_class;
GHashTable *groups;
+
+ /* signals */
+ void (* action_added) (GimpActionGroup *group,
+ GtkAction *action);
};
struct _GimpActionEntry
diff --git a/app/widgets/gimpmenufactory.c b/app/widgets/gimpmenufactory.c
index 6aaaf51..9db82b8 100644
--- a/app/widgets/gimpmenufactory.c
+++ b/app/widgets/gimpmenufactory.c
@@ -191,6 +191,15 @@ gimp_menu_factory_get_registered_menus (GimpMenuFactory *factory)
return factory->p->registered_menus;
}
+static void
+gimp_menu_factory_manager_action_added (GimpActionGroup *group,
+ GtkAction *action,
+ GtkAccelGroup *accel_group)
+{
+ gtk_action_set_accel_group (action, accel_group);
+ gtk_action_connect_accelerator (action);
+}
+
GimpUIManager *
gimp_menu_factory_manager_new (GimpMenuFactory *factory,
const gchar *identifier,
@@ -240,6 +249,10 @@ gimp_menu_factory_manager_new (GimpMenuFactory *factory,
g_list_free (actions);
+ g_signal_connect_object (group, "action-added",
+ G_CALLBACK (gimp_menu_factory_manager_action_added),
+ accel_group, 0);
+
gtk_ui_manager_insert_action_group (GTK_UI_MANAGER (manager),
GTK_ACTION_GROUP (group),
-1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]