[Xfce4-commits] <xfce4-session:master> Support the TryExec key in the settings dialog.
Nick Schermer
noreply at xfce.org
Sat Mar 24 22:50:09 CET 2012
Updating branch refs/heads/master
to 00915e5e3769b5a8afc3c340b538da2de70a9937 (commit)
from 2aeac5b2c2fbe329d131fe0a102a700b18d1a2d8 (commit)
commit 00915e5e3769b5a8afc3c340b538da2de70a9937
Author: Nick Schermer <nick at xfce.org>
Date: Fri Feb 24 21:57:31 2012 +0100
Support the TryExec key in the settings dialog.
settings/xfae-model.c | 38 +++++++++++++++++++++++++++-----------
1 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/settings/xfae-model.c b/settings/xfae-model.c
index 1680fae..89c861a 100644
--- a/settings/xfae-model.c
+++ b/settings/xfae-model.c
@@ -397,16 +397,17 @@ xfae_model_iter_parent (GtkTreeModel *tree_model,
static XfaeItem*
xfae_item_new (const gchar *relpath)
{
- const gchar *value;
- XfaeItem *item = NULL;
- gboolean skip = FALSE;
- XfceRc *rc;
- gchar **only_show_in;
- gchar **not_show_in;
- gchar **args;
- gchar *icon_name;
- gint m;
- GtkIconTheme *icon_theme;
+ const gchar *value;
+ XfaeItem *item = NULL;
+ gboolean skip = FALSE;
+ XfceRc *rc;
+ gchar **only_show_in;
+ gchar **not_show_in;
+ gchar **args;
+ gchar *icon_name;
+ gint m;
+ GtkIconTheme *icon_theme;
+ gchar *command;
rc = xfce_rc_config_open (XFCE_RESOURCE_CONFIG, relpath, TRUE);
if (G_LIKELY (rc != NULL))
@@ -415,7 +416,8 @@ xfae_item_new (const gchar *relpath)
/* verify that we have an application here */
value = xfce_rc_read_entry (rc, "Type", NULL);
- if (G_LIKELY (value != NULL && g_ascii_strcasecmp (value, "Application") == 0))
+ if (G_LIKELY (value != NULL
+ && g_ascii_strcasecmp (value, "Application") == 0))
{
icon_theme = gtk_icon_theme_get_default ();
@@ -488,6 +490,20 @@ xfae_item_new (const gchar *relpath)
}
}
+ value = xfce_rc_read_entry (rc, "TryExec", NULL);
+ if (value != NULL && g_shell_parse_argv (value, NULL, &args, NULL))
+ {
+ if (!g_file_test (args[0], G_FILE_TEST_EXISTS))
+ {
+ command = g_find_program_in_path (args[0]);
+ if (command == NULL)
+ skip = TRUE;
+ g_free (command);
+ }
+
+ g_strfreev (args);
+ }
+
xfce_rc_close (rc);
/* check if we should skip the item */
More information about the Xfce4-commits
mailing list