[gtk-mac-integration] initial conversion to gobject-introspectable structure
- From: John Ralls <jralls src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-mac-integration] initial conversion to gobject-introspectable structure
- Date: Thu, 29 Dec 2011 23:35:47 +0000 (UTC)
commit 49e7f0a3b42024e956f61241b8a83e5b897d10dc
Author: John Ralls <jralls ceridwen us>
Date: Mon Nov 21 12:35:13 2011 -0800
initial conversion to gobject-introspectable structure
acinclude.m4 | 15 ++-
configure.ac | 2 +
src/GNSMenuBar.c | 4 +-
src/GNSMenuBar.h | 2 +-
src/GtkApplicationDelegate.c | 14 ++--
src/GtkApplicationNotify.c | 14 ++--
src/Makefile.am | 27 ++++++
src/cocoa_menu_item.c | 2 +-
src/gtkosxapplication.c | 84 +++++++++--------
src/gtkosxapplication.h | 77 ++++++++--------
src/gtkosxapplication_quartz.c | 192 ++++++++++++++++++++--------------------
src/gtkosxapplicationprivate.h | 8 +-
src/test-integration.c | 50 +++++-----
13 files changed, 265 insertions(+), 226 deletions(-)
---
diff --git a/acinclude.m4 b/acinclude.m4
index 8a9da55..dde44e9 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -87,17 +87,22 @@ AC_DEFUN([GTK_PYTHON_CHECK],
],
[ test x$GTK_MAJOR = "xgtk+-3.0" -o x$enable_python = "xall"],
dnl Check that pygobject and gtk-3.0.gir are present
- [ PKG_CHECK_MODULES(PYGOBJECT, pygobject-2.0 >= 2.28.0,,have_pygobject=no)
- AC_MSG_CHECKING([PyGObject 3.0])
- if test "x$have_pygobject" = xno; then
- AC_MSG_RESULT([PyGObject 3.0.0 or newer])
- fi
+ [ PKG_CHECK_MODULES(PYGOBJECT_2, pygobject-2.0 >= 2.28.0,[
AC_MSG_CHECKING([PyGObject-Codegen-2.0])
AC_PATH_PROG([PYGOBJECT_CODEGEN], [pygobject-codegen-2.0], [no])
if test "x$PYGOBJECT_CODEGEN" = xno; then
have_python=no
AC_MSG_RESULT([pygobject-codegen-2.0 script not found])
fi
+ ],
+ [
+ AC_MSG_CHECKING([PyGObject 3.0])
+ PKG_CHECK_MODULES([PYGOBJECT_3], [pygobject-3.0],,
+ [
+ AC_MSG_RESULT([No pygobject found])
+ have_python=no
+ ])
+ ])
AC_MSG_CHECKING([Gtk GIR])
GIR_PATH="$PREFIX/share/gir-1.0/Gtk-3.0.gir"
AC_CHECK_FILE($GIR_PATH,,have_python=no)
diff --git a/configure.ac b/configure.ac
index c900dee..d780e38 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,6 +60,8 @@ AM_CONDITIONAL([INTROSPECTION], [test x$GTK_MAJOR = "xgtk+-3.0"])
GTK_PYTHON_CHECK
+GOBJECT_INTROSPECTION_CHECK([0.10.1])
+
# This will cause the automake generated makefiles to pass the correct
# flags to aclocal.
ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}"
diff --git a/src/GNSMenuBar.c b/src/GNSMenuBar.c
index b801a51..117b3af 100644
--- a/src/GNSMenuBar.c
+++ b/src/GNSMenuBar.c
@@ -37,9 +37,9 @@
return self;
}
-- (GtkOSXApplicationMenuGroup*) addGroup
+- (GtkosxApplicationMenuGroup*) addGroup
{
- GtkOSXApplicationMenuGroup *group = g_slice_new0 (GtkOSXApplicationMenuGroup);
+ GtkosxApplicationMenuGroup *group = g_slice_new0 (GtkosxApplicationMenuGroup);
app_menu_groups = g_list_append (app_menu_groups, group);
return group;
}
diff --git a/src/GNSMenuBar.h b/src/GNSMenuBar.h
index 18739ca..5971e4a 100644
--- a/src/GNSMenuBar.h
+++ b/src/GNSMenuBar.h
@@ -66,7 +66,7 @@
* Create a new GtkApplicationMenuGroup, add it to the list, and
* return a pointer to it.
*/
-- (GtkOSXApplicationMenuGroup *) addGroup;
+- (GtkosxApplicationMenuGroup *) addGroup;
/**
* app_menu_groups:
diff --git a/src/GtkApplicationDelegate.c b/src/GtkApplicationDelegate.c
index 14be482..0176813 100644
--- a/src/GtkApplicationDelegate.c
+++ b/src/GtkApplicationDelegate.c
@@ -28,9 +28,9 @@
-(BOOL) application:(NSApplication*) theApplication openFile:(NSString*) file
{
const gchar *utf8_path = [file UTF8String];
- GtkOSXApplication *app = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
+ GtkosxApplication *app = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
guint sig = g_signal_lookup("NSApplicationOpenFile",
- GTK_TYPE_OSX_APPLICATION);
+ GTKOSX_TYPE_APPLICATION);
gboolean result = FALSE;
if (sig)
g_signal_emit(app, sig, 0, utf8_path, &result);
@@ -41,9 +41,9 @@
- (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *)sender
{
- GtkOSXApplication *app = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
+ GtkosxApplication *app = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
guint sig = g_signal_lookup("NSApplicationBlockTermination",
- GTK_TYPE_OSX_APPLICATION);
+ GTKOSX_TYPE_APPLICATION);
gboolean result = FALSE;
static gboolean inHandler = FALSE;
if (inHandler) return NSTerminateCancel;
@@ -60,12 +60,12 @@
return NSTerminateCancel;
}
-extern NSMenu* _gtk_osxapplication_dock_menu(GtkOSXApplication* app);
+extern NSMenu* _gtkosx_application_dock_menu(GtkosxApplication* app);
-(NSMenu *)applicationDockMenu: (NSApplication*) sender
{
- GtkOSXApplication *app = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
- return _gtk_osxapplication_dock_menu(app);
+ GtkosxApplication *app = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
+ return _gtkosx_application_dock_menu(app);
}
@end
diff --git a/src/GtkApplicationNotify.c b/src/GtkApplicationNotify.c
index d60fa88..f7cf0f8 100644
--- a/src/GtkApplicationNotify.c
+++ b/src/GtkApplicationNotify.c
@@ -49,9 +49,9 @@
- (void)appDidBecomeActive:(NSNotification *)notification
{
- GtkOSXApplication *app = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
+ GtkosxApplication *app = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
guint sig = g_signal_lookup("NSApplicationDidBecomeActive",
- GTK_TYPE_OSX_APPLICATION);
+ GTKOSX_TYPE_APPLICATION);
if (sig)
g_signal_emit(app, sig, 0);
g_object_unref(app);
@@ -59,9 +59,9 @@
- (void)appDidBecomeInactive:(NSNotification *)notification
{
- GtkOSXApplication *app = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
+ GtkosxApplication *app = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
guint sig = g_signal_lookup("NSApplicationWillResignActive",
- GTK_TYPE_OSX_APPLICATION);
+ GTKOSX_TYPE_APPLICATION);
if (sig)
g_signal_emit(app, sig, 0);
g_object_unref(app);
@@ -69,13 +69,13 @@
- (void)appWillTerminate:(NSNotification *)notification
{
- GtkOSXApplication *app = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
+ GtkosxApplication *app = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
[[NSNotificationCenter defaultCenter] removeObserver: self];
guint sig = g_signal_lookup("NSApplicationWillTerminate",
- GTK_TYPE_OSX_APPLICATION);
+ GTKOSX_TYPE_APPLICATION);
if (sig)
g_signal_emit(app, sig, 0);
- gtk_osxapplication_cleanup(app);
+ gtkosx_application_cleanup(app);
g_object_unref(app);
}
diff --git a/src/Makefile.am b/src/Makefile.am
index 053d045..481c1cb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,7 @@
AM_CPPFLAGS = -I$(top_srcdir) $(WARN_CFLAGS)
+-include $(INTROSPECTION_MAKEFILE)
+
lib_LTLIBRARIES = libgtkmacintegration.la
libgtkmacintegration_la_SOURCES = \
@@ -48,3 +50,28 @@ test_integration_CFLAGS = $(MAC_CFLAGS)
test_integration_LDADD = $(MAC_LIBS) libgtkmacintegration.la
EXTRA_DIST = testui.xml
+if HAVE_INTROSPECTION
+GtkosxApplication-1.0.gir: $(INTROSPECTION_SCANNER) libgtkmacintegration.la
+GtkosxApplication_1_0_gir_SCANNERFLAGS = \
+ --identifier-prefix=Gtkosx \
+ --warn-all
+
+GtkosxApplication_1_0_gir_INCLUDES = Atk-1.0 GLib-2.0 Gtk-3.0
+
+GtkosxApplication_1_0_gir_CFLAGS = \
+ $(AM_CPPFLAGS)
+GtkosxApplication_1_0_gir_LIBS = libgtkmacintegration.la
+GtkosxApplication_1_0_gir_FILES = \
+ gtkosxapplication.h \
+ gtkosxapplication.c
+
+INTROSPECTION_GIRS = GtkosxApplication-1.0.gir
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibsdir = $(libdir)/girepository-1.0
+typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES = $(gir_DATA) $(typelibs_DATA)
+endif
diff --git a/src/cocoa_menu_item.c b/src/cocoa_menu_item.c
index 9a95846..e08ab75 100644
--- a/src/cocoa_menu_item.c
+++ b/src/cocoa_menu_item.c
@@ -206,7 +206,7 @@ cocoa_menu_item_update_accelerator (GNSMenuItem *cocoa_item,
/* Important note: this function doesn't do anything to actually
* change key handling. Its goal is to get Cocoa to display the
* correct accelerator as part of a menu item. Actual accelerator
- * handling depends on gtk_osxapplication_use_quartz_accelerators,
+ * handling depends on gtkosx_application_use_quartz_accelerators,
* so this is more cosmetic than it may appear.
*/
/* Return if there's no label; it's probably a separator which isn't
diff --git a/src/gtkosxapplication.c b/src/gtkosxapplication.c
index 54de3ae..af641e6 100644
--- a/src/gtkosxapplication.c
+++ b/src/gtkosxapplication.c
@@ -30,7 +30,7 @@
/**
* SECTION:gtkosxapplication
* @short_description: Base class for OSX integration
- * @title: GtkOSXApplication
+ * @title: GtkosxApplication
* @include: gtkosxapplication.h
*
* Exposes to the Gtk+ program important functions of
@@ -38,10 +38,10 @@
* the quartz Gdk backend and provides addtional functions for
* integrating a Gtk+ program into the OSX user environment.
*
- * Using GtkOSXApplication is pretty simple.
+ * Using GtkosxApplication is pretty simple.
* First, create an instance at startup:
*
- * |[GtkOSXApplication *theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);]|
+ * |[GtkosxApplication *theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);]|
*
* Do this early in your program, shortly after you run
* |[gtk_init()]|. Don't forget to guard it, and all other calls into
@@ -50,7 +50,7 @@
* object is a singleton, so you can call g_object_new as often as you
* like. You'll always get the same pointer back. There's no need to
* pass it around as an argument. Do note that all of the
- * GtkOSXApplication functions take theApp as an argument, even if
+ * GtkosxApplication functions take theApp as an argument, even if
* they don't use it. This seems silly in C, and perhaps it is, but
* it's needed to make the Python binding logic recognize that they're
* class methods.
@@ -65,20 +65,20 @@
* around because you needed it to add the menus to. With GtkBuilder,
* you need to ask the GtkUIManager for a pointer. Once everything is
* more-or-less set up on the Gtk+ side, you need only hide the menu
- * and call gtk_osxapplication_set_main_menu(). Here's an example with
+ * and call gtkosx_application_set_main_menu(). Here's an example with
* GtkBuilder:
*
* <example>
* <title>Setting the MenuBar</title>
* <programlisting>
* GtkUIManager *mgr = gtk_ui_manager_new();
- * GtkOSXApplication *theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
+ * GtkosxApplication *theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
* ...
* mergeid = gtk_ui_manager_add_ui_from_file(mgr, "src/testui.xml", &err);
* ...
* menubar = gtk_ui_manager_get_widget(mgr, "/menubar");
* gtk_widget_hide (menubar);
- * gtk_osxapplication_set_menu_bar(theApp, GTK_MENU_SHELL(menubar));
+ * gtkosx_application_set_menu_bar(theApp, GTK_MENU_SHELL(menubar));
* </programlisting>
* </example>
*
@@ -88,8 +88,8 @@
* the menu item action event is placed on the event queue by OSX, or
* Gtk, where the accelerator key event is passed through to Gtk to
* recognize. This is controlled by
- * gtk_osxapplication_set_use_quartz_accelerators() (you can test the
- * value with gtk_osxapplication_use_quartz_accelerators()), and the
+ * gtkosx_application_set_use_quartz_accelerators() (you can test the
+ * value with gtkosx_application_use_quartz_accelerators()), and the
* default is to use Quartz handling. This has two advantages:
* <itemizedlist>
* <listitem><para>It works without any extra steps</para></listitem>
@@ -135,32 +135,32 @@
* items to the groups. Here's an example:
* <example>
* <programlisting>
- * GtkOSXApplicationMenuGroup *group;
+ * GtkosxApplicationMenuGroup *group;
* GtkMenuItem *about_item, *preferences_item;
* about_item = gtk_ui_manager_get_widget(mgr, "/menubar/Help/About");
* preferences_item = gtk_ui_manager_get_widget(mgr, "/menubar/Edit/Preferences");
*
- * group = gtk_osxapplication_add_app_menu_group (theApp);
- * gtk_osxapplication_add_app_menu_item (theApp, group,
+ * group = gtkosx_application_add_app_menu_group (theApp);
+ * gtkosx_application_add_app_menu_item (theApp, group,
* GTK_MENU_ITEM (about_item));
*
- * group = gtk_osxapplication_add_app_menu_group (theApp);
- * gtk_osxapplication_add_app_menu_item (theApp, group,
+ * group = gtkosx_application_add_app_menu_group (theApp);
+ * gtkosx_application_add_app_menu_item (theApp, group,
* GTK_MENU_ITEM (preferences_item));
* </programlisting>
* </example>
* Once we have everything set up for as many windows as we're going
* to open before we call gtk_main_loop(), we need to tell OSX that
* we're ready:
- * |[gtk_osxapplication_ready(theApp);]|
+ * |[gtkosx_application_ready(theApp);]|
*
* If you add other windows later, you must do everything above for
* each one's menubar. Most of the time the internal notifictations
- * will ensure that the GtkOSXApplication is able to keep everything
+ * will ensure that the GtkosxApplication is able to keep everything
* in sync. However, if you at any time disconnect or block signals
* and change the menu (perhaps because of a context change within a
* window, as with changing pages in a GtkNotebook) you need to call
- * |[gtk_osxapplication_sync_menubar(theApp)]|
+ * |[gtkosx_application_sync_menubar(theApp)]|
*
*
* * The dock is that bar of icons that normally lives at the bottom of
@@ -170,9 +170,9 @@
* an icon on the dock. Users can, if they like, add application (or
* document) icons to the dock, and those can be used to launch the
* application. Apple allows limited customization of the dock tile,
- * and GtkOSXApplication has an interface for adding to the dock's
+ * and GtkosxApplication has an interface for adding to the dock's
* menu and for changing the icon that is displayed for the the
- * application. GtkOSXApplication also provides an interface to
+ * application. GtkosxApplication also provides an interface to
* AttentionRequest, which bounces the dock tile if the application
* doesn't have focus. You might want to do that at the end of a long
* task so that the user will know that it's finished if she's
@@ -180,7 +180,7 @@
* They're all pretty simple, so you can just read the details below.
*
*
- * * The last feature to which GtkOSXApplication provides an interface
+ * * The last feature to which GtkosxApplication provides an interface
* is the bundle. Normally in OSX, graphical applications are packaged
* along with their non-standard dependencies and their resources
* (graphical elements, translations, and such) in special directory
@@ -188,20 +188,20 @@
* application, have a look at gtk-mac-bundler, also available from
* the Gtk-OSX project.
*
- * OSX provides a variety of functions pertaining to bundles, most of which are not likely to interest someone porting a Gtk+ application. GtkOSXApplication has wrapped a few that might be:
+ * OSX provides a variety of functions pertaining to bundles, most of which are not likely to interest someone porting a Gtk+ application. GtkosxApplication has wrapped a few that might be:
* <itemizedlist>
- * <listitem><para>gtk_osxapplication_get_bundle_path()</para></listitem>
- * <listitem><para>gtk_osxapplication_get_resource_path()</para></listitem>
- * <listitem><para>gtk_osxapplication_get_executable_path()</para></listitem>
- * <listitem><para>gtk_osxapplication_get_bundle_id()</para></listitem>
- * <listitem><para>gtk_osxapplication_get_bundle_info()</para></listitem>
+ * <listitem><para>gtkosx_application_get_bundle_path()</para></listitem>
+ * <listitem><para>gtkosx_application_get_resource_path()</para></listitem>
+ * <listitem><para>gtkosx_application_get_executable_path()</para></listitem>
+ * <listitem><para>gtkosx_application_get_bundle_id()</para></listitem>
+ * <listitem><para>gtkosx_application_get_bundle_info()</para></listitem>
* </itemizedlist>
*
* The first three just get a UTF8-encoded path. An interesting note
* is that they'll return the path to the executable or the folder
* it's in regardless of whether it's actually in a bundle. To find
* out if one is actually dealing with a bundle,
- * gtk_osxapplication_get_bundle_id() will return "" if it can't find
+ * gtkosx_application_get_bundle_id() will return "" if it can't find
* the key %CFBundleIdentifier from the bundle's Info.plist -- which it
* won't if the application isn't in a bundle or wasn't launched by
* opening the bundle. (In other words, even if you have your
@@ -209,20 +209,20 @@
* line as
*|[$ Foo.app/Contents/MacOS/Foo]|
* the Info.plist won't have been opened and
- * gtk_osxapplication_get_bundle_id() will return "". Of course, it
+ * gtkosx_application_get_bundle_id() will return "". Of course, it
* will also return "" if you didn't set %CFBundleIdentifier in the
* Info.plist, so make sure that you do!
*
- * The last function, gtk_osxapplication_get_bundle_info(), will
+ * The last function, gtkosx_application_get_bundle_info(), will
* return the value associated with an arbitrary key from Info.plist
* as long as that value is a string. If it isn't, then the function
* returns a null string ("").
*
* Finally, notice the signals. These are emitted in response to the
* indicated OSX notifications. Except for
- * #GtkOSXApplication::NSApplicationBlockTermination, most programs
+ * #GtkosxApplication::NSApplicationBlockTermination, most programs
* won't need to do anything with
- * them. #GtkOSXApplication::NSApplicationBlockTermination is telling
+ * them. #GtkosxApplication::NSApplicationBlockTermination is telling
* you that OSX is planning to shut down your program. If you have any
* cleanup to do (like saving open files), or if you want to ask the
* user if it's OK, you should connect to the signal and do your
@@ -230,24 +230,30 @@
* from quitting.
*/
+GtkosxApplication *
+gtkosx_application_get (void)
+{
+ return g_object_new (GTKOSX_TYPE_APPLICATION, NULL);
+}
+
/**
- * gtk_osxapplication_use_quartz_accelerators:
- * @self: The GtkOSXApplication pointer.
+ * gtkosx_application_use_quartz_accelerators:
+ * @self: The GtkosxApplication pointer.
*
* Are we using Quartz or Gtk+ accelerator handling?
*
* Returns: a gboolean
*/
gboolean
-gtk_osxapplication_use_quartz_accelerators(GtkOSXApplication *self)
+gtkosx_application_use_quartz_accelerators(GtkosxApplication *self)
{
return self->priv->use_quartz_accelerators;
}
/**
- * gtk_osxapplication_set_use_quartz_accelerators:
- * @self: The GtkOSXApplication pointer.
+ * gtkosx_application_set_use_quartz_accelerators:
+ * @self: The GtkosxApplication pointer.
* @use_quartz_accelerators: Gboolean
*
* Set quartz accelerator handling; TRUE (default) uses quartz; FALSE
@@ -255,7 +261,7 @@ gtk_osxapplication_use_quartz_accelerators(GtkOSXApplication *self)
* accelerators (e.g., command-q to quit) to work.
*/
void
-gtk_osxapplication_set_use_quartz_accelerators(GtkOSXApplication *self,
+gtkosx_application_set_use_quartz_accelerators(GtkosxApplication *self,
gboolean use_quartz_accelerators)
{
self->priv->use_quartz_accelerators = use_quartz_accelerators;
@@ -268,8 +274,8 @@ gtk_osxapplication_set_use_quartz_accelerators(GtkOSXApplication *self,
* requests. Exists soley to satisfy the PyGObject codegen system.
*/
GType
-gtk_type_osxapplication_attention_type_get_type(void)
+gtkosx_type_application_attention_type_get_type(void)
{
//Bogus GType, but there's no good reason to register this; it's only an enum
- return 0;
+ return GTKOSX_TYPE_APPLICATION;
}
diff --git a/src/gtkosxapplication.h b/src/gtkosxapplication.h
index 76ae1cf..6a8a327 100644
--- a/src/gtkosxapplication.h
+++ b/src/gtkosxapplication.h
@@ -28,61 +28,60 @@
G_BEGIN_DECLS
-#define GTK_TYPE_OSX_APPLICATION (gtk_osxapplication_get_type())
-#define GTK_OSX_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_OSX_APPLICATION, GtkOSXApplication))
-#define GTK_IS_OSX_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_OSX_APPLICATION))
-#define GTK_OSX_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_OSX_APPLICATION, GtkOSXApplicationClass))
-#define GTK_IS_OSX_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_OSX_APPLICATION))
-#define GTK_OSX_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_OSX_APPLICATION, GtkOSXApplicationClass))
-
-typedef struct _GtkOSXApplication GtkOSXApplication;
-typedef struct _GtkOSXApplicationPrivate GtkOSXApplicationPrivate;
-typedef struct _GtkOSXApplicationClass GtkOSXApplicationClass;
-typedef struct _GtkOSXApplicationMenuGroup GtkOSXApplicationMenuGroup;
-
-struct _GtkOSXApplication
+#define GTKOSX_TYPE_APPLICATION (gtkosx_application_get_type())
+#define GTKOSX_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTKOSX_TYPE_APPLICATION, GtkosxApplication))
+#define GTKOSX_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTKOSX_TYPE_APPLICATION))
+#define GTKOSX_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTKOSX_TYPE_APPLICATION, GtkosxApplicationClass))
+#define GTKOSX_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTKOSX_TYPE_APPLICATION))
+#define GTKOSX_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTKOSX_TYPE_APPLICATION, GtkosxApplicationClass))
+
+typedef struct _GtkosxApplication GtkosxApplication;
+typedef struct _GtkosxApplicationPrivate GtkosxApplicationPrivate;
+typedef struct _GtkosxApplicationClass GtkosxApplicationClass;
+typedef struct _GtkosxApplicationMenuGroup GtkosxApplicationMenuGroup;
+
+struct _GtkosxApplication
{
GObject parent_instance;
/*< private >*/
- GtkOSXApplicationPrivate *priv;
+ GtkosxApplicationPrivate *priv;
};
-struct _GtkOSXApplicationClass
+struct _GtkosxApplicationClass
{
GObjectClass parent_class;
- void (*should_load) (GtkOSXApplication *self, gchar *utf8_path);
};
-struct _GtkOSXApplicationMenuGroup
+struct _GtkosxApplicationMenuGroup
{
GList *items;
};
-GType gtk_osxapplication_get_type (void);
-//GtkOSXApplication *gtk_osxapplication_get (void);
+GType gtkosx_application_get_type (void);
+GtkosxApplication *gtkosx_application_get (void);
-//void gtk_osxapplication_init (GtkOSXApplication *self);
-void gtk_osxapplication_ready (GtkOSXApplication *self);
-void gtk_osxapplication_cleanup (GtkOSXApplication *self);
+//void gtkosx_application_init (GtkosxApplication *self);
+void gtkosx_application_ready (GtkosxApplication *self);
+void gtkosx_application_cleanup (GtkosxApplication *self);
/*Accelerator functions*/
-void gtk_osxapplication_set_use_quartz_accelerators(GtkOSXApplication *self,
+void gtkosx_application_set_use_quartz_accelerators(GtkosxApplication *self,
gboolean use_quartz_accelerators);
-gboolean gtk_osxapplication_use_quartz_accelerators(GtkOSXApplication *self);
+gboolean gtkosx_application_use_quartz_accelerators(GtkosxApplication *self);
/*Menu functions*/
-void gtk_osxapplication_set_menu_bar (GtkOSXApplication *self,
+void gtkosx_application_set_menu_bar (GtkosxApplication *self,
GtkMenuShell *menu_shell);
-void gtk_osxapplication_sync_menubar (GtkOSXApplication *self);
+void gtkosx_application_sync_menubar (GtkosxApplication *self);
-void gtk_osxapplication_insert_app_menu_item (GtkOSXApplication *self,
+void gtkosx_application_insert_app_menu_item (GtkosxApplication *self,
GtkWidget *menu_item,
gint index);
-void gtk_osxapplication_set_window_menu (GtkOSXApplication *self,
+void gtkosx_application_set_window_menu (GtkosxApplication *self,
GtkMenuItem *menu_item);
-void gtk_osxapplication_set_help_menu (GtkOSXApplication *self,
+void gtkosx_application_set_help_menu (GtkosxApplication *self,
GtkMenuItem *menu_item);
/*Dock Functions*/
@@ -90,17 +89,17 @@ void gtk_osxapplication_set_help_menu (GtkOSXApplication *self,
typedef enum {
CRITICAL_REQUEST = 0,
INFO_REQUEST = 10
-} GtkOSXApplicationAttentionType;
+} GtkosxApplicationAttentionType;
/*To satisfy h2defs.py */
-#define GTK_TYPE_OSX_APPLICATION_ATTENTION_TYPE (gtk_type_osxapplication_attention_type_get_type())
-GType gtk_type_osxapplication_attention_type_get_type(void);
+// #define GTKOSX_TYPE_APPLICATION_ATTENTION_TYPE (gtkosx_type_application_attention_type_get_type())
+// GType gtkosx_type_application_attention_type_get_type(void);
-void gtk_osxapplication_set_dock_menu(GtkOSXApplication *self,
+void gtkosx_application_set_dock_menu(GtkosxApplication *self,
GtkMenuShell *menu_shell);
-void gtk_osxapplication_set_dock_icon_pixbuf(GtkOSXApplication *self,
+void gtkosx_application_set_dock_icon_pixbuf(GtkosxApplication *self,
GdkPixbuf *pixbuf);
-void gtk_osxapplication_set_dock_icon_resource(GtkOSXApplication *self,
+void gtkosx_application_set_dock_icon_resource(GtkosxApplication *self,
const gchar *name,
const gchar *type,
const gchar *subdir);
@@ -113,9 +112,9 @@ void gtk_osxapplication_set_dock_icon_resource(GtkOSXApplication *self,
* icon. The interface to change this is a bit complex and will be
* left up to the application rather than implemented here.
*/
-gint gtk_osxapplication_attention_request(GtkOSXApplication *self,
- GtkOSXApplicationAttentionType type);
-void gtk_osxapplication_cancel_attention_request(GtkOSXApplication *self, gint id);
+gint gtkosx_application_attention_request(GtkosxApplication *self,
+ GtkosxApplicationAttentionType type);
+void gtkosx_application_cancel_attention_request(GtkosxApplication *self, gint id);
/* Bundle Functions */
/* gtk-mac-bundle included a bunch of silly stuff for setting up the
@@ -135,7 +134,7 @@ void gtk_osxapplication_cancel_attention_request(GtkOSXApplication *self, gint i
* Richard Proctor pointed out that these functions don't really need
* to be class functions: the self parameter isn't used, and making
* them "free" functions will often save one from having to call
- * g_object_new(GTK_TYPE_OSX_APPLICATION) just to get it. */
+ * g_object_new(GTKOSX_TYPE_APPLICATION) just to get it. */
gchar *quartz_application_get_bundle_path(void);
gchar *quartz_application_get_resource_path(void);
diff --git a/src/gtkosxapplication_quartz.c b/src/gtkosxapplication_quartz.c
index 6c44b62..74aba87 100644
--- a/src/gtkosxapplication_quartz.c
+++ b/src/gtkosxapplication_quartz.c
@@ -53,7 +53,7 @@ extern NSWindow* gdk_quartz_window_get_nswindow(GdkWindow*);
* - Figure out what to do per app/window...
*
*/
-G_DEFINE_TYPE (GtkOSXApplication, gtk_osxapplication, G_TYPE_OBJECT)
+G_DEFINE_TYPE (GtkosxApplication, gtkosx_application, G_TYPE_OBJECT)
static GQuark emission_hook_quark = 0;
@@ -133,7 +133,7 @@ parent_set_emission_hook_remove (GtkWidget *widget,
/*
* add_to_menubar:
- * @self: The GtkOSXApplication pointer.
+ * @self: The GtkosxApplication pointer.
* @menu: The cocoa menu to add
* pos: The position on the menubar to insert the new menu
*
@@ -142,7 +142,7 @@ parent_set_emission_hook_remove (GtkWidget *widget,
* Returns: a pointer to the NSMenuItem now holding the menu.
*/
static GNSMenuItem*
-add_to_menubar (GtkOSXApplication *self, NSMenu *menu, int pos)
+add_to_menubar (GtkosxApplication *self, NSMenu *menu, int pos)
{
GNSMenuItem *dummyItem = [[GNSMenuItem alloc] initWithTitle:@""
action:nil keyEquivalent:@""];
@@ -158,7 +158,7 @@ add_to_menubar (GtkOSXApplication *self, NSMenu *menu, int pos)
/*
* create_apple_menu:
- * @self: The GtkOSXApplication object.
+ * @self: The GtkosxApplication object.
*
* Creates the "app" menu -- the first one on the menubar with the
* application's name. The function is called create_apple_menu
@@ -167,46 +167,46 @@ add_to_menubar (GtkOSXApplication *self, NSMenu *menu, int pos)
* Note that the static strings are internationalized the Apple way,
* so you'll need to use the Apple localization tools if you need to
* translations other than the ones provided. The resource file will
- * be GtkOSXApplication.strings, and must be installed in lang.proj in
+ * be GtkosxApplication.strings, and must be installed in lang.proj in
* the application bundle's Resources directory.
*
* Returns: A pointer to the menu item.
*/
static GNSMenuItem*
-create_apple_menu (GtkOSXApplication *self)
+create_apple_menu (GtkosxApplication *self)
{
NSMenuItem *menuitem;
// Create the application (Apple) menu.
NSMenu *app_menu = [[NSMenu alloc] initWithTitle: @"Apple Menu"];
- NSMenu *menuServices = [[NSMenu alloc] initWithTitle: NSLocalizedStringFromTable(@"Services", @"GtkOSXApplication", @"Services Menu title")];
+ NSMenu *menuServices = [[NSMenu alloc] initWithTitle: NSLocalizedStringFromTable(@"Services", @"GtkosxApplication", @"Services Menu title")];
[NSApp setServicesMenu:menuServices];
[app_menu addItem: [NSMenuItem separatorItem]];
- menuitem = [[NSMenuItem alloc] initWithTitle: NSLocalizedStringFromTable(@"Services", @"GtkOSXApplication", @"Services Menu Item title")
+ menuitem = [[NSMenuItem alloc] initWithTitle: NSLocalizedStringFromTable(@"Services", @"GtkosxApplication", @"Services Menu Item title")
action:nil keyEquivalent:@""];
[menuitem setSubmenu:menuServices];
[app_menu addItem: menuitem];
[menuitem release];
[app_menu addItem: [NSMenuItem separatorItem]];
- menuitem = [[NSMenuItem alloc] initWithTitle: NSLocalizedStringFromTable(@"Hide", @"GtkOSXApplication", @"Hide menu item title")
+ menuitem = [[NSMenuItem alloc] initWithTitle: NSLocalizedStringFromTable(@"Hide", @"GtkosxApplication", @"Hide menu item title")
action:@selector(hide:) keyEquivalent:@"h"];
[menuitem setTarget: NSApp];
[app_menu addItem: menuitem];
[menuitem release];
- menuitem = [[NSMenuItem alloc] initWithTitle: NSLocalizedStringFromTable(@"Hide Others", @"GtkOSXApplication", @"Hide Others menu item title")
+ menuitem = [[NSMenuItem alloc] initWithTitle: NSLocalizedStringFromTable(@"Hide Others", @"GtkosxApplication", @"Hide Others menu item title")
action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
[menuitem setKeyEquivalentModifierMask: NSCommandKeyMask | NSAlternateKeyMask];
[menuitem setTarget: NSApp];
[app_menu addItem: menuitem];
[menuitem release];
- menuitem = [[NSMenuItem alloc] initWithTitle: NSLocalizedStringFromTable( @"Show All", @"GtkOSXApplication", @"Show All menu item title")
+ menuitem = [[NSMenuItem alloc] initWithTitle: NSLocalizedStringFromTable( @"Show All", @"GtkosxApplication", @"Show All menu item title")
action:@selector(unhideAllApplications:) keyEquivalent:@""];
[menuitem setTarget: NSApp];
[app_menu addItem: menuitem];
[menuitem release];
[app_menu addItem: [NSMenuItem separatorItem]];
- menuitem = [[NSMenuItem alloc] initWithTitle: NSLocalizedStringFromTable(@"Quit", @"GtkOSXApplication", @"Quit menu item title")
+ menuitem = [[NSMenuItem alloc] initWithTitle: NSLocalizedStringFromTable(@"Quit", @"GtkosxApplication", @"Quit menu item title")
action:@selector(terminate:) keyEquivalent:@"q"];
[menuitem setTarget: NSApp];
[app_menu addItem: menuitem];
@@ -218,7 +218,7 @@ create_apple_menu (GtkOSXApplication *self)
/*
* create_window_menu:
- * @self: The pointer to the GtkOSXApplication object
+ * @self: The pointer to the GtkosxApplication object
* @window: The toplevel window for which the menu is being created
*
* Creates the Window menu, the one which tracks the application's windows.
@@ -226,15 +226,15 @@ create_apple_menu (GtkOSXApplication *self)
* Note that the static strings are internationalized the Apple way,
* so you'll need to use the Apple localization tools if you need to
* translations other than the ones provided. The resource file will
- * be GtkOSXApplication.strings, and must be installed in lang.proj in
+ * be GtkosxApplication.strings, and must be installed in lang.proj in
* the application bundle's Resources directory.
*
* Returns: A pointer to the menu item on the mainMenu.
*/
static GNSMenuItem *
-create_window_menu (GtkOSXApplication *self)
+create_window_menu (GtkosxApplication *self)
{
- NSMenu *window_menu = [[NSMenu alloc] initWithTitle: NSLocalizedStringFromTable(@"Window", @"GtkOSXApplication", @"Window Menu title")];
+ NSMenu *window_menu = [[NSMenu alloc] initWithTitle: NSLocalizedStringFromTable(@"Window", @"GtkosxApplication", @"Window Menu title")];
GtkMenuBar *menubar = [(GNSMenuBar*)[NSApp mainMenu] menuBar];
GtkWidget *parent = NULL;
GdkWindow *win = NULL;
@@ -249,10 +249,10 @@ create_window_menu (GtkOSXApplication *self)
if (win && GDK_IS_WINDOW(win))
nswin = gdk_quartz_window_get_nswindow(win);
- [window_menu addItemWithTitle: NSLocalizedStringFromTable(@"Minimize", @"GtkOSXApplication", @"Windows|Minimize menu item")
+ [window_menu addItemWithTitle: NSLocalizedStringFromTable(@"Minimize", @"GtkosxApplication", @"Windows|Minimize menu item")
action:@selector(performMiniaturize:) keyEquivalent:@"m"];
[window_menu addItem: [NSMenuItem separatorItem]];
- [window_menu addItemWithTitle: NSLocalizedStringFromTable(@"Bring All to Front", @"GtkOSXApplication", @"Windows|Bring All To Front menu item title")
+ [window_menu addItemWithTitle: NSLocalizedStringFromTable(@"Bring All to Front", @"GtkosxApplication", @"Windows|Bring All To Front menu item title")
action:@selector(arrangeInFront:) keyEquivalent:@""];
[NSApp setWindowsMenu:window_menu];
@@ -263,7 +263,7 @@ create_window_menu (GtkOSXApplication *self)
}
/*
- * gtk_osxapplication_constructor:
+ * gtkosx_application_constructor:
* @gtype: The GType of the new class
* @n_properties: The number of properties passed in the next parameter
* @properties: an array of construction properties
@@ -272,13 +272,13 @@ create_window_menu (GtkOSXApplication *self)
* Note that the static strings are internationalized the Apple way,
* so you'll need to use the Apple localization tools if you need to
* translations other than the ones provided. The resource file will
- * be GtkOSXApplication.strings, and must be installed in lang.proj in
+ * be GtkosxApplication.strings, and must be installed in lang.proj in
* the application bundle's Resources directory.
*
* Returns: A pointer to the new object.
*/
static GObject *
-gtk_osxapplication_constructor (GType gtype,
+gtkosx_application_constructor (GType gtype,
guint n_properties,
GObjectConstructParam *properties)
{
@@ -287,7 +287,7 @@ gtk_osxapplication_constructor (GType gtype,
g_static_mutex_lock (&mutex);
if (self == NULL)
{
- self = G_OBJECT_CLASS(gtk_osxapplication_parent_class)->constructor(gtype, n_properties, properties);
+ self = G_OBJECT_CLASS(gtkosx_application_parent_class)->constructor(gtype, n_properties, properties);
g_object_add_weak_pointer (self, (gpointer) &self);
}
@@ -423,7 +423,7 @@ global_event_filter_func (gpointer windowing_event, GdkEvent *event,
gpointer user_data)
{
NSEvent *nsevent = windowing_event;
- GtkOSXApplication* app = user_data;
+ GtkosxApplication* app = user_data;
/* Handle menu events with no window, since they won't go through
* the regular event processing. We have to release the gdk mutex so
@@ -433,7 +433,7 @@ global_event_filter_func (gpointer windowing_event, GdkEvent *event,
* environment!
*/
if ([nsevent type] == NSKeyDown &&
- gtk_osxapplication_use_quartz_accelerators(app) ) {
+ gtkosx_application_use_quartz_accelerators(app) ) {
gboolean result;
gdk_threads_leave();
result = [[NSApp mainMenu] performKeyEquivalent: nsevent];
@@ -452,19 +452,19 @@ enum {
LastSignal
};
-static guint gtk_osxapplication_signals[LastSignal] = {0};
+static guint gtkosx_application_signals[LastSignal] = {0};
/*
- * gtk_osxapplication_init:
- * @self: The GtkOSXApplication object.
+ * gtkosx_application_init:
+ * @self: The GtkosxApplication object.
*
* Class initialization. Includes creating a bunch of special signals
* for echoing Cocoa signals through to the application.
*/
static void
-gtk_osxapplication_init (GtkOSXApplication *self)
+gtkosx_application_init (GtkosxApplication *self)
{
[NSApplication sharedApplication];
- self->priv = GTK_OSX_APPLICATION_GET_PRIVATE (self);
+ self->priv = GTKOSX_APPLICATION_GET_PRIVATE (self);
self->priv->pool = [[NSAutoreleasePool alloc] init];
self->priv->use_quartz_accelerators = TRUE;
self->priv->dock_menu = NULL;
@@ -475,19 +475,19 @@ gtk_osxapplication_init (GtkOSXApplication *self)
}
/**
- * gtk_osxapplication_class_init:
+ * gtkosx_application_class_init:
* @klass: The class type pointer
*
* Not normaly called directly; Use g_object_new(GTK_TYPE_OSXAPPLICATION)
*/
void
-gtk_osxapplication_class_init(GtkOSXApplicationClass *klass)
+gtkosx_application_class_init(GtkosxApplicationClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
- g_type_class_add_private(klass, sizeof(GtkOSXApplicationPrivate));
- gobject_class->constructor = gtk_osxapplication_constructor;
+ g_type_class_add_private(klass, sizeof(GtkosxApplicationPrivate));
+ gobject_class->constructor = gtkosx_application_constructor;
/**
- * GtkOSXApplication::NSApplicationDidBecomeActive:
+ * GtkosxApplication::NSApplicationDidBecomeActive:
* @app: The application object
* #user_data: Data appended at connection
*
@@ -495,15 +495,15 @@ gtk_osxapplication_class_init(GtkOSXApplicationClass *klass)
* an NSApplicationDidBecomeActive notification. Connect a handler if
* there is anything you need to do when the application is activated.
*/
-gtk_osxapplication_signals[DidBecomeActive] =
+gtkosx_application_signals[DidBecomeActive] =
g_signal_new("NSApplicationDidBecomeActive",
- GTK_TYPE_OSX_APPLICATION,
+ GTKOSX_TYPE_APPLICATION,
G_SIGNAL_NO_RECURSE | G_SIGNAL_ACTION,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
- * GtkOSXApplication::NSApplicationWillResignActive:
+ * GtkosxApplication::NSApplicationWillResignActive:
* @app: The application object
* @user_data: Data appended at connection
*
@@ -512,16 +512,16 @@ gtk_osxapplication_signals[DidBecomeActive] =
* notification. Connect a handler to it if there's anything your
* application needs to do to prepare for inactivity.
*/
-gtk_osxapplication_signals[WillResignActive] =
+gtkosx_application_signals[WillResignActive] =
g_signal_new("NSApplicationWillResignActive",
- GTK_TYPE_OSX_APPLICATION,
+ GTKOSX_TYPE_APPLICATION,
G_SIGNAL_NO_RECURSE | G_SIGNAL_ACTION,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
- * GtkOSXApplication::NSApplicationBlockTermination:
+ * GtkosxApplication::NSApplicationBlockTermination:
* @app: The application object
* @user_data: Data appended at connection
*
@@ -535,16 +535,16 @@ gtk_osxapplication_signals[WillResignActive] =
* Returns: Boolean indicating that further emission and application
* termination should be blocked.
*/
-gtk_osxapplication_signals[BlockTermination] =
+gtkosx_application_signals[BlockTermination] =
g_signal_new("NSApplicationBlockTermination",
- GTK_TYPE_OSX_APPLICATION,
+ GTKOSX_TYPE_APPLICATION,
G_SIGNAL_NO_RECURSE | G_SIGNAL_ACTION,
0, block_termination_accumulator, NULL,
g_cclosure_marshal_BOOLEAN__VOID,
G_TYPE_BOOLEAN, 0);
/**
- * GtkOSXApplication::NSApplicationWillTerminate:
+ * GtkosxApplication::NSApplicationWillTerminate:
* @app: The application object
* @user_data: Data appended at connection
*
@@ -552,16 +552,16 @@ gtk_osxapplication_signals[BlockTermination] =
* an NSApplicationSWillTerminate notification. Connect your final
* shutdown routine (the one that calls gtk_main_quit() here.
*/
-gtk_osxapplication_signals[WillTerminate] =
+gtkosx_application_signals[WillTerminate] =
g_signal_new("NSApplicationWillTerminate",
- GTK_TYPE_OSX_APPLICATION,
+ GTKOSX_TYPE_APPLICATION,
G_SIGNAL_NO_RECURSE | G_SIGNAL_ACTION,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
- * GtkOSXApplication::NSApplicationOpenFile:
+ * GtkosxApplication::NSApplicationOpenFile:
* @app: The application object
* @path: A UTF8-encoded file path to open.
* @user_data: Data attached at connection
@@ -573,9 +573,9 @@ gtk_osxapplication_signals[WillTerminate] =
*
* Returns: Boolean indicating success at opening the file.
*/
-gtk_osxapplication_signals[OpenFile] =
+gtkosx_application_signals[OpenFile] =
g_signal_new("NSApplicationOpenFile",
- GTK_TYPE_OSX_APPLICATION,
+ GTKOSX_TYPE_APPLICATION,
G_SIGNAL_NO_RECURSE | G_SIGNAL_ACTION,
0, NULL, NULL,
g_cclosure_marshal_BOOLEAN__STRING,
@@ -584,28 +584,28 @@ gtk_osxapplication_signals[OpenFile] =
}
/**
- * gtk_osxapplication_ready:
- * @self: The GtkOSXApplication object
+ * gtkosx_application_ready:
+ * @self: The GtkosxApplication object
*
* Inform Cocoa that application initialization is complete.
*/
void
-gtk_osxapplication_ready (GtkOSXApplication *self)
+gtkosx_application_ready (GtkosxApplication *self)
{
[ NSApp finishLaunching ];
}
/**
- * gtk_osxapplication_cleanup:
+ * gtkosx_application_cleanup:
* @self: The GtkApplication object
*
- * Destroy the GtkOSXApplication object. Not normally needed, as the
+ * Destroy the GtkosxApplication object. Not normally needed, as the
* object is expected to remain until the application quits, and this
* function is called by the notification object at that time. Menu
* bars are released as the corresponding GtkMenuBars are destroyed.
*/
void
-gtk_osxapplication_cleanup(GtkOSXApplication *self)
+gtkosx_application_cleanup(GtkosxApplication *self)
{
[self->priv->dock_menu release];
[self->priv->notify release];
@@ -630,8 +630,8 @@ window_focus_cb (GtkWindow* window, GdkEventFocus *event, GNSMenuBar *menubar)
}
/**
- * gtk_osxapplication_set_menu_bar:
- * @self: The GtkOSXApplication object
+ * gtkosx_application_set_menu_bar:
+ * @self: The GtkosxApplication object
* @menu_shell: The GtkMenuBar that you want to set.
*
* Set a window's menubar as the application menu bar. Call this once
@@ -641,7 +641,7 @@ window_focus_cb (GtkWindow* window, GdkEventFocus *event, GNSMenuBar *menubar)
* block them.
*/
void
-gtk_osxapplication_set_menu_bar (GtkOSXApplication *self, GtkMenuShell *menu_shell)
+gtkosx_application_set_menu_bar (GtkosxApplication *self, GtkMenuShell *menu_shell)
{
GNSMenuBar* cocoa_menubar;
NSMenu* old_menubar = [NSApp mainMenu];
@@ -673,7 +673,7 @@ gtk_osxapplication_set_menu_bar (GtkOSXApplication *self, GtkMenuShell *menu_she
parent_set_emission_hook,
cocoa_menubar, NULL);
if (emission_hook_quark == 0)
- emission_hook_quark = g_quark_from_static_string("GtkOSXApplicationEmissionHook");
+ emission_hook_quark = g_quark_from_static_string("GtkosxApplicationEmissionHook");
g_object_set_qdata(G_OBJECT(menu_shell), emission_hook_quark,
(gpointer)emission_hook_id);
@@ -691,23 +691,23 @@ gtk_osxapplication_set_menu_bar (GtkOSXApplication *self, GtkMenuShell *menu_she
}
/**
- * gtk_osxapplication_sync_menubar:
- * @self: The GtkOSXApplication object
+ * gtkosx_application_sync_menubar:
+ * @self: The GtkosxApplication object
*
* Syncronize the active window's GtkMenuBar with the OSX menu
* bar. You should only need this if you have programmatically changed
* the menus with signals blocked or disconnected.
*/
void
-gtk_osxapplication_sync_menubar (GtkOSXApplication *self)
+gtkosx_application_sync_menubar (GtkosxApplication *self)
{
[(GNSMenuBar*)[NSApp mainMenu] resync];
}
/**
- * gtk_osxapplication_insert_app_menu_item:
- * @self: The GtkOSXApplication object
+ * gtkosx_application_insert_app_menu_item:
+ * @self: The GtkosxApplication object
* @menu_item: The GtkMenuItem to add to the group.
* @index: The place in the app menu that you want the item
* inserted. The first item is 0.
@@ -725,7 +725,7 @@ gtk_osxapplication_sync_menubar (GtkOSXApplication *self)
* along with the Application menu. Just hide your Gtk Quit menu item.
*/
void
-gtk_osxapplication_insert_app_menu_item (GtkOSXApplication* self,
+gtkosx_application_insert_app_menu_item (GtkosxApplication* self,
GtkWidget* item,
gint index) {
cocoa_menu_item_add_item ([[[NSApp mainMenu] itemAtIndex: 0] submenu],
@@ -735,7 +735,7 @@ gtk_osxapplication_insert_app_menu_item (GtkOSXApplication* self,
}
/**
- * gtk_osxapplication_set_window_menu:
+ * gtkosx_application_set_window_menu:
* @self: The application object
* @menu_item: The menu item which will be set as the Window menu
*
@@ -748,7 +748,7 @@ gtk_osxapplication_insert_app_menu_item (GtkOSXApplication* self,
* will create a new menu for you, which will not be gettext translatable.
*/
void
-gtk_osxapplication_set_window_menu(GtkOSXApplication *self,
+gtkosx_application_set_window_menu(GtkosxApplication *self,
GtkMenuItem *menu_item)
{
GNSMenuBar *cocoa_menubar = (GNSMenuBar*)[NSApp mainMenu];
@@ -771,20 +771,20 @@ gtk_osxapplication_set_window_menu(GtkOSXApplication *self,
}
/**
- * gtk_osxapplication_set_help_menu:
+ * gtkosx_application_set_help_menu:
* @self: The application object
* @menu_item: The menu item which will be set as the Window menu
*
* Sets a designated menu item already on the menu bar as the Help
* menu. Call this after gtk_osx_application_set_menu_bar(), but
* before gtk_osx_application_window_menu(), especially if you're
- * letting GtkOSXApplication create a Window menu for you (it helps
+ * letting GtkosxApplication create a Window menu for you (it helps
* position the Window menu correctly). It operates on the currently
* active menubar. If @nenu_item is %NULL, it will create a new menu
* for you, which will not be gettext translatable.
*/
void
-gtk_osxapplication_set_help_menu (GtkOSXApplication *self,
+gtkosx_application_set_help_menu (GtkosxApplication *self,
GtkMenuItem *menu_item)
{
GNSMenuBar *cocoa_menubar = (GNSMenuBar*)[NSApp mainMenu];
@@ -804,11 +804,11 @@ gtk_osxapplication_set_help_menu (GtkOSXApplication *self,
/* Dock support */
/* A bogus prototype to shut up a compiler warning. This function is for GtkApplicationDelegate and is not public. */
-NSMenu* _gtk_osxapplication_dock_menu(GtkOSXApplication *self);
+NSMenu* _gtkosx_application_dock_menu(GtkosxApplication *self);
/**
- * _gtk_osxapplication_dock_menu:
- * @self: The GtkOSXApplication object.
+ * _gtkosx_application_dock_menu:
+ * @self: The GtkosxApplication object.
*
* Return the dock menu to the Application Delegate; if not null, it
* will be added to the dock menu.
@@ -816,14 +816,14 @@ NSMenu* _gtk_osxapplication_dock_menu(GtkOSXApplication *self);
* Returns: NSMenu*
*/
NSMenu*
-_gtk_osxapplication_dock_menu(GtkOSXApplication *self)
+_gtkosx_application_dock_menu(GtkosxApplication *self)
{
return(self->priv->dock_menu);
}
/**
- * gtk_osxapplication_set_dock_menu:
- * @self: The GtkOSXApplication object
+ * gtkosx_application_set_dock_menu:
+ * @self: The GtkosxApplication object
* @menu_shell: A GtkMenu (cast it with GTK_MENU_SHELL() when you
* pass it in
*
@@ -836,7 +836,7 @@ _gtk_osxapplication_dock_menu(GtkOSXApplication *self)
* deallocated.
*/
void
-gtk_osxapplication_set_dock_menu(GtkOSXApplication *self,
+gtkosx_application_set_dock_menu(GtkosxApplication *self,
GtkMenuShell *menu_shell)
{
g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
@@ -922,14 +922,14 @@ nsimage_from_pixbuf(GdkPixbuf *pixbuf)
}
/**
- * gtk_osxapplication_set_dock_icon_pixbuf:
- * @self: The GtkOSXApplication
+ * gtkosx_application_set_dock_icon_pixbuf:
+ * @self: The GtkosxApplication
* @pixbuf: The pixbuf. Pass NULL to reset the icon to its default.
*
* Set the dock icon from a GdkPixbuf
*/
void
-gtk_osxapplication_set_dock_icon_pixbuf(GtkOSXApplication *self,
+gtkosx_application_set_dock_icon_pixbuf(GtkosxApplication *self,
GdkPixbuf *pixbuf)
{
if (!pixbuf)
@@ -940,8 +940,8 @@ gtk_osxapplication_set_dock_icon_pixbuf(GtkOSXApplication *self,
}
/**
- * gtk_osxapplication_set_dock_icon_resource:
- * @self: The GtkOSXApplication
+ * gtkosx_application_set_dock_icon_resource:
+ * @self: The GtkosxApplication
* @name: The ame of the image file
* @type: The extension (e.g., jpg) of the filename
* @subdir: The subdirectory of $Bundle/Contents/Resources in which to
@@ -950,7 +950,7 @@ gtk_osxapplication_set_dock_icon_pixbuf(GtkOSXApplication *self,
* Set the dock icon from an image file in the bundle/
*/
void
-gtk_osxapplication_set_dock_icon_resource(GtkOSXApplication *self,
+gtkosx_application_set_dock_icon_resource(GtkosxApplication *self,
const gchar *name,
const gchar *type,
const gchar *subdir)
@@ -961,8 +961,8 @@ gtk_osxapplication_set_dock_icon_resource(GtkOSXApplication *self,
}
/**
- * gtk_osxapplication_attention_request:
- * @self: The GtkOSXApplication pointer
+ * gtkosx_application_attention_request:
+ * @self: The GtkosxApplication pointer
* @type: CRITICAL_REQUEST or INFO_REQUEST
*
* Create an attention request. If type is CRITICAL_REQUEST, the
@@ -972,33 +972,33 @@ gtk_osxapplication_set_dock_icon_resource(GtkOSXApplication *self,
* receives focus. This function has no effect if the application has focus.
*
* Returns: A the attention request ID. Pass this id to
- * gtk_osxapplication_cancel_attention_request.
+ * gtkosx_application_cancel_attention_request.
*/
gint
-gtk_osxapplication_attention_request(GtkOSXApplication *self,
- GtkOSXApplicationAttentionType type)
+gtkosx_application_attention_request(GtkosxApplication *self,
+ GtkosxApplicationAttentionType type)
{
return (gint)[NSApp requestUserAttention: (NSRequestUserAttentionType)type];
}
/**
- * gtk_osxapplication_cancel_attention_request:
+ * gtkosx_application_cancel_attention_request:
* @self: The application
* @id: The integer attention request id returned from
- * gtk_osxapplication_attention_request.
+ * gtkosx_application_attention_request.
*
* Cancel an attention request created with
- * gtk_osxapplication_attention_request.
+ * gtkosx_application_attention_request.
*/
void
-gtk_osxapplication_cancel_attention_request(GtkOSXApplication *self, gint id)
+gtkosx_application_cancel_attention_request(GtkosxApplication *self, gint id)
{
[NSApp cancelUserAttentionRequest: id];
}
/**
* quartz_application_get_bundle_path:
- * @self: The GtkOSXApplication. Not Used.
+ * @self: The GtkosxApplication. Not Used.
*
* Return the root path of the bundle or the directory containing the
* executable if it isn't actually a bundle.
@@ -1020,7 +1020,7 @@ quartz_application_get_bundle_path(void)
/**
* quartz_application_get_bundle_id:
- * @self: The GtkOSXApplication. Not Used.
+ * @self: The GtkosxApplication. Not Used.
*
*Return the value of the CFBundleIdentifier key from the bundle's Info.plist
*
@@ -1046,7 +1046,7 @@ quartz_application_get_bundle_id(void)
/**
* quartz_application_get_resource_path:
- * @self: The GtkOSXApplication. Not Used.
+ * @self: The GtkosxApplication. Not Used.
*
* Return the Resource path for the bundle or the directory containing the
* executable if it isn't actually a bundle. Use quartz_application_get_bundle_id() to check (it will return %NULL if it's not a bundle).
@@ -1069,7 +1069,7 @@ quartz_application_get_resource_path(void)
/**
* quartz_application_get_executable_path:
- * @self: The GtkOSXApplication. Not Used.
+ * @self: The GtkosxApplication. Not Used.
*
* Return the executable path, including file name
*
@@ -1090,7 +1090,7 @@ quartz_application_get_executable_path(void)
/**
* quartz_application_get_bundle_info:
- * @self: The GtkOSXApplication. Not Used.
+ * @self: The GtkosxApplication. Not Used.
* @key: The key, as a normal UTF8 string.
*
* Queries the bundle's Info.plist with key. If the returned object is
diff --git a/src/gtkosxapplicationprivate.h b/src/gtkosxapplicationprivate.h
index 0a5d48b..6c60c19 100644
--- a/src/gtkosxapplicationprivate.h
+++ b/src/gtkosxapplicationprivate.h
@@ -20,17 +20,17 @@
* Boston, MA 02111-1307, USA.
*/
-#ifndef __GTK_OSX_APPLICATIONPRIVATE_H__
-#define __GTK_OSX_APPLICATIONPRIVATE_H__
+#ifndef __GTKOSX_APPLICATIONPRIVATE_H__
+#define __GTKOSX_APPLICATIONPRIVATE_H__
#import <AppKit/NSMenu.h>
#import <AppKit/NSApplication.h>
#include "gtkosxapplication.h"
#import "GtkApplicationNotify.h"
-#define GTK_OSX_APPLICATION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_OSX_APPLICATION, GtkOSXApplicationPrivate))
+#define GTKOSX_APPLICATION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTKOSX_TYPE_APPLICATION, GtkosxApplicationPrivate))
-struct _GtkOSXApplicationPrivate
+struct _GtkosxApplicationPrivate
{
NSAutoreleasePool *pool;
gboolean use_quartz_accelerators;
diff --git a/src/test-integration.c b/src/test-integration.c
index 0143097..d040774 100644
--- a/src/test-integration.c
+++ b/src/test-integration.c
@@ -372,21 +372,21 @@ change_icon_cb (GtkWidget *button,
}
#elif defined GTKOSXAPPLICATION
typedef struct {
- GtkOSXApplication *app;
- GtkOSXApplicationAttentionType type;
+ GtkosxApplication *app;
+ GtkosxApplicationAttentionType type;
} AttentionRequest;
static gboolean
attention_cb(AttentionRequest* req)
{
- gtk_osxapplication_attention_request(req->app, req->type);
+ gtkosx_application_attention_request(req->app, req->type);
g_free(req);
return FALSE;
}
static void
bounce_cb (GtkWidget *button,
- GtkOSXApplication *app)
+ GtkosxApplication *app)
{
AttentionRequest *req = g_new0 (AttentionRequest, 1);
req->app = app;
@@ -397,7 +397,7 @@ bounce_cb (GtkWidget *button,
static void
change_icon_cb (GtkWidget *button,
- GtkOSXApplication *app)
+ GtkosxApplication *app)
{
static gboolean changed;
static GdkPixbuf *pixbuf;
@@ -409,9 +409,9 @@ change_icon_cb (GtkWidget *button,
}
if (changed)
- gtk_osxapplication_set_dock_icon_pixbuf (app, NULL);
+ gtkosx_application_set_dock_icon_pixbuf (app, NULL);
else
- gtk_osxapplication_set_dock_icon_pixbuf (app, pixbuf);
+ gtkosx_application_set_dock_icon_pixbuf (app, pixbuf);
changed = !changed;
}
@@ -452,7 +452,7 @@ view_menu_cb (GtkWidget *button, gpointer user_data)
static GtkActionGroup* view_action_group = NULL;
GtkUIManager *mgr = user_data;
GtkWidget *window = gtk_widget_get_toplevel(button);
- GtkOSXApplication *theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
+ GtkosxApplication *theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
GError *err = NULL;
if (view_action_group == NULL) {
view_action_group = gtk_action_group_new("ViewAction");
@@ -487,7 +487,7 @@ view_menu_cb (GtkWidget *button, gpointer user_data)
menu_cbdata_new ( "Freebish", item),
(GClosureNotify) menu_cbdata_delete, 0);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
- gtk_osxapplication_set_dock_menu(theApp, GTK_MENU_SHELL(menu));
+ gtkosx_application_set_dock_menu(theApp, GTK_MENU_SHELL(menu));
}
}
else if (mergeid) {
@@ -502,13 +502,13 @@ view_menu_cb (GtkWidget *button, gpointer user_data)
#ifdef GTKOSXAPPLICATION
static void
-app_active_cb (GtkOSXApplication* app, gboolean* data)
+app_active_cb (GtkosxApplication* app, gboolean* data)
{
g_print("Application became %s\n", *data ? "active" : "inactive");
}
static gboolean
-app_should_quit_cb (GtkOSXApplication *app, gpointer data)
+app_should_quit_cb (GtkosxApplication *app, gpointer data)
{
static gboolean abort = TRUE;
gboolean answer;
@@ -520,14 +520,14 @@ app_should_quit_cb (GtkOSXApplication *app, gpointer data)
}
static void
-app_will_quit_cb (GtkOSXApplication *app, gpointer data)
+app_will_quit_cb (GtkosxApplication *app, gpointer data)
{
g_print ("Quitting Now\n");
gtk_main_quit();
}
static gboolean
-app_open_file_cb (GtkOSXApplication *app, gchar *path, gpointer user_data)
+app_open_file_cb (GtkosxApplication *app, gchar *path, gpointer user_data)
{
g_print("File open event for %s", path);
return FALSE;
@@ -567,7 +567,7 @@ create_window(const gchar *title)
GtkMacMenuGroup *group;
#endif //GTKMACINTEGRATION
#ifdef GTKOSXAPPLICATION
- GtkOSXApplication *theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
+ GtkosxApplication *theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
#endif //GTKOSXAPPLICATION
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
if (title)
@@ -671,21 +671,21 @@ create_window(const gchar *title)
#endif //GTKMACINTEGRATION
#ifdef GTKOSXAPPLICATION
GtkWidget *sep;
- gtk_osxapplication_set_menu_bar(theApp, GTK_MENU_SHELL(menubar));
- gtk_osxapplication_insert_app_menu_item (theApp, items->about_item,
+ gtkosx_application_set_menu_bar(theApp, GTK_MENU_SHELL(menubar));
+ gtkosx_application_insert_app_menu_item (theApp, items->about_item,
0);
sep = gtk_separator_menu_item_new();
g_object_ref(sep);
- gtk_osxapplication_insert_app_menu_item (theApp, sep, 1);
- gtk_osxapplication_insert_app_menu_item (theApp,
+ gtkosx_application_insert_app_menu_item (theApp, sep, 1);
+ gtkosx_application_insert_app_menu_item (theApp,
items->preferences_item,
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);
- gtk_osxapplication_set_help_menu(theApp, GTK_MENU_ITEM(items->help_menu));
- gtk_osxapplication_set_window_menu(theApp, GTK_MENU_ITEM(items->window_menu));
+ gtkosx_application_set_help_menu(theApp, GTK_MENU_ITEM(items->help_menu));
+ gtkosx_application_set_window_menu(theApp, GTK_MENU_ITEM(items->window_menu));
#endif //GTKOSXAPPLICATION
if (!menu_items_quark)
menu_items_quark = g_quark_from_static_string("MenuItem");
@@ -705,7 +705,7 @@ main (int argc, char **argv)
GtkMacDock *dock;
#endif //GTKMACINTEGRATION
#ifdef GTKOSXAPPLICATION
- GtkOSXApplication *theApp;
+ GtkosxApplication *theApp;
#endif //GTKOSXAPPLICATION
g_thread_init(NULL);
gdk_threads_init();
@@ -725,7 +725,7 @@ main (int argc, char **argv)
window1);
#endif //GTKMACINTEGRATION
#ifdef GTKOSXAPPLICATION
- theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
+ theApp = g_object_new(GTKOSX_TYPE_APPLICATION, NULL);
window1 = create_window("Test Integration Window 1");
#ifndef BUILT_UI
window2 = create_window("Test Integration Window 2");
@@ -745,9 +745,9 @@ main (int argc, char **argv)
G_CALLBACK(app_open_file_cb), NULL);
}
#ifndef QUARTZ_HANDLERS
- gtk_osxapplication_set_use_quartz_accelerators(theApp, FALSE);
+ gtkosx_application_set_use_quartz_accelerators(theApp, FALSE);
#endif //QUARTZ_HANDLERS
- gtk_osxapplication_ready(theApp);
+ gtkosx_application_ready(theApp);
{
const gchar *id = quartz_application_get_bundle_id();
if (id != NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]