[Xfce4-commits] [apps/xfdashboard] 01/05: Split out pop-up menu setup functions from XfdashboardQuicklaunch to XfdashboardApplicationButton to make these functions reusable at other actor classes.

noreply at xfce.org noreply at xfce.org
Fri Oct 27 11:52:17 CEST 2017


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

n   o   m   a   d       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfdashboard.

commit 100cb33edb488dcb8bfd89d84ca644265e0f7403
Author: Stephan Haller <nomad at froevel.de>
Date:   Fri Oct 27 10:16:11 2017 +0200

    Split out pop-up menu setup functions from XfdashboardQuicklaunch to XfdashboardApplicationButton to make these functions reusable at other actor classes.
    
    This commit addresses issue GH #160
---
 libxfdashboard/application-button.c | 263 ++++++++++++++++++++++++++++++++++++
 libxfdashboard/application-button.h |  18 ++-
 libxfdashboard/quicklaunch.c        | 216 +----------------------------
 3 files changed, 283 insertions(+), 214 deletions(-)

diff --git a/libxfdashboard/application-button.c b/libxfdashboard/application-button.c
index 0e94f1a..c9409eb 100644
--- a/libxfdashboard/application-button.c
+++ b/libxfdashboard/application-button.c
@@ -37,6 +37,10 @@
 #include <libxfdashboard/application-tracker.h>
 #include <libxfdashboard/stylable.h>
 #include <libxfdashboard/application.h>
+#include <libxfdashboard/window-tracker.h>
+#include <libxfdashboard/popup-menu-item-button.h>
+#include <libxfdashboard/popup-menu-item-separator.h>
+#include <libxfdashboard/desktop-app-info.h>
 #include <libxfdashboard/compat.h>
 
 
@@ -203,6 +207,95 @@ static void _xfdashboard_application_button_on_running_state_changed(Xfdashboard
 	_xfdashboard_application_button_update_running_state(self);
 }
 
+/* User selected to activate a window at pop-up menu */
+static void _xfdashboard_application_button_on_popup_menu_item_activate_window(XfdashboardPopupMenuItem *inMenuItem,
+																				gpointer inUserData)
+{
+	XfdashboardWindowTrackerWindow		*window;
+
+	g_return_if_fail(XFDASHBOARD_IS_POPUP_MENU_ITEM(inMenuItem));
+	g_return_if_fail(XFDASHBOARD_IS_WINDOW_TRACKER_WINDOW(inUserData));
+
+	window=XFDASHBOARD_WINDOW_TRACKER_WINDOW(inUserData);
+
+	/* Activate window */
+	xfdashboard_window_tracker_window_activate(window);
+
+	/* Quit application */
+	xfdashboard_application_suspend_or_quit(NULL);
+}
+
+/* User selected to execute an application action */
+static void _xfdashboard_application_button_on_popup_menu_item_application_action(XfdashboardPopupMenuItem *inMenuItem,
+																					gpointer inUserData)
+{
+	XfdashboardApplicationButton			*self;
+	XfdashboardApplicationButtonPrivate		*priv;
+	XfdashboardDesktopAppInfoAction			*action;
+	GError									*error;
+
+	g_return_if_fail(XFDASHBOARD_IS_POPUP_MENU_ITEM(inMenuItem));
+	g_return_if_fail(XFDASHBOARD_IS_APPLICATION_BUTTON(inUserData));
+
+	self=XFDASHBOARD_APPLICATION_BUTTON(inUserData);
+	priv=self->priv;
+	error=NULL;
+
+	/* Get action to execute */
+	if(!XFDASHBOARD_IS_DESKTOP_APP_INFO(priv->appInfo))
+	{
+		g_warning(_("Could not get information about application '%s'"),
+					g_app_info_get_display_name(priv->appInfo));
+		return;
+	}
+
+	action=XFDASHBOARD_DESKTOP_APP_INFO_ACTION(g_object_get_data(G_OBJECT(inMenuItem), "popup-menu-item-app-action"));
+	if(!action)
+	{
+		g_warning(_("Could not get application action for application '%s'"),
+					g_app_info_get_display_name(priv->appInfo));
+		return;
+	}
+
+	/* Execute action */
+	if(!xfdashboard_desktop_app_info_launch_action(XFDASHBOARD_DESKTOP_APP_INFO(priv->appInfo), action, NULL, &error))
+	{
+		/* Show notification about failed launch of action */
+		xfdashboard_notify(CLUTTER_ACTOR(self),
+							"dialog-error",
+							_("Could not execute action '%s' for application '%s': %s"),
+							xfdashboard_desktop_app_info_action_get_name(action),
+							g_app_info_get_display_name(priv->appInfo),
+							error ? error->message : _("Unknown error"));
+		g_error_free(error);
+	}
+		else
+		{
+			GIcon						*gicon;
+			const gchar					*iconName;
+
+			/* Get icon of application */
+			iconName=NULL;
+
+			gicon=g_app_info_get_icon(priv->appInfo);
+			if(gicon) iconName=g_icon_to_string(gicon);
+
+			/* Show notification about successful launch of action */
+			xfdashboard_notify(CLUTTER_ACTOR(self),
+								iconName,
+								_("Executed action '%s' for application '%s'"),
+								xfdashboard_desktop_app_info_action_get_name(action),
+								g_app_info_get_display_name(priv->appInfo));
+
+			/* Quit application */
+			xfdashboard_application_suspend_or_quit(NULL);
+
+			/* Release allocated resources */
+			g_object_unref(gicon);
+		}
+}
+
+
 /* IMPLEMENTATION: GObject */
 
 /* Dispose this object */
