[gtk-mac-integration] Avoid deprecated functions from Gtk-3.4 and Gtk3.10



commit f7af5a72d8032f4d2df71ea3348d875a47232b25
Author: John Ralls <jralls ceridwen us>
Date:   Thu Sep 26 13:43:58 2013 -0700

    Avoid deprecated functions from Gtk-3.4 and Gtk3.10

 configure.ac           |    6 ++++++
 src/cocoa_menu_item.c  |    3 ++-
 src/test-integration.c |   11 +++++++++++
 3 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 286242c..3b05657 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,6 +81,12 @@ AC_SUBST(GTK_VERSION)
 AC_MSG_RESULT("$GTK_VERSION")
 AM_CONDITIONAL([INTROSPECTION], [test x$GTK_MAJOR = "xgtk+-3.0"])
 
+AS_IF([test "$GTK_MAJOR" = gtk+-3.0],
+        [PKG_CHECK_EXISTS([gtk+-3.0 >= 3.3.0],
+        AC_DEFINE([HAVE_GTK_34], 1, [Gtk version 3.3 or higher]))
+        PKG_CHECK_EXISTS([gtk+-3.0 >= 3.9.0],
+        AC_DEFINE([HAVE_GTK_310], 1, [Gtk version 3.9 or higher]))],)
+
 GTK_PYTHON_CHECK
 
 GOBJECT_INTROSPECTION_CHECK([0.10.1])
diff --git a/src/cocoa_menu_item.c b/src/cocoa_menu_item.c
index 0643667..30f77e4 100644
--- a/src/cocoa_menu_item.c
+++ b/src/cocoa_menu_item.c
@@ -651,10 +651,11 @@ cocoa_menu_item_add_submenu (GtkMenuShell *menu_shell,
         /* Don't want separators on the menubar */
         continue;
 
+#ifndef HAVE_GTK_34
       if (GTK_IS_TEAROFF_MENU_ITEM (menu_item))
         /*Don't want tearoff items at all */
         continue;
-
+#endif
       if (g_object_get_data (G_OBJECT (menu_item), "gtk-empty-menu-item"))
         /* Nor blank items. */
         continue;
diff --git a/src/test-integration.c b/src/test-integration.c
index 225d92e..a54f091 100644
--- a/src/test-integration.c
+++ b/src/test-integration.c
@@ -61,6 +61,9 @@
 #define GTKOSXAPPLICATION
 /* These others are optional */
 #define BUILT_UI
+#ifndef HAVE_GTK_310
+//#define BUILT_UI //The built UI uses deprecated functions
+#endif
 //#define QUARTZ_HANDLERS
 
 /* GTKMACINTEGRATION uses Carbon, which isn't available for 64-bit builds. */
@@ -295,7 +298,11 @@ test_setup_menu (MenuItems *items, GtkAccelGroup *accel)
   gtk_menu_set_accel_group (GTK_MENU (menu), accel);
   gtk_menu_set_accel_path (GTK_MENU (menu), "<test-integration>/File");
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);
+#ifndef HAVE_GTK_310
   item = gtk_image_menu_item_new_from_stock (GTK_STOCK_OPEN, NULL);
+#else
+  item = gtk_menu_item_new_with_label ("Open");
+#endif
   items->open_item = item;
   /* We're being fancy with our connection here so that we don't have to
    * have a separate callback function for each menu item, since each
@@ -308,7 +315,11 @@ test_setup_menu (MenuItems *items, GtkAccelGroup *accel)
                          menu_cbdata_new ("open", items->window),
                          (GClosureNotify) menu_cbdata_delete, 0);
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+#ifndef HAVE_GTK_310
   items->quit_item = gtk_image_menu_item_new_from_stock (GTK_STOCK_QUIT, NULL);
+#else
+  items->quit_item = gtk_menu_item_new_with_label ("Quit");
+#endif
   g_signal_connect (items->quit_item, "activate", G_CALLBACK (gtk_main_quit), NULL);
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), items->quit_item);
 //Set accelerators


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]