* @title: a string containing the title for the menu.
*
* Sets the title string for the menu. The title is displayed when the menu
- * is shown as a tearoff menu.
+ * is shown as a tearoff menu. If @title is %NULL, the menu will see if it is
+ * attached to a parent menu item, and if so it will try to use the same text as
+ * that menu item's label.
**/
-void
+void
gtk_menu_set_title (GtkMenu *menu,
const gchar *title)
{
GtkMenuPrivate *priv;
+ char *old_title;
g_return_if_fail (GTK_IS_MENU (menu));
priv = gtk_menu_get_private (menu);
- if (strcmp (title ? title : "", priv->title ? priv->title : "") != 0)
- {
- g_free (priv->title);
- priv->title = g_strdup (title);
+ old_title = priv->title;
+ priv->title = g_strdup (title);
+ g_free (old_title);
- gtk_menu_update_title (menu);
- g_object_notify (G_OBJECT (menu), "tearoff-title");
- }
+ gtk_menu_update_title (menu);
+ g_object_notify (G_OBJECT (menu), "tearoff-title");
}
/**
* (basically, those items are accelerator-locked).
*/
/* g_print("item has no path or is locked, menu prefix: %s\n", menu->accel_path); */
- gdk_display_beep (display);
+ gtk_widget_error_bell (widget);
}
else
{
* locked already
*/
/* g_print("failed to change\n"); */
- gdk_display_beep (display);
+ gtk_widget_error_bell (widget);
}
}
}
GtkSettings *settings;
gboolean touchscreen_mode;
- GDK_THREADS_ENTER ();
-
menu = GTK_MENU (data);
settings = gtk_widget_get_settings (GTK_WIDGET (menu));
gtk_menu_do_timeout_scroll (menu, touchscreen_mode);
- GDK_THREADS_LEAVE ();
-
return TRUE;
}
guint timeout;
gboolean touchscreen_mode;
- GDK_THREADS_ENTER ();
-
menu = GTK_MENU (data);
settings = gtk_widget_get_settings (GTK_WIDGET (menu));
gtk_menu_remove_scroll_timeout (menu);
- menu->timeout_id = g_timeout_add (timeout, gtk_menu_scroll_timeout, menu);
-
- GDK_THREADS_LEAVE ();
+ menu->timeout_id = gdk_threads_add_timeout (timeout, gtk_menu_scroll_timeout, menu);
return FALSE;
}
gtk_menu_do_timeout_scroll (menu, touchscreen_mode);
- menu->timeout_id = g_timeout_add (timeout, gtk_menu_scroll_timeout_initial,
+ menu->timeout_id = gdk_threads_add_timeout (timeout, gtk_menu_scroll_timeout_initial,
menu);
}
-MENU_SCROLL_STEP2 : -MENU_SCROLL_STEP1;
menu->timeout_id =
- g_timeout_add (scroll_fast ?
+ gdk_threads_add_timeout (scroll_fast ?
MENU_SCROLL_TIMEOUT2 : MENU_SCROLL_TIMEOUT1,
gtk_menu_scroll_timeout, menu);
}
MENU_SCROLL_STEP2 : MENU_SCROLL_STEP1;
menu->timeout_id =
- g_timeout_add (scroll_fast ?
+ gdk_threads_add_timeout (scroll_fast ?
MENU_SCROLL_TIMEOUT2 : MENU_SCROLL_TIMEOUT1,
gtk_menu_scroll_timeout, menu);
}
GtkMenu *menu = user_data;
GdkWindow *child_window;
- GDK_THREADS_ENTER ();
-
gtk_menu_stop_navigating_submenu (menu);
if (GTK_WIDGET_REALIZED (menu))
}
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
"gtk-menu-popdown-delay", &popdown_delay,
NULL);
- menu->navigation_timeout = g_timeout_add (popdown_delay,
+ menu->navigation_timeout = gdk_threads_add_timeout (popdown_delay,
gtk_menu_stop_navigating_submenu_cb, menu);
#ifdef DRAW_STAY_UP_TRIANGLE
{
GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (menu));
gboolean touchscreen_mode;
- gboolean was_scrolling;
gtk_menu_remove_scroll_timeout (menu);