diff options
author | Philip Chimento <philip.chimento@gmail.com> | 2014-10-10 22:35:24 -0700 |
---|---|---|
committer | Tristan Van Berkom <tristan@upstairslabs.com> | 2014-10-12 19:42:57 +0900 |
commit | fc24963f93ea227ae6c627402166fa8184d6a51c (patch) | |
tree | 3d2787a77231c7524e1569480e41dd3e63ce9c21 /src/glade-window.c | |
parent | e36e1ae6882d6e5345bcbf6f029f8239c4afd76f (diff) | |
download | glade-fc24963f93ea227ae6c627402166fa8184d6a51c.tar.gz |
osx: Use current gtk-mac-integration API
The #ifdef'd block did not compile at all because it used the old API
from gtk-mac-integration, and because it used GtkBuilder when the
surrounding code had been ported to use widget templates.
This fixes up the use of the API and adds a few widget variables to
GladeWindowPrivate which have to be bound to the template.
https://bugzilla.gnome.org/show_bug.cgi?id=738339
Diffstat (limited to 'src/glade-window.c')
-rw-r--r-- | src/glade-window.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/src/glade-window.c b/src/glade-window.c index 2fae4f68..6dbfe628 100644 --- a/src/glade-window.c +++ b/src/glade-window.c @@ -136,11 +136,17 @@ struct _GladeWindowPrivate GtkActionGroup *static_actiongroup; GtkActionGroup *view_actiongroup; + GtkMenuShell *menubar; GtkMenuShell *project_menu; GtkRecentManager *recent_manager; GtkWidget *recent_menu; + GtkWidget *quit_menuitem; + GtkWidget *about_menuitem; + GtkWidget *properties_menuitem; + GtkMenuItem *help_menuitem; + gchar *default_path; /* the default path for open/save operations */ GtkToolItem *undo_toolbutton; /* customized buttons for undo/redo with history */ @@ -3272,33 +3278,29 @@ glade_window_constructed (GObject *object) #ifdef MAC_INTEGRATION { /* Fix up the menubar for MacOSX Quartz builds */ - GtkWidget *menubar = GET_OBJECT (builder, GTK_WIDGET, "menubar"); - GtkOSXApplication *theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL); - GtkWidget *sep, *widget; - - gtk_widget_hide (menubar); - gtk_osxapplication_set_menu_bar(theApp, GTK_MENU_SHELL(menubar)); - widget = GET_OBJECT (builder, GTK_WIDGET, "quit_menuitem"); - gtk_widget_hide (widget); - widget = GET_OBJECT (builder, GTK_WIDGET, "about_menuitem"); - gtk_osxapplication_insert_app_menu_item (theApp, widget, 0); + GtkosxApplication *theApp = gtkosx_application_get (); + GtkWidget *sep; + + gtk_widget_hide (priv->menubar); + gtkosx_application_set_menu_bar (theApp, priv->menubar); + gtk_widget_hide (priv->quit_menuitem); + gtkosx_application_insert_app_menu_item (theApp, priv->about_menuitem, 0); sep = gtk_separator_menu_item_new(); g_object_ref(sep); - gtk_osxapplication_insert_app_menu_item (theApp, sep, 1); + gtkosx_application_insert_app_menu_item (theApp, sep, 1); - widget = GET_OBJECT (builder, GTK_WIDGET, "properties_menuitem"); - gtk_osxapplication_insert_app_menu_item (theApp, widget, 2); + gtkosx_application_insert_app_menu_item (theApp, priv->properties_menuitem, + 2); sep = gtk_separator_menu_item_new(); g_object_ref(sep); - gtk_osxapplication_insert_app_menu_item (theApp, sep, 3); + gtkosx_application_insert_app_menu_item (theApp, sep, 3); - widget = GET_OBJECT (builder, GTK_WIDGET, "help_menuitem"); - gtk_osxapplication_set_help_menu(theApp, GTK_MENU_ITEM(widget)); + gtkosx_application_set_help_menu (theApp, priv->help_menuitem); g_signal_connect(theApp, "NSApplicationWillTerminate", G_CALLBACK(on_quit_action_activate), window); - gtk_osxapplication_ready(theApp); + gtkosx_application_ready (theApp); } #endif @@ -3391,7 +3393,12 @@ glade_window_class_init (GladeWindowClass *klass) gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, pointer_mode_actiongroup); gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, static_actiongroup); gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, view_actiongroup); - + gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, menubar); + gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, quit_menuitem); + gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, properties_menuitem); + gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, about_menuitem); + gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, help_menuitem); + /* Actions */ gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, save_action); gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, quit_action); |