[Xfce4-commits] [apps/xfdashboard] 02/02: Remove xfdashboard_actor_contains_child_deep() and replace it with clutter_actor_contains().

noreply at xfce.org noreply at xfce.org
Sun Aug 16 11:25:13 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 0d30a12b20e673bcc2e866bfe223240afb4b0e4c
Author: Stephan Haller <nomad at froevel.de>
Date:   Sun Aug 16 11:23:09 2015 +0200

    Remove xfdashboard_actor_contains_child_deep() and replace it with clutter_actor_contains().
    
    I don't know why I created this complex and slow function xfdashboard_actor_contains_child_deep() when clutter_actor_contains() does already the wanted function :/
---
 xfdashboard/applications-view.c       |    7 ++++---
 xfdashboard/collapse-box.c            |    8 ++++----
 xfdashboard/quicklaunch.c             |    7 ++++---
 xfdashboard/search-result-container.c |    5 +++--
 xfdashboard/utils.c                   |   29 -----------------------------
 xfdashboard/utils.h                   |    1 -
 xfdashboard/view.c                    |    4 ++--
 xfdashboard/windows-view.c            |    7 ++++---
 xfdashboard/workspace-selector.c      |    6 +++---
 9 files changed, 24 insertions(+), 50 deletions(-)

diff --git a/xfdashboard/applications-view.c b/xfdashboard/applications-view.c
index 83f73c1..719685f 100644
--- a/xfdashboard/applications-view.c
+++ b/xfdashboard/applications-view.c
@@ -713,7 +713,8 @@ static gboolean _xfdashboard_applications_view_focusable_set_selection(Xfdashboa
 	priv=self->priv;
 
 	/* Check that selection is a child of this actor */
-	if(inSelection && !xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self), inSelection))
+	if(inSelection &&
+		!clutter_actor_contains(CLUTTER_ACTOR(self), inSelection))
 	{
 		g_warning(_("%s is not a child of %s and cannot be selected"),
 					G_OBJECT_TYPE_NAME(inSelection),
@@ -1025,7 +1026,7 @@ static ClutterActor* _xfdashboard_applications_view_focusable_find_selection(Xfd
 	}
 
 	/* Check that selection is a child of this actor otherwise return NULL */
-	if(!xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self), inSelection))
+	if(!clutter_actor_contains(CLUTTER_ACTOR(self), inSelection))
 	{
 		ClutterActor						*parent;
 
@@ -1111,7 +1112,7 @@ static gboolean _xfdashboard_applications_view_focusable_activate_selection(Xfda
 	self=XFDASHBOARD_APPLICATIONS_VIEW(inFocusable);
 
 	/* Check that selection is a child of this actor */
-	if(!xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self), inSelection))
+	if(!clutter_actor_contains(CLUTTER_ACTOR(self), inSelection))
 	{
 		ClutterActor						*parent;
 
diff --git a/xfdashboard/collapse-box.c b/xfdashboard/collapse-box.c
index 1655bd6..66601fc 100644
--- a/xfdashboard/collapse-box.c
+++ b/xfdashboard/collapse-box.c
@@ -201,11 +201,11 @@ static void _xfdashboard_collapse_box_on_focus_changed(XfdashboardCollapseBox *s
 	/* Determine if old and new focusable actor are children of
 	 * this collapse box.
 	 */
-	oldActorIsChild=xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self),
-															CLUTTER_ACTOR(inOldActor));
+	oldActorIsChild=clutter_actor_contains(CLUTTER_ACTOR(self),
+											CLUTTER_ACTOR(inOldActor));
 
-	newActorIsChild=xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self),
-															CLUTTER_ACTOR(inNewActor));
+	newActorIsChild=clutter_actor_contains(CLUTTER_ACTOR(self),
+											CLUTTER_ACTOR(inNewActor));
 
 	/* Do nothing if both actors are children of this collapse box */
 	if(oldActorIsChild==newActorIsChild) return;
