From 0677ad8e5967586ba0583340f92d9a5a616618e9 Mon Sep 17 00:00:00 2001 From: Kristian Rietveld Date: Wed, 27 Dec 2006 19:52:25 +0000 Subject: [PATCH] Support inverting arrows via XSetting. (#377979, Yevgen Muntyan). 2006-12-27 Kristian Rietveld Support inverting arrows via XSetting. (#377979, Yevgen Muntyan). * gtk/gtksettings.c (gtk_settings_class_init): add new setting gtk-alternative-sort-arrows. * gdk/win32/gdkproperty-win32.c (gdk_screen_get_setting): add new setting. * modules/engines/ms-windows/Theme/gtk-2.0/gtkrc: set new gtk-alternative-sort-arrows setting to true. * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_button): invert direction if gtk-alternative-sort-arrows is TRUE. --- ChangeLog | 16 ++++++++++++++++ gdk/win32/gdkproperty-win32.c | 6 ++++++ gtk/gtksettings.c | 19 +++++++++++++++++++ gtk/gtktreeviewcolumn.c | 10 ++++++++-- .../engines/ms-windows/Theme/gtk-2.0/gtkrc | 3 +++ 5 files changed, 52 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a6d62b7583..3bdb5c563a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2006-12-27 Kristian Rietveld + + Support inverting arrows via XSetting. (#377979, Yevgen Muntyan). + + * gtk/gtksettings.c (gtk_settings_class_init): add new setting + gtk-alternative-sort-arrows. + + * gdk/win32/gdkproperty-win32.c (gdk_screen_get_setting): add + new setting. + + * modules/engines/ms-windows/Theme/gtk-2.0/gtkrc: set new + gtk-alternative-sort-arrows setting to true. + + * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_button): + invert direction if gtk-alternative-sort-arrows is TRUE. + 2006-12-27 Tor Lillqvist * gtk/gtk.symbols: Add gtk_status_icon_get_screen and diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c index 37fc2fdf8c..e4bdc81ae9 100644 --- a/gdk/win32/gdkproperty-win32.c +++ b/gdk/win32/gdkproperty-win32.c @@ -421,6 +421,12 @@ gdk_screen_get_setting (GdkScreen *screen, g_value_set_boolean (value, TRUE); return TRUE; } + else if (strcmp ("gtk-alternative-sort-arrows", name) == 0) + { + GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : TRUE\n", name)); + g_value_set_boolean (value, TRUE); + return TRUE; + } #if 0 /* * With 'MS Sans Serif' as windows menu font (default on win98se) you'll get a diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c index bd969c64b6..707139af68 100644 --- a/gtk/gtksettings.c +++ b/gtk/gtksettings.c @@ -85,6 +85,7 @@ enum { PROP_CURSOR_THEME_SIZE, #endif PROP_ALTERNATIVE_BUTTON_ORDER, + PROP_ALTERNATIVE_SORT_ARROWS, PROP_SHOW_INPUT_METHOD_MENU, PROP_SHOW_UNICODE_MENU, PROP_TIMEOUT_INITIAL, @@ -419,6 +420,24 @@ gtk_settings_class_init (GtkSettingsClass *class) NULL); g_assert (result == PROP_ALTERNATIVE_BUTTON_ORDER); + /** + * GtkSettings:gtk-alternative-sort-arrows: + * + * Controls the direction of the sort indicators in sorted list and tree + * views. By default an arrow pointing down means the column is sorted + * in ascending order. When set to %TRUE, this order will be inverted. + * + * Since: 2.12 + */ + result = settings_install_property_parser (class, + g_param_spec_boolean ("gtk-alternative-sort-arrows", + P_("Alternative sort indicator direction"), + P_("Whether the direction of the sort indicators in list and tree views is inverted compared to the default (where down means ascending)"), + FALSE, + GTK_PARAM_READWRITE), + NULL); + g_assert (result == PROP_ALTERNATIVE_SORT_ARROWS); + result = settings_install_property_parser (class, g_param_spec_boolean ("gtk-show-input-method-menu", P_("Show the 'Input Methods' menu"), diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c index b529db54a1..69cd5f7fb5 100644 --- a/gtk/gtktreeviewcolumn.c +++ b/gtk/gtktreeviewcolumn.c @@ -913,14 +913,20 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column) if (tree_column->show_sort_indicator || (sort_column_id >= 0 && sort_column_id == tree_column->sort_column_id)) { + gboolean alternative; + + g_object_get (gtk_widget_get_settings (tree_column->tree_view), + "gtk-alternative-sort-arrows", &alternative, + NULL); + switch (tree_column->sort_order) { case GTK_SORT_ASCENDING: - arrow_type = GTK_ARROW_DOWN; + arrow_type = alternative ? GTK_ARROW_UP : GTK_ARROW_DOWN; break; case GTK_SORT_DESCENDING: - arrow_type = GTK_ARROW_UP; + arrow_type = alternative ? GTK_ARROW_DOWN : GTK_ARROW_UP; break; default: diff --git a/modules/engines/ms-windows/Theme/gtk-2.0/gtkrc b/modules/engines/ms-windows/Theme/gtk-2.0/gtkrc index 39f2a7b14c..0553fb0b2c 100755 --- a/modules/engines/ms-windows/Theme/gtk-2.0/gtkrc +++ b/modules/engines/ms-windows/Theme/gtk-2.0/gtkrc @@ -11,6 +11,9 @@ gtk-menu-images = 1 # use the win32 button ordering instead of the GNOME HIG one, where applicable gtk-alternative-button-order = 1 +# use the win32 sort indicators direction, as in Explorer +gtk-alternative-sort-arrows = 1 + style "msw-default" { GtkWidget::interior-focus = 1