gnome-panel r11459 - trunk/gnome-panel
- From: vuntz svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-panel r11459 - trunk/gnome-panel
- Date: Tue, 20 Jan 2009 14:03:44 +0000 (UTC)
Author: vuntz
Date: Tue Jan 20 14:03:44 2009
New Revision: 11459
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11459&view=rev
Log:
2009-01-20 Vincent Untz <vuntz gnome org>
* panel-menu-items.c: (panel_menu_items_append_from_desktop): respect
TryExec in the desktop file.
Based on patch by Matthias Clasen <mclasen redhat com>
Fix bug #555710.
Modified:
trunk/gnome-panel/ChangeLog
trunk/gnome-panel/panel-menu-items.c
Modified: trunk/gnome-panel/panel-menu-items.c
==============================================================================
--- trunk/gnome-panel/panel-menu-items.c (original)
+++ trunk/gnome-panel/panel-menu-items.c Tue Jan 20 14:03:44 2009
@@ -149,6 +149,9 @@
char *path_freeme;
char *full_path;
char *uri;
+ char *type;
+ gboolean is_application;
+ char *tryexec;
char *icon;
char *name;
char *comment;
@@ -191,6 +194,41 @@
return;
}
+ /* For Application desktop files, respect TryExec */
+ type = panel_key_file_get_string (key_file, "Type");
+ if (!type) {
+ g_key_file_free (key_file);
+ if (path_freeme)
+ g_free (path_freeme);
+ return;
+ }
+ is_application = (strcmp (type, "Application") == 0);
+ g_free (type);
+
+ if (is_application) {
+ tryexec = panel_key_file_get_string (key_file, "TryExec");
+ if (tryexec) {
+ char *prog;
+
+ prog = g_find_program_in_path (tryexec);
+ g_free (tryexec);
+
+ if (!prog) {
+ /* FIXME: we could add some file monitor magic,
+ * so that the menu items appears when the
+ * program appears, but that's really complex
+ * for not a huge benefit */
+ g_key_file_free (key_file);
+ if (path_freeme)
+ g_free (path_freeme);
+ return;
+ }
+
+ g_free (prog);
+ }
+ }
+
+ /* Now, simply build the menu item */
icon = panel_key_file_get_locale_string (key_file, "Icon");
comment = panel_key_file_get_locale_string (key_file, "Comment");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]