[Xfce4-commits] [apps/xfdashboard] 02/04: Remove any dynamically added non-favourite application button for a newly added favourite in XfdashboardQuicklaunch

noreply at xfce.org noreply at xfce.org
Thu Sep 3 09:00:34 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 322ce14486e4a85a1b4eec8a09c78dd9a0d0b15b
Author: Stephan Haller <nomad at froevel.de>
Date:   Thu Sep 3 08:39:48 2015 +0200

    Remove any dynamically added non-favourite application button for a newly added favourite in XfdashboardQuicklaunch
---
 xfdashboard/quicklaunch.c |   30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/xfdashboard/quicklaunch.c b/xfdashboard/quicklaunch.c
index 6cc7b5f..e8b974d 100644
--- a/xfdashboard/quicklaunch.c
+++ b/xfdashboard/quicklaunch.c
@@ -500,6 +500,8 @@ static void _xfdashboard_quicklaunch_on_drop_drop(XfdashboardQuicklaunch *self,
 {
 	XfdashboardQuicklaunchPrivate		*priv;
 	ClutterActor						*draggedActor;
+	ClutterActorIter					iter;
+	ClutterActor						*child;
 
 	g_return_if_fail(XFDASHBOARD_IS_QUICKLAUNCH(self));
 	g_return_if_fail(XFDASHBOARD_IS_DRAG_ACTION(inDragAction));
@@ -510,10 +512,13 @@ static void _xfdashboard_quicklaunch_on_drop_drop(XfdashboardQuicklaunch *self,
 	/* Get dragged actor */
 	draggedActor=xfdashboard_drag_action_get_actor(inDragAction);
 
-	/* Emit signal when a favourite icon was added */
+	/* Remove dynamically added non-favourite application buttons and
+	 * emit signal when a favourite icon was added.
+	 */
 	if(priv->dragMode==DRAG_MODE_CREATE)
 	{
 		GAppInfo						*appInfo;
+		ClutterActor					*actor;
 
 		xfdashboard_notify(CLUTTER_ACTOR(self),
 							xfdashboard_application_button_get_icon_name(XFDASHBOARD_APPLICATION_BUTTON(draggedActor)),
@@ -523,6 +528,13 @@ static void _xfdashboard_quicklaunch_on_drop_drop(XfdashboardQuicklaunch *self,
 		appInfo=xfdashboard_application_button_get_app_info(XFDASHBOARD_APPLICATION_BUTTON(draggedActor));
 		if(appInfo)
 		{
+			/* Remove any application button marked as dynamically added for non-favourite
+			 * apps for the newly added favourite if available.
+			 */
+			actor=_xfdashboard_quicklaunch_get_actor_for_appinfo(self, appInfo);
+			if(actor) clutter_actor_destroy(actor);
+
+			/* Emit signal for newly added favourite */
 			g_signal_emit(self, XfdashboardQuicklaunchSignals[SIGNAL_FAVOURITE_ADDED], 0, appInfo);
 		}
 	}
@@ -544,6 +556,22 @@ static void _xfdashboard_quicklaunch_on_drop_drop(XfdashboardQuicklaunch *self,
 		}
 	}
 
+	/* Show (remaining) hidden application buttons for non-favourite apps again */
+	clutter_actor_iter_init(&iter, CLUTTER_ACTOR(self));
+	while(clutter_actor_iter_next(&iter, &child))
+	{
+		/* Only check application buttons */
+		if(!XFDASHBOARD_IS_APPLICATION_BUTTON(child)) continue;
+
+		/* If actor is an application button for non-favourite apps,
+		 * show it now.
+		 */
+		if(xfdashboard_stylable_has_class(XFDASHBOARD_STYLABLE(child), "is-dynamic-app"))
+		{
+			clutter_actor_show(child);
+		}
+	}
+
 	/* Update favourites from icon order */
 	_xfdashboard_quicklaunch_update_property_from_icons(self);
 

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


More information about the Xfce4-commits mailing list