mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
Bug 455268 - Add gtk-enable-tooltips GtkSetting
2008-07-02 Kristian Rietveld <kris@imendio.com> Bug 455268 - Add gtk-enable-tooltips GtkSetting * gtk/gtk.symbols: * gtk/gtktoolbar.[ch] (gtk_toolbar_[gs]et_tooltips): deprecated. * gtk/gtksettings.c: introduce gtk-enable-tooltips XSetting. * gtk/gtktooltip.c (_gtk_tooltip_handle_event): take the newly introduced XSetting into account. * demos/gtk-demo/appwindow.c: don't use the now deprecated gtk_toolbar_set_tooltips(). svn path=/trunk/; revision=20730
This commit is contained in:
parent
e625b41a1d
commit
4cceb2f1dc
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
2008-07-02 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
Bug 455268 - Add gtk-enable-tooltips GtkSetting
|
||||
|
||||
* gtk/gtk.symbols:
|
||||
* gtk/gtktoolbar.[ch] (gtk_toolbar_[gs]et_tooltips): deprecated.
|
||||
|
||||
* gtk/gtksettings.c: introduce gtk-enable-tooltips XSetting.
|
||||
|
||||
* gtk/gtktooltip.c (_gtk_tooltip_handle_event): take the newly
|
||||
introduced XSetting into account.
|
||||
|
||||
* demos/gtk-demo/appwindow.c: don't use the now deprecated
|
||||
gtk_toolbar_set_tooltips().
|
||||
|
||||
2008-07-02 Cody Russell <bratsche@gnome.org>
|
||||
|
||||
Bug 541162 – [Win32] Update for the new GdkWindowImpl stuff
|
||||
|
@ -509,7 +509,6 @@ do_appwindow (GtkWidget *do_widget)
|
||||
0, 0);
|
||||
|
||||
bar = gtk_ui_manager_get_widget (merge, "/ToolBar");
|
||||
gtk_toolbar_set_tooltips (GTK_TOOLBAR (bar), TRUE);
|
||||
gtk_widget_show (bar);
|
||||
gtk_table_attach (GTK_TABLE (table),
|
||||
bar,
|
||||
|
@ -4028,7 +4028,9 @@ gtk_toolbar_get_orientation
|
||||
gtk_toolbar_get_relief_style
|
||||
gtk_toolbar_get_show_arrow
|
||||
gtk_toolbar_get_style
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
gtk_toolbar_get_tooltips
|
||||
#endif
|
||||
gtk_toolbar_get_type G_GNUC_CONST
|
||||
gtk_toolbar_insert
|
||||
gtk_toolbar_new
|
||||
@ -4036,7 +4038,9 @@ gtk_toolbar_set_drop_highlight_item
|
||||
gtk_toolbar_set_orientation
|
||||
gtk_toolbar_set_show_arrow
|
||||
gtk_toolbar_set_style
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
gtk_toolbar_set_tooltips
|
||||
#endif
|
||||
gtk_toolbar_unset_style
|
||||
#endif
|
||||
#endif
|
||||
|
@ -115,7 +115,8 @@ enum {
|
||||
PROP_FONTCONFIG_TIMESTAMP,
|
||||
PROP_SOUND_THEME_NAME,
|
||||
PROP_ENABLE_INPUT_FEEDBACK_SOUNDS,
|
||||
PROP_ENABLE_EVENT_SOUNDS
|
||||
PROP_ENABLE_EVENT_SOUNDS,
|
||||
PROP_ENABLE_TOOLTIPS
|
||||
};
|
||||
|
||||
|
||||
@ -859,7 +860,7 @@ gtk_settings_class_init (GtkSettingsClass *class)
|
||||
NULL);
|
||||
|
||||
g_assert (result == PROP_FONTCONFIG_TIMESTAMP);
|
||||
|
||||
|
||||
/**
|
||||
* GtkSettings:gtk-sound-theme-name:
|
||||
*
|
||||
@ -925,6 +926,22 @@ gtk_settings_class_init (GtkSettingsClass *class)
|
||||
GTK_PARAM_READWRITE),
|
||||
NULL);
|
||||
g_assert (result == PROP_ENABLE_EVENT_SOUNDS);
|
||||
|
||||
/**
|
||||
* GtkSettings:gtk-enable-tooltips:
|
||||
*
|
||||
* Whether tooltips should be shown on widgets.
|
||||
*
|
||||
* Since: 2.14
|
||||
*/
|
||||
result = settings_install_property_parser (class,
|
||||
g_param_spec_boolean ("gtk-enable-tooltips",
|
||||
P_("Enable Tooltips"),
|
||||
P_("Whether tooltips should be shown on widgets"),
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE),
|
||||
NULL);
|
||||
g_assert (result == PROP_ENABLE_TOOLTIPS);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2933,6 +2933,9 @@ gtk_toolbar_unset_style (GtkToolbar *toolbar)
|
||||
* @enable: set to %FALSE to disable the tooltips, or %TRUE to enable them.
|
||||
*
|
||||
* Sets if the tooltips of a toolbar should be active or not.
|
||||
*
|
||||
* Deprecated: 2.14: The toolkit-wide #GtkSettings:gtk-enable-tooltips property
|
||||
* is now used instead.
|
||||
**/
|
||||
void
|
||||
gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
|
||||
@ -2956,6 +2959,9 @@ gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
|
||||
* gtk_toolbar_set_tooltips().
|
||||
*
|
||||
* Return value: %TRUE if tooltips are enabled
|
||||
*
|
||||
* Deprecated: 2.14: The toolkit-wide #GtkSettings:gtk-enable-tooltips property
|
||||
* is now used instead.
|
||||
**/
|
||||
gboolean
|
||||
gtk_toolbar_get_tooltips (GtkToolbar *toolbar)
|
||||
|
@ -155,9 +155,11 @@ void gtk_toolbar_set_show_arrow (GtkToolbar *toolbar,
|
||||
GtkOrientation gtk_toolbar_get_orientation (GtkToolbar *toolbar);
|
||||
void gtk_toolbar_set_orientation (GtkToolbar *toolbar,
|
||||
GtkOrientation orientation);
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
gboolean gtk_toolbar_get_tooltips (GtkToolbar *toolbar);
|
||||
void gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
|
||||
gboolean enable);
|
||||
#endif /* GTK_DISABLE_DEPRECATED */
|
||||
GtkToolbarStyle gtk_toolbar_get_style (GtkToolbar *toolbar);
|
||||
void gtk_toolbar_set_style (GtkToolbar *toolbar,
|
||||
GtkToolbarStyle style);
|
||||
|
@ -1201,24 +1201,35 @@ _gtk_tooltip_hide (GtkWidget *widget)
|
||||
gtk_tooltip_hide_tooltip (tooltip);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
tooltips_enabled (GdkWindow *window)
|
||||
{
|
||||
gboolean enabled;
|
||||
gboolean touchscreen;
|
||||
GdkScreen *screen;
|
||||
GtkSettings *settings;
|
||||
|
||||
screen = gdk_drawable_get_screen (window);
|
||||
settings = gtk_settings_get_for_screen (screen);
|
||||
|
||||
g_object_get (settings,
|
||||
"gtk-touchscreen-mode", &touchscreen,
|
||||
"gtk-enable-tooltips", &enabled,
|
||||
NULL);
|
||||
|
||||
return (!touchscreen && enabled);
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_tooltip_handle_event (GdkEvent *event)
|
||||
{
|
||||
gint x, y;
|
||||
gboolean return_value = FALSE;
|
||||
gboolean touchscreen;
|
||||
GtkWidget *has_tooltip_widget = NULL;
|
||||
GdkScreen *screen;
|
||||
GdkDisplay *display;
|
||||
GtkTooltip *current_tooltip;
|
||||
GtkSettings *settings;
|
||||
|
||||
/* Disable tooltips in touchscreen mode */
|
||||
screen = gdk_drawable_get_screen (event->any.window);
|
||||
settings = gtk_settings_get_for_screen (screen);
|
||||
g_object_get (settings, "gtk-touchscreen-mode", &touchscreen, NULL);
|
||||
|
||||
if (touchscreen)
|
||||
if (!tooltips_enabled (event->any.window))
|
||||
return;
|
||||
|
||||
/* Returns coordinates relative to has_tooltip_widget's allocation. */
|
||||
|
Loading…
Reference in New Issue
Block a user