scrolled window: Convert to g_object_notify_by_pspec
This commit is contained in:
		| @ -261,7 +261,8 @@ enum { | ||||
|   PROP_MIN_CONTENT_WIDTH, | ||||
|   PROP_MIN_CONTENT_HEIGHT, | ||||
|   PROP_KINETIC_SCROLLING, | ||||
|   PROP_OVERLAY_SCROLLING | ||||
|   PROP_OVERLAY_SCROLLING, | ||||
|   NUM_PROPERTIES | ||||
| }; | ||||
|  | ||||
| /* Signals */ | ||||
| @ -362,6 +363,7 @@ static void     indicator_set_over   (Indicator *indicator, | ||||
|  | ||||
|  | ||||
| static guint signals[LAST_SIGNAL] = {0}; | ||||
| static GParamSpec *properties[NUM_PROPERTIES]; | ||||
|  | ||||
| G_DEFINE_TYPE_WITH_PRIVATE (GtkScrolledWindow, gtk_scrolled_window, GTK_TYPE_BIN) | ||||
|  | ||||
| @ -452,53 +454,48 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class) | ||||
|   class->scroll_child = gtk_scrolled_window_scroll_child; | ||||
|   class->move_focus_out = gtk_scrolled_window_move_focus_out; | ||||
|  | ||||
|   g_object_class_install_property (gobject_class, | ||||
|                                    PROP_HADJUSTMENT, | ||||
|                                    g_param_spec_object ("hadjustment", | ||||
|                                                         P_("Horizontal Adjustment"), | ||||
|                                                         P_("The GtkAdjustment for the horizontal position"), | ||||
|                                                         GTK_TYPE_ADJUSTMENT, | ||||
|                                                         GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT)); | ||||
|   properties[PROP_HADJUSTMENT] = | ||||
|       g_param_spec_object ("hadjustment", | ||||
|                            P_("Horizontal Adjustment"), | ||||
|                            P_("The GtkAdjustment for the horizontal position"), | ||||
|                            GTK_TYPE_ADJUSTMENT, | ||||
|                            GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT); | ||||
|  | ||||
|   g_object_class_install_property (gobject_class, | ||||
|                                    PROP_VADJUSTMENT, | ||||
|                                    g_param_spec_object ("vadjustment", | ||||
|                                                         P_("Vertical Adjustment"), | ||||
|                                                         P_("The GtkAdjustment for the vertical position"), | ||||
|                                                         GTK_TYPE_ADJUSTMENT, | ||||
|                                                         GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT)); | ||||
|   properties[PROP_VADJUSTMENT] = | ||||
|       g_param_spec_object ("vadjustment", | ||||
|                            P_("Vertical Adjustment"), | ||||
|                            P_("The GtkAdjustment for the vertical position"), | ||||
|                            GTK_TYPE_ADJUSTMENT, | ||||
|                            GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT); | ||||
|  | ||||
|   g_object_class_install_property (gobject_class, | ||||
|                                    PROP_HSCROLLBAR_POLICY, | ||||
|                                    g_param_spec_enum ("hscrollbar-policy", | ||||
|                                                       P_("Horizontal Scrollbar Policy"), | ||||
|                                                       P_("When the horizontal scrollbar is displayed"), | ||||
|                                                       GTK_TYPE_POLICY_TYPE, | ||||
|                                                       GTK_POLICY_AUTOMATIC, | ||||
|                                                       GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); | ||||
|   properties[PROP_HSCROLLBAR_POLICY] = | ||||
|       g_param_spec_enum ("hscrollbar-policy", | ||||
|                          P_("Horizontal Scrollbar Policy"), | ||||
|                          P_("When the horizontal scrollbar is displayed"), | ||||
|                          GTK_TYPE_POLICY_TYPE, | ||||
|                          GTK_POLICY_AUTOMATIC, | ||||
|                          GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); | ||||
|  | ||||
|   g_object_class_install_property (gobject_class, | ||||
|                                    PROP_VSCROLLBAR_POLICY, | ||||
|                                    g_param_spec_enum ("vscrollbar-policy", | ||||
|                                                       P_("Vertical Scrollbar Policy"), | ||||
|                                                       P_("When the vertical scrollbar is displayed"), | ||||
| 						      GTK_TYPE_POLICY_TYPE, | ||||
| 						      GTK_POLICY_AUTOMATIC, | ||||
|                                                       GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); | ||||
|   properties[PROP_VSCROLLBAR_POLICY] = | ||||
|       g_param_spec_enum ("vscrollbar-policy", | ||||
|                          P_("Vertical Scrollbar Policy"), | ||||
|                          P_("When the vertical scrollbar is displayed"), | ||||
| 			GTK_TYPE_POLICY_TYPE, | ||||
| 			GTK_POLICY_AUTOMATIC, | ||||
|                         GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); | ||||
|  | ||||
|   properties[PROP_WINDOW_PLACEMENT] = | ||||
|       g_param_spec_enum ("window-placement", | ||||
|                          P_("Window Placement"), | ||||
|                          P_("Where the contents are located with respect to the scrollbars."), | ||||
| 			GTK_TYPE_CORNER_TYPE, | ||||
| 			GTK_CORNER_TOP_LEFT, | ||||
|                         GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); | ||||
|  | ||||
|   g_object_class_install_property (gobject_class, | ||||
|                                    PROP_WINDOW_PLACEMENT, | ||||
|                                    g_param_spec_enum ("window-placement", | ||||
|                                                       P_("Window Placement"), | ||||
|                                                       P_("Where the contents are located with respect to the scrollbars."), | ||||
| 						      GTK_TYPE_CORNER_TYPE, | ||||
| 						      GTK_CORNER_TOP_LEFT, | ||||
|                                                       GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); | ||||
|    | ||||
|   /** | ||||
|    * GtkScrolledWindow:window-placement-set: | ||||
|    * | ||||
|    * Whether "window-placement" should be used to determine the location  | ||||
|    * Whether "window-placement" should be used to determine the location | ||||
|    * of the contents with respect to the scrollbars. | ||||
|    * | ||||
|    * Since: 2.10 | ||||
| @ -506,22 +503,20 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class) | ||||
|    * Deprecated: 3.10: This value is ignored and | ||||
|    * #GtkScrolledWindow:window-placement value is always honored. | ||||
|    */ | ||||
|   g_object_class_install_property (gobject_class, | ||||
|                                    PROP_WINDOW_PLACEMENT_SET, | ||||
|                                    g_param_spec_boolean ("window-placement-set", | ||||
|                                                          P_("Window Placement Set"), | ||||
|                                                          P_("Whether \"window-placement\" should be used to determine the location of the contents with respect to the scrollbars."), | ||||
|                                                          TRUE, | ||||
|                                                          GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); | ||||
|   properties[PROP_WINDOW_PLACEMENT_SET] = | ||||
|       g_param_spec_boolean ("window-placement-set", | ||||
|                             P_("Window Placement Set"), | ||||
|                             P_("Whether \"window-placement\" should be used to determine the location of the contents with respect to the scrollbars."), | ||||
|                             TRUE, | ||||
|                             GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); | ||||
|  | ||||
|   g_object_class_install_property (gobject_class, | ||||
|                                    PROP_SHADOW_TYPE, | ||||
|                                    g_param_spec_enum ("shadow-type", | ||||
|                                                       P_("Shadow Type"), | ||||
|                                                       P_("Style of bevel around the contents"), | ||||
| 						      GTK_TYPE_SHADOW_TYPE, | ||||
| 						      GTK_SHADOW_NONE, | ||||
|                                                       GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); | ||||
|   properties[PROP_SHADOW_TYPE] = | ||||
|       g_param_spec_enum ("shadow-type", | ||||
|                          P_("Shadow Type"), | ||||
|                          P_("Style of bevel around the contents"), | ||||
| 			GTK_TYPE_SHADOW_TYPE, | ||||
| 			GTK_SHADOW_NONE, | ||||
|                         GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); | ||||
|  | ||||
|   /** | ||||
|    * GtkScrolledWindow:scrollbars-within-bevel: | ||||
| @ -553,13 +548,12 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class) | ||||
|    * | ||||
|    * Since: 3.0 | ||||
|    */ | ||||
|   g_object_class_install_property (gobject_class, | ||||
|                                    PROP_MIN_CONTENT_WIDTH, | ||||
|                                    g_param_spec_int ("min-content-width", | ||||
|                                                      P_("Minimum Content Width"), | ||||
|                                                      P_("The minimum width that the scrolled window will allocate to its content"), | ||||
|                                                      -1, G_MAXINT, -1, | ||||
|                                                      GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); | ||||
|   properties[PROP_MIN_CONTENT_WIDTH] = | ||||
|       g_param_spec_int ("min-content-width", | ||||
|                         P_("Minimum Content Width"), | ||||
|                         P_("The minimum width that the scrolled window will allocate to its content"), | ||||
|                         -1, G_MAXINT, -1, | ||||
|                         GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); | ||||
|  | ||||
|   /** | ||||
|    * GtkScrolledWindow:min-content-height: | ||||
| @ -568,13 +562,12 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class) | ||||
|    * | ||||
|    * Since: 3.0 | ||||
|    */ | ||||
|   g_object_class_install_property (gobject_class, | ||||
|                                    PROP_MIN_CONTENT_HEIGHT, | ||||
|                                    g_param_spec_int ("min-content-height", | ||||
|                                                      P_("Minimum Content Height"), | ||||
|                                                      P_("The minimum height that the scrolled window will allocate to its content"), | ||||
|                                                      -1, G_MAXINT, -1, | ||||
|                                                      GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); | ||||
|   properties[PROP_MIN_CONTENT_HEIGHT] = | ||||
|       g_param_spec_int ("min-content-height", | ||||
|                         P_("Minimum Content Height"), | ||||
|                         P_("The minimum height that the scrolled window will allocate to its content"), | ||||
|                         -1, G_MAXINT, -1, | ||||
|                         GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); | ||||
|  | ||||
|   /** | ||||
|    * GtkScrolledWindow:kinetic-scrolling: | ||||
| @ -584,13 +577,12 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class) | ||||
|    * | ||||
|    * Since: 3.4 | ||||
|    */ | ||||
|   g_object_class_install_property (gobject_class, | ||||
|                                    PROP_KINETIC_SCROLLING, | ||||
|                                    g_param_spec_boolean ("kinetic-scrolling", | ||||
|                                                          P_("Kinetic Scrolling"), | ||||
|                                                          P_("Kinetic scrolling mode."), | ||||
|                                                          TRUE, | ||||
|                                                          GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); | ||||
|   properties[PROP_KINETIC_SCROLLING] = | ||||
|       g_param_spec_boolean ("kinetic-scrolling", | ||||
|                             P_("Kinetic Scrolling"), | ||||
|                             P_("Kinetic scrolling mode."), | ||||
|                             TRUE, | ||||
|                             GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); | ||||
|  | ||||
|   /** | ||||
|    * GtkScrolledWindow:overlay-scrolling: | ||||
| @ -602,13 +594,14 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class) | ||||
|    * | ||||
|    * Since: 3.16 | ||||
|    */ | ||||
|   g_object_class_install_property (gobject_class, | ||||
|                                    PROP_OVERLAY_SCROLLING, | ||||
|                                    g_param_spec_boolean ("overlay-scrolling", | ||||
|                                                          P_("Overlay Scrolling"), | ||||
|                                                          P_("Overlay scrolling mode"), | ||||
|                                                          TRUE, | ||||
|                                                          GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); | ||||
|   properties[PROP_OVERLAY_SCROLLING] = | ||||
|       g_param_spec_boolean ("overlay-scrolling", | ||||
|                             P_("Overlay Scrolling"), | ||||
|                             P_("Overlay scrolling mode"), | ||||
|                             TRUE, | ||||
|                             GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); | ||||
|  | ||||
|   g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties); | ||||
|  | ||||
|   /** | ||||
|    * GtkScrolledWindow::scroll-child: | ||||
| @ -1454,7 +1447,7 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window, | ||||
|  | ||||
|   if (gtk_scrolled_window_should_animate (scrolled_window)) | ||||
|     gtk_adjustment_enable_animation (hadjustment, gtk_widget_get_frame_clock (GTK_WIDGET (scrolled_window)), ANIMATION_DURATION); | ||||
|   g_object_notify (G_OBJECT (scrolled_window), "hadjustment"); | ||||
|   g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_HADJUSTMENT]); | ||||
| } | ||||
|  | ||||
| /** | ||||
| @ -1522,7 +1515,7 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window, | ||||
|   if (gtk_scrolled_window_should_animate (scrolled_window)) | ||||
|     gtk_adjustment_enable_animation (vadjustment, gtk_widget_get_frame_clock (GTK_WIDGET (scrolled_window)), ANIMATION_DURATION); | ||||
|  | ||||
|   g_object_notify (G_OBJECT (scrolled_window), "vadjustment"); | ||||
|   g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_VADJUSTMENT]); | ||||
| } | ||||
|  | ||||
| /** | ||||
| @ -1639,10 +1632,8 @@ gtk_scrolled_window_set_policy (GtkScrolledWindow *scrolled_window, | ||||
|  | ||||
|       gtk_widget_queue_resize (GTK_WIDGET (scrolled_window)); | ||||
|  | ||||
|       g_object_freeze_notify (object); | ||||
|       g_object_notify (object, "hscrollbar-policy"); | ||||
|       g_object_notify (object, "vscrollbar-policy"); | ||||
|       g_object_thaw_notify (object); | ||||
|       g_object_notify_by_pspec (object, properties[PROP_HSCROLLBAR_POLICY]); | ||||
|       g_object_notify_by_pspec (object, properties[PROP_VSCROLLBAR_POLICY]); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -1686,7 +1677,7 @@ gtk_scrolled_window_set_placement_internal (GtkScrolledWindow *scrolled_window, | ||||
|  | ||||
|       gtk_widget_queue_resize (GTK_WIDGET (scrolled_window)); | ||||
|  | ||||
|       g_object_notify (G_OBJECT (scrolled_window), "window-placement"); | ||||
|       g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_WINDOW_PLACEMENT]); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -1791,7 +1782,7 @@ gtk_scrolled_window_set_shadow_type (GtkScrolledWindow *scrolled_window, | ||||
|  | ||||
|       gtk_widget_queue_resize (GTK_WIDGET (scrolled_window)); | ||||
|  | ||||
|       g_object_notify (G_OBJECT (scrolled_window), "shadow-type"); | ||||
|       g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_SHADOW_TYPE]); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -1849,7 +1840,7 @@ gtk_scrolled_window_set_kinetic_scrolling (GtkScrolledWindow *scrolled_window, | ||||
|   gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->long_press_gesture), phase); | ||||
|   gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->pan_gesture), phase); | ||||
|  | ||||
|   g_object_notify (G_OBJECT (scrolled_window), "kinetic-scrolling"); | ||||
|   g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_KINETIC_SCROLLING]); | ||||
| } | ||||
|  | ||||
| /** | ||||
| @ -4372,7 +4363,7 @@ gtk_scrolled_window_set_min_content_width (GtkScrolledWindow *scrolled_window, | ||||
|  | ||||
|       gtk_widget_queue_resize (GTK_WIDGET (scrolled_window)); | ||||
|  | ||||
|       g_object_notify (G_OBJECT (scrolled_window), "min-content-width"); | ||||
|       g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_MIN_CONTENT_WIDTH]); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -4421,7 +4412,7 @@ gtk_scrolled_window_set_min_content_height (GtkScrolledWindow *scrolled_window, | ||||
|  | ||||
|       gtk_widget_queue_resize (GTK_WIDGET (scrolled_window)); | ||||
|  | ||||
|       g_object_notify (G_OBJECT (scrolled_window), "min-content-height"); | ||||
|       g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_MIN_CONTENT_HEIGHT]); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -4451,7 +4442,7 @@ gtk_scrolled_window_set_overlay_scrolling (GtkScrolledWindow *scrolled_window, | ||||
|       if (gtk_widget_get_realized (GTK_WIDGET (scrolled_window))) | ||||
|         gtk_scrolled_window_update_use_indicators (scrolled_window); | ||||
|  | ||||
|       g_object_notify (G_OBJECT (scrolled_window), "overlay-scrolling"); | ||||
|       g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_OVERLAY_SCROLLING]); | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Matthias Clasen
					Matthias Clasen