]> code.delx.au - gnu-emacs/commitdiff
Check for deprecated gtk tearoff menu item in configure.
authorJan Djärv <jan.h.d@swipnet.se>
Sun, 30 Dec 2012 19:08:15 +0000 (20:08 +0100)
committerJan Djärv <jan.h.d@swipnet.se>
Sun, 30 Dec 2012 19:08:15 +0000 (20:08 +0100)
* configure.ac: Check for GtkHandlebox.
Check for GtkTearoffMenuItem.

* src/gtkutil.c (TOOLBAR_TOP_WIDGET): New macro.
(xg_pack_tool_bar): Use TOOLBAR_TOP_WIDGET, condition out use of
handlebox_widget.  Set toolbar_in_hbox to false/true, set
toolbar_is_packed to true.
(xg_update_tool_bar_sizes): Use widget returned by TOOLBAR_TOP_WIDGET.
(update_frame_tool_bar): Check toolbar_is_packed for packing.
Show all on TOOLBAR_TOP_WIDGET.
(free_frame_tool_bar): Check toolbar_is_packed.  Use widget returned
by TOOLBAR_TOP_WIDGET.
(xg_change_toolbar_position): Use widget returned by TOOLBAR_TOP_WIDGET.
Check toolbar_is_packed.
(xg_have_tear_offs, tearoff_remove, tearoff_activate): Condition on
HAVE_GTK_TEAROFF_MENU_ITEM_NEW.
(xg_have_tear_offs): When ! HAVE_GTK_TEAROFF_MENU_ITEM_NEW, return
false.
(create_menus): Create tearoff only if HAVE_GTK_TEAROFF_MENU_ITEM_NEW.
(xg_update_menubar): Update title only if
HAVE_GTK_TEAROFF_MENU_ITEM_NEW.
(xg_update_submenu): Skip tearoff only if
HAVE_GTK_TEAROFF_MENU_ITEM_NEW.
(xg_initialize): Initialize xg_detached_menus only if
HAVE_GTK_TEAROFF_MENU_ITEM_NEW.

ChangeLog
configure.ac
src/ChangeLog
src/gtkutil.c

index c40aca0c08af15f0de7125e994e03994f95d7391..0246433c5e166ae4132881633b5515c6c2e4d65c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2012-12-30  Jan Djärv  <jan.h.d@swipnet.se>
 
        * configure.ac: Check for GtkHandlebox.
+       Check for GtkTearoffMenuItem.
 
 2012-12-30  Andreas Schwab  <schwab@linux-m68k.org>
 
index 291da61ad14177a7ccf9a071210f2cb7ccc266bc..c7785db454fbc7397423dbdc34c5ba71cc88a426 100644 (file)
@@ -2080,6 +2080,15 @@ if test "${HAVE_GTK}" = "yes"; then
     AC_CHECK_FUNCS(gtk_handle_box_new)
   fi
 
+  dnl Same as above for gtk_tearoff_menu_item.
+  HAVE_GTK_TEAROFF_MENU_ITEM=no
+  AC_CHECK_DECL(GTK_TYPE_TEAROFF_MENU_ITEM, HAVE_GTK_TEAROFF_MENU_ITEM=yes,
+                   HAVE_GTK_TEAROFF_MENU_ITEM=no, [AC_INCLUDES_DEFAULT
+#include <gtk/gtk.h>])
+  if test "$HAVE_GTK_TEAROFF_MENU_ITEM" = yes; then
+    AC_CHECK_FUNCS(gtk_tearoff_menu_item_new)
+  fi
+
   dnl Check for functions introduced in 2.14 and later.
   AC_CHECK_FUNCS(gtk_widget_get_window gtk_widget_set_has_window \
                  gtk_dialog_get_action_area gtk_widget_get_sensitive \
index 0234af5f1ef8d50b50dc4585998a2a1b6d1467c7..bb69917bfb2b71dc53267b59a529bf32c95151b8 100644 (file)
        by TOOLBAR_TOP_WIDGET.
        (xg_change_toolbar_position): Use widget returned by TOOLBAR_TOP_WIDGET.
        Check toolbar_is_packed.
+       (xg_have_tear_offs, tearoff_remove, tearoff_activate): Condition on
+       HAVE_GTK_TEAROFF_MENU_ITEM_NEW.
+       (xg_have_tear_offs): When ! HAVE_GTK_TEAROFF_MENU_ITEM_NEW, return
+       false.
+       (create_menus): Create tearoff only if HAVE_GTK_TEAROFF_MENU_ITEM_NEW.
+       (xg_update_menubar): Update title only if
+       HAVE_GTK_TEAROFF_MENU_ITEM_NEW.
+       (xg_update_submenu): Skip tearoff only if
+       HAVE_GTK_TEAROFF_MENU_ITEM_NEW.
+       (xg_initialize): Initialize xg_detached_menus only if
+       HAVE_GTK_TEAROFF_MENU_ITEM_NEW.
 
        * xterm.h (struct x_output): Surround handlebox_widget with
        #ifdef HAVE_GTK_HANDLE_BOX_NEW.  toolbar_is_packed is new,
index b957f1241b8959b14400f224f2182ca98780216f..7b05cff71c02913ecfdb65445a26075369e6fb2f 100644 (file)
@@ -2416,6 +2416,8 @@ make_menu_item (const char *utf8_label,
   return w;
 }
 
+#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
+
 static int xg_detached_menus;
 
 /* Return true if there are detached menus.  */
@@ -2454,7 +2456,13 @@ tearoff_activate (GtkWidget *widget, gpointer client_data)
                         G_CALLBACK (tearoff_remove), 0);
     }
 }
