[gedit/gnome-3-2-osx] Added "ready" vfunc for gedit app
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/gnome-3-2-osx] Added "ready" vfunc for gedit app
- Date: Mon, 30 Jan 2012 15:50:18 +0000 (UTC)
commit f53b2a69a3a216d6827764d383d24cb5e7958c5d
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Mon Jan 30 16:48:17 2012 +0100
Added "ready" vfunc for gedit app
This is needed for OS X to signal the NSApp that
we are ready to receive events. This needs to be
done after the main gedit window has been created
because those events contain things like OpenFile
gedit/gedit-app-osx.c | 20 +++++++++++++++-----
gedit/gedit-app.c | 14 ++++++++++++++
gedit/gedit-app.h | 3 +++
gedit/gedit.c | 2 ++
4 files changed, 34 insertions(+), 5 deletions(-)
---
diff --git a/gedit/gedit-app-osx.c b/gedit/gedit-app-osx.c
index f8963ce..2b07fe8 100644
--- a/gedit/gedit-app-osx.c
+++ b/gedit/gedit-app-osx.c
@@ -308,12 +308,11 @@ static GeditWindow *
gedit_app_osx_create_window_impl (GeditApp *app)
{
GeditWindow *window;
-
+
window = GEDIT_APP_CLASS (gedit_app_osx_parent_class)->create_window (app);
setup_mac_menu (window);
-
return window;
}
@@ -323,13 +322,13 @@ gedit_app_osx_process_window_event_impl (GeditApp *app,
GdkEvent *event)
{
NSEvent *nsevent;
-
+
/* For OS X we will propagate the event to NSApp, which handles some OS X
* specific keybindings and the accelerators for the menu
*/
nsevent = gdk_quartz_event_get_nsevent (event);
[NSApp sendEvent:nsevent];
-
+
/* It does not really matter what we return here since it's the last thing
* in the chain. Also we can't get from sendEvent whether the event was
* actually handled by NSApp anyway
@@ -338,6 +337,17 @@ gedit_app_osx_process_window_event_impl (GeditApp *app,
}
static void
+gedit_app_osx_ready_impl (GeditApp *app)
+{
+ GtkOSXApplication *osxapp;
+
+ osxapp = g_object_new (GTK_TYPE_OSX_APPLICATION, NULL);
+ gtk_osxapplication_ready (osxapp);
+
+ GEDIT_APP_CLASS (gedit_app_osx_parent_class)->ready (app);
+}
+
+static void
gedit_app_osx_class_init (GeditAppOSXClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -352,6 +362,7 @@ gedit_app_osx_class_init (GeditAppOSXClass *klass)
app_class->quit = gedit_app_osx_quit_impl;
app_class->create_window = gedit_app_osx_create_window_impl;
app_class->process_window_event = gedit_app_osx_process_window_event_impl;
+ app_class->ready = gedit_app_osx_ready_impl;
}
static void
@@ -444,7 +455,6 @@ gedit_app_osx_init (GeditAppOSX *app)
app);
gtk_osxapplication_set_use_quartz_accelerators (osxapp, FALSE);
- gtk_osxapplication_ready (osxapp);
}
/* ex:set ts=8 noet: */
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index 5fa0137..e452147 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -546,6 +546,11 @@ gedit_app_create_window_impl (GeditApp *app)
}
static void
+gedit_app_ready_impl (GeditApp *app)
+{
+}
+
+static void
gedit_app_class_init (GeditAppClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -562,6 +567,7 @@ gedit_app_class_init (GeditAppClass *klass)
klass->set_window_title = gedit_app_set_window_title_impl;
klass->quit = gedit_app_quit_impl;
klass->create_window = gedit_app_create_window_impl;
+ klass->ready = gedit_app_ready_impl;
g_object_class_install_property (object_class,
PROP_LOCKDOWN,
@@ -1192,4 +1198,12 @@ _gedit_app_get_settings (GeditApp *app)
return app->priv->settings;
}
+void
+_gedit_app_ready (GeditApp *app)
+{
+ g_return_if_fail (GEDIT_IS_APP (app));
+
+ GEDIT_APP_GET_CLASS (app)->ready (app);
+}
+
/* ex:set ts=8 noet: */
diff --git a/gedit/gedit-app.h b/gedit/gedit-app.h
index 988b135..9b9b8c7 100644
--- a/gedit/gedit-app.h
+++ b/gedit/gedit-app.h
@@ -95,6 +95,8 @@ struct _GeditAppClass
gboolean (*process_window_event) (GeditApp *app,
GeditWindow *window,
GdkEvent *event);
+
+ void (*ready) (GeditApp *app);
};
/*
@@ -177,6 +179,7 @@ void _gedit_app_set_default_print_settings (GeditApp *app,
GObject *_gedit_app_get_settings (GeditApp *app);
void _gedit_app_quit (GeditApp *app);
+void _gedit_app_ready (GeditApp *app);
G_END_DECLS
diff --git a/gedit/gedit.c b/gedit/gedit.c
index da93d46..53039ba 100644
--- a/gedit/gedit.c
+++ b/gedit/gedit.c
@@ -199,6 +199,8 @@ gedit_main (gboolean service)
}
}
+ _gedit_app_ready (app);
+
gedit_debug_message (DEBUG_APP, "Start gtk-main");
gtk_main ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]