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

« back to all changes in this revision

Viewing changes to libmenu/desktop-entries.c

  • 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:
56
56
  guint refcount : 24;
57
57
};
58
58
 
 
59
static char *derivative_session = "toto";
 
60
 
59
61
struct DesktopEntrySet
60
62
{
61
63
  int         refcount;
76
78
  gboolean   no_display;
77
79
  gboolean   hidden;
78
80
  gboolean   show_in_gnome;
 
81
  gboolean   show_in_derivative_session;
 
82
  gboolean   defined_for_derivative_session = FALSE;
79
83
  gboolean   tryexec_failed;
80
84
  char      *tryexec;
81
85
  guint      flags;
82
86
  int        i;
 
87
  const char *desktop;
83
88
 
84
89
  error = NULL;
85
90
  no_display = g_key_file_get_boolean (key_file,
104
109
    }
105
110
 
106
111
  show_in_gnome = TRUE;
 
112
 
 
113
  /* if the value is unset, fallback to GNOME, if the
 
114
   * value is empty, allow all applications in the menu */
 
115
  desktop = g_getenv ("XDG_CURRENT_DESKTOP");
 
116
  if (G_LIKELY (desktop == NULL))
 
117
    desktop = "GNOME";
 
118
  else if (*desktop == '\0')
 
119
    goto skip_show_in_checks;
 
120
 
107
121
  strv = g_key_file_get_string_list (key_file,
108
122
                                     desktop_entry_group,
109
123
                                     "OnlyShowIn",
114
128
      show_in_gnome = FALSE;
115
129
      for (i = 0; strv[i]; i++)
116
130
        {
117
 
          if (!strcmp (strv[i], "GNOME"))
 
131
          if (!strcmp (strv[i], desktop))
118
132
            {
119
133
              show_in_gnome = TRUE;
120
 
              break;
121
134
            }
122
135
        }
123
136
    }
133
146
          show_in_gnome = TRUE;
134
147
          for (i = 0; strv[i]; i++)
135
148
            {
136
 
              if (!strcmp (strv[i], "GNOME"))
 
149
              if (!strcmp (strv[i], desktop))
137
150
                {
138
151
                  show_in_gnome = FALSE;
139
152
                }
142
155
    }
143
156
  g_strfreev (strv);
144
157
 
 
158
  if (derivative_session)
 
159
    {
 
160
      strv = g_key_file_get_string_list (key_file,
 
161
                                         desktop_entry_group,
 
162
                                         "X-UBUNTU-OnlyShowIn-Derivative",
 
163
                                         NULL,
 
164
                                         NULL);
 
165
      if (strv)
 
166
        {
 
167
          for (i = 0; strv[i]; i++)
 
168
            {
 
169
              if (!strcmp (strv[i], derivative_session))
 
170
                {
 
171
                  show_in_derivative_session = TRUE;
 
172
                  defined_for_derivative_session = TRUE;
 
173
                }
 
174
            }
 
175
        }
 
176
      g_strfreev (strv);
 
177
      strv = g_key_file_get_string_list (key_file,
 
178
                                         desktop_entry_group,
 
179
                                         "X-UBUNTU-NotShowIn-Derivative",
 
180
                                         NULL,
 
181
                                         NULL);
 
182
      if (strv)
 
183
        {
 
184
          for (i = 0; strv[i]; i++)
 
185
            {
 
186
              if (!strcmp (strv[i], derivative_session))
 
187
                {
 
188
                  show_in_derivative_session = FALSE;
 
189
                  defined_for_derivative_session = TRUE;
 
190
                }
 
191
            }
 
192
        }
 
193
      g_strfreev (strv);
 
194
      if (defined_for_derivative_session)
 
195
        {
 
196
          show_in_gnome = show_in_derivative_session;
 
197
        }
 
198
    }
 
199
 
 
200
  skip_show_in_checks:
 
201
 
145
202
  tryexec_failed = FALSE;
146
203
  tryexec = g_key_file_get_string (key_file,
147
204
                                   desktop_entry_group,