-
+#else /* ! HAVE_GTK_TEAROFF_MENU_ITEM_NEW */
+bool
+xg_have_tear_offs (void)
+{
+  return false;
+}
+#endif /* ! HAVE_GTK_TEAROFF_MENU_ITEM_NEW */
 
 /* Create a menu item widget, and connect the callbacks.
    ITEM describes the menu item.
@@ -2526,7 +2534,8 @@ xg_create_one_menuitem (widget_value *item,
    HIGHLIGHT_CB is the callback to call when entering/leaving menu items.
    If POP_UP_P, create a popup menu.
    If MENU_BAR_P, create a menu bar.
-   If ADD_TEAROFF_P, add a tearoff menu item.  Ignored if MENU_BAR_P.
+   If ADD_TEAROFF_P, add a tearoff menu item.  Ignored if MENU_BAR_P or
+   the Gtk+ version used does not have tearoffs.
    TOPMENU is the topmost GtkWidget that others shall be placed under.
    It may be NULL, in that case we create the appropriate widget
    (menu bar or menu item depending on POP_UP_P and MENU_BAR_P)
@@ -2599,6 +2608,7 @@ create_menus (widget_value *data,
                           "selection-done", deactivate_cb, 0);
     }
 
+#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
   if (! menu_bar_p && add_tearoff_p)
     {
       GtkWidget *tearoff = gtk_tearoff_menu_item_new ();
@@ -2607,6 +2617,7 @@ create_menus (widget_value *data,
       g_signal_connect (G_OBJECT (tearoff), "activate",
                         G_CALLBACK (tearoff_activate), 0);
     }
+#endif
 
   for (item = data; item; item = item->next)
     {
@@ -2897,11 +2908,13 @@ xg_update_menubar (GtkWidget *menubar,
 
           gtk_label_set_text (wlabel, utf8_label);
 
+#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
           /* If this item has a submenu that has been detached, change
              the title in the WM decorations also.  */
           if (submenu && gtk_menu_get_tearoff_state (GTK_MENU (submenu)))
             /* Set the title of the detached window.  */
             gtk_menu_set_title (GTK_MENU (submenu), utf8_label);
+#endif
 
           if (utf8_label) g_free (utf8_label);
           iter = g_list_next (iter);
@@ -3129,7 +3142,8 @@ xg_update_submenu (GtkWidget *submenu,
   {
     GtkWidget *w = GTK_WIDGET (iter->data);
 
-    /* Skip tearoff items, they have no counterpart in val.  */
+#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
+  /* Skip tearoff items, they have no counterpart in val.  */
     if (GTK_IS_TEAROFF_MENU_ITEM (w))
       {
         has_tearoff_p = 1;
@@ -3137,6 +3151,7 @@ xg_update_submenu (GtkWidget *submenu,
         if (iter) w = GTK_WIDGET (iter->data);
         else break;
       }
+#endif
 
     /* Remember first radio button in a group.  If we get a mismatch in
        a radio group we must rebuild the whole group so that the connections
@@ -4987,7 +5002,9 @@ xg_initialize (void)
 
   gdpy_def = NULL;
   xg_ignore_gtk_scrollbar = 0;
+#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
   xg_detached_menus = 0;
+#endif
   xg_menu_cb_list.prev = xg_menu_cb_list.next =
     xg_menu_item_cb_list.prev = xg_menu_item_cb_list.next = 0;