mirror of https://github.com/GNOME/gimp.git
new versions with sane namespace and support for setting the application
2007-08-31 Michael Natterer <mitch@gimp.org> * app/gui/sync-menu.[ch]: new versions with sane namespace and support for setting the application menu's "Quit", "About" and "Preferences" items. * app/gui/gui.c: changed accordingly and use the new menu items from the application menu. svn path=/trunk/; revision=23427
This commit is contained in:
parent
9f66bd88ce
commit
340e4d315f
|
@ -1,3 +1,12 @@
|
|||
2007-08-31 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/gui/sync-menu.[ch]: new versions with sane namespace and
|
||||
support for setting the application menu's "Quit", "About" and
|
||||
"Preferences" items.
|
||||
|
||||
* app/gui/gui.c: changed accordingly and use the new menu items
|
||||
from the application menu.
|
||||
|
||||
2007-08-31 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/base/tile-manager.c (tile_manager_get): if
|
||||
|
|
|
@ -465,14 +465,30 @@ gui_restore_after_callback (Gimp *gimp,
|
|||
#ifdef HAVE_CARBON
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *item;
|
||||
|
||||
menu = gtk_ui_manager_get_widget (image_ui_manager,
|
||||
menu = gtk_ui_manager_get_widget (GTK_UI_MANAGER (image_ui_manager),
|
||||
"/dummy-menubar/image-popup");
|
||||
|
||||
if (GTK_IS_MENU_ITEM (menu))
|
||||
menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menu));
|
||||
|
||||
sync_menu_takeover_menu (GTK_MENU_SHELL (menu));
|
||||
gtk_macmenu_set_menubar (GTK_MENU_SHELL (menu));
|
||||
|
||||
item = gtk_ui_manager_get_widget (GTK_UI_MANAGER (image_ui_manager),
|
||||
"/dummy-menubar/image-popup/File/file-quit");
|
||||
if (GTK_IS_MENU_ITEM (item))
|
||||
gtk_macmenu_set_quit_item (GTK_MENU_ITEM (item));
|
||||
|
||||
item = gtk_ui_manager_get_widget (GTK_UI_MANAGER (image_ui_manager),
|
||||
"/dummy-menubar/image-popup/Help/dialogs-about");
|
||||
if (GTK_IS_MENU_ITEM (item))
|
||||
gtk_macmenu_set_about_item (GTK_MENU_ITEM (item), _("About GIMP"));
|
||||
|
||||
item = gtk_ui_manager_get_widget (GTK_UI_MANAGER (image_ui_manager),
|
||||
"/dummy-menubar/image-popup/Edit/dialogs-preferences");
|
||||
if (GTK_IS_MENU_ITEM (item))
|
||||
gtk_macmenu_set_prefs_item (GTK_MENU_ITEM (item), _("Preferences"));
|
||||
}
|
||||
#endif /* HAVE_CARBON */
|
||||
|
||||
|
|
|
@ -689,7 +689,7 @@ sync_menu_shell (GtkMenuShell *menu_shell,
|
|||
}
|
||||
|
||||
void
|
||||
sync_menu_takeover_menu (GtkMenuShell *menu_shell)
|
||||
gtk_macmenu_set_menubar (GtkMenuShell *menu_shell)
|
||||
{
|
||||
MenuRef carbon_menubar;
|
||||
|
||||
|
@ -709,4 +709,86 @@ sync_menu_takeover_menu (GtkMenuShell *menu_shell)
|
|||
sync_menu_shell (menu_shell, carbon_menubar, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_macmenu_set_quit_item (GtkMenuItem *menu_item)
|
||||
{
|
||||
MenuRef appmenu;
|
||||
MenuItemIndex index;
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
|
||||
|
||||
if (GetIndMenuItemWithCommandID (NULL, kHICommandQuit, 1,
|
||||
&appmenu, &index) == noErr)
|
||||
{
|
||||
SetMenuItemCommandID (appmenu, index, 0);
|
||||
SetMenuItemProperty (appmenu, index,
|
||||
GTK_QUARTZ_MENU_CREATOR,
|
||||
GTK_QUARTZ_ITEM_WIDGET,
|
||||
sizeof (menu_item), &menu_item);
|
||||
|
||||
gtk_widget_hide (GTK_WIDGET (menu_item));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_macmenu_set_about_item (GtkMenuItem *menu_item,
|
||||
const gchar *label)
|
||||
{
|
||||
MenuRef appmenu;
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
|
||||
g_return_if_fail (label != NULL);
|
||||
|
||||
if (GetIndMenuItemWithCommandID (NULL, kHICommandHide, 1,
|
||||
&appmenu, NULL) == noErr)
|
||||
{
|
||||
CFStringRef cfstr;
|
||||
|
||||
cfstr = CFStringCreateWithCString (NULL, label,
|
||||
kCFStringEncodingUTF8);
|
||||
|
||||
InsertMenuItemTextWithCFString (appmenu, cfstr, 0, 0, 0);
|
||||
SetMenuItemProperty (appmenu, 1,
|
||||
GTK_QUARTZ_MENU_CREATOR,
|
||||
GTK_QUARTZ_ITEM_WIDGET,
|
||||
sizeof (menu_item), &menu_item);
|
||||
|
||||
CFRelease (cfstr);
|
||||
|
||||
gtk_widget_hide (GTK_WIDGET (menu_item));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_macmenu_set_prefs_item (GtkMenuItem *menu_item,
|
||||
const gchar *label)
|
||||
{
|
||||
MenuRef appmenu;
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
|
||||
g_return_if_fail (label != NULL);
|
||||
|
||||
if (GetIndMenuItemWithCommandID (NULL, kHICommandHide, 1,
|
||||
&appmenu, NULL) == noErr)
|
||||
{
|
||||
CFStringRef cfstr;
|
||||
|
||||
InsertMenuItemTextWithCFString (appmenu, NULL, 1,
|
||||
kMenuItemAttrSeparator, 0);
|
||||
|
||||
cfstr = CFStringCreateWithCString (NULL, label,
|
||||
kCFStringEncodingUTF8);
|
||||
|
||||
InsertMenuItemTextWithCFString (appmenu, cfstr, 2, 0, 0);
|
||||
SetMenuItemProperty (appmenu, 3,
|
||||
GTK_QUARTZ_MENU_CREATOR,
|
||||
GTK_QUARTZ_ITEM_WIDGET,
|
||||
sizeof (menu_item), &menu_item);
|
||||
|
||||
CFRelease (cfstr);
|
||||
|
||||
gtk_widget_hide (GTK_WIDGET (menu_item));
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_CARBON */
|
||||
|
|
|
@ -28,7 +28,13 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void sync_menu_takeover_menu (GtkMenuShell *menu_shell);
|
||||
void gtk_macmenu_set_menubar (GtkMenuShell *menu_shell);
|
||||
|
||||
void gtk_macmenu_set_quit_item (GtkMenuItem *menu_item);
|
||||
void gtk_macmenu_set_about_item (GtkMenuItem *menu_item,
|
||||
const gchar *label);
|
||||
void gtk_macmenu_set_prefs_item (GtkMenuItem *menu_item,
|
||||
const gchar *label);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
Loading…
Reference in New Issue