[gimp] Bug 624642 - 'GtkAccelLabel' has no member named 'accel_closure'
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 624642 - 'GtkAccelLabel' has no member named 'accel_closure'
- Date: Thu, 1 Sep 2011 19:36:25 +0000 (UTC)
commit 0351c13a36b01e45be65c616a6d52b28445247af
Author: Michael Natterer <mitch gimp org>
Date: Thu Sep 1 21:25:00 2011 +0200
Bug 624642 - 'GtkAccelLabel' has no member named 'accel_closure'
Apply cleaned up and fixed patch from Alex Mankuta which
undeprecates ige-mac-menu.c. The file builds now and I only
see warnings about using unknown Carbon API, but I have no
way of checking if it still works on systems where the
deprecated Carbon API actually does something.
app/gui/ige-mac-menu.c | 114 +++++++++++++++++++++++++++++-------------------
1 files changed, 69 insertions(+), 45 deletions(-)
---
diff --git a/app/gui/ige-mac-menu.c b/app/gui/ige-mac-menu.c
index 0dc1f08..79b4dba 100644
--- a/app/gui/ige-mac-menu.c
+++ b/app/gui/ige-mac-menu.c
@@ -300,52 +300,60 @@ carbon_menu_item_update_accelerator (CarbonMenuItem *carbon_item,
get_menu_label_text (widget, &label);
- if (GTK_IS_ACCEL_LABEL (label) &&
- GTK_ACCEL_LABEL (label)->accel_closure)
+ if (GTK_IS_ACCEL_LABEL (label))
{
- GtkAccelKey *key;
+ GClosure *closure;
- key = gtk_accel_group_find (GTK_ACCEL_LABEL (label)->accel_group,
- accel_find_func,
- GTK_ACCEL_LABEL (label)->accel_closure);
+ g_object_get (label, "accel-closure", &closure, NULL);
- if (key &&
- key->accel_key &&
- key->accel_flags & GTK_ACCEL_VISIBLE)
+ if (closure)
{
- GdkDisplay *display = gtk_widget_get_display (widget);
- GdkKeymap *keymap = gdk_keymap_get_for_display (display);
- GdkKeymapKey *keys;
- gint n_keys;
+ GtkAccelGroup *group;
+ GtkAccelKey *key;
- if (gdk_keymap_get_entries_for_keyval (keymap, key->accel_key,
- &keys, &n_keys))
- {
- UInt8 modifiers = 0;
+ group = gtk_accel_group_from_accel_closure (closure);
+ key = gtk_accel_group_find (group, accel_find_func, closure);
- SetMenuItemCommandKey (carbon_item->menu, carbon_item->index,
- true, keys[0].keycode);
+ g_closure_unref (closure);
- g_free (keys);
+ if (key &&
+ key->accel_key &&
+ key->accel_flags & GTK_ACCEL_VISIBLE)
+ {
+ GdkDisplay *display = gtk_widget_get_display (widget);
+ GdkKeymap *keymap = gdk_keymap_get_for_display (display);
+ GdkKeymapKey *keys;
+ gint n_keys;
- if (key->accel_mods)
+ if (gdk_keymap_get_entries_for_keyval (keymap, key->accel_key,
+ &keys, &n_keys))
{
- if (key->accel_mods & GDK_SHIFT_MASK)
- modifiers |= kMenuShiftModifier;
+ UInt8 modifiers = 0;
- if (key->accel_mods & GDK_MOD1_MASK)
- modifiers |= kMenuOptionModifier;
- }
+ SetMenuItemCommandKey (carbon_item->menu, carbon_item->index,
+ true, keys[0].keycode);
- if (!(key->accel_mods & GDK_CONTROL_MASK))
- {
- modifiers |= kMenuNoCommandModifier;
- }
+ g_free (keys);
- SetMenuItemModifiers (carbon_item->menu, carbon_item->index,
- modifiers);
+ if (key->accel_mods)
+ {
+ if (key->accel_mods & GDK_SHIFT_MASK)
+ modifiers |= kMenuShiftModifier;
- return;
+ if (key->accel_mods & GDK_MOD1_MASK)
+ modifiers |= kMenuOptionModifier;
+ }
+
+ if (!(key->accel_mods & GDK_CONTROL_MASK))
+ {
+ modifiers |= kMenuNoCommandModifier;
+ }
+
+ SetMenuItemModifiers (carbon_item->menu, carbon_item->index,
+ modifiers);
+
+ return;
+ }
}
}
}
@@ -371,9 +379,20 @@ carbon_menu_item_accel_changed (GtkAccelGroup *accel_group,
get_menu_label_text (widget, &label);
- if (GTK_IS_ACCEL_LABEL (label) &&
- GTK_ACCEL_LABEL (label)->accel_closure == accel_closure)
- carbon_menu_item_update_accelerator (carbon_item, widget);
+ if (GTK_IS_ACCEL_LABEL (label))
+ {
+ GClosure *closure;
+
+ g_object_get (label, "accel-closure", &closure, NULL);
+
+ if (closure)
+ {
+ if (closure == accel_closure)
+ carbon_menu_item_update_accelerator (carbon_item, widget);
+
+ g_closure_unref (closure);
+ }
+ }
}
static void
@@ -398,12 +417,10 @@ carbon_menu_item_update_accel_closure (CarbonMenuItem *carbon_item,
}
if (GTK_IS_ACCEL_LABEL (label))
- carbon_item->accel_closure = GTK_ACCEL_LABEL (label)->accel_closure;
+ g_object_get (label, "accel-closure", &carbon_item->accel_closure, NULL);
if (carbon_item->accel_closure)
{
- g_closure_ref (carbon_item->accel_closure);
-
group = gtk_accel_group_from_accel_closure (carbon_item->accel_closure);
g_signal_connect_object (group, "accel-changed",
@@ -674,10 +691,10 @@ sync_menu_shell (GtkMenuShell *menu_shell,
if (GTK_IS_SEPARATOR_MENU_ITEM (menu_item))
attributes |= kMenuItemAttrSeparator;
- if (!GTK_WIDGET_IS_SENSITIVE (menu_item))
+ if (!gtk_widget_is_sensitive (menu_item))
attributes |= kMenuItemAttrDisabled;
- if (!GTK_WIDGET_VISIBLE (menu_item))
+ if (!gtk_widget_get_visible (menu_item))
attributes |= kMenuItemAttrHidden;
InsertMenuItemTextWithCFString (carbon_menu, cfstr,
@@ -730,10 +747,17 @@ parent_set_emission_hook (GSignalInvocationHint *ihint,
{
menu_shell = previous_parent;
}
- else if (GTK_IS_MENU_SHELL (instance->parent))
- {
- menu_shell = instance->parent;
- }
+ else
+ {
+ GtkWidget *parent;
+
+ parent = gtk_widget_get_parent (instance);
+
+ if (GTK_IS_MENU_SHELL (parent))
+ {
+ menu_shell = parent;
+ }
+ }
if (menu_shell)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]