[Xfce4-commits] [apps/xfdashboard] 02/02: If an application button exists when current selection should be added to favourites by action then move existing one before separator (between application buttons for favourites and non-favourites) and ensure that the correct CSS class is set. Otherwise fallback to normal behaviour adding a new application button for current selection.

noreply at xfce.org noreply at xfce.org
Wed Sep 2 21:22:26 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 3f0396cc874854da0e67cdc1ad987a78bb7812e7
Author: Stephan Haller <nomad at froevel.de>
Date:   Wed Sep 2 21:14:30 2015 +0200

    If an application button exists when current selection should be added to favourites by action then move existing one before separator (between application buttons for favourites and non-favourites) and ensure that the correct CSS class is set. Otherwise fallback to normal behaviour adding a new application button for current selection.
---
 xfdashboard/quicklaunch.c |   36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/xfdashboard/quicklaunch.c b/xfdashboard/quicklaunch.c
index 1cc2ecb..8958aab 100644
--- a/xfdashboard/quicklaunch.c
+++ b/xfdashboard/quicklaunch.c
@@ -1434,14 +1434,36 @@ static gboolean _xfdashboard_quicklaunch_selection_add_favourite(XfdashboardQuic
 			return(CLUTTER_EVENT_STOP);
 		}
 
-		/* Add current selection to favourites but hidden as it will become visible
-		 * and properly set up when function _xfdashboard_quicklaunch_update_property_from_icons
-		 * is called.
+		/* If an actor for current selection to add to favourites already exists,
+		 * move it above the separator (between favourites and non-favourites) and
+		 * correct CSS class ...
 		 */
-		favouriteActor=xfdashboard_application_button_new_from_app_info(appInfo);
-		clutter_actor_hide(favouriteActor);
-		xfdashboard_stylable_add_class(XFDASHBOARD_STYLABLE(favouriteActor), "is-favourite-app");
-		clutter_actor_insert_child_below(CLUTTER_ACTOR(self), favouriteActor, priv->separatorFavouritesToDynamic);
+		favouriteActor=_xfdashboard_quicklaunch_get_actor_for_appinfo(self, appInfo);
+		if(favouriteActor)
+		{
+			/* Move existing actor before separator */
+			g_object_ref(favouriteActor);
+
+			clutter_actor_remove_child(CLUTTER_ACTOR(self), favouriteActor);
+			clutter_actor_insert_child_below(CLUTTER_ACTOR(self), favouriteActor, priv->separatorFavouritesToDynamic);
+
+			g_object_unref(favouriteActor);
+
+			/* Set proper CSS class */
+			xfdashboard_stylable_remove_class(XFDASHBOARD_STYLABLE(favouriteActor), "is-dynamic-app");
+			xfdashboard_stylable_add_class(XFDASHBOARD_STYLABLE(favouriteActor), "is-favourite-app");
+		}
+			/* ... otherwise add current selection to favourites but hidden as it will
+			 * become visible and properly set up when function _xfdashboard_quicklaunch_update_property_from_icons
+			 * is called.
+			 */
+			else
+			{
+				favouriteActor=xfdashboard_application_button_new_from_app_info(appInfo);
+				clutter_actor_hide(favouriteActor);
+				xfdashboard_stylable_add_class(XFDASHBOARD_STYLABLE(favouriteActor), "is-favourite-app");
+				clutter_actor_insert_child_below(CLUTTER_ACTOR(self), favouriteActor, priv->separatorFavouritesToDynamic);
+			}
 
 		/* 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