@@ -701,3 +794,173 @@ gboolean xfdashboard_application_button_execute(XfdashboardApplicationButton *se
 	/* Return status */
 	return(started);
 }
+
+/* Add each open window of applicatio as menu item to pop-up menu*/
+guint xfdashboard_application_button_add_popup_menu_items_for_windows(XfdashboardApplicationButton *self,
+																		XfdashboardPopupMenu *inMenu)
+{
+	XfdashboardApplicationButtonPrivate		*priv;
+	guint									numberItems;
+	const GList								*windows;
+
+	g_return_val_if_fail(XFDASHBOARD_IS_APPLICATION_BUTTON(self), 0);
+	g_return_val_if_fail(XFDASHBOARD_IS_POPUP_MENU(inMenu), 0);
+
+	priv=self->priv;
+	numberItems=0;
+
+	/* Add each open window to pop-up of application */
+	windows=xfdashboard_application_tracker_get_window_list_by_app_info(priv->appTracker, priv->appInfo);
+	if(windows)
+	{
+		const GList							*iter;
+		GList								*sortedList;
+		XfdashboardWindowTracker			*windowTracker;
+		XfdashboardWindowTrackerWindow		*window;
+		XfdashboardWindowTrackerWorkspace	*activeWorkspace;
+		XfdashboardWindowTrackerWorkspace	*windowWorkspace;
+		gboolean							separatorAdded;
+		ClutterActor						*menuItem;
+
+		/* Create sorted list of windows. The window is added to begin
+		 * of list if it is on active workspace and to end of list if it
+		 * is on any other workspace.
+		 */
+		windowTracker=xfdashboard_window_tracker_get_default();
+		activeWorkspace=xfdashboard_window_tracker_get_active_workspace(windowTracker);
+
+		sortedList=NULL;
+		for(iter=windows; iter; iter=g_list_next(iter))
+		{
+			/* Get window currently iterated */
+			window=XFDASHBOARD_WINDOW_TRACKER_WINDOW(iter->data);
+			if(!window) continue;
+
+			/* Get workspace of window */
+			windowWorkspace=xfdashboard_window_tracker_window_get_workspace(window);
+
+			/* If window is on active workspace add to begin of sorted list,
+			 * otherwise add to end of sorted list.
+			 */
+			if(windowWorkspace==activeWorkspace)
+			{
+				sortedList=g_list_prepend(sortedList, window);
+			}
+				else
+				{
+					sortedList=g_list_append(sortedList, window);
+				}
+		}
+
+		/* Now add menu items for each window in sorted list */
+		separatorAdded=FALSE;
+		for(iter=sortedList; iter; iter=g_list_next(iter))
+		{
+			/* Get window currently iterated */
+			window=XFDASHBOARD_WINDOW_TRACKER_WINDOW(iter->data);
+			if(!window) continue;
+
+			/* Get workspace of window */
+			windowWorkspace=xfdashboard_window_tracker_window_get_workspace(window);
+
+			/* Add separator if currently iterated window is not on active
+			 * workspace then all following windows are not on active workspace
+			 * anymore and a separator is added to split them from the ones
+			 * on active workspace. But add this separator only once.
+			 */
+			if(windowWorkspace!=activeWorkspace &&
+				!separatorAdded)
+			{
+				menuItem=xfdashboard_popup_menu_item_separator_new();
+				clutter_actor_set_x_expand(menuItem, TRUE);
+				xfdashboard_popup_menu_add_item(inMenu, XFDASHBOARD_POPUP_MENU_ITEM(menuItem));
+
+				separatorAdded=TRUE;
+			}
+
+			/* Create menu item for window */
+			menuItem=xfdashboard_popup_menu_item_button_new();
+			xfdashboard_label_set_text(XFDASHBOARD_LABEL(menuItem), xfdashboard_window_tracker_window_get_name(window));
+			clutter_actor_set_x_expand(menuItem, TRUE);
+			xfdashboard_popup_menu_add_item(inMenu, XFDASHBOARD_POPUP_MENU_ITEM(menuItem));
+
+			g_signal_connect(menuItem,
+								"activated",
+								G_CALLBACK(_xfdashboard_application_button_on_popup_menu_item_activate_window),
+								window);
+
+			/* Count number of menu items created */
+			numberItems++;
+		}
+
+		/* Release allocated resources */
+		g_list_free(sortedList);
+		g_object_unref(windowTracker);
+	}
+
+	/* Return number of menu items added to pop-up menu */
+	return(numberItems);
+}
+
+/* Add application actions as menu items to pop-up menu */
+guint xfdashboard_application_button_add_popup_menu_items_for_actions(XfdashboardApplicationButton *self,
+																		XfdashboardPopupMenu *inMenu)
+{
+	XfdashboardApplicationButtonPrivate			*priv;
+	guint										numberItems;
+	GList										*actions;
+	const GList									*iter;
+
+	g_return_val_if_fail(XFDASHBOARD_IS_APPLICATION_BUTTON(self), 0);
+	g_return_val_if_fail(XFDASHBOARD_IS_POPUP_MENU(inMenu), 0);
+
+	priv=self->priv;
+	numberItems=0;
+
+	/* Check if application actions can be requested */
+	if(XFDASHBOARD_IS_DESKTOP_APP_INFO(priv->appInfo))
+	{
+		/* Get actions and create a menu item for each one */
+		actions=xfdashboard_desktop_app_info_get_actions(XFDASHBOARD_DESKTOP_APP_INFO(priv->appInfo));
+		for(iter=actions; iter; iter=g_list_next(iter))
+		{
+			XfdashboardDesktopAppInfoAction		*action;
+			const gchar							*iconName;
+			ClutterActor						*menuItem;
+
+			/* Get currently iterated application action */
+			action=XFDASHBOARD_DESKTOP_APP_INFO_ACTION(iter->data);
+			if(!action) continue;
+
+			/* Get icon name to determine style of pop-up menu item */
+			iconName=xfdashboard_desktop_app_info_action_get_icon_name(action);
+
+			/* Create pop-up menu item. If icon name is available then set
+			 * style to both (text+icon) and set icon. If icon name is NULL
+			 * then keep style at text-only.
+			 */
+			menuItem=xfdashboard_popup_menu_item_button_new();
+			xfdashboard_label_set_text(XFDASHBOARD_LABEL(menuItem), xfdashboard_desktop_app_info_action_get_name(action));
+			if(iconName)
+			{
+				xfdashboard_label_set_icon_name(XFDASHBOARD_LABEL(menuItem), iconName);
+				xfdashboard_label_set_style(XFDASHBOARD_LABEL(menuItem), XFDASHBOARD_LABEL_STYLE_BOTH);
+			}
+			clutter_actor_set_x_expand(menuItem, TRUE);
+			xfdashboard_popup_menu_add_item(inMenu, XFDASHBOARD_POPUP_MENU_ITEM(menuItem));
+
+			g_object_set_data_full(G_OBJECT(menuItem), "popup-menu-item-app-action", g_object_ref(action), g_object_unref);
+
+			g_signal_connect(menuItem,
+								"activated",
+								G_CALLBACK(_xfdashboard_application_button_on_popup_menu_item_application_action),
+								self);
+
+			/* Count number of menu items created */
+			numberItems++;
+		}
+	}
+
+	/* Return number of menu items added to pop-up menu */
+	return(numberItems);
+}
diff --git a/libxfdashboard/application-button.h b/libxfdashboard/application-button.h
index 35f59a5..fd9227c 100644
--- a/libxfdashboard/application-button.h
+++ b/libxfdashboard/application-button.h
@@ -33,6 +33,7 @@
 
 #include <libxfdashboard/button.h>
 #include <libxfdashboard/desktop-app-info.h>
