diff options
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkbutton.c | 13 | ||||
-rw-r--r-- | gtk/gtkcolorsel.c | 28 | ||||
-rw-r--r-- | gtk/gtkentry.c | 23 | ||||
-rw-r--r-- | gtk/gtkimagemenuitem.c | 8 | ||||
-rw-r--r-- | gtk/gtklabel.c | 6 | ||||
-rw-r--r-- | gtk/gtkmenu.c | 25 | ||||
-rw-r--r-- | gtk/gtkmenubar.c | 8 | ||||
-rw-r--r-- | gtk/gtkscrolledwindow.c | 15 | ||||
-rw-r--r-- | gtk/gtksettings.c | 168 |
9 files changed, 181 insertions, 113 deletions
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index b862ebf077..940b2cc93f 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -538,19 +538,6 @@ gtk_button_class_init (GtkButtonClass *klass) 2, GTK_PARAM_READABLE)); - /** - * GtkSettings::gtk-button-images: - * - * Whether images should be shown on buttons - * - * Since: 2.4 - */ - gtk_settings_install_property (g_param_spec_boolean ("gtk-button-images", - P_("Show button images"), - P_("Whether images should be shown on buttons"), - TRUE, - GTK_PARAM_READWRITE)); - g_type_class_add_private (gobject_class, sizeof (GtkButtonPrivate)); } diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c index 1814394697..100f764dd9 100644 --- a/gtk/gtkcolorsel.c +++ b/gtk/gtkcolorsel.c @@ -63,6 +63,9 @@ #include "gtkprivate.h" #include "gtkintl.h" +/* Keep it in sync with gtksettings.c:default_color_palette */ +#define DEFAULT_COLOR_PALETTE "black:white:gray50:red:purple:blue:light blue:green:yellow:orange:lavender:brown:goldenrod4:dodger blue:pink:light green:gray10:gray30:gray75:gray90" + /* Number of elements in the custom palatte */ #define GTK_CUSTOM_PALETTE_WIDTH 10 #define GTK_CUSTOM_PALETTE_HEIGHT 2 @@ -235,8 +238,6 @@ static void shutdown_eyedropper (GtkWidget *widget); static guint color_selection_signals[LAST_SIGNAL] = { 0 }; -static const gchar default_colors[] = "black:white:gray50:red:purple:blue:light blue:green:yellow:orange:lavender:brown:goldenrod4:dodger blue:pink:light green:gray10:gray30:gray75:gray90"; - static GtkColorSelectionChangePaletteFunc noscreen_change_palette_hook = default_noscreen_change_palette_func; static GtkColorSelectionChangePaletteWithScreenFunc change_palette_hook = default_change_palette_func; @@ -341,13 +342,7 @@ gtk_color_selection_class_init (GtkColorSelectionClass *klass) _gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); - gtk_settings_install_property (g_param_spec_string ("gtk-color-palette", - P_("Custom palette"), - P_("Palette to use in the color selector"), - default_colors, - GTK_PARAM_READWRITE)); - - g_type_class_add_private (gobject_class, sizeof (GtkColorSelectionPrivate)); + g_type_class_add_private (gobject_class, sizeof (GtkColorSelectionPrivate)); } static void @@ -1189,13 +1184,13 @@ get_current_colors (GtkColorSelection *colorsel) gchar *palette; settings = gtk_widget_get_settings (GTK_WIDGET (colorsel)); - g_object_get (settings, - "gtk-color-palette", &palette, - NULL); + g_object_get (settings, "gtk-color-palette", &palette, NULL); if (!gtk_color_selection_palette_from_string (palette, &colors, &n_colors)) { - gtk_color_selection_palette_from_string (default_colors, &colors, &n_colors); + gtk_color_selection_palette_from_string (DEFAULT_COLOR_PALETTE, + &colors, + &n_colors); } else { @@ -1207,14 +1202,17 @@ get_current_colors (GtkColorSelection *colorsel) GdkColor *tmp_colors = colors; gint tmp_n_colors = n_colors; - gtk_color_selection_palette_from_string (default_colors, &colors, &n_colors); + gtk_color_selection_palette_from_string (DEFAULT_COLOR_PALETTE, + &colors, + &n_colors); memcpy (colors, tmp_colors, sizeof (GdkColor) * tmp_n_colors); g_free (tmp_colors); } } - g_assert (n_colors >= GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT); + /* make sure that we fill every slot */ + g_assert (n_colors == GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT); g_free (palette); return colors; diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 040d35bb45..67f7565657 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -1741,28 +1741,7 @@ gtk_entry_class_init (GtkEntryClass *class) P_("Inner Border"), P_("Border between text and frame."), GTK_TYPE_BORDER, - GTK_PARAM_READABLE)); - - gtk_settings_install_property (g_param_spec_boolean ("gtk-entry-select-on-focus", - P_("Select on focus"), - P_("Whether to select the contents of an entry when it is focused"), - TRUE, - GTK_PARAM_READWRITE)); - - /** - * GtkSettings:gtk-entry-password-hint-timeout: - * - * How long to show the last input character in hidden - * entries. This value is in milliseconds. 0 disables showing the - * last char. 600 is a good value for enabling it. - * - * Since: 2.10 - */ - gtk_settings_install_property (g_param_spec_uint ("gtk-entry-password-hint-timeout", - P_("Password Hint Timeout"), - P_("How long to show the last input character in hidden entries"), - 0, G_MAXUINT, 0, - GTK_PARAM_READWRITE)); + GTK_PARAM_READABLE)); g_type_class_add_private (gobject_class, sizeof (GtkEntryPrivate)); } diff --git a/gtk/gtkimagemenuitem.c b/gtk/gtkimagemenuitem.c index 16d8ddca42..e39c3c10d8 100644 --- a/gtk/gtkimagemenuitem.c +++ b/gtk/gtkimagemenuitem.c @@ -189,13 +189,7 @@ gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass) GTK_TYPE_ACCEL_GROUP, GTK_PARAM_WRITABLE)); - gtk_settings_install_property (g_param_spec_boolean ("gtk-menu-images", - P_("Show menu images"), - P_("Whether images should be shown in menus"), - TRUE, - GTK_PARAM_READWRITE)); - - g_type_class_add_private (klass, sizeof (GtkImageMenuItemPrivate)); + g_type_class_add_private (klass, sizeof (GtkImageMenuItemPrivate)); } static void diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 1f05d05936..f024b2847e 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -899,12 +899,6 @@ gtk_label_class_init (GtkLabelClass *class) gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Enter, 0, "activate-current-link", 0); - gtk_settings_install_property (g_param_spec_boolean ("gtk-label-select-on-focus", - P_("Select on focus"), - P_("Whether to select the contents of a selectable label when it is focused"), - TRUE, - GTK_PARAM_READWRITE)); - g_type_class_add_private (class, sizeof (GtkLabelPrivate)); } diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 0199614b34..c5b3109e04 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -44,9 +44,6 @@ #include "gtkprivate.h" #include "gtkintl.h" -#define DEFAULT_POPUP_DELAY 225 -#define DEFAULT_POPDOWN_DELAY 1000 - #define NAVIGATION_REGION_OVERSHOOT 50 /* How much the navigation region * extends below the submenu */ @@ -817,28 +814,6 @@ gtk_menu_class_init (GtkMenuClass *class) GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_DOWN); - gtk_settings_install_property (g_param_spec_boolean ("gtk-can-change-accels", - P_("Can change accelerators"), - P_("Whether menu accelerators can be changed by pressing a key over the menu item"), - FALSE, - GTK_PARAM_READWRITE)); - - gtk_settings_install_property (g_param_spec_int ("gtk-menu-popup-delay", - P_("Delay before submenus appear"), - P_("Minimum time the pointer must stay over a menu item before the submenu appear"), - 0, - G_MAXINT, - DEFAULT_POPUP_DELAY, - GTK_PARAM_READWRITE)); - - gtk_settings_install_property (g_param_spec_int ("gtk-menu-popdown-delay", - P_("Delay before hiding a submenu"), - P_("The time before hiding a submenu when the pointer is moving towards the submenu"), - 0, - G_MAXINT, - DEFAULT_POPDOWN_DELAY, - GTK_PARAM_READWRITE)); - g_type_class_add_private (gobject_class, sizeof (GtkMenuPrivate)); } diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c index 298f6258c6..8dab56b972 100644 --- a/gtk/gtkmenubar.c +++ b/gtk/gtkmenubar.c @@ -201,14 +201,6 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class) DEFAULT_IPADDING, GTK_PARAM_READABLE)); - gtk_settings_install_property (g_param_spec_int ("gtk-menu-bar-popup-delay", - P_("Delay before drop down menus appear"), - P_("Delay before the submenus of a menu bar appear"), - 0, - G_MAXINT, - 0, - GTK_PARAM_READWRITE)); - g_type_class_add_private (gobject_class, sizeof (GtkMenuBarPrivate)); } diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index bdd4a2d197..191c3c3921 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -381,21 +381,6 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class) GTK_PARAM_READABLE)); /** - * GtkSettings:gtk-scrolled-window-placement: - * - * Where the contents of scrolled windows are located with respect to the - * scrollbars, if not overridden by the scrolled window's own placement. - * - * Since: 2.10 - */ - gtk_settings_install_property (g_param_spec_enum ("gtk-scrolled-window-placement", - P_("Scrolled Window Placement"), - P_("Where the contents of scrolled windows are located with respect to the scrollbars, if not overridden by the scrolled window's own placement."), - GTK_TYPE_CORNER_TYPE, - GTK_CORNER_TOP_LEFT, - G_PARAM_READABLE | G_PARAM_WRITABLE)); - - /** * GtkScrolledWindow::scroll-child: * @scrolled_window: a #GtkScrolledWindow * @scroll: a #GtkScrollType describing how much to scroll diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c index 9152c33f1f..4ea8685bd6 100644 --- a/gtk/gtksettings.c +++ b/gtk/gtksettings.c @@ -126,10 +126,22 @@ enum { PROP_TOOLBAR_STYLE, PROP_TOOLBAR_ICON_SIZE, PROP_AUTO_MNEMONICS, - PROP_APPLICATION_PREFER_DARK_THEME + PROP_APPLICATION_PREFER_DARK_THEME, + PROP_BUTTON_IMAGES, + PROP_ENTRY_SELECT_ON_FOCUS, + PROP_ENTRY_PASSWORD_HINT_TIMEOUT, + PROP_MENU_IMAGES, + PROP_MENU_BAR_POPUP_DELAY, + PROP_SCROLLED_WINDOW_PLACEMENT, + PROP_CAN_CHANGE_ACCELS, + PROP_MENU_POPUP_DELAY, + PROP_MENU_POPDOWN_DELAY, + PROP_LABEL_SELECT_ON_FOCUS, + PROP_COLOR_PALETTE, + PROP_IM_PREEDIT_STYLE, + PROP_IM_STATUS_STYLE }; - /* --- prototypes --- */ static void gtk_settings_finalize (GObject *object); static void gtk_settings_get_property (GObject *object, @@ -162,6 +174,10 @@ static void merge_color_scheme (GtkSettings *setting static gchar *get_color_scheme (GtkSettings *settings); static GHashTable *get_color_hash (GtkSettings *settings); +/* the default palette for GtkColorSelelection */ +static const gchar default_color_palette[] = + "black:white:gray50:red:purple:blue:light blue:green:yellow:orange:" + "lavender:brown:goldenrod4:dodger blue:pink:light green:gray10:gray30:gray75:gray90"; /* --- variables --- */ static GQuark quark_property_parser = 0; @@ -1044,6 +1060,154 @@ gtk_settings_class_init (GtkSettingsClass *class) GTK_PARAM_READWRITE), NULL); g_assert (result == PROP_APPLICATION_PREFER_DARK_THEME); + + /** + * GtkSettings::gtk-button-images: + * + * Whether images should be shown on buttons + * + * Since: 2.4 + */ + result = settings_install_property_parser (class, + g_param_spec_boolean ("gtk-button-images", + P_("Show button images"), + P_("Whether images should be shown on buttons"), + TRUE, + GTK_PARAM_READWRITE), + NULL); + g_assert (result == PROP_BUTTON_IMAGES); + + result = settings_install_property_parser (class, + g_param_spec_boolean ("gtk-entry-select-on-focus", + P_("Select on focus"), + P_("Whether to select the contents of an entry when it is focused"), + TRUE, + GTK_PARAM_READWRITE), + NULL); + g_assert (result == PROP_ENTRY_SELECT_ON_FOCUS); + + /** + * GtkSettings:gtk-entry-password-hint-timeout: + * + * How long to show the last input character in hidden + * entries. This value is in milliseconds. 0 disables showing the + * last char. 600 is a good value for enabling it. + * + * Since: 2.10 + */ + result = settings_install_property_parser (class, + g_param_spec_uint ("gtk-entry-password-hint-timeout", + P_("Password Hint Timeout"), + P_("How long to show the last input character in hidden entries"), + 0, G_MAXUINT, + 0, + GTK_PARAM_READWRITE), + NULL); + g_assert (result == PROP_ENTRY_PASSWORD_HINT_TIMEOUT); + + result = settings_install_property_parser (class, + g_param_spec_boolean ("gtk-menu-images", + P_("Show menu images"), + P_("Whether images should be shown in menus"), + TRUE, + GTK_PARAM_READWRITE), + NULL); + g_assert (result == PROP_MENU_IMAGES); + + result = settings_install_property_parser (class, + g_param_spec_int ("gtk-menu-bar-popup-delay", + P_("Delay before drop down menus appear"), + P_("Delay before the submenus of a menu bar appear"), + 0, G_MAXINT, + 0, + GTK_PARAM_READWRITE), + NULL); + g_assert (result == PROP_MENU_BAR_POPUP_DELAY); + + /** + * GtkSettings:gtk-scrolled-window-placement: + * + * Where the contents of scrolled windows are located with respect to the + * scrollbars, if not overridden by the scrolled window's own placement. + * + * Since: 2.10 + */ + result = settings_install_property_parser (class, + g_param_spec_enum ("gtk-scrolled-window-placement", + P_("Scrolled Window Placement"), + P_("Where the contents of scrolled windows are located with respect to the scrollbars, if not overridden by the scrolled window's own placement."), + GTK_TYPE_CORNER_TYPE, + GTK_CORNER_TOP_LEFT, + GTK_PARAM_READWRITE), + gtk_rc_property_parse_enum); + g_assert (result == PROP_SCROLLED_WINDOW_PLACEMENT); + + result = settings_install_property_parser (class, + g_param_spec_boolean ("gtk-can-change-accels", + P_("Can change accelerators"), + P_("Whether menu accelerators can be changed by pressing a key over the menu item"), + FALSE, + GTK_PARAM_READWRITE), + NULL); + g_assert (result == PROP_CAN_CHANGE_ACCELS); + + result = settings_install_property_parser (class, + g_param_spec_int ("gtk-menu-popup-delay", + P_("Delay before submenus appear"), + P_("Minimum time the pointer must stay over a menu item before the submenu appear"), + 0, G_MAXINT, + 225, + GTK_PARAM_READWRITE), + NULL); + g_assert (result == PROP_MENU_POPUP_DELAY); + + result = settings_install_property_parser (class, + g_param_spec_int ("gtk-menu-popdown-delay", + P_("Delay before hiding a submenu"), + P_("The time before hiding a submenu when the pointer is moving towards the submenu"), + 0, G_MAXINT, + 1000, + GTK_PARAM_READWRITE), + NULL); + g_assert (result == PROP_MENU_POPDOWN_DELAY); + + result = settings_install_property_parser (class, + g_param_spec_boolean ("gtk-label-select-on-focus", + P_("Select on focus"), + P_("Whether to select the contents of a selectable label when it is focused"), + TRUE, + GTK_PARAM_READWRITE), + NULL); + g_assert (result == PROP_LABEL_SELECT_ON_FOCUS); + + result = settings_install_property_parser (class, + g_param_spec_string ("gtk-color-palette", + P_("Custom palette"), + P_("Palette to use in the color selector"), + default_color_palette, + GTK_PARAM_READWRITE), + NULL); + g_assert (result == PROP_COLOR_PALETTE); + + result = settings_install_property_parser (class, + g_param_spec_enum ("gtk-im-preedit-style", + P_("IM Preedit style"), + P_("How to draw the input method preedit string"), + GTK_TYPE_IM_PREEDIT_STYLE, + GTK_IM_PREEDIT_CALLBACK, + GTK_PARAM_READWRITE), + gtk_rc_property_parse_enum); + g_assert (result == PROP_IM_PREEDIT_STYLE); + + result = settings_install_property_parser (class, + g_param_spec_enum ("gtk-im-status-style", + P_("IM Status style"), + P_("How to draw the input method statusbar"), + GTK_TYPE_IM_STATUS_STYLE, + GTK_IM_STATUS_CALLBACK, + GTK_PARAM_READWRITE), + gtk_rc_property_parse_enum); + g_assert (result == PROP_IM_STATUS_STYLE); } static void |