[gtk/wip/chergert/quartz4u: 6/7] macos: make gtkapplication-quartz.c compile
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/quartz4u: 6/7] macos: make gtkapplication-quartz.c compile
- Date: Wed, 22 Jul 2020 01:08:01 +0000 (UTC)
commit eb39571735dc4e8b44856fb00714f359114208c8
Author: Christian Hergert <chergert redhat com>
Date: Tue Jul 21 18:04:14 2020 -0700
macos: make gtkapplication-quartz.c compile
This does a minimal fix to get the module to compile by assuming that we do not
have an app-menu. We probably want to improve how this is really fixed going
forward.
gtk/gtkapplication-quartz.c | 37 +++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtkapplication-quartz.c b/gtk/gtkapplication-quartz.c
index d59a19b1e2..b734959183 100644
--- a/gtk/gtkapplication-quartz.c
+++ b/gtk/gtkapplication-quartz.c
@@ -41,8 +41,19 @@ gtk_application_quartz_inhibitor_free (GtkApplicationQuartzInhibitor *inhibitor)
}
typedef GtkApplicationImplClass GtkApplicationImplQuartzClass;
+typedef struct _GtkApplicationImplQuartz GtkApplicationImplQuartz;
-typedef struct
+@interface GtkApplicationQuartzDelegate : NSObject
+{
+ GtkApplicationImplQuartz *quartz;
+}
+
+- (id)initWithImpl:(GtkApplicationImplQuartz*)impl;
+- (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *)sender;
+- (void)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames;
+@end
+
+struct _GtkApplicationImplQuartz
{
GtkApplicationImpl impl;
@@ -52,21 +63,11 @@ typedef struct
GSList *inhibitors;
gint quit_inhibit;
guint next_cookie;
- NSObject *delegate;
-} GtkApplicationImplQuartz;
+ GtkApplicationQuartzDelegate *delegate;
+};
G_DEFINE_TYPE (GtkApplicationImplQuartz, gtk_application_impl_quartz, GTK_TYPE_APPLICATION_IMPL)
-@interface GtkApplicationQuartzDelegate : NSObject
-{
- GtkApplicationImplQuartz *quartz;
-}
-
-- (id)initWithImpl:(GtkApplicationImplQuartz*)impl;
-- (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *)sender;
-- (void)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames;
-@end
-
@implementation GtkApplicationQuartzDelegate
-(id)initWithImpl:(GtkApplicationImplQuartz*)impl
{
@@ -162,10 +163,10 @@ gtk_application_impl_quartz_startup (GtkApplicationImpl *impl,
if (register_session)
{
quartz->delegate = [[GtkApplicationQuartzDelegate alloc] initWithImpl:quartz];
- [NSApp setDelegate: quartz->delegate];
+ [NSApp setDelegate: (id<NSApplicationDelegate>)quartz->delegate];
}
- quartz->muxer = gtk_action_muxer_new ();
+ quartz->muxer = gtk_action_muxer_new (NULL);
gtk_action_muxer_set_parent (quartz->muxer, gtk_application_get_action_muxer (impl->application));
/* Add the default accels */
@@ -182,7 +183,11 @@ gtk_application_impl_quartz_startup (GtkApplicationImpl *impl,
g_object_unref (gtkinternal);
/* now setup the menu */
+#if 0
app_menu = gtk_application_get_app_menu (impl->application);
+#else
+ app_menu = NULL;
+#endif
if (app_menu == NULL)
{
GtkBuilder *builder;
@@ -193,7 +198,7 @@ gtk_application_impl_quartz_startup (GtkApplicationImpl *impl,
* app menu at index 0 in 'combined'.
*/
builder = gtk_builder_new_from_resource ("/org/gtk/libgtk/ui/gtkapplication-quartz.ui");
- gtk_application_set_app_menu (impl->application, G_MENU_MODEL (gtk_builder_get_object (builder,
"app-menu")));
+ gtk_application_impl_set_app_menu (impl, G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));
g_object_unref (builder);
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]