diff --git a/xfdashboard/quicklaunch.c b/xfdashboard/quicklaunch.c
index 6512e86..687db67 100644
--- a/xfdashboard/quicklaunch.c
+++ b/xfdashboard/quicklaunch.c
@@ -1922,7 +1922,8 @@ static gboolean _xfdashboard_quicklaunch_focusable_set_selection(XfdashboardFocu
 	priv=self->priv;
 
 	/* Check that selection is a child of this actor */
-	if(inSelection && !xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self), inSelection))
+	if(inSelection &&
+		!clutter_actor_contains(CLUTTER_ACTOR(self), inSelection))
 	{
 		ClutterActor						*parent;
 
@@ -1974,7 +1975,7 @@ static ClutterActor* _xfdashboard_quicklaunch_focusable_find_selection(Xfdashboa
 	}
 
 	/* Check that selection is a child of this actor otherwise return NULL */
-	if(!xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self), inSelection))
+	if(!clutter_actor_contains(CLUTTER_ACTOR(self), inSelection))
 	{
 		ClutterActor						*parent;
 
@@ -2104,7 +2105,7 @@ static gboolean _xfdashboard_quicklaunch_focusable_activate_selection(Xfdashboar
 	self=XFDASHBOARD_QUICKLAUNCH(inFocusable);
 
 	/* Check that selection is a child of this actor */
-	if(!xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self), inSelection))
+	if(!clutter_actor_contains(CLUTTER_ACTOR(self), inSelection))
 	{
 		ClutterActor						*parent;
 
diff --git a/xfdashboard/search-result-container.c b/xfdashboard/search-result-container.c
index 719a744..25c48d0 100644
--- a/xfdashboard/search-result-container.c
+++ b/xfdashboard/search-result-container.c
@@ -1064,7 +1064,8 @@ gboolean xfdashboard_search_result_container_set_selection(XfdashboardSearchResu
 	priv=self->priv;
 
 	/* Check that selection is a child of this actor */
-	if(inSelection && !xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self), inSelection))
+	if(inSelection &&
+		!clutter_actor_contains(CLUTTER_ACTOR(self), inSelection))
 	{
 		g_warning(_("%s is not a child of %s and cannot be selected"),
 					G_OBJECT_TYPE_NAME(inSelection),
@@ -1111,7 +1112,7 @@ ClutterActor* xfdashboard_search_result_container_find_selection(XfdashboardSear
 	}
 
 	/* Check that selection is a child of this actor otherwise return NULL */
-	if(!xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self), inSelection))
+	if(!clutter_actor_contains(CLUTTER_ACTOR(self), inSelection))
 	{
 		ClutterActor						*parent;
 
diff --git a/xfdashboard/utils.c b/xfdashboard/utils.c
index 7faba84..bf5426d 100644
--- a/xfdashboard/utils.c
+++ b/xfdashboard/utils.c
@@ -331,35 +331,6 @@ void xfdashboard_register_gvalue_transformation_funcs(void)
 	g_value_register_transform_func(G_TYPE_STRING, G_TYPE_ENUM, _xfdashboard_gvalue_transform_string_enum);
 }
 
-/* Determine if child is a sibling of actor deeply */
-gboolean xfdashboard_actor_contains_child_deep(ClutterActor *inActor, ClutterActor *inChild)
-{
-	ClutterActorIter	iter;
-	ClutterActor		*child;
-
-	g_return_val_if_fail(CLUTTER_IS_ACTOR(inActor), FALSE);
-	g_return_val_if_fail(CLUTTER_IS_ACTOR(inChild), FALSE);
-
-	/* For each child of actor call ourselve recursive */
-	clutter_actor_iter_init(&iter, inActor);
-	while(clutter_actor_iter_next(&iter, &child))
-	{
-		/* First check if current child of iterator is the one to lookup */
-		if(child==inChild) return(TRUE);
-
-		/* Then call ourselve with child as "top-parent" actor
-		 * to lookup recursively.
-		 */
-		if(xfdashboard_actor_contains_child_deep(child, inChild))
-		{
-			return(TRUE);
-		}
-	}
-
-	/* If we get here the child was not found deeply */
-	return(FALSE);
-}
-
 /**
  * xfdashboard_find_actor_by_name:
  * @inActor: The root #ClutterActor where to begin searching
diff --git a/xfdashboard/utils.h b/xfdashboard/utils.h
index 50cc92a..7a85c2e 100644
--- a/xfdashboard/utils.h
+++ b/xfdashboard/utils.h
@@ -83,7 +83,6 @@ GAppLaunchContext* xfdashboard_create_app_context(XfdashboardWindowTrackerWorksp
 
 void xfdashboard_register_gvalue_transformation_funcs(void);
 
-gboolean xfdashboard_actor_contains_child_deep(ClutterActor *inActor, ClutterActor *inChild);
 ClutterActor* xfdashboard_find_actor_by_name(ClutterActor *inActor, const gchar *inName);
 
 gchar** xfdashboard_split_string(const gchar *inString, const gchar *inDelimiters);
diff --git a/xfdashboard/view.c b/xfdashboard/view.c
index fffbb9a..ddc1bb1 100644
--- a/xfdashboard/view.c
+++ b/xfdashboard/view.c
@@ -750,7 +750,7 @@ gboolean xfdashboard_view_child_needs_scroll(XfdashboardView *self, ClutterActor
 	result=FALSE;
 
 	/* Only emit signal if given actor is a child of this view */