+#include <libxfdashboard/popup-menu.h>
 
 G_BEGIN_DECLS
 
@@ -74,22 +75,31 @@ ClutterActor* xfdashboard_application_button_new(void);
 ClutterActor* xfdashboard_application_button_new_from_app_info(GAppInfo *inAppInfo);
 
 GAppInfo* xfdashboard_application_button_get_app_info(XfdashboardApplicationButton *self);
-void xfdashboard_application_button_set_app_info(XfdashboardApplicationButton *self, GAppInfo *inAppInfo);
+void xfdashboard_application_button_set_app_info(XfdashboardApplicationButton *self,
+													GAppInfo *inAppInfo);
 
 gboolean xfdashboard_application_button_get_show_description(XfdashboardApplicationButton *self);
-void xfdashboard_application_button_set_show_description(XfdashboardApplicationButton *self, gboolean inShowDescription);
+void xfdashboard_application_button_set_show_description(XfdashboardApplicationButton *self,
+															gboolean inShowDescription);
 
 const gchar* xfdashboard_application_button_get_format_title_only(XfdashboardApplicationButton *self);
-void xfdashboard_application_button_set_format_title_only(XfdashboardApplicationButton *self, const gchar *inFormat);
+void xfdashboard_application_button_set_format_title_only(XfdashboardApplicationButton *self,
+															const gchar *inFormat);
 
 const gchar* xfdashboard_application_button_get_format_title_description(XfdashboardApplicationButton *self);
