~ubuntu-branches/ubuntu/trusty/gnome-do/trusty

« back to all changes in this revision

Viewing changes to Do.Platform.Linux/src/Do.Universe/ApplicationItem.cs

  • Committer: Package Import Robot
  • Author(s): Christopher James Halse Rogers
  • Date: 2012-03-26 11:12:21 UTC
  • mfrom: (0.1.12 sid)
  • Revision ID: package-import@ubuntu.com-20120326111221-1jk143fy37zxi3e4
Tags: 0.9-1
* New upstream version no longer uses deprecated internal glib headers.
  (Closes: #665537)
* [59fa37b9] Fix watch file
* [63486516] Imported Upstream version 0.9
* [8c636d84] Disable testsuite for now; requires running dbus and gconf daemons
* [e46de4b9] Remove inaccurate README.Source
* [4591d677] Add git-buildpackage configuration to default to pristine-tar

Show diffs side-by-side

added added

removed removed

Lines of Context:
195
195
 
196
196
                public bool IsAppropriateForCurrentDesktop {
197
197
                        get {
198
 
                                // This check should eventually account for xfce too.  Ideally here
199
 
                                // though, we wish to throw away certain items that are not useful to
200
 
                                // the current DE.  We are using the same check that xdg-open uses.
201
 
                                if (!item.AttrExists ("OnlyShowIn")) return true;
202
 
 
203
 
                                string show_in = item.GetString ("OnlyShowIn").ToLower ();
204
 
                                return !show_in.Contains ("kde") || 
205
 
                                        Environment.GetEnvironmentVariable ("KDE_FULL_SESSION") == "true";
 
198
                                string onlyShowIn = item.GetString ("OnlyShowIn");
 
199
                                string notShowIn = item.GetString ("NotShowIn");
 
200
                                string desktopSession = Environment.GetEnvironmentVariable ("XDG_CURRENT_DESKTOP");
 
201
 
 
202
                                if (desktopSession == null) {
 
203
                                        // Legacy fallbacks:
 
204
                                        // If KDE_FULL_SESSION is true, assume kde.
 
205
                                        // Else, assume GNOME
 
206
                                        if (Environment.GetEnvironmentVariable ("KDE_FULL_SESSION") == "true") {
 
207
                                                desktopSession = "KDE";
 
208
                                        } else {
 
209
                                                desktopSession = "GNOME";
 
210
                                        }
 
211
                                }
 
212
 
 
213
                                // It doesn't make sense for a DE to appear in both OnlyShowIn and
 
214
                                // NotShowIn.  We choose to prefer OnlyShowIn in this case as it makes
 
215
                                // the following checks easier.
 
216
                                if (onlyShowIn != null) {
 
217
                                        foreach (string environment in onlyShowIn.Split (';')) {
 
218
                                                if (desktopSession.Equals (environment, StringComparison.InvariantCultureIgnoreCase)) {
 
219
                                                        return true;
 
220
                                                }
 
221
                                        }
 
222
                                        // There's an OnlyShowIn attribute, and the current environment doesn't match.
 
223
                                        return false;
 
224
                                }
 
225
 
 
226
                                if (notShowIn != null) {
 
227
                                        foreach (string environment in notShowIn.Split (';')) {
 
228
                                                if (desktopSession.Equals (environment, StringComparison.InvariantCultureIgnoreCase)) {
 
229
                                                        return false;
 
230
                                                }
 
231
                                        }
 
232
                                }
 
233
 
 
234
                                return true;
206
235
                        }
207
236
                }
208
237