[Xfce4-commits] <garcon:master> Support Link desktop types.
Nick Schermer
noreply at xfce.org
Fri Dec 23 19:50:01 CET 2011
Updating branch refs/heads/master
to e0f987ba52b8b2dcfca32fece44852b2bd736eaf (commit)
from c2f0538dee6d91a3f7daa0ad011386baf36e4a09 (commit)
commit e0f987ba52b8b2dcfca32fece44852b2bd736eaf
Author: Nick Schermer <nick at xfce.org>
Date: Fri Dec 23 19:48:26 2011 +0100
Support Link desktop types.
Bit of Xfce hardcoding here (using exo-open), but this way
we nicely support Link desktop items out of the box.
garcon/garcon-menu-item.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/garcon/garcon-menu-item.c b/garcon/garcon-menu-item.c
index 0570d6d..048f3e1 100644
--- a/garcon/garcon-menu-item.c
+++ b/garcon/garcon-menu-item.c
@@ -703,8 +703,10 @@ garcon_menu_item_new (GFile *file)
const gchar *exec;
const gchar *try_exec;
const gchar *icon;
+ const gchar *url;
gchar **mt;
gchar **str_list;
+ gchar *url_exec = NULL;
g_return_val_if_fail (G_IS_FILE (file), NULL);
g_return_val_if_fail (g_file_is_native (file), NULL);
@@ -722,6 +724,17 @@ garcon_menu_item_new (GFile *file)
name = xfce_rc_read_entry (rc, G_KEY_FILE_DESKTOP_KEY_NAME, NULL);
exec = xfce_rc_read_entry_untranslated (rc, G_KEY_FILE_DESKTOP_KEY_EXEC, NULL);
+ if (G_UNLIKELY (exec == NULL))
+ {
+ /* Support Type=Link items */
+ url = xfce_rc_read_entry_untranslated (rc, G_KEY_FILE_DESKTOP_KEY_URL, NULL);
+ if (url != NULL)
+ {
+ url_exec = g_strdup_printf ("exo-open --launch WebBrowser '%s'", url);
+ exec = url_exec;
+ }
+ }
+
/* Validate Name and Exec fields */
if (G_LIKELY (exec != NULL && name != NULL))
{
@@ -780,6 +793,7 @@ garcon_menu_item_new (GFile *file)
/* Cleanup */
xfce_rc_close (rc);
+ g_free (url_exec);
return item;
}
More information about the Xfce4-commits
mailing list