-void xfdashboard_application_button_set_format_title_description(XfdashboardApplicationButton *self, const gchar *inFormat);
+void xfdashboard_application_button_set_format_title_description(XfdashboardApplicationButton *self,
+																	const gchar *inFormat);
 
 const gchar* xfdashboard_application_button_get_display_name(XfdashboardApplicationButton *self);
 const gchar* xfdashboard_application_button_get_icon_name(XfdashboardApplicationButton *self);
 
 gboolean xfdashboard_application_button_execute(XfdashboardApplicationButton *self, GAppLaunchContext *inContext);
 
+guint xfdashboard_application_button_add_popup_menu_items_for_windows(XfdashboardApplicationButton *self,
+																		XfdashboardPopupMenu *inMenu);
+guint xfdashboard_application_button_add_popup_menu_items_for_actions(XfdashboardApplicationButton *self,
+																		XfdashboardPopupMenu *inMenu);
+
 G_END_DECLS
 
 #endif	/* __LIBXFDASHBOARD_APPLICATION_BUTTON__ */
diff --git a/libxfdashboard/quicklaunch.c b/libxfdashboard/quicklaunch.c
index 1e34075..e5b3bd0 100644
--- a/libxfdashboard/quicklaunch.c
+++ b/libxfdashboard/quicklaunch.c
@@ -422,24 +422,6 @@ static void _xfdashboard_quicklaunch_on_favourite_clicked(XfdashboardQuicklaunch
 	}
 }
 
