~ubuntu-branches/ubuntu/quantal/gnome-menus2/quantal

« back to all changes in this revision

Viewing changes to debian/patches/24_xdg_current_desktop.patch

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-08-26 11:43:02 UTC
  • Revision ID: james.westby@ubuntu.com-20110826114302-vgdcyicgxh3xzyzn
Tags: 3.0.1-0ubuntu6
Restore old gnome-menus, the lib still has some rdepends

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Support XDG_CURRENT_DESKTOP when looking at OnlyShowIn/NotShowIn
 
2
Origin: http://bugzilla-attachments.gnome.org/attachment.cgi?id=190706
 
3
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=653440
 
4
Bug-Ubuntu: https://launchpad.net/bugs/803519
 
5
 
 
6
Index: gnome-menus-3.0.1/libmenu/desktop-entries.c
 
7
===================================================================
 
8
--- gnome-menus-3.0.1.orig/libmenu/desktop-entries.c    2011-07-20 13:45:45.828954257 -0400
 
9
+++ gnome-menus-3.0.1/libmenu/desktop-entries.c 2011-07-20 13:46:02.096954430 -0400
 
10
@@ -84,6 +84,7 @@
 
11
   char      *tryexec;
 
12
   guint      flags;
 
13
   int        i;
 
14
+  const char *desktop;
 
15
 
 
16
   error = NULL;
 
17
   no_display = g_key_file_get_boolean (key_file,
 
18
@@ -108,6 +109,15 @@
 
19
     }
 
20
 
 
21
   show_in_gnome = TRUE;
 
22
+
 
23
+  /* if the value is unset, fallback to GNOME, if the
 
24
+   * value is empty, allow all applications in the menu */
 
25
+  desktop = g_getenv ("XDG_CURRENT_DESKTOP");
 
26
+  if (G_LIKELY (desktop == NULL))
 
27
+    desktop = "GNOME";
 
28
+  else if (*desktop == '\0')
 
29
+    goto skip_show_in_checks;
 
30
+
 
31
   strv = g_key_file_get_string_list (key_file,
 
32
                                      desktop_entry_group,
 
33
                                      "OnlyShowIn",
 
34
@@ -118,7 +128,7 @@
 
35
       show_in_gnome = FALSE;
 
36
       for (i = 0; strv[i]; i++)
 
37
         {
 
38
-          if (!strcmp (strv[i], "GNOME"))
 
39
+          if (!strcmp (strv[i], desktop))
 
40
             {
 
41
               show_in_gnome = TRUE;
 
42
             }
 
43
@@ -136,7 +146,7 @@
 
44
           show_in_gnome = TRUE;
 
45
           for (i = 0; strv[i]; i++)
 
46
             {
 
47
-              if (!strcmp (strv[i], "GNOME"))
 
48
+              if (!strcmp (strv[i], desktop))
 
49
                 {
 
50
                   show_in_gnome = FALSE;
 
51
                 }
 
52
@@ -187,6 +197,8 @@
 
53
         }
 
54
     }
 
55
 
 
56
+  skip_show_in_checks:
 
57
+
 
58
   tryexec_failed = FALSE;
 
59
   tryexec = g_key_file_get_string (key_file,
 
60
                                    desktop_entry_group,