libgimpwidgets: add gtk_label_set,get_x,yalign() to gimp3migration.[ch]

They are deprecated in GTK+ 3.x and cause tons of warnings, now we can
port calls to gtk_misc_set_alignment(label) to the new API and have
the same code in master and gtk3-port.
This commit is contained in:
Michael Natterer 2016-09-08 18:56:44 +02:00
parent 8952b49142
commit d78d4ce82b
3 changed files with 58 additions and 8 deletions

View File

@ -214,3 +214,49 @@ gdk_screen_get_monitor_workarea (GdkScreen *screen,
{
gdk_screen_get_monitor_geometry (screen, monitor_num, dest);
}
void
gtk_label_set_xalign (GtkLabel *label,
gfloat xalign)
{
g_return_if_fail (GTK_IS_LABEL (label));
xalign = CLAMP (xalign, 0.0, 1.0);
g_object_set (label, "xalign", xalign, NULL);
}
gfloat
gtk_label_get_xalign (GtkLabel *label)
{
gfloat xalign;
g_return_val_if_fail (GTK_IS_LABEL (label), 0.5);
g_object_get (label, "xalign", &xalign, NULL);
return xalign;
}
void
gtk_label_set_yalign (GtkLabel *label,
gfloat yalign)
{
g_return_if_fail (GTK_IS_LABEL (label));
yalign = CLAMP (yalign, 0.0, 1.0);
g_object_set (label, "yalign", yalign, NULL);
}
gfloat
gtk_label_get_yalign (GtkLabel *label)
{
gfloat yalign;
g_return_val_if_fail (GTK_IS_LABEL (label), 0.5);
g_object_get (label, "yalign", &yalign, NULL);
return yalign;
}

View File

@ -44,13 +44,6 @@ GtkWidget * gtk_scrollbar_new (GtkOrientation orientation,
GtkWidget * gtk_separator_new (GtkOrientation orientation);
/* These functions are even more evil. They exist only since GTK+ 3.3
* and need to be taken care of carefully when building against GTK+
* 3.x. This is not an issue as long as we don't have any GIMP 3.x
* release, and this file will be gone until then.
*/
#if ! GTK_CHECK_VERSION (3, 3, 0)
typedef enum
{
GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR,
@ -65,7 +58,6 @@ GdkModifierType gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
GdkModifierIntent intent);
GdkModifierType gtk_widget_get_modifier_mask (GtkWidget *widget,
GdkModifierIntent intent);
#endif
gboolean gdk_cairo_get_clip_rectangle (cairo_t *cr,
GdkRectangle *rect);
@ -73,5 +65,13 @@ void gdk_screen_get_monitor_workarea (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest);
void gtk_label_set_xalign (GtkLabel *label,
gfloat xalign);
gfloat gtk_label_get_xalign (GtkLabel *label);
void gtk_label_set_yalign (GtkLabel *label,
gfloat yalign);
gfloat gtk_label_get_yalign (GtkLabel *label);
#endif /* __GIMP_3_MIGRATION_H__ */

View File

@ -435,6 +435,10 @@ EXPORTS
gimp_zoom_type_get_type
gtk_box_new
gtk_button_box_new
gtk_label_get_xalign
gtk_label_get_yalign
gtk_label_set_xalign
gtk_label_set_yalign
gtk_paned_new
gtk_scale_new
gtk_scrollbar_new