-/* User selected to activate a window at pop-up menu */
-static void _xfdashboard_quicklaunch_on_favourite_popup_menu_item_activate_window(XfdashboardPopupMenuItem *inMenuItem,
-																					gpointer inUserData)
-{
-	XfdashboardWindowTrackerWindow		*window;
-
-	g_return_if_fail(XFDASHBOARD_IS_POPUP_MENU_ITEM(inMenuItem));
-	g_return_if_fail(XFDASHBOARD_IS_WINDOW_TRACKER_WINDOW(inUserData));
-
-	window=XFDASHBOARD_WINDOW_TRACKER_WINDOW(inUserData);
-
-	/* Activate window */
-	xfdashboard_window_tracker_window_activate(window);
-
-	/* Quit application */
-	xfdashboard_application_suspend_or_quit(NULL);
-}
-
 /* User selected to open a new window or to launch that application at pop-up menu */
 static void _xfdashboard_quicklaunch_on_favourite_popup_menu_item_launch(XfdashboardPopupMenuItem *inMenuItem,
 																			gpointer inUserData)
@@ -649,76 +631,6 @@ static void _xfdashboard_quicklaunch_on_favourite_popup_menu_item_add_to_favouri
 	}
 }
 
-
-/* User selected to execute an application action */
-static void _xfdashboard_quicklaunch_on_favourite_popup_menu_item_application_action(XfdashboardPopupMenuItem *inMenuItem,
-																						gpointer inUserData)
-{
-	XfdashboardQuicklaunch				*self;
-	XfdashboardDesktopAppInfo			*appInfo;
-	XfdashboardDesktopAppInfoAction		*appAction;
-	GError								*error;
-
-	g_return_if_fail(XFDASHBOARD_IS_POPUP_MENU_ITEM(inMenuItem));
-	g_return_if_fail(XFDASHBOARD_IS_QUICKLAUNCH(inUserData));
-
-	self=XFDASHBOARD_QUICKLAUNCH(inUserData);
-	error=NULL;
-
-	/* Get application and action to execute */
-	appInfo=XFDASHBOARD_DESKTOP_APP_INFO(g_object_get_data(G_OBJECT(inMenuItem), "popup-menu-item-app-info"));
-	if(!appInfo)
-	{
-		g_warning(_("Could not get application to execute action"));
-		return;
-	}
-
-	appAction=XFDASHBOARD_DESKTOP_APP_INFO_ACTION(g_object_get_data(G_OBJECT(inMenuItem), "popup-menu-item-app-action"));
-	if(!appInfo)
-	{
-		g_warning(_("Could not get application action for application '%s'"),
-					g_app_info_get_display_name(G_APP_INFO(appInfo)));
-		return;
-	}
-
-	/* Execute action */
-	if(!xfdashboard_desktop_app_info_launch_action(appInfo, appAction, NULL, &error))
-	{
-		/* Show notification about failed launch of action */
-		xfdashboard_notify(CLUTTER_ACTOR(self),
-							"dialog-error",
-							_("Could not execute action '%s' for application '%s': %s"),
-							xfdashboard_desktop_app_info_action_get_name(appAction),
-							g_app_info_get_display_name(G_APP_INFO(appInfo)),
-							error ? error->message : _("Unknown error"));
-		g_error_free(error);
-	}
-		else
-		{
-			GIcon						*gicon;
-			const gchar					*iconName;
-
-			/* Get icon of application */
-			iconName=NULL;
-
-			gicon=g_app_info_get_icon(G_APP_INFO(appInfo));
-			if(gicon) iconName=g_icon_to_string(gicon);
-
-			/* Show notification about successful launch of action */
-			xfdashboard_notify(CLUTTER_ACTOR(self),
-								iconName,
-								_("Executed action '%s' for application '%s'"),
-								xfdashboard_desktop_app_info_action_get_name(appAction),
-								g_app_info_get_display_name(G_APP_INFO(appInfo)));
-
-			/* Quit application */
-			xfdashboard_application_suspend_or_quit(NULL);
-
-			/* Release allocated resources */
-			g_object_unref(gicon);
-		}
-}
-
 /* A right-click might have happened on an application icon (favourite) in quicklaunch */
 static void _xfdashboard_quicklaunch_on_favourite_popup_menu(XfdashboardQuicklaunch *self,
 																ClutterActor *inActor,
@@ -742,7 +654,6 @@ static void _xfdashboard_quicklaunch_on_favourite_popup_menu(XfdashboardQuicklau
 		ClutterActor							*popup;
 		ClutterActor							*menuItem;
 		GAppInfo								*appInfo;
-		const GList								*appWindows;
 
 		/* Get app info for application button as it is needed most the time */
 		appInfo=xfdashboard_application_button_get_app_info(appButton);
@@ -759,93 +670,12 @@ static void _xfdashboard_quicklaunch_on_favourite_popup_menu(XfdashboardQuicklau
 		xfdashboard_popup_menu_set_title_gicon(XFDASHBOARD_POPUP_MENU(popup), g_app_info_get_icon(appInfo));
 
 		/* Add each open window to pop-up of application */
-		appWindows=xfdashboard_application_tracker_get_window_list_by_app_info(priv->appTracker, appInfo);
-		if(appWindows)
+		if(xfdashboard_application_button_add_popup_menu_items_for_windows(appButton, XFDASHBOARD_POPUP_MENU(popup))>0)
 		{
-			const GList							*iter;
-			GList								*sortedList;
-			XfdashboardWindowTracker			*windowTracker;
-			XfdashboardWindowTrackerWindow		*window;
-			XfdashboardWindowTrackerWorkspace	*activeWorkspace;
-			XfdashboardWindowTrackerWorkspace	*windowWorkspace;
-			gboolean							separatorAdded;
-
-			/* Create sorted list of windows. The window is added to begin
-			 * of list if it is on active workspace and to end of list if it
-			 * is on any other workspace.
-			 */
-			windowTracker=xfdashboard_window_tracker_get_default();
-			activeWorkspace=xfdashboard_window_tracker_get_active_workspace(windowTracker);
-
-			sortedList=NULL;
-			for(iter=appWindows; iter; iter=g_list_next(iter))
-			{
-				/* Get window currently iterated */
-				window=XFDASHBOARD_WINDOW_TRACKER_WINDOW(iter->data);
-				if(!window) continue;
-
-				/* Get workspace of window */
-				windowWorkspace=xfdashboard_window_tracker_window_get_workspace(window);
-
-				/* If window is on active workspace add to begin of sorted list,
-				 * otherwise add to end of sorted list.
-				 */
-				if(windowWorkspace==activeWorkspace)
-				{
-					sortedList=g_list_prepend(sortedList, window);
-				}
-					else
-					{
-						sortedList=g_list_append(sortedList, window);
-					}
-			}
-
-			/* Now add menu items for each window in sorted list */
-			separatorAdded=FALSE;
-			for(iter=sortedList; iter; iter=g_list_next(iter))
-			{
-				/* Get window currently iterated */
-				window=XFDASHBOARD_WINDOW_TRACKER_WINDOW(iter->data);
-				if(!window) continue;
-
-				/* Get workspace of window */
-				windowWorkspace=xfdashboard_window_tracker_window_get_workspace(window);
-
-				/* Add separator if currently iterated window is not on active
-				 * workspace then all following windows are not on active workspace
-				 * anymore and a separator is added to split them from the ones
-				 * on active workspace. But add this separator only once.
-				 */
-				if(windowWorkspace!=activeWorkspace &&
-					!separatorAdded)
-				{
-					menuItem=xfdashboard_popup_menu_item_separator_new();
-					clutter_actor_set_x_expand(menuItem, TRUE);
-					xfdashboard_popup_menu_add_item(XFDASHBOARD_POPUP_MENU(popup), XFDASHBOARD_POPUP_MENU_ITEM(menuItem));
-
-					separatorAdded=TRUE;
-				}
-
-				/* Create menu item for window */
-				menuItem=xfdashboard_popup_menu_item_button_new();
-				xfdashboard_label_set_text(XFDASHBOARD_LABEL(menuItem), xfdashboard_window_tracker_window_get_name(window));
-				clutter_actor_set_x_expand(menuItem, TRUE);
-				xfdashboard_popup_menu_add_item(XFDASHBOARD_POPUP_MENU(popup), XFDASHBOARD_POPUP_MENU_ITEM(menuItem));
-
-				g_signal_connect(menuItem,
-									"activated",
-									G_CALLBACK(_xfdashboard_quicklaunch_on_favourite_popup_menu_item_activate_window),
-									window);
-			}
-
 			/* Add a separator to split windows from other actions in pop-up menu */
 			menuItem=xfdashboard_popup_menu_item_separator_new();
 			clutter_actor_set_x_expand(menuItem, TRUE);
 			xfdashboard_popup_menu_add_item(XFDASHBOARD_POPUP_MENU(popup), XFDASHBOARD_POPUP_MENU_ITEM(menuItem));
-
-			/* Release allocated resources */
-			g_list_free(sortedList);
-			g_object_unref(windowTracker);
 		}
 
 		/* Add menu item to launch application if it is not running */
@@ -863,46 +693,12 @@ static void _xfdashboard_quicklaunch_on_favourite_popup_menu(XfdashboardQuicklau
 		}
 
 		/* Add application actions */
-		if(XFDASHBOARD_IS_DESKTOP_APP_INFO(appInfo))
+		if(xfdashboard_application_button_add_popup_menu_items_for_actions(appButton, XFDASHBOARD_POPUP_MENU(popup))>0)
 		{
-			GList									*appActions;
-			const GList								*iter;
-
-			appActions=xfdashboard_desktop_app_info_get_actions(XFDASHBOARD_DESKTOP_APP_INFO(appInfo));
-			for(iter=appActions; iter; iter=g_list_next(iter))
-			{
-				XfdashboardDesktopAppInfoAction		*appAction;
-				const gchar							*iconName;
-
-				/* Get currently iterated application action */
-				appAction=XFDASHBOARD_DESKTOP_APP_INFO_ACTION(iter->data);
-				if(!appAction) continue;
-
-				/* Get icon name to determine style of pop-up menu item */
-				iconName=xfdashboard_desktop_app_info_action_get_icon_name(appAction);
-
-				/* Create pop-up menu item. If icon name is available then set
-				 * style to both (text+icon) and set icon. If icon name is NULL
-				 * then keep style at text-only.
-				 */
-				menuItem=xfdashboard_popup_menu_item_button_new();
-				xfdashboard_label_set_text(XFDASHBOARD_LABEL(menuItem), xfdashboard_desktop_app_info_action_get_name(appAction));
-				if(iconName)
-				{
-					xfdashboard_label_set_icon_name(XFDASHBOARD_LABEL(menuItem), iconName);
-					xfdashboard_label_set_style(XFDASHBOARD_LABEL(menuItem), XFDASHBOARD_LABEL_STYLE_BOTH);
-				}
-				clutter_actor_set_x_expand(menuItem, TRUE);
-				xfdashboard_popup_menu_add_item(XFDASHBOARD_POPUP_MENU(popup), XFDASHBOARD_POPUP_MENU_ITEM(menuItem));
-
-				g_object_set_data_full(G_OBJECT(menuItem), "popup-menu-item-app-info", g_object_ref(appInfo), g_object_unref);
-				g_object_set_data_full(G_OBJECT(menuItem), "popup-menu-item-app-action", g_object_ref(appAction), g_object_unref);
-
-				g_signal_connect(menuItem,
-									"activated",
-									G_CALLBACK(_xfdashboard_quicklaunch_on_favourite_popup_menu_item_application_action),
-									self);
-			}
+			/* Add a separator to split windows from other actions in pop-up menu */
+			menuItem=xfdashboard_popup_menu_item_separator_new();
+			clutter_actor_set_x_expand(menuItem, TRUE);
+			xfdashboard_popup_menu_add_item(XFDASHBOARD_POPUP_MENU(popup), XFDASHBOARD_POPUP_MENU_ITEM(menuItem));
 		}
 
 		/* Add "Remove from favourites" if application button is for a favourite application */

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


More information about the Xfce4-commits mailing list