-	if(xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self), inActor))
+	if(clutter_actor_contains(CLUTTER_ACTOR(self), inActor))
 	{
 		g_signal_emit(self, XfdashboardViewSignals[SIGNAL_CHILD_NEEDS_SCROLL], 0, inActor, &result);
 	}
@@ -765,7 +765,7 @@ void xfdashboard_view_child_ensure_visible(XfdashboardView *self, ClutterActor *
 	g_return_if_fail(CLUTTER_IS_ACTOR(inActor));
 
 	/* Only emit signal if given actor is a child of this view */
-	if(xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self), inActor))
+	if(clutter_actor_contains(CLUTTER_ACTOR(self), inActor))
 	{
 		g_signal_emit(self, XfdashboardViewSignals[SIGNAL_CHILD_ENSURE_VISIBLE], 0, inActor);
 	}
diff --git a/xfdashboard/windows-view.c b/xfdashboard/windows-view.c
index a2b089e..176d888 100644
--- a/xfdashboard/windows-view.c
+++ b/xfdashboard/windows-view.c
@@ -1262,7 +1262,8 @@ static gboolean _xfdashboard_windows_view_focusable_set_selection(XfdashboardFoc
 	priv=self->priv;
 
 	/* Check that selection is a child of this actor */
-	if(inSelection && !xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self), inSelection))
+	if(inSelection &&
+		!clutter_actor_contains(CLUTTER_ACTOR(self), inSelection))
 	{
 		g_warning(_("%s is not a child of %s and cannot be selected"),
 					G_OBJECT_TYPE_NAME(inSelection),
@@ -1321,7 +1322,7 @@ static ClutterActor* _xfdashboard_windows_view_focusable_find_selection(Xfdashbo
 	}
 
 	/* Check that selection is a child of this actor otherwise return NULL */
-	if(!xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self), inSelection))
+	if(!clutter_actor_contains(CLUTTER_ACTOR(self), inSelection))
 	{
 		ClutterActor						*parent;
 
@@ -1476,7 +1477,7 @@ static gboolean _xfdashboard_windows_view_focusable_activate_selection(Xfdashboa
 	self=XFDASHBOARD_WINDOWS_VIEW(inFocusable);
 
 	/* Check that selection is a child of this actor */
-	if(!xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self), inSelection))
+	if(!clutter_actor_contains(CLUTTER_ACTOR(self), inSelection))
 	{
 		ClutterActor						*parent;
 
diff --git a/xfdashboard/workspace-selector.c b/xfdashboard/workspace-selector.c
index 8cfb99e..08aaa68 100644
--- a/xfdashboard/workspace-selector.c
+++ b/xfdashboard/workspace-selector.c
@@ -897,7 +897,7 @@ static gboolean _xfdashboard_workspace_selector_focusable_set_selection(Xfdashbo
 	workspace=NULL;
 
 	/* Check that selection is a child of this actor */
-	if(!xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self), inSelection))
+	if(!clutter_actor_contains(CLUTTER_ACTOR(self), inSelection))
 	{
 		ClutterActor						*parent;
 
@@ -967,7 +967,7 @@ static ClutterActor* _xfdashboard_workspace_selector_focusable_find_selection(Xf
 	}
 
 	/* Check that selection is a child of this actor otherwise return NULL */
-	if(!xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self), inSelection))
+	if(!clutter_actor_contains(CLUTTER_ACTOR(self), inSelection))
 	{
 		ClutterActor						*parent;
 
@@ -1084,7 +1084,7 @@ static gboolean _xfdashboard_workspace_selector_focusable_activate_selection(Xfd
 	workspace=NULL;
 
 	/* Check that selection is a child of this actor */
-	if(!xfdashboard_actor_contains_child_deep(CLUTTER_ACTOR(self), inSelection))
+	if(!clutter_actor_contains(CLUTTER_ACTOR(self), inSelection))
 	{
 		ClutterActor						*parent;
 

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


More information about the Xfce4-commits mailing list