diff options
-rw-r--r-- | gtk/gtkentry.c | 976 |
1 files changed, 470 insertions, 506 deletions
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 330ccbd8be..97b58b5556 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -326,16 +326,19 @@ enum { PROP_TOOLTIP_MARKUP_PRIMARY, PROP_TOOLTIP_MARKUP_SECONDARY, PROP_IM_MODULE, - PROP_EDITING_CANCELED, PROP_PLACEHOLDER_TEXT, PROP_COMPLETION, PROP_INPUT_PURPOSE, PROP_INPUT_HINTS, PROP_ATTRIBUTES, PROP_POPULATE_ALL, - PROP_TABS + PROP_TABS, + PROP_EDITING_CANCELED, + NUM_PROPERTIES = PROP_EDITING_CANCELED }; +static GParamSpec *entry_props[NUM_PROPERTIES] = { NULL, }; + static guint signals[LAST_SIGNAL] = { 0 }; typedef enum { @@ -765,66 +768,57 @@ gtk_entry_class_init (GtkEntryClass *class) PROP_EDITING_CANCELED, "editing-canceled"); - g_object_class_install_property (gobject_class, - PROP_BUFFER, - g_param_spec_object ("buffer", - P_("Text Buffer"), - P_("Text buffer object which actually stores entry text"), - GTK_TYPE_ENTRY_BUFFER, - GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY)); - - g_object_class_install_property (gobject_class, - PROP_CURSOR_POSITION, - g_param_spec_int ("cursor-position", - P_("Cursor Position"), - P_("The current position of the insertion cursor in chars"), - 0, - GTK_ENTRY_BUFFER_MAX_SIZE, - 0, - GTK_PARAM_READABLE)); - - g_object_class_install_property (gobject_class, - PROP_SELECTION_BOUND, - g_param_spec_int ("selection-bound", - P_("Selection Bound"), - P_("The position of the opposite end of the selection from the cursor in chars"), - 0, - GTK_ENTRY_BUFFER_MAX_SIZE, - 0, - GTK_PARAM_READABLE)); - - g_object_class_install_property (gobject_class, - PROP_EDITABLE, - g_param_spec_boolean ("editable", - P_("Editable"), - P_("Whether the entry contents can be edited"), - TRUE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - - g_object_class_install_property (gobject_class, - PROP_MAX_LENGTH, - g_param_spec_int ("max-length", - P_("Maximum length"), - P_("Maximum number of characters for this entry. Zero if no maximum"), - 0, - GTK_ENTRY_BUFFER_MAX_SIZE, - 0, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - g_object_class_install_property (gobject_class, - PROP_VISIBILITY, - g_param_spec_boolean ("visibility", - P_("Visibility"), - P_("FALSE displays the \"invisible char\" instead of the actual text (password mode)"), - TRUE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - - g_object_class_install_property (gobject_class, - PROP_HAS_FRAME, - g_param_spec_boolean ("has-frame", - P_("Has Frame"), - P_("FALSE removes outside bevel from entry"), - TRUE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_BUFFER] = + g_param_spec_object ("buffer", + P_("Text Buffer"), + P_("Text buffer object which actually stores entry text"), + GTK_TYPE_ENTRY_BUFFER, + GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY); + + entry_props[PROP_CURSOR_POSITION] = + g_param_spec_int ("cursor-position", + P_("Cursor Position"), + P_("The current position of the insertion cursor in chars"), + 0, GTK_ENTRY_BUFFER_MAX_SIZE, + 0, + GTK_PARAM_READABLE); + + entry_props[PROP_SELECTION_BOUND] = + g_param_spec_int ("selection-bound", + P_("Selection Bound"), + P_("The position of the opposite end of the selection from the cursor in chars"), + 0, GTK_ENTRY_BUFFER_MAX_SIZE, + 0, + GTK_PARAM_READABLE); + + entry_props[PROP_EDITABLE] = + g_param_spec_boolean ("editable", + P_("Editable"), + P_("Whether the entry contents can be edited"), + TRUE, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + + entry_props[PROP_MAX_LENGTH] = + g_param_spec_int ("max-length", + P_("Maximum length"), + P_("Maximum number of characters for this entry. Zero if no maximum"), + 0, GTK_ENTRY_BUFFER_MAX_SIZE, + 0, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + + entry_props[PROP_VISIBILITY] = + g_param_spec_boolean ("visibility", + P_("Visibility"), + P_("FALSE displays the \"invisible char\" instead of the actual text (password mode)"), + TRUE, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + + entry_props[PROP_HAS_FRAME] = + g_param_spec_boolean ("has-frame", + P_("Has Frame"), + P_("FALSE removes outside bevel from entry"), + TRUE, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:inner-border: @@ -835,38 +829,34 @@ gtk_entry_class_init (GtkEntryClass *class) * (through objects like #GtkStyleContext and #GtkCssProvider); the value * of this style property is ignored. */ - g_object_class_install_property (gobject_class, - PROP_INNER_BORDER, - g_param_spec_boxed ("inner-border", - P_("Inner Border"), - P_("Border between text and frame. Overrides the inner-border style property"), - GTK_TYPE_BORDER, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_DEPRECATED)); - - g_object_class_install_property (gobject_class, - PROP_INVISIBLE_CHAR, - g_param_spec_unichar ("invisible-char", - P_("Invisible character"), - P_("The character to use when masking entry contents (in \"password mode\")"), - '*', - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - - g_object_class_install_property (gobject_class, - PROP_ACTIVATES_DEFAULT, - g_param_spec_boolean ("activates-default", - P_("Activates default"), - P_("Whether to activate the default widget (such as the default button in a dialog) when Enter is pressed"), - FALSE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - g_object_class_install_property (gobject_class, - PROP_WIDTH_CHARS, - g_param_spec_int ("width-chars", - P_("Width in chars"), - P_("Number of characters to leave space for in the entry"), - -1, - G_MAXINT, - -1, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_INNER_BORDER] = + g_param_spec_boxed ("inner-border", + P_("Inner Border"), + P_("Border between text and frame. Overrides the inner-border style property"), + GTK_TYPE_BORDER, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_DEPRECATED); + + entry_props[PROP_INVISIBLE_CHAR] = + g_param_spec_unichar ("invisible-char", + P_("Invisible character"), + P_("The character to use when masking entry contents (in \"password mode\")"), + '*', + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + + entry_props[PROP_ACTIVATES_DEFAULT] = + g_param_spec_boolean ("activates-default", + P_("Activates default"), + P_("Whether to activate the default widget (such as the default button in a dialog) when Enter is pressed"), + FALSE, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + + entry_props[PROP_WIDTH_CHARS] = + g_param_spec_int ("width-chars", + P_("Width in chars"), + P_("Number of characters to leave space for in the entry"), + -1, G_MAXINT, + -1, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:max-width-chars: @@ -876,52 +866,45 @@ gtk_entry_class_init (GtkEntryClass *class) * automatically. * * Since: 3.12 - */ - g_object_class_install_property (gobject_class, - PROP_MAX_WIDTH_CHARS, - g_param_spec_int ("max-width-chars", - P_("Maximum width in characters"), - P_("The desired maximum width of the entry, in characters"), - -1, - G_MAXINT, - -1, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - - g_object_class_install_property (gobject_class, - PROP_SCROLL_OFFSET, - g_param_spec_int ("scroll-offset", - P_("Scroll offset"), - P_("Number of pixels of the entry scrolled off the screen to the left"), - 0, - G_MAXINT, - 0, - GTK_PARAM_READABLE|G_PARAM_EXPLICIT_NOTIFY)); - - g_object_class_install_property (gobject_class, - PROP_TEXT, - g_param_spec_string ("text", - P_("Text"), - P_("The contents of the entry"), - "", - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + */ + entry_props[PROP_MAX_WIDTH_CHARS] = + g_param_spec_int ("max-width-chars", + P_("Maximum width in characters"), + P_("The desired maximum width of the entry, in characters"), + -1, G_MAXINT, + -1, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + + entry_props[PROP_SCROLL_OFFSET] = + g_param_spec_int ("scroll-offset", + P_("Scroll offset"), + P_("Number of pixels of the entry scrolled off the screen to the left"), + 0, G_MAXINT, + 0, + GTK_PARAM_READABLE|G_PARAM_EXPLICIT_NOTIFY); + + entry_props[PROP_TEXT] = + g_param_spec_string ("text", + P_("Text"), + P_("The contents of the entry"), + "", + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:xalign: * - * The horizontal alignment, from 0 (left) to 1 (right). + * The horizontal alignment, from 0 (left) to 1 (right). * Reversed for RTL layouts. - * + * * Since: 2.4 */ - g_object_class_install_property (gobject_class, - PROP_XALIGN, - g_param_spec_float ("xalign", - P_("X align"), - P_("The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts."), - 0.0, - 1.0, - 0.0, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_XALIGN] = + g_param_spec_float ("xalign", + P_("X align"), + P_("The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts."), + 0.0, 1.0, + 0.0, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:truncate-multiline: @@ -930,30 +913,28 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 2.10 */ - g_object_class_install_property (gobject_class, - PROP_TRUNCATE_MULTILINE, - g_param_spec_boolean ("truncate-multiline", - P_("Truncate multiline"), - P_("Whether to truncate multiline pastes to one line."), - FALSE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_TRUNCATE_MULTILINE] = + g_param_spec_boolean ("truncate-multiline", + P_("Truncate multiline"), + P_("Whether to truncate multiline pastes to one line."), + FALSE, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:shadow-type: * - * Which kind of shadow to draw around the entry when + * Which kind of shadow to draw around the entry when * #GtkEntry:has-frame is set to %TRUE. * * Since: 2.12 */ - g_object_class_install_property (gobject_class, - PROP_SHADOW_TYPE, - g_param_spec_enum ("shadow-type", - P_("Shadow type"), - P_("Which kind of shadow to draw around the entry when has-frame is set"), - GTK_TYPE_SHADOW_TYPE, - GTK_SHADOW_IN, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_SHADOW_TYPE] = + g_param_spec_enum ("shadow-type", + P_("Shadow type"), + P_("Which kind of shadow to draw around the entry when has-frame is set"), + GTK_TYPE_SHADOW_TYPE, + GTK_SHADOW_IN, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:overwrite-mode: @@ -962,13 +943,12 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 2.14 */ - g_object_class_install_property (gobject_class, - PROP_OVERWRITE_MODE, - g_param_spec_boolean ("overwrite-mode", - P_("Overwrite mode"), - P_("Whether new text overwrites existing text"), - FALSE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_OVERWRITE_MODE] = + g_param_spec_boolean ("overwrite-mode", + P_("Overwrite mode"), + P_("Whether new text overwrites existing text"), + FALSE, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:text-length: @@ -977,15 +957,14 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 2.14 */ - g_object_class_install_property (gobject_class, - PROP_TEXT_LENGTH, - g_param_spec_uint ("text-length", - P_("Text length"), - P_("Length of the text currently in the entry"), - 0, - G_MAXUINT16, - 0, - GTK_PARAM_READABLE)); + entry_props[PROP_TEXT_LENGTH] = + g_param_spec_uint ("text-length", + P_("Text length"), + P_("Length of the text currently in the entry"), + 0, G_MAXUINT16, + 0, + GTK_PARAM_READABLE); + /** * GtkEntry:invisible-char-set: * @@ -993,13 +972,12 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_INVISIBLE_CHAR_SET, - g_param_spec_boolean ("invisible-char-set", - P_("Invisible character set"), - P_("Whether the invisible character has been set"), - FALSE, - GTK_PARAM_READWRITE)); + entry_props[PROP_INVISIBLE_CHAR_SET] = + g_param_spec_boolean ("invisible-char-set", + P_("Invisible character set"), + P_("Whether the invisible character has been set"), + FALSE, + GTK_PARAM_READWRITE); /** * GtkEntry:caps-lock-warning: @@ -1007,18 +985,17 @@ gtk_entry_class_init (GtkEntryClass *class) * Whether password entries will show a warning when Caps Lock is on. * * Note that the warning is shown using a secondary icon, and thus - * does not work if you are using the secondary icon position for some + * does not work if you are using the secondary icon position for some * other purpose. * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_CAPS_LOCK_WARNING, - g_param_spec_boolean ("caps-lock-warning", - P_("Caps Lock warning"), - P_("Whether password entries will show a warning when Caps Lock is on"), - TRUE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_CAPS_LOCK_WARNING] = + g_param_spec_boolean ("caps-lock-warning", + P_("Caps Lock warning"), + P_("Whether password entries will show a warning when Caps Lock is on"), + TRUE, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:progress-fraction: @@ -1027,15 +1004,13 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_PROGRESS_FRACTION, - g_param_spec_double ("progress-fraction", - P_("Progress Fraction"), - P_("The current fraction of the task that's been completed"), - 0.0, - 1.0, - 0.0, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_PROGRESS_FRACTION] = + g_param_spec_double ("progress-fraction", + P_("Progress Fraction"), + P_("The current fraction of the task that's been completed"), + 0.0, 1.0, + 0.0, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:progress-pulse-step: @@ -1045,15 +1020,13 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_PROGRESS_PULSE_STEP, - g_param_spec_double ("progress-pulse-step", - P_("Progress Pulse Step"), - P_("The fraction of total entry width to move the progress bouncing block for each call to gtk_entry_progress_pulse()"), - 0.0, - 1.0, - 0.1, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_PROGRESS_PULSE_STEP] = + g_param_spec_double ("progress-pulse-step", + P_("Progress Pulse Step"), + P_("The fraction of total entry width to move the progress bouncing block for each call to gtk_entry_progress_pulse()"), + 0.0, 1.0, + 0.1, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:placeholder-text: @@ -1063,13 +1036,12 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 3.2 */ - g_object_class_install_property (gobject_class, - PROP_PLACEHOLDER_TEXT, - g_param_spec_string ("placeholder-text", - P_("Placeholder text"), - P_("Show text in the entry when it's empty and unfocused"), - NULL, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_PLACEHOLDER_TEXT] = + g_param_spec_string ("placeholder-text", + P_("Placeholder text"), + P_("Show text in the entry when it's empty and unfocused"), + NULL, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:primary-icon-pixbuf: @@ -1078,14 +1050,13 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_PIXBUF_PRIMARY, - g_param_spec_object ("primary-icon-pixbuf", - P_("Primary pixbuf"), - P_("Primary pixbuf for the entry"), - GDK_TYPE_PIXBUF, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - + entry_props[PROP_PIXBUF_PRIMARY] = + g_param_spec_object ("primary-icon-pixbuf", + P_("Primary pixbuf"), + P_("Primary pixbuf for the entry"), + GDK_TYPE_PIXBUF, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + /** * GtkEntry:secondary-icon-pixbuf: * @@ -1093,13 +1064,12 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_PIXBUF_SECONDARY, - g_param_spec_object ("secondary-icon-pixbuf", - P_("Secondary pixbuf"), - P_("Secondary pixbuf for the entry"), - GDK_TYPE_PIXBUF, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_PIXBUF_SECONDARY] = + g_param_spec_object ("secondary-icon-pixbuf", + P_("Secondary pixbuf"), + P_("Secondary pixbuf for the entry"), + GDK_TYPE_PIXBUF, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:primary-icon-stock: @@ -1110,13 +1080,12 @@ gtk_entry_class_init (GtkEntryClass *class) * * Deprecated: 3.10: Use #GtkEntry:primary-icon-name instead. */ - g_object_class_install_property (gobject_class, - PROP_STOCK_PRIMARY, - g_param_spec_string ("primary-icon-stock", - P_("Primary stock ID"), - P_("Stock ID for primary icon"), - NULL, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_DEPRECATED)); + entry_props[PROP_STOCK_PRIMARY] = + g_param_spec_string ("primary-icon-stock", + P_("Primary stock ID"), + P_("Stock ID for primary icon"), + NULL, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_DEPRECATED); /** * GtkEntry:secondary-icon-stock: @@ -1127,14 +1096,13 @@ gtk_entry_class_init (GtkEntryClass *class) * * Deprecated: 3.10: Use #GtkEntry:secondary-icon-name instead. */ - g_object_class_install_property (gobject_class, - PROP_STOCK_SECONDARY, - g_param_spec_string ("secondary-icon-stock", - P_("Secondary stock ID"), - P_("Stock ID for secondary icon"), - NULL, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_DEPRECATED)); - + entry_props[PROP_STOCK_SECONDARY] = + g_param_spec_string ("secondary-icon-stock", + P_("Secondary stock ID"), + P_("Stock ID for secondary icon"), + NULL, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_DEPRECATED); + /** * GtkEntry:primary-icon-name: * @@ -1142,14 +1110,13 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_ICON_NAME_PRIMARY, - g_param_spec_string ("primary-icon-name", - P_("Primary icon name"), - P_("Icon name for primary icon"), - NULL, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - + entry_props[PROP_ICON_NAME_PRIMARY] = + g_param_spec_string ("primary-icon-name", + P_("Primary icon name"), + P_("Icon name for primary icon"), + NULL, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + /** * GtkEntry:secondary-icon-name: * @@ -1157,14 +1124,13 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_ICON_NAME_SECONDARY, - g_param_spec_string ("secondary-icon-name", - P_("Secondary icon name"), - P_("Icon name for secondary icon"), - NULL, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - + entry_props[PROP_ICON_NAME_SECONDARY] = + g_param_spec_string ("secondary-icon-name", + P_("Secondary icon name"), + P_("Icon name for secondary icon"), + NULL, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + /** * GtkEntry:primary-icon-gicon: * @@ -1172,14 +1138,13 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_GICON_PRIMARY, - g_param_spec_object ("primary-icon-gicon", - P_("Primary GIcon"), - P_("GIcon for primary icon"), - G_TYPE_ICON, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - + entry_props[PROP_GICON_PRIMARY] = + g_param_spec_object ("primary-icon-gicon", + P_("Primary GIcon"), + P_("GIcon for primary icon"), + G_TYPE_ICON, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + /** * GtkEntry:secondary-icon-gicon: * @@ -1187,14 +1152,13 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_GICON_SECONDARY, - g_param_spec_object ("secondary-icon-gicon", - P_("Secondary GIcon"), - P_("GIcon for secondary icon"), - G_TYPE_ICON, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - + entry_props[PROP_GICON_SECONDARY] = + g_param_spec_object ("secondary-icon-gicon", + P_("Secondary GIcon"), + P_("GIcon for secondary icon"), + G_TYPE_ICON, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + /** * GtkEntry:primary-icon-storage-type: * @@ -1202,15 +1166,14 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_STORAGE_TYPE_PRIMARY, - g_param_spec_enum ("primary-icon-storage-type", - P_("Primary storage type"), - P_("The representation being used for primary icon"), - GTK_TYPE_IMAGE_TYPE, - GTK_IMAGE_EMPTY, - GTK_PARAM_READABLE)); - + entry_props[PROP_STORAGE_TYPE_PRIMARY] = + g_param_spec_enum ("primary-icon-storage-type", + P_("Primary storage type"), + P_("The representation being used for primary icon"), + GTK_TYPE_IMAGE_TYPE, + GTK_IMAGE_EMPTY, + GTK_PARAM_READABLE); + /** * GtkEntry:secondary-icon-storage-type: * @@ -1218,87 +1181,82 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_STORAGE_TYPE_SECONDARY, - g_param_spec_enum ("secondary-icon-storage-type", - P_("Secondary storage type"), - P_("The representation being used for secondary icon"), - GTK_TYPE_IMAGE_TYPE, - GTK_IMAGE_EMPTY, - GTK_PARAM_READABLE)); - + entry_props[PROP_STORAGE_TYPE_SECONDARY] = + g_param_spec_enum ("secondary-icon-storage-type", + P_("Secondary storage type"), + P_("The representation being used for secondary icon"), + GTK_TYPE_IMAGE_TYPE, + GTK_IMAGE_EMPTY, + GTK_PARAM_READABLE); + /** * GtkEntry:primary-icon-activatable: * * Whether the primary icon is activatable. * - * GTK+ emits the #GtkEntry::icon-press and #GtkEntry::icon-release - * signals only on sensitive, activatable icons. + * GTK+ emits the #GtkEntry::icon-press and #GtkEntry::icon-release + * signals only on sensitive, activatable icons. * - * Sensitive, but non-activatable icons can be used for purely + * Sensitive, but non-activatable icons can be used for purely * informational purposes. * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_ACTIVATABLE_PRIMARY, - g_param_spec_boolean ("primary-icon-activatable", - P_("Primary icon activatable"), - P_("Whether the primary icon is activatable"), - TRUE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - + entry_props[PROP_ACTIVATABLE_PRIMARY] = + g_param_spec_boolean ("primary-icon-activatable", + P_("Primary icon activatable"), + P_("Whether the primary icon is activatable"), + TRUE, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + /** * GtkEntry:secondary-icon-activatable: * * Whether the secondary icon is activatable. * - * GTK+ emits the #GtkEntry::icon-press and #GtkEntry::icon-release + * GTK+ emits the #GtkEntry::icon-press and #GtkEntry::icon-release * signals only on sensitive, activatable icons. * - * Sensitive, but non-activatable icons can be used for purely + * Sensitive, but non-activatable icons can be used for purely * informational purposes. * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_ACTIVATABLE_SECONDARY, - g_param_spec_boolean ("secondary-icon-activatable", - P_("Secondary icon activatable"), - P_("Whether the secondary icon is activatable"), - TRUE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - - + entry_props[PROP_ACTIVATABLE_SECONDARY] = + g_param_spec_boolean ("secondary-icon-activatable", + P_("Secondary icon activatable"), + P_("Whether the secondary icon is activatable"), + TRUE, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + /** * GtkEntry:primary-icon-sensitive: * * Whether the primary icon is sensitive. * - * An insensitive icon appears grayed out. GTK+ does not emit the - * #GtkEntry::icon-press and #GtkEntry::icon-release signals and + * An insensitive icon appears grayed out. GTK+ does not emit the + * #GtkEntry::icon-press and #GtkEntry::icon-release signals and * does not allow DND from insensitive icons. * * An icon should be set insensitive if the action that would trigger * when clicked is currently not available. - * + * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_SENSITIVE_PRIMARY, - g_param_spec_boolean ("primary-icon-sensitive", - P_("Primary icon sensitive"), - P_("Whether the primary icon is sensitive"), - TRUE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - + entry_props[PROP_SENSITIVE_PRIMARY] = + g_param_spec_boolean ("primary-icon-sensitive", + P_("Primary icon sensitive"), + P_("Whether the primary icon is sensitive"), + TRUE, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + /** * GtkEntry:secondary-icon-sensitive: * * Whether the secondary icon is sensitive. * - * An insensitive icon appears grayed out. GTK+ does not emit the - * #GtkEntry::icon-press and #GtkEntry::icon-release signals and + * An insensitive icon appears grayed out. GTK+ does not emit the + * #GtkEntry::icon-press and #GtkEntry::icon-release signals and * does not allow DND from insensitive icons. * * An icon should be set insensitive if the action that would trigger @@ -1306,51 +1264,48 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_SENSITIVE_SECONDARY, - g_param_spec_boolean ("secondary-icon-sensitive", - P_("Secondary icon sensitive"), - P_("Whether the secondary icon is sensitive"), - TRUE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - + entry_props[PROP_SENSITIVE_SECONDARY] = + g_param_spec_boolean ("secondary-icon-sensitive", + P_("Secondary icon sensitive"), + P_("Whether the secondary icon is sensitive"), + TRUE, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + /** * GtkEntry:primary-icon-tooltip-text: - * + * * The contents of the tooltip on the primary icon. * * Also see gtk_entry_set_icon_tooltip_text(). * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_TOOLTIP_TEXT_PRIMARY, - g_param_spec_string ("primary-icon-tooltip-text", - P_("Primary icon tooltip text"), - P_("The contents of the tooltip on the primary icon"), - NULL, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); - + entry_props[PROP_TOOLTIP_TEXT_PRIMARY] = + g_param_spec_string ("primary-icon-tooltip-text", + P_("Primary icon tooltip text"), + P_("The contents of the tooltip on the primary icon"), + NULL, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + /** * GtkEntry:secondary-icon-tooltip-text: - * + * * The contents of the tooltip on the secondary icon. * * Also see gtk_entry_set_icon_tooltip_text(). * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_TOOLTIP_TEXT_SECONDARY, - g_param_spec_string ("secondary-icon-tooltip-text", - P_("Secondary icon tooltip text"), - P_("The contents of the tooltip on the secondary icon"), - NULL, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_TOOLTIP_TEXT_SECONDARY] = + g_param_spec_string ("secondary-icon-tooltip-text", + P_("Secondary icon tooltip text"), + P_("The contents of the tooltip on the secondary icon"), + NULL, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:primary-icon-tooltip-markup: - * + * * The contents of the tooltip on the primary icon, which is marked up * with the [Pango text markup language][PangoMarkupFormat]. * @@ -1358,17 +1313,16 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_TOOLTIP_MARKUP_PRIMARY, - g_param_spec_string ("primary-icon-tooltip-markup", - P_("Primary icon tooltip markup"), - P_("The contents of the tooltip on the primary icon"), - NULL, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_TOOLTIP_MARKUP_PRIMARY] = + g_param_spec_string ("primary-icon-tooltip-markup", + P_("Primary icon tooltip markup"), + P_("The contents of the tooltip on the primary icon"), + NULL, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:secondary-icon-tooltip-markup: - * + * * The contents of the tooltip on the secondary icon, which is marked up * with the [Pango text markup language][PangoMarkupFormat]. * @@ -1376,33 +1330,31 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 2.16 */ - g_object_class_install_property (gobject_class, - PROP_TOOLTIP_MARKUP_SECONDARY, - g_param_spec_string ("secondary-icon-tooltip-markup", - P_("Secondary icon tooltip markup"), - P_("The contents of the tooltip on the secondary icon"), - NULL, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_TOOLTIP_MARKUP_SECONDARY] = + g_param_spec_string ("secondary-icon-tooltip-markup", + P_("Secondary icon tooltip markup"), + P_("The contents of the tooltip on the secondary icon"), + NULL, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:im-module: * - * Which IM (input method) module should be used for this entry. + * Which IM (input method) module should be used for this entry. * See #GtkIMContext. - * + * * Setting this to a non-%NULL value overrides the - * system-wide IM module setting. See the GtkSettings + * system-wide IM module setting. See the GtkSettings * #GtkSettings:gtk-im-module property. * * Since: 2.16 - */ - g_object_class_install_property (gobject_class, - PROP_IM_MODULE, - g_param_spec_string ("im-module", - P_("IM module"), - P_("Which IM module should be used"), - NULL, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + */ + entry_props[PROP_IM_MODULE] = + g_param_spec_string ("im-module", + P_("IM module"), + P_("Which IM module should be used"), + NULL, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:completion: @@ -1410,14 +1362,13 @@ gtk_entry_class_init (GtkEntryClass *class) * The auxiliary completion object to use with the entry. * * Since: 3.2 - */ - g_object_class_install_property (gobject_class, - PROP_COMPLETION, - g_param_spec_object ("completion", - P_("Completion"), - P_("The auxiliary completion object"), - GTK_TYPE_ENTRY_COMPLETION, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + */ + entry_props[PROP_COMPLETION] = + g_param_spec_object ("completion", + P_("Completion"), + P_("The auxiliary completion object"), + GTK_TYPE_ENTRY_COMPLETION, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:input-purpose: @@ -1433,14 +1384,13 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 3.6 */ - g_object_class_install_property (gobject_class, - PROP_INPUT_PURPOSE, - g_param_spec_enum ("input-purpose", - P_("Purpose"), - P_("Purpose of the text field"), - GTK_TYPE_INPUT_PURPOSE, - GTK_INPUT_PURPOSE_FREE_FORM, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_INPUT_PURPOSE] = + g_param_spec_enum ("input-purpose", + P_("Purpose"), + P_("Purpose of the text field"), + GTK_TYPE_INPUT_PURPOSE, + GTK_INPUT_PURPOSE_FREE_FORM, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:input-hints: @@ -1450,14 +1400,13 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 3.6 */ - g_object_class_install_property (gobject_class, - PROP_INPUT_HINTS, - g_param_spec_flags ("input-hints", - P_("hints"), - P_("Hints for the text field behaviour"), - GTK_TYPE_INPUT_HINTS, - GTK_INPUT_HINT_NONE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_INPUT_HINTS] = + g_param_spec_flags ("input-hints", + P_("hints"), + P_("Hints for the text field behaviour"), + GTK_TYPE_INPUT_HINTS, + GTK_INPUT_HINT_NONE, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:attributes: @@ -1468,13 +1417,12 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 3.6 */ - g_object_class_install_property (gobject_class, - PROP_ATTRIBUTES, - g_param_spec_boxed ("attributes", - P_("Attributes"), - P_("A list of style attributes to apply to the text of the label"), - PANGO_TYPE_ATTR_LIST, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_ATTRIBUTES] = + g_param_spec_boxed ("attributes", + P_("Attributes"), + P_("A list of style attributes to apply to the text of the label"), + PANGO_TYPE_ATTR_LIST, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry:populate-all: @@ -1484,13 +1432,12 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 3.8 */ - g_object_class_install_property (gobject_class, - PROP_POPULATE_ALL, - g_param_spec_boolean ("populate-all", - P_("Populate all"), - P_("Whether to emit ::populate-popup for touch popups"), - FALSE, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_POPULATE_ALL] = + g_param_spec_boolean ("populate-all", + P_("Populate all"), + P_("Whether to emit ::populate-popup for touch popups"), + FALSE, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); /** * GtkEntry::tabs: @@ -1499,13 +1446,14 @@ gtk_entry_class_init (GtkEntryClass *class) * * Since: 3.8 */ - g_object_class_install_property (gobject_class, - PROP_TABS, - g_param_spec_boxed ("tabs", - P_("Tabs"), - P_("A list of tabstop locations to apply to the text of the entry"), - PANGO_TYPE_TAB_ARRAY, - GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); + entry_props[PROP_TABS] = + g_param_spec_boxed ("tabs", + P_("Tabs"), + P_("A list of tabstop locations to apply to the text of the entry"), + PANGO_TYPE_TAB_ARRAY, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + + g_object_class_install_properties (gobject_class, NUM_PROPERTIES, entry_props); /** * GtkEntry:icon-prelight: @@ -2094,7 +2042,7 @@ gtk_entry_do_set_inner_border (GtkEntry *entry, else g_object_set_qdata (G_OBJECT (entry), quark_inner_border, NULL); - g_object_notify (G_OBJECT (entry), "inner-border"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_INNER_BORDER]); } static const GtkBorder * @@ -2148,7 +2096,7 @@ gtk_entry_set_property (GObject *object, if (new_value && gtk_widget_has_focus (widget)) gtk_im_context_focus_in (priv->im_context); - g_object_notify (object, "editable"); + g_object_notify_by_pspec (object, pspec); gtk_widget_queue_draw (widget); } } @@ -2157,7 +2105,7 @@ gtk_entry_set_property (GObject *object, case PROP_MAX_LENGTH: gtk_entry_set_max_length (entry, g_value_get_int (value)); break; - + case PROP_VISIBILITY: gtk_entry_set_visibility (entry, g_value_get_boolean (value)); break; @@ -2198,7 +2146,7 @@ gtk_entry_set_property (GObject *object, if (priv->truncate_multiline != g_value_get_boolean (value)) { priv->truncate_multiline = g_value_get_boolean (value); - g_object_notify (object, "truncate-multiline"); + g_object_notify_by_pspec (object, pspec); } break; @@ -2206,7 +2154,7 @@ gtk_entry_set_property (GObject *object, if (priv->shadow_type != g_value_get_enum (value)) { priv->shadow_type = g_value_get_enum (value); - g_object_notify (object, "shadow-type"); + g_object_notify_by_pspec (object, pspec); } break; @@ -2225,7 +2173,7 @@ gtk_entry_set_property (GObject *object, if (priv->caps_lock_warning != g_value_get_boolean (value)) { priv->caps_lock_warning = g_value_get_boolean (value); - g_object_notify (object, "caps-lock-warning"); + g_object_notify_by_pspec (object, pspec); } break; @@ -2346,7 +2294,7 @@ gtk_entry_set_property (GObject *object, priv->im_module = g_value_dup_string (value); if (GTK_IS_IM_MULTICONTEXT (priv->im_context)) gtk_im_multicontext_set_context_id (GTK_IM_MULTICONTEXT (priv->im_context), priv->im_module); - g_object_notify (object, "im-module"); + g_object_notify_by_pspec (object, pspec); break; case PROP_EDITING_CANCELED: @@ -5256,7 +5204,7 @@ gtk_entry_update_cached_style_values (GtkEntry *entry) if (priv->invisible_char != ch) { priv->invisible_char = ch; - g_object_notify (G_OBJECT (entry), "invisible-char"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_INVISIBLE_CHAR]); } } } @@ -5494,7 +5442,7 @@ buffer_notify_text (GtkEntryBuffer *buffer, gtk_entry_obscure_mouse_cursor (entry); gtk_entry_recompute (entry); emit_changed (entry); - g_object_notify (G_OBJECT (entry), "text"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_TEXT]); } static void @@ -5502,7 +5450,7 @@ buffer_notify_length (GtkEntryBuffer *buffer, GParamSpec *spec, GtkEntry *entry) { - g_object_notify (G_OBJECT (entry), "text-length"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_TEXT_LENGTH]); } static void @@ -5510,7 +5458,7 @@ buffer_notify_max_length (GtkEntryBuffer *buffer, GParamSpec *spec, GtkEntry *entry) { - g_object_notify (G_OBJECT (entry), "max-length"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_MAX_LENGTH]); } static void @@ -6115,14 +6063,14 @@ gtk_entry_set_positions (GtkEntry *entry, gboolean changed = FALSE; g_object_freeze_notify (G_OBJECT (entry)); - + if (current_pos != -1 && priv->current_pos != current_pos) { priv->current_pos = current_pos; changed = TRUE; - g_object_notify (G_OBJECT (entry), "cursor-position"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_CURSOR_POSITION]); } if (selection_bound != -1 && @@ -6130,13 +6078,13 @@ gtk_entry_set_positions (GtkEntry *entry, { priv->selection_bound = selection_bound; changed = TRUE; - - g_object_notify (G_OBJECT (entry), "selection-bound"); + + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_SELECTION_BOUND]); } g_object_thaw_notify (G_OBJECT (entry)); - if (changed) + if (changed) { gtk_entry_move_adjustments (entry); gtk_entry_recompute (entry); @@ -7065,7 +7013,7 @@ gtk_entry_adjust_scroll (GtkEntry *entry) priv->scroll_offset += weak_xoffset - text_area_width; } - g_object_notify (G_OBJECT (entry), "scroll-offset"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_SCROLL_OFFSET]); if (priv->text_handle) { @@ -7500,23 +7448,31 @@ gtk_entry_clear (GtkEntry *entry, switch (storage_type) { case GTK_IMAGE_PIXBUF: - g_object_notify (G_OBJECT (entry), - icon_pos == GTK_ENTRY_ICON_PRIMARY ? "primary-icon-pixbuf" : "secondary-icon-pixbuf"); + g_object_notify_by_pspec (G_OBJECT (entry), + entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY + ? PROP_PIXBUF_PRIMARY + : PROP_PIXBUF_SECONDARY]); break; case GTK_IMAGE_STOCK: - g_object_notify (G_OBJECT (entry), - icon_pos == GTK_ENTRY_ICON_PRIMARY ? "primary-icon-stock" : "secondary-icon-stock"); + g_object_notify_by_pspec (G_OBJECT (entry), + entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY + ? PROP_STOCK_PRIMARY + : PROP_STOCK_SECONDARY]); break; case GTK_IMAGE_ICON_NAME: - g_object_notify (G_OBJECT (entry), - icon_pos == GTK_ENTRY_ICON_PRIMARY ? "primary-icon-name" : "secondary-icon-name"); + g_object_notify_by_pspec (G_OBJECT (entry), + entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY + ? PROP_ICON_NAME_PRIMARY + : PROP_ICON_NAME_SECONDARY]); break; case GTK_IMAGE_GICON: - g_object_notify (G_OBJECT (entry), - icon_pos == GTK_ENTRY_ICON_PRIMARY ? "primary-icon-gicon" : "secondary-icon-gicon"); + g_object_notify_by_pspec (G_OBJECT (entry), + entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY + ? PROP_GICON_PRIMARY + : PROP_GICON_SECONDARY]); break; default: @@ -7526,8 +7482,10 @@ gtk_entry_clear (GtkEntry *entry, _gtk_icon_helper_clear (icon_info->icon_helper); - g_object_notify (G_OBJECT (entry), - icon_pos == GTK_ENTRY_ICON_PRIMARY ? "primary-icon-storage-type" : "secondary-icon-storage-type"); + g_object_notify_by_pspec (G_OBJECT (entry), + entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY + ? PROP_STORAGE_TYPE_PRIMARY + : PROP_STORAGE_TYPE_SECONDARY]); g_object_thaw_notify (G_OBJECT (entry)); } @@ -7660,13 +7618,13 @@ gtk_entry_set_buffer (GtkEntry *entry, obj = G_OBJECT (entry); g_object_freeze_notify (obj); - g_object_notify (obj, "buffer"); - g_object_notify (obj, "text"); - g_object_notify (obj, "text-length"); - g_object_notify (obj, "max-length"); - g_object_notify (obj, "visibility"); - g_object_notify (obj, "invisible-char"); - g_object_notify (obj, "invisible-char-set"); + g_object_notify_by_pspec (obj, entry_props[PROP_BUFFER]); + g_object_notify_by_pspec (obj, entry_props[PROP_TEXT]); + g_object_notify_by_pspec (obj, entry_props[PROP_TEXT_LENGTH]); + g_object_notify_by_pspec (obj, entry_props[PROP_MAX_LENGTH]); + g_object_notify_by_pspec (obj, entry_props[PROP_VISIBILITY]); + g_object_notify_by_pspec (obj, entry_props[PROP_INVISIBLE_CHAR]); + g_object_notify_by_pspec (obj, entry_props[PROP_INVISIBLE_CHAR_SET]); g_object_thaw_notify (obj); gtk_editable_set_position (GTK_EDITABLE (entry), 0); @@ -7796,7 +7754,7 @@ gtk_entry_set_visibility (GtkEntry *entry, { priv->visible = visible; - g_object_notify (G_OBJECT (entry), "visibility"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_VISIBILITY]); gtk_entry_recompute (entry); } } @@ -7844,15 +7802,15 @@ gtk_entry_set_invisible_char (GtkEntry *entry, if (!priv->invisible_char_set) { priv->invisible_char_set = TRUE; - g_object_notify (G_OBJECT (entry), "invisible-char-set"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_INVISIBLE_CHAR_SET]); } if (ch == priv->invisible_char) return; priv->invisible_char = ch; - g_object_notify (G_OBJECT (entry), "invisible-char"); - gtk_entry_recompute (entry); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_INVISIBLE_CHAR]); + gtk_entry_recompute (entry); } /** @@ -7902,10 +7860,10 @@ gtk_entry_unset_invisible_char (GtkEntry *entry) if (priv->invisible_char != ch) { priv->invisible_char = ch; - g_object_notify (G_OBJECT (entry), "invisible-char"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_INVISIBLE_CHAR]); } - g_object_notify (G_OBJECT (entry), "invisible-char-set"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_INVISIBLE_CHAR_SET]); gtk_entry_recompute (entry); } @@ -7913,7 +7871,7 @@ gtk_entry_unset_invisible_char (GtkEntry *entry) * gtk_entry_set_overwrite_mode: * @entry: a #GtkEntry * @overwrite: new value - * + * * Sets whether the text is overwritten when typing in the #GtkEntry. * * Since: 2.14 @@ -7928,18 +7886,18 @@ gtk_entry_set_overwrite_mode (GtkEntry *entry, if (priv->overwrite_mode == overwrite) return; - + gtk_entry_toggle_overwrite (entry); - g_object_notify (G_OBJECT (entry), "overwrite-mode"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_OVERWRITE_MODE]); } /** * gtk_entry_get_overwrite_mode: * @entry: a #GtkEntry - * + * * Gets the value set by gtk_entry_set_overwrite_mode(). - * + * * Returns: whether the text is overwritten when typing. * * Since: 2.14 @@ -8090,18 +8048,18 @@ gtk_entry_set_activates_default (GtkEntry *entry, if (setting != priv->activates_default) { priv->activates_default = setting; - g_object_notify (G_OBJECT (entry), "activates-default"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_ACTIVATES_DEFAULT]); } } /** * gtk_entry_get_activates_default: * @entry: a #GtkEntry - * + * * Retrieves the value set by gtk_entry_set_activates_default(). - * + * * Returns: %TRUE if the entry will activate the default widget - **/ + */ gboolean gtk_entry_get_activates_default (GtkEntry *entry) { @@ -8134,7 +8092,7 @@ gtk_entry_set_width_chars (GtkEntry *entry, if (priv->width_chars != n_chars) { priv->width_chars = n_chars; - g_object_notify (G_OBJECT (entry), "width-chars"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_WIDTH_CHARS]); gtk_widget_queue_resize (GTK_WIDGET (entry)); } } @@ -8177,7 +8135,7 @@ gtk_entry_set_max_width_chars (GtkEntry *entry, if (priv->max_width_chars != n_chars) { priv->max_width_chars = n_chars; - g_object_notify (G_OBJECT (entry), "max-width-chars"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_MAX_WIDTH_CHARS]); gtk_widget_queue_resize (GTK_WIDGET (entry)); } } @@ -8227,7 +8185,7 @@ gtk_entry_set_has_frame (GtkEntry *entry, else gtk_style_context_add_class (context, GTK_STYLE_CLASS_FLAT); gtk_widget_queue_draw (GTK_WIDGET (entry)); - g_object_notify (G_OBJECT (entry), "has-frame"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_HAS_FRAME]); } /** @@ -8486,19 +8444,17 @@ gtk_entry_set_alignment (GtkEntry *entry, gfloat xalign) if (xalign != priv->xalign) { priv->xalign = xalign; - gtk_entry_recompute (entry); - - g_object_notify (G_OBJECT (entry), "xalign"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_XALIGN]); } } /** * gtk_entry_get_alignment: * @entry: a #GtkEntry - * + * * Gets the value set by gtk_entry_set_alignment(). - * + * * Returns: the alignment * * Since: 2.4 @@ -8554,13 +8510,13 @@ gtk_entry_set_icon_from_pixbuf (GtkEntry *entry, if (icon_pos == GTK_ENTRY_ICON_PRIMARY) { - g_object_notify (G_OBJECT (entry), "primary-icon-pixbuf"); - g_object_notify (G_OBJECT (entry), "primary-icon-storage-type"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_PIXBUF_PRIMARY]); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STORAGE_TYPE_PRIMARY]); } else { - g_object_notify (G_OBJECT (entry), "secondary-icon-pixbuf"); - g_object_notify (G_OBJECT (entry), "secondary-icon-storage-type"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_PIXBUF_SECONDARY]); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STORAGE_TYPE_SECONDARY]); } if (gtk_widget_get_mapped (GTK_WIDGET (entry))) @@ -8620,13 +8576,13 @@ gtk_entry_set_icon_from_stock (GtkEntry *entry, if (icon_pos == GTK_ENTRY_ICON_PRIMARY) { - g_object_notify (G_OBJECT (entry), "primary-icon-stock"); - g_object_notify (G_OBJECT (entry), "primary-icon-storage-type"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STOCK_PRIMARY]); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STORAGE_TYPE_PRIMARY]); } else { - g_object_notify (G_OBJECT (entry), "secondary-icon-stock"); - g_object_notify (G_OBJECT (entry), "secondary-icon-storage-type"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STOCK_SECONDARY]); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STORAGE_TYPE_SECONDARY]); } if (gtk_widget_get_mapped (GTK_WIDGET (entry))) @@ -8687,13 +8643,13 @@ gtk_entry_set_icon_from_icon_name (GtkEntry *entry, if (icon_pos == GTK_ENTRY_ICON_PRIMARY) { - g_object_notify (G_OBJECT (entry), "primary-icon-name"); - g_object_notify (G_OBJECT (entry), "primary-icon-storage-type"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_ICON_NAME_PRIMARY]); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STORAGE_TYPE_PRIMARY]); } else { - g_object_notify (G_OBJECT (entry), "secondary-icon-name"); - g_object_notify (G_OBJECT (entry), "secondary-icon-storage-type"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_ICON_NAME_SECONDARY]); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STORAGE_TYPE_SECONDARY]); } if (gtk_widget_get_mapped (GTK_WIDGET (entry))) @@ -8753,13 +8709,13 @@ gtk_entry_set_icon_from_gicon (GtkEntry *entry, if (icon_pos == GTK_ENTRY_ICON_PRIMARY) { - g_object_notify (G_OBJECT (entry), "primary-icon-gicon"); - g_object_notify (G_OBJECT (entry), "primary-icon-storage-type"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_GICON_PRIMARY]); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STORAGE_TYPE_PRIMARY]); } else { - g_object_notify (G_OBJECT (entry), "secondary-icon-gicon"); - g_object_notify (G_OBJECT (entry), "secondary-icon-storage-type"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_GICON_SECONDARY]); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STORAGE_TYPE_SECONDARY]); } if (gtk_widget_get_mapped (GTK_WIDGET (entry))) @@ -8809,8 +8765,10 @@ gtk_entry_set_icon_activatable (GtkEntry *entry, if (gtk_widget_get_realized (GTK_WIDGET (entry))) update_cursors (GTK_WIDGET (entry)); - g_object_notify (G_OBJECT (entry), - icon_pos == GTK_ENTRY_ICON_PRIMARY ? "primary-icon-activatable" : "secondary-icon-activatable"); + g_object_notify_by_pspec (G_OBJECT (entry), + entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY + ? PROP_ACTIVATABLE_PRIMARY + : PROP_ACTIVATABLE_SECONDARY]); } } @@ -9025,8 +8983,10 @@ gtk_entry_set_icon_sensitive (GtkEntry *entry, gtk_widget_queue_draw (GTK_WIDGET (entry)); - g_object_notify (G_OBJECT (entry), - icon_pos == GTK_ENTRY_ICON_PRIMARY ? "primary-icon-sensitive" : "secondary-icon-sensitive"); + g_object_notify_by_pspec (G_OBJECT (entry), + entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY + ? PROP_SENSITIVE_PRIMARY + : PROP_SENSITIVE_SECONDARY]); } } @@ -9383,8 +9343,10 @@ gtk_entry_set_icon_tooltip_text (GtkEntry *entry, ensure_has_tooltip (entry); - g_object_notify (G_OBJECT (entry), - icon_pos == GTK_ENTRY_ICON_PRIMARY ? "primary-icon-tooltip-text" : "secondary-icon-tooltip-text"); + g_object_notify_by_pspec (G_OBJECT (entry), + entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY + ? PROP_TOOLTIP_TEXT_PRIMARY + : PROP_TOOLTIP_TEXT_SECONDARY]); } /** @@ -9465,8 +9427,10 @@ gtk_entry_set_icon_tooltip_markup (GtkEntry *entry, ensure_has_tooltip (entry); - g_object_notify (G_OBJECT (entry), - icon_pos == GTK_ENTRY_ICON_PRIMARY ? "primary-icon-tooltip-markup" : "secondary-icon-tooltip-markup"); + g_object_notify_by_pspec (G_OBJECT (entry), + entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY + ? PROP_TOOLTIP_MARKUP_PRIMARY + : PROP_TOOLTIP_MARKUP_SECONDARY]); } static gboolean @@ -10536,7 +10500,7 @@ gtk_entry_set_completion (GtkEntry *entry, g_object_set_data (G_OBJECT (entry), I_(GTK_ENTRY_COMPLETION_KEY), completion); - g_object_notify (G_OBJECT (entry), "completion"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_COMPLETION]); } /** @@ -10771,7 +10735,7 @@ gtk_entry_set_progress_fraction (GtkEntry *entry, } if (fraction != old_fraction) - g_object_notify (G_OBJECT (entry), "progress-fraction"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_PROGRESS_FRACTION]); } /** @@ -10818,7 +10782,7 @@ gtk_entry_set_progress_pulse_step (GtkEntry *entry, if (fraction != private->progress_pulse_fraction) { private->progress_pulse_fraction = fraction; - g_object_notify (G_OBJECT (entry), "progress-pulse-step"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_PROGRESS_PULSE_STEP]); } } @@ -10897,7 +10861,7 @@ gtk_entry_set_placeholder_text (GtkEntry *entry, gtk_entry_recompute (entry); - g_object_notify (G_OBJECT (entry), "placeholder-text"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_PLACEHOLDER_TEXT]); } /** @@ -11017,7 +10981,7 @@ gtk_entry_set_input_purpose (GtkEntry *entry, "input-purpose", purpose, NULL); - g_object_notify (G_OBJECT (entry), "input-purpose"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_INPUT_PURPOSE]); } } @@ -11066,7 +11030,7 @@ gtk_entry_set_input_hints (GtkEntry *entry, "input-hints", hints, NULL); - g_object_notify (G_OBJECT (entry), "input-hints"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_INPUT_HINTS]); } } @@ -11116,7 +11080,7 @@ gtk_entry_set_attributes (GtkEntry *entry, pango_attr_list_unref (priv->attrs); priv->attrs = attrs; - g_object_notify (G_OBJECT (entry), "attributes"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_ATTRIBUTES]); gtk_entry_recompute (entry); gtk_widget_queue_resize (GTK_WIDGET (entry)); @@ -11169,7 +11133,7 @@ gtk_entry_set_tabs (GtkEntry *entry, else priv->tabs = NULL; - g_object_notify (G_OBJECT (entry), "tabs"); + g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_TABS]); gtk_entry_recompute (entry); gtk_widget_queue_resize (GTK_WIDGET (entry)); |