[Xfce4-commits] [apps/xfdashboard] 02/03: Rename 'gravity' to 'anchor-point' in XfdashboardWindowContent

noreply at xfce.org noreply at xfce.org
Wed Apr 22 20:30:56 CEST 2015


This is an automated email from the git hooks/post-receive script.

nomad pushed a commit to branch master
in repository apps/xfdashboard.

commit 18e0b070c26aef941f697cf0536dc786f9a5b464
Author: Stephan Haller <nomad at froevel.de>
Date:   Wed Apr 22 19:41:36 2015 +0200

    Rename 'gravity' to 'anchor-point' in XfdashboardWindowContent
    
    Gravity does not describe well what this property is used for. So rename gravity to anchor point and replace all occurences with new definition and type.
---
 xfdashboard/window-content.c |   89 +++++++++++++++++++++---------------------
 xfdashboard/window-content.h |    5 ++-
 2 files changed, 48 insertions(+), 46 deletions(-)

diff --git a/xfdashboard/window-content.c b/xfdashboard/window-content.c
index edf7be2..ec28adf 100644
--- a/xfdashboard/window-content.c
+++ b/xfdashboard/window-content.c
@@ -45,6 +45,7 @@
 #include "marshal.h"
 #include "stylable.h"
 #include "window-tracker.h"
+#include "enums.h"
 
 /* Definitions */
 typedef enum
@@ -84,7 +85,7 @@ struct _XfdashboardWindowContentPrivate
 	gfloat									unmappedWindowIconYAlign;
 	gfloat									unmappedWindowIconXScale;
 	gfloat									unmappedWindowIconYScale;
-	ClutterGravity							unmappedWindowIconGravity;
+	XfdashboardAnchorPoint					unmappedWindowIconAnchorPoint;
 
 	gchar									*styleClasses;
 	gchar									*stylePseudoClasses;
@@ -127,7 +128,7 @@ enum
 	PROP_UNMAPPED_WINDOW_ICON_Y_ALIGN,
 	PROP_UNMAPPED_WINDOW_ICON_X_SCALE,
 	PROP_UNMAPPED_WINDOW_ICON_Y_SCALE,
-	PROP_UNMAPPED_WINDOW_ICON_GRAVITY,
+	PROP_UNMAPPED_WINDOW_ICON_ANCHOR_POINT,
 
 	/* From interface: XfdashboardStylable */
 	PROP_STYLE_CLASSES,
