summaryrefslogtreecommitdiff
path: root/src/gtkutil.c
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2012-12-30 20:08:15 +0100
committerJan Djärv <jan.h.d@swipnet.se>2012-12-30 20:08:15 +0100
commit8b745d925b620fba21bd575e375ed101c17d8e29 (patch)
tree61762bcac520c425f4469c8003fd17b8b37a6ee4 /src/gtkutil.c
parent5a1d858bbc5410916d764e7f9c62b4e405fab592 (diff)
Check for deprecated gtk tearoff menu item in configure.
* 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.
Diffstat (limited to 'src/gtkutil.c')
-rw-r--r--src/gtkutil.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c
index b957f1241b..7b05cff71c 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -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;