@@ -1090,29 +1091,29 @@ static void _xdashboard_window_content_clutter_content_iface_paint_content(Clutt
 
 			/* Get boundary in X axis depending on gravity and scaled width */
 			offset=(priv->unmappedWindowIconXAlign*allocationWidth);
-			switch(priv->unmappedWindowIconGravity)
+			switch(priv->unmappedWindowIconAnchorPoint)
 			{
 				/* Align to left boundary.
 				 * This is also the default if gravity is none or undefined.
 				 */
 				default:
-				case CLUTTER_GRAVITY_NONE:
-				case CLUTTER_GRAVITY_WEST:
-				case CLUTTER_GRAVITY_NORTH_WEST:
-				case CLUTTER_GRAVITY_SOUTH_WEST:
+				case XFDASHBOARD_ANCHOR_POINT_NONE:
+				case XFDASHBOARD_ANCHOR_POINT_WEST:
+				case XFDASHBOARD_ANCHOR_POINT_NORTH_WEST:
+				case XFDASHBOARD_ANCHOR_POINT_SOUTH_WEST:
 					break;
 
 				/* Align to center of X axis */
-				case CLUTTER_GRAVITY_CENTER:
-				case CLUTTER_GRAVITY_NORTH:
-				case CLUTTER_GRAVITY_SOUTH:
+				case XFDASHBOARD_ANCHOR_POINT_CENTER:
+				case XFDASHBOARD_ANCHOR_POINT_NORTH:
+				case XFDASHBOARD_ANCHOR_POINT_SOUTH:
 					offset-=(textureWidth/2.0f);
 					break;
 
 				/* Align to right boundary */
-				case CLUTTER_GRAVITY_EAST:
-				case CLUTTER_GRAVITY_NORTH_EAST:
-				case CLUTTER_GRAVITY_SOUTH_EAST:
+				case XFDASHBOARD_ANCHOR_POINT_EAST:
+				case XFDASHBOARD_ANCHOR_POINT_NORTH_EAST:
+				case XFDASHBOARD_ANCHOR_POINT_SOUTH_EAST:
 					offset-=textureWidth;
 					break;
 			}
@@ -1152,29 +1153,29 @@ static void _xdashboard_window_content_clutter_content_iface_paint_content(Clutt
 
 			/* Get boundary in Y axis depending on gravity and scaled width */
 			offset=(priv->unmappedWindowIconYAlign*allocationHeight);
-			switch(priv->unmappedWindowIconGravity)
+			switch(priv->unmappedWindowIconAnchorPoint)
 			{
 				/* Align to upper boundary.
 				 * This is also the default if gravity is none or undefined.
 				 */
 				default:
-				case CLUTTER_GRAVITY_NONE:
-				case CLUTTER_GRAVITY_NORTH:
-				case CLUTTER_GRAVITY_NORTH_WEST:
-				case CLUTTER_GRAVITY_NORTH_EAST:
+				case XFDASHBOARD_ANCHOR_POINT_NONE:
+				case XFDASHBOARD_ANCHOR_POINT_NORTH:
+				case XFDASHBOARD_ANCHOR_POINT_NORTH_WEST:
+				case XFDASHBOARD_ANCHOR_POINT_NORTH_EAST:
 					break;
 
 				/* Align to center of Y axis */
-				case CLUTTER_GRAVITY_CENTER:
-				case CLUTTER_GRAVITY_WEST:
-				case CLUTTER_GRAVITY_EAST:
+				case XFDASHBOARD_ANCHOR_POINT_CENTER:
+				case XFDASHBOARD_ANCHOR_POINT_WEST:
+				case XFDASHBOARD_ANCHOR_POINT_EAST:
 					offset-=(textureHeight/2.0f);
 					break;
 
 				/* Align to lower boundary */
-				case CLUTTER_GRAVITY_SOUTH:
-				case CLUTTER_GRAVITY_SOUTH_WEST:
-				case CLUTTER_GRAVITY_SOUTH_EAST:
+				case XFDASHBOARD_ANCHOR_POINT_SOUTH:
+				case XFDASHBOARD_ANCHOR_POINT_SOUTH_WEST:
+				case XFDASHBOARD_ANCHOR_POINT_SOUTH_EAST:
 					offset-=textureHeight;
 					break;
 			}
@@ -1319,7 +1320,7 @@ static void _xfdashboard_window_content_stylable_get_stylable_properties(Xfdashb
 	xfdashboard_stylable_add_stylable_property(self, ioStylableProperties, "unmapped-window-icon-y-align");
 	xfdashboard_stylable_add_stylable_property(self, ioStylableProperties, "unmapped-window-icon-x-scale");
 	xfdashboard_stylable_add_stylable_property(self, ioStylableProperties, "unmapped-window-icon-y-scale");
-	xfdashboard_stylable_add_stylable_property(self, ioStylableProperties, "unmapped-window-icon-gravity");
+	xfdashboard_stylable_add_stylable_property(self, ioStylableProperties, "unmapped-window-icon-anchor-point");
 }
 
 /* Get/set style classes of stage */
@@ -1475,8 +1476,8 @@ static void _xfdashboard_window_content_set_property(GObject *inObject,
 			xfdashboard_window_content_set_unmapped_window_icon_y_scale(self, g_value_get_float(inValue));
 			break;
 
-		case PROP_UNMAPPED_WINDOW_ICON_GRAVITY:
-			xfdashboard_window_content_set_unmapped_window_icon_gravity(self, g_value_get_enum(inValue));
+		case PROP_UNMAPPED_WINDOW_ICON_ANCHOR_POINT:
+			xfdashboard_window_content_set_unmapped_window_icon_anchor_point(self, g_value_get_enum(inValue));
 			break;
 
 		case PROP_STYLE_CLASSES:
@@ -1547,8 +1548,8 @@ static void _xfdashboard_window_content_get_property(GObject *inObject,
 			g_value_set_float(outValue, priv->unmappedWindowIconYScale);
 			break;
 
-		case PROP_UNMAPPED_WINDOW_ICON_GRAVITY:
-			g_value_set_enum(outValue, priv->unmappedWindowIconGravity);
+		case PROP_UNMAPPED_WINDOW_ICON_ANCHOR_POINT:
+			g_value_set_enum(outValue, priv->unmappedWindowIconAnchorPoint);
 			break;
 
 		case PROP_STYLE_CLASSES:
@@ -1668,12 +1669,12 @@ void xfdashboard_window_content_class_init(XfdashboardWindowContentClass *klass)
 							1.0f,
 							G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
-	XfdashboardWindowContentProperties[PROP_UNMAPPED_WINDOW_ICON_GRAVITY]=
-		g_param_spec_enum("unmapped-window-icon-gravity",
-							_("Unmapped window icon gravity"),
+	XfdashboardWindowContentProperties[PROP_UNMAPPED_WINDOW_ICON_ANCHOR_POINT]=
+		g_param_spec_enum("unmapped-window-icon-anchor-point",
+							_("Unmapped window icon anchor point"),
 							_("The anchor point of unmapped window icon"),
-							CLUTTER_TYPE_GRAVITY,
-							CLUTTER_GRAVITY_NONE,
+							XFDASHBOARD_TYPE_ANCHOR_POINT,
+							XFDASHBOARD_ANCHOR_POINT_NONE,
 							G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
 	paramSpec=g_object_interface_find_property(stylableIface, "style-classes");
@@ -1726,7 +1727,7 @@ void xfdashboard_window_content_init(XfdashboardWindowContent *self)
 	priv->unmappedWindowIconYAlign=0.0f;
 	priv->unmappedWindowIconXScale=1.0f;
 	priv->unmappedWindowIconYScale=1.0f;
-	priv->unmappedWindowIconGravity=CLUTTER_GRAVITY_NONE;
+	priv->unmappedWindowIconAnchorPoint=XFDASHBOARD_ANCHOR_POINT_NONE;
 
 	/* Check extensions (will only be done once) */
 	_xfdashboard_window_content_check_extension();
@@ -2102,33 +2103,33 @@ void xfdashboard_window_content_set_unmapped_window_icon_y_scale(XfdashboardWind
 }
 
 /* Get/set gravity (anchor point) of unmapped window icon */
-ClutterGravity xfdashboard_window_content_get_unmapped_window_icon_gravity(XfdashboardWindowContent *self)
+XfdashboardAnchorPoint xfdashboard_window_content_get_unmapped_window_icon_anchor_point(XfdashboardWindowContent *self)
 {
-	g_return_val_if_fail(XFDASHBOARD_IS_WINDOW_CONTENT(self), CLUTTER_GRAVITY_NONE);
+	g_return_val_if_fail(XFDASHBOARD_IS_WINDOW_CONTENT(self), XFDASHBOARD_ANCHOR_POINT_NONE);
 
-	return(self->priv->unmappedWindowIconGravity);
+	return(self->priv->unmappedWindowIconAnchorPoint);
 }
 
-void xfdashboard_window_content_set_unmapped_window_icon_gravity(XfdashboardWindowContent *self, const ClutterGravity inGravity)
+void xfdashboard_window_content_set_unmapped_window_icon_anchor_point(XfdashboardWindowContent *self, const XfdashboardAnchorPoint inAnchorPoint)
 {
 	XfdashboardWindowContentPrivate		*priv;
 
 	g_return_if_fail(XFDASHBOARD_IS_WINDOW_CONTENT(self));
-	g_return_if_fail(inGravity>=CLUTTER_GRAVITY_NONE);
-	g_return_if_fail(inGravity<=CLUTTER_GRAVITY_CENTER);
+	g_return_if_fail(inAnchorPoint>=XFDASHBOARD_ANCHOR_POINT_NONE);
+	g_return_if_fail(inAnchorPoint<=XFDASHBOARD_ANCHOR_POINT_CENTER);
 
 	priv=self->priv;
 
 	/* Set value if changed */
-	if(priv->unmappedWindowIconGravity!=inGravity)
+	if(priv->unmappedWindowIconAnchorPoint!=inAnchorPoint)
 	{
 		/* Set value */
-		priv->unmappedWindowIconGravity=inGravity;
+		priv->unmappedWindowIconAnchorPoint=inAnchorPoint;
 
 		/* Invalidate ourselve to get us redrawn */
 		clutter_content_invalidate(CLUTTER_CONTENT(self));
 
 		/* Notify about property change */
-		g_object_notify_by_pspec(G_OBJECT(self), XfdashboardWindowContentProperties[PROP_UNMAPPED_WINDOW_ICON_GRAVITY]);
+		g_object_notify_by_pspec(G_OBJECT(self), XfdashboardWindowContentProperties[PROP_UNMAPPED_WINDOW_ICON_ANCHOR_POINT]);
 	}
 }
diff --git a/xfdashboard/window-content.h b/xfdashboard/window-content.h
index 8a9fd48..a2dc456 100644
--- a/xfdashboard/window-content.h
+++ b/xfdashboard/window-content.h
@@ -27,6 +27,7 @@
 #include <clutter/clutter.h>
 
 #include "window-tracker-window.h"
+#include "types.h"
 
 G_BEGIN_DECLS
 
@@ -96,8 +97,8 @@ void xfdashboard_window_content_set_unmapped_window_icon_x_scale(XfdashboardWind
 gfloat xfdashboard_window_content_get_unmapped_window_icon_y_scale(XfdashboardWindowContent *self);
 void xfdashboard_window_content_set_unmapped_window_icon_y_scale(XfdashboardWindowContent *self, const gfloat inScale);
 
-ClutterGravity xfdashboard_window_content_get_unmapped_window_icon_gravity(XfdashboardWindowContent *self);
-void xfdashboard_window_content_set_unmapped_window_icon_gravity(XfdashboardWindowContent *self, const ClutterGravity inGravity);
+XfdashboardAnchorPoint xfdashboard_window_content_get_unmapped_window_icon_anchor_point(XfdashboardWindowContent *self);
+void xfdashboard_window_content_set_unmapped_window_icon_anchor_point(XfdashboardWindowContent *self, const XfdashboardAnchorPoint inAnchorPoint);
 
 G_END_DECLS
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list