Codebase list cinnamon-menus / 4450452
Improve integration of flatpak apps This adds the suffix ":flatpak" to the desktop id, so that Cinnamon can keep Flatpak apps separate from system repositories' apps. It's done by adding a wrapper for GDesktopAppInfo that only changes the desktop file id and the StartupWMClass while making sure it's used where it's supposed to be used. Lars Mueller authored 3 years ago Michael Webster committed 3 years ago
8 changed file(s) with 908 addition(s) and 38 deletion(s). Raw diff Collapse all Expand all
1717 */
1818
1919 #include "desktop-entries.h"
20 #include <gio/gdesktopappinfo.h>
20 #include "gmenu-desktopappinfo.h"
2121
2222 #include <string.h>
2323
4040 {
4141 DesktopEntry base;
4242
43 GDesktopAppInfo *appinfo;
43 GMenuDesktopAppInfo *appinfo;
4444 GQuark *categories;
4545 guint showin : 1;
4646 } DesktopEntryDesktop;
271271 DesktopEntryDesktop *entry_desktop = (DesktopEntryDesktop*)entry;
272272 const char *categories_str;
273273
274 entry_desktop->appinfo = g_desktop_app_info_new_from_filename (entry->path);
275 if (!G_IS_DESKTOP_APP_INFO (((DesktopEntryDesktop*)entry)->appinfo))
274 entry_desktop->appinfo = gmenu_desktopappinfo_new_from_filename (entry->path);
275 if (!GMENU_IS_DESKTOPAPPINFO (((DesktopEntryDesktop*)entry)->appinfo))
276276 {
277277 menu_verbose ("Failed to load \"%s\"\n", entry->path);
278278 return DESKTOP_ENTRY_LOAD_FAIL_APPINFO;
279279 }
280280
281 categories_str = g_desktop_app_info_get_categories (entry_desktop->appinfo);
281 categories_str = gmenu_desktopappinfo_get_categories (entry_desktop->appinfo);
282282 if (categories_str)
283283 {
284284 char **categories;
522522 DesktopEntryDesktop *desktop_entry = (DesktopEntryDesktop*) entry;
523523 g_free (desktop_entry->categories);
524524 if (desktop_entry->appinfo)
525 {
525526 g_object_unref (desktop_entry->appinfo);
527 desktop_entry->appinfo = NULL;
528 }
526529 }
527530 else if (entry->type == DESKTOP_ENTRY_DIRECTORY)
528531 {
569572 {
570573 if (entry->type == DESKTOP_ENTRY_DESKTOP)
571574 {
572 g_return_val_if_fail (G_IS_DESKTOP_APP_INFO (((DesktopEntryDesktop*)entry)->appinfo), NULL);
575 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (((DesktopEntryDesktop*)entry)->appinfo), NULL);
573576 return g_app_info_get_name (G_APP_INFO (((DesktopEntryDesktop*)entry)->appinfo));
574577 }
575578
581584 {
582585 if (entry->type == DESKTOP_ENTRY_DESKTOP)
583586 {
584 g_return_val_if_fail (G_IS_DESKTOP_APP_INFO (((DesktopEntryDesktop*)entry)->appinfo), NULL);
585 return g_desktop_app_info_get_generic_name (((DesktopEntryDesktop*)entry)->appinfo);
587 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (((DesktopEntryDesktop*)entry)->appinfo), NULL);
588 return gmenu_desktopappinfo_get_generic_name (((DesktopEntryDesktop*)entry)->appinfo);
586589 }
587590
588591 return ((DesktopEntryDirectory*)entry)->generic_name;
593596 {
594597 if (entry->type == DESKTOP_ENTRY_DESKTOP)
595598 {
596 g_return_val_if_fail (G_IS_DESKTOP_APP_INFO (((DesktopEntryDesktop*)entry)->appinfo), NULL);
599 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (((DesktopEntryDesktop*)entry)->appinfo), NULL);
597600 return g_app_info_get_description (G_APP_INFO (((DesktopEntryDesktop*)entry)->appinfo));
598601 }
599602
605608 {
606609 if (entry->type == DESKTOP_ENTRY_DESKTOP)
607610 {
608 g_return_val_if_fail (G_IS_DESKTOP_APP_INFO (((DesktopEntryDesktop*)entry)->appinfo), NULL);
611 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (((DesktopEntryDesktop*)entry)->appinfo), NULL);
609612 return g_app_info_get_icon (G_APP_INFO (((DesktopEntryDesktop*)entry)->appinfo));
610613 }
611614
617620 {
618621 if (entry->type == DESKTOP_ENTRY_DESKTOP)
619622 {
620 g_return_val_if_fail (G_IS_DESKTOP_APP_INFO (((DesktopEntryDesktop*)entry)->appinfo), FALSE);
621 return g_desktop_app_info_get_nodisplay (((DesktopEntryDesktop*)entry)->appinfo);
623 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (((DesktopEntryDesktop*)entry)->appinfo), FALSE);
624 return gmenu_desktopappinfo_get_nodisplay (((DesktopEntryDesktop*)entry)->appinfo);
622625 }
623626
624627 return ((DesktopEntryDirectory*)entry)->nodisplay;
629632 {
630633 if (entry->type == DESKTOP_ENTRY_DESKTOP)
631634 {
632 g_return_val_if_fail (G_IS_DESKTOP_APP_INFO (((DesktopEntryDesktop*)entry)->appinfo), FALSE);
633 return g_desktop_app_info_get_is_hidden (((DesktopEntryDesktop*)entry)->appinfo);
635 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (((DesktopEntryDesktop*)entry)->appinfo), FALSE);
636 return gmenu_desktopappinfo_get_is_hidden (((DesktopEntryDesktop*)entry)->appinfo);
634637 }
635638
636639 return ((DesktopEntryDirectory*)entry)->hidden;
652655 return ((DesktopEntryDirectory*)entry)->showin;
653656 }
654657
655
656 GDesktopAppInfo *
658 const char *
659 desktop_entry_get_id (DesktopEntry *entry)
660 {
661 if (entry->type == DESKTOP_ENTRY_DESKTOP)
662 {
663 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (((DesktopEntryDesktop*)entry)->appinfo), NULL);
664 return g_app_info_get_id (G_APP_INFO (((DesktopEntryDesktop*)entry)->appinfo));
665 }
666
667 // this only applies to non-desktop entries
668 return entry->basename;
669 }
670
671 GMenuDesktopAppInfo *
657672 desktop_entry_get_app_info (DesktopEntry *entry)
658673 {
659674 g_return_val_if_fail (entry->type == DESKTOP_ENTRY_DESKTOP, NULL);
751766 DesktopEntry *entry,
752767 const char *file_id)
753768 {
769 const char *file_id_to_use;
754770 menu_verbose (" Adding to set %p entry %s\n", set, file_id);
755771
756772 if (set->hash == NULL)
761777 (GDestroyNotify) desktop_entry_unref);
762778 }
763779
780 if (desktop_entry_get_type (entry) == DESKTOP_ENTRY_DESKTOP) {
781 file_id_to_use = desktop_entry_get_id (entry);
782 }
783 else {
784 file_id_to_use = file_id;
785 }
764786 g_hash_table_replace (set->hash,
765 g_strdup (file_id),
787 g_strdup (file_id_to_use),
766788 desktop_entry_ref (entry));
767789 }
768790
1919 #ifndef __DESKTOP_ENTRIES_H__
2020 #define __DESKTOP_ENTRIES_H__
2121
22 #include <gio/gdesktopappinfo.h>
22 #include "gmenu-desktopappinfo.h"
2323
2424 G_BEGIN_DECLS
2525
5959 gboolean desktop_entry_get_show_in (DesktopEntry *entry);
6060
6161 /* Only valid for DESKTOP_ENTRY_DESKTOP */
62 GDesktopAppInfo *desktop_entry_get_app_info (DesktopEntry *entry);
62 GMenuDesktopAppInfo *desktop_entry_get_app_info (DesktopEntry *entry);
6363 gboolean desktop_entry_has_categories (DesktopEntry *entry);
6464 gboolean desktop_entry_has_category (DesktopEntry *entry,
6565 const char *category);
8686 DesktopEntrySet *other);
8787 void desktop_entry_set_swap_contents (DesktopEntrySet *a,
8888 DesktopEntrySet *b);
89 const char * desktop_entry_get_id (DesktopEntry *entry);
8990
9091 typedef void (*DesktopEntrySetForeachFunc) (const char *file_id,
9192 DesktopEntry *entry,
573573 * NOTIFY: mimeinfo.cache
574574 *
575575 * Additionally, the failure is not upon trying to read the file,
576 * but attempting to get its GAppInfo (g_desktop_app_info_new_from_filename()
576 * but attempting to get its GAppInfo (gmenu_desktopappinfo_new_from_filename()
577577 * in desktop-entries.c ln 277). If you jigger desktop_entry_load() around
578578 * and read the file as a keyfile *first*, it succeeds. If you then try
579 * to run g_desktop_app_info_new_from_keyfile(), *then* it fails.
579 * to run gmenu_desktopappinfo_new_from_keyfile(), *then* it fails.
580580 *
581581 * The theory here is there is a race condition where app info (which includes
582582 * mimetype stuff) is unavailable because mimeinfo.cache is updated immediately
10581058 if (desktop_entries &&
10591059 desktop_entry_get_type (entry) == DESKTOP_ENTRY_DESKTOP)
10601060 {
1061 char *file_id;
1062
1063 file_id = get_desktop_file_id_from_path (ed,
1064 DESKTOP_ENTRY_DESKTOP,
1065 basename);
1066
10671061 desktop_entry_set_add_entry (desktop_entries,
10681062 entry,
1069 file_id);
1070
1071 g_free (file_id);
1063 NULL);
10721064 }
10731065
10741066 if (directory_entries &&
0 /*
1 * gmenu-desktopappinfo.c
2 * Copyright (C) 2020 Lars Mueller <lmueller@cobinja.fritz.box>
3 *
4 * gmenutest is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * gmenutest is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include "gmenu-desktopappinfo.h"
19 #include <gio/gdesktopappinfo.h>
20
21 struct _GMenuDesktopAppInfo
22 {
23 GObject parent_instance;
24
25 GDesktopAppInfo *super_appinfo;
26 gchar *desktop_id;
27 gboolean is_flatpak;
28 gchar *startup_wm_class;
29 gchar *flatpak_app_id;
30 };
31
32 // This function sets desktop id and startup wm class and adds ":flatpak" for flatpak apps
33 static void
34 update_app_data (GMenuDesktopAppInfo *info)
35 {
36 const gchar *exec;
37 const gchar *id;
38 const gchar *startup_wm_class;
39
40 g_free (info->desktop_id);
41 info->desktop_id = NULL;
42
43 g_free (info->startup_wm_class);
44 info->startup_wm_class = NULL;
45
46 g_free (info->flatpak_app_id);
47 info->flatpak_app_id = NULL;
48
49 if (info->super_appinfo != NULL)
50 {
51 exec = g_app_info_get_executable (G_APP_INFO (info->super_appinfo));
52 id = g_app_info_get_id (G_APP_INFO (info->super_appinfo));
53 startup_wm_class = g_desktop_app_info_get_startup_wm_class (info->super_appinfo);
54
55 if (strstr (exec, "flatpak") || strstr (exec, "bwrap"))
56 {
57 info->desktop_id = g_strconcat (id, GMENU_DESKTOPAPPINFO_FLATPAK_SUFFIX, NULL);
58 if (startup_wm_class)
59 {
60 info->startup_wm_class = g_strconcat (startup_wm_class, GMENU_DESKTOPAPPINFO_FLATPAK_SUFFIX, NULL);
61 }
62
63 // if (g_desktop_app_info_has_key (info->super_appinfo, "X-Flatpak"))
64 // {
65 info->flatpak_app_id = g_desktop_app_info_get_string (info->super_appinfo, "X-Flatpak");
66 // }
67
68 info->is_flatpak = TRUE;
69 } else {
70 info->desktop_id = g_strdup (id);
71 info->is_flatpak = FALSE;
72 info->startup_wm_class = g_strdup (startup_wm_class);
73 }
74 }
75 }
76
77 static GAppInfo *
78 gmenu_desktopappinfo_dup (GAppInfo *appinfo)
79 {
80 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
81 GMenuDesktopAppInfo *new_info;
82
83 new_info = g_object_new (GMENU_TYPE_DESKTOPAPPINFO, NULL);
84
85 new_info->super_appinfo = G_DESKTOP_APP_INFO (g_app_info_dup(G_APP_INFO(info->super_appinfo)));
86
87 update_app_data (new_info);
88
89 return G_APP_INFO (new_info);
90 }
91
92 static gboolean
93 gmenu_desktopappinfo_equal (GAppInfo *appinfo1,
94 GAppInfo *appinfo2)
95 {
96 GMenuDesktopAppInfo *info1 = GMENU_DESKTOPAPPINFO (appinfo1);
97 GMenuDesktopAppInfo *info2 = GMENU_DESKTOPAPPINFO (appinfo2);
98
99 if (info1->desktop_id == NULL ||
100 info2->desktop_id == NULL)
101 return info1 == info2;
102
103 return strcmp (info1->desktop_id, info2->desktop_id) == 0;
104 }
105
106 static const char *
107 gmenu_desktopappinfo_get_id (GAppInfo *appinfo)
108 {
109 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
110
111 return info->desktop_id;
112 }
113
114 static const char *
115 gmenu_desktopappinfo_get_name (GAppInfo *appinfo)
116 {
117 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
118 return g_app_info_get_name (G_APP_INFO(info->super_appinfo));
119 }
120
121 static const char *
122 gmenu_desktopappinfo_get_description (GAppInfo *appinfo)
123 {
124 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
125 return g_app_info_get_description (G_APP_INFO(info->super_appinfo));
126 }
127
128 static const char *
129 gmenu_desktopappinfo_get_executable (GAppInfo *appinfo)
130 {
131 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
132 return g_app_info_get_executable (G_APP_INFO(info->super_appinfo));
133 }
134
135 static GIcon *
136 gmenu_desktopappinfo_get_icon (GAppInfo *appinfo)
137 {
138 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
139 return g_app_info_get_icon (G_APP_INFO(info->super_appinfo));
140 }
141
142 static gboolean
143 gmenu_desktopappinfo_launch (GAppInfo *appinfo, GList *files, GAppLaunchContext *launch_context, GError **error)
144 {
145 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
146 return g_app_info_launch (G_APP_INFO(info->super_appinfo), files, launch_context, error);
147 }
148
149 static gboolean
150 gmenu_desktopappinfo_supports_uris (GAppInfo *appinfo)
151 {
152 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
153 return g_app_info_supports_uris (G_APP_INFO(info->super_appinfo));
154 }
155
156 static gboolean
157 gmenu_desktopappinfo_supports_files (GAppInfo *appinfo)
158 {
159 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
160 return g_app_info_supports_files (G_APP_INFO(info->super_appinfo));
161 }
162
163 static gboolean
164 gmenu_desktopappinfo_launch_uris (GAppInfo *appinfo,
165 GList *uris,
166 GAppLaunchContext *launch_context,
167 GError **error)
168 {
169 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
170 return g_app_info_launch_uris (G_APP_INFO(info->super_appinfo), uris, launch_context, error);
171 }
172
173 static gboolean
174 gmenu_desktopappinfo_should_show (GAppInfo *appinfo)
175 {
176 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
177 return g_app_info_should_show (G_APP_INFO(info->super_appinfo));
178 }
179
180 static gboolean
181 gmenu_desktopappinfo_set_as_default_for_type (GAppInfo *appinfo,
182 const char *content_type,
183 GError **error)
184 {
185 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
186 return g_app_info_set_as_default_for_type (G_APP_INFO(info->super_appinfo), content_type, error);
187 }
188
189 static gboolean
190 gmenu_desktopappinfo_set_as_default_for_extension (GAppInfo *appinfo,
191 const char *extension,
192 GError **error)
193 {
194 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
195 return g_app_info_set_as_default_for_extension (G_APP_INFO(info->super_appinfo), extension, error);
196 }
197
198 static gboolean
199 gmenu_desktopappinfo_add_supports_type (GAppInfo *appinfo,
200 const char *content_type,
201 GError **error)
202 {
203 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
204 return g_app_info_add_supports_type (G_APP_INFO(info->super_appinfo), content_type, error);
205 }
206
207 static gboolean
208 gmenu_desktopappinfo_can_remove_supports_type (GAppInfo *appinfo)
209 {
210 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
211 return g_app_info_can_remove_supports_type (G_APP_INFO(info->super_appinfo));
212 }
213
214 static gboolean
215 gmenu_desktopappinfo_remove_supports_type (GAppInfo *appinfo,
216 const char *content_type,
217 GError **error)
218 {
219 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
220 return g_app_info_remove_supports_type (G_APP_INFO(info->super_appinfo), content_type, error);
221 }
222
223 static gboolean
224 gmenu_desktopappinfo_can_delete (GAppInfo *appinfo)
225 {
226 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
227 return g_app_info_can_delete (G_APP_INFO(info->super_appinfo));
228 }
229
230 static gboolean
231 gmenu_desktopappinfo_delete (GAppInfo *appinfo)
232 {
233 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
234 return g_app_info_delete (G_APP_INFO(info->super_appinfo));
235 }
236
237 static const char *
238 gmenu_desktopappinfo_get_commandline (GAppInfo *appinfo)
239 {
240 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
241 return g_app_info_get_commandline (G_APP_INFO(info->super_appinfo));
242 }
243
244 static const char *
245 gmenu_desktopappinfo_get_display_name (GAppInfo *appinfo)
246 {
247 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
248 return g_app_info_get_display_name (G_APP_INFO(info->super_appinfo));
249 }
250
251 static gboolean
252 gmenu_desktopappinfo_set_as_last_used_for_type (GAppInfo *appinfo,
253 const char *content_type,
254 GError **error)
255 {
256 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
257 return g_app_info_set_as_last_used_for_type (G_APP_INFO(info->super_appinfo), content_type, error);
258 }
259
260 static const char **
261 gmenu_desktopappinfo_get_supported_types (GAppInfo *appinfo)
262 {
263 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
264 return g_app_info_get_supported_types (G_APP_INFO(info->super_appinfo));
265 }
266
267 static void
268 gmenu_desktopappinfo_interface_init (GAppInfoIface *iface)
269 {
270 iface->dup = gmenu_desktopappinfo_dup;
271 iface->equal = gmenu_desktopappinfo_equal;
272 iface->get_id = gmenu_desktopappinfo_get_id;
273 iface->get_name = gmenu_desktopappinfo_get_name;
274 iface->get_description = gmenu_desktopappinfo_get_description;
275 iface->get_executable = gmenu_desktopappinfo_get_executable;
276 iface->get_icon = gmenu_desktopappinfo_get_icon;
277 iface->launch = gmenu_desktopappinfo_launch;
278 iface->supports_uris = gmenu_desktopappinfo_supports_uris;
279 iface->supports_files = gmenu_desktopappinfo_supports_files;
280 iface->launch_uris = gmenu_desktopappinfo_launch_uris;
281 iface->should_show = gmenu_desktopappinfo_should_show;
282 iface->set_as_default_for_type = gmenu_desktopappinfo_set_as_default_for_type;
283 iface->set_as_default_for_extension = gmenu_desktopappinfo_set_as_default_for_extension;
284 iface->add_supports_type = gmenu_desktopappinfo_add_supports_type;
285 iface->can_remove_supports_type = gmenu_desktopappinfo_can_remove_supports_type;
286 iface->remove_supports_type = gmenu_desktopappinfo_remove_supports_type;
287 iface->can_delete = gmenu_desktopappinfo_can_delete;
288 iface->do_delete = gmenu_desktopappinfo_delete;
289 iface->get_commandline = gmenu_desktopappinfo_get_commandline;
290 iface->get_display_name = gmenu_desktopappinfo_get_display_name;
291 iface->set_as_last_used_for_type = gmenu_desktopappinfo_set_as_last_used_for_type;
292 iface->get_supported_types = gmenu_desktopappinfo_get_supported_types;
293 }
294
295 G_DEFINE_TYPE_WITH_CODE (GMenuDesktopAppInfo, gmenu_desktopappinfo, G_TYPE_OBJECT,
296 G_IMPLEMENT_INTERFACE (G_TYPE_APP_INFO, gmenu_desktopappinfo_interface_init))
297
298 static void
299 gmenu_desktopappinfo_init (GMenuDesktopAppInfo *info)
300 {
301 info->super_appinfo = NULL;
302 info->desktop_id = NULL;
303 info->flatpak_app_id = NULL;
304 info->startup_wm_class = NULL;
305 }
306
307 static void
308 gmenu_desktopappinfo_finalize (GObject *object)
309 {
310 /* TODO: Add deinitalization code here */
311
312 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (object);
313
314 g_free (info->desktop_id);
315 g_free (info->startup_wm_class);
316 g_free (info->flatpak_app_id);
317
318 if (info->super_appinfo)
319 g_object_unref (info->super_appinfo);
320 }
321
322 static void
323 gmenu_desktopappinfo_class_init (GMenuDesktopAppInfoClass *klass)
324 {
325 GObjectClass* object_class = G_OBJECT_CLASS (klass);
326
327 object_class->finalize = gmenu_desktopappinfo_finalize;
328 }
329
330 /**
331 * gmenu_desktopappinfo_new:
332 * @desktop_id: the desktop file id
333 *
334 * This is currently unused in Cinnamon and does not make sense here
335 * because the desktop id as used here is not necessarily unique
336 *
337 * Returns: (nullable): %NULL
338 */
339 GMenuDesktopAppInfo*
340 gmenu_desktopappinfo_new (const char *desktop_id)
341 {
342 return NULL;
343 }
344
345 /**
346 * gmenu_desktopappinfo_new_from_filename:
347 * @filename: (type filename): the path of a desktop file, in the GLib
348 * filename encoding
349 *
350 * Creates a new #GMenuDesktopAppInfo.
351 *
352 * Returns: (nullable): a new #GMenuDesktopAppInfo or %NULL on error.
353 **/
354 GMenuDesktopAppInfo*
355 gmenu_desktopappinfo_new_from_filename (gchar *filename)
356 {
357 GMenuDesktopAppInfo *info = NULL;
358
359 info = g_object_new (GMENU_TYPE_DESKTOPAPPINFO, NULL);
360 info->super_appinfo = g_desktop_app_info_new_from_filename (filename);
361
362 if (info->super_appinfo)
363 {
364 update_app_data (info);
365 return info;
366 } else {
367 g_object_unref (info);
368 return NULL;
369 }
370 }
371
372 /**
373 * gmenu_desktopappinfo_new_from_keyfile:
374 * @key_file: an opened #GKeyFile
375 *
376 * Creates a new #GMenuDesktopAppInfo.
377 *
378 * Returns: (nullable): a new #GMenuDesktopAppInfo or %NULL on error.
379 **/
380 GMenuDesktopAppInfo*
381 gmenu_desktopappinfo_new_from_keyfile (GKeyFile *keyfile)
382 {
383 GMenuDesktopAppInfo *info = NULL;
384
385 info = g_object_new (GMENU_TYPE_DESKTOPAPPINFO, NULL);
386 info->super_appinfo = g_desktop_app_info_new_from_keyfile (keyfile);
387
388 if (info->super_appinfo)
389 {
390 update_app_data (info);
391 return info;
392 } else {
393 g_object_unref (info);
394 return NULL;
395 }
396 }
397
398 /**
399 * gmenu_desktopappinfo_get_filename:
400 * @appinfo: a #MenuGDesktopAppInfo
401 *
402 * When @info was created from a known filename, return it. In some
403 * situations such as the #GMenuDesktopAppInfo returned from
404 * gmenu_desktopappinfo_new_from_keyfile(), this function will return %NULL.
405 *
406 * Returns: (type filename): The full path to the file for @info,
407 * or %NULL if not known.
408 * Since: 2.24
409 */
410 const char * gmenu_desktopappinfo_get_filename (GMenuDesktopAppInfo *appinfo)
411 {
412 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
413 return g_desktop_app_info_get_filename (info->super_appinfo);
414 }
415
416 /**
417 * gmenu_desktopappinfo_get_generic_name:
418 * @appinfo: a #MenuGDesktopAppInfo
419 *
420 * Gets the generic name from the destkop file.
421 *
422 * Returns: The value of the GenericName key
423 */
424 const char * gmenu_desktopappinfo_get_generic_name (GMenuDesktopAppInfo *appinfo)
425 {
426 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
427 return g_desktop_app_info_get_generic_name (info->super_appinfo);
428 }
429
430 /**
431 * gmenu_desktopappinfo_get_categories:
432 * @appinfo: a #GMenuDesktopAppInfo
433 *
434 * Gets the categories from the desktop file.
435 *
436 * Returns: The unparsed Categories key from the desktop file;
437 * i.e. no attempt is made to split it by ';' or validate it.
438 */
439 const char * gmenu_desktopappinfo_get_categories (GMenuDesktopAppInfo *appinfo)
440 {
441 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
442 return g_desktop_app_info_get_categories (info->super_appinfo);
443 }
444
445 /**
446 * gmenu_desktopappinfo_get_keywords:
447 * @appinfo: a #GMenuDesktopAppInfo
448 *
449 * Gets the keywords from the desktop file.
450 *
451 * Returns: (transfer none): The value of the Keywords key
452 */
453 const char * const *gmenu_desktopappinfo_get_keywords (GMenuDesktopAppInfo *appinfo)
454 {
455 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
456 return g_desktop_app_info_get_keywords (info->super_appinfo);
457 }
458
459 /**
460 * gmenu_desktopappinfo_get_nodisplay:
461 * @appinfo: a #GMenuDesktopAppInfo
462 *
463 * Gets the value of the NoDisplay key, which helps determine if the
464 * application info should be shown in menus. See
465 * #G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY and g_app_info_should_show().
466 *
467 * Returns: The value of the NoDisplay key
468 */
469 gboolean gmenu_desktopappinfo_get_nodisplay (GMenuDesktopAppInfo *appinfo)
470 {
471 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
472 return g_desktop_app_info_get_nodisplay (info->super_appinfo);
473 }
474
475 /**
476 * gmenu_desktopappinfo_get_show_in:
477 * @appinfo: a #GMenuDesktopAppInfo
478 * @desktop_env: (nullable): a string specifying a desktop name
479 *
480 * Checks if the application info should be shown in menus that list available
481 * applications for a specific name of the desktop, based on the
482 * `OnlyShowIn` and `NotShowIn` keys.
483 *
484 * @desktop_env should typically be given as %NULL, in which case the
485 * `XDG_CURRENT_DESKTOP` environment variable is consulted. If you want
486 * to override the default mechanism then you may specify @desktop_env,
487 * but this is not recommended.
488 *
489 * Note that g_app_info_should_show() for @info will include this check (with
490 * %NULL for @desktop_env) as well as additional checks.
491 *
492 * Returns: %TRUE if the @info should be shown in @desktop_env according to the
493 * `OnlyShowIn` and `NotShowIn` keys, %FALSE
494 * otherwise.
495 */
496 gboolean gmenu_desktopappinfo_get_show_in (GMenuDesktopAppInfo *appinfo, const gchar *desktop_env)
497 {
498 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
499 return g_desktop_app_info_get_show_in (info->super_appinfo, desktop_env);
500 }
501
502 /**
503 * gmenu_desktopappinfo_get_startup_wm_class:
504 * @appinfo: a #GMenuDesktopAppInfo that supports startup notify
505 *
506 * Retrieves the StartupWMClass field from @info. This represents the
507 * WM_CLASS property of the main window of the application, if launched
508 * through @info.
509 *
510 * Note: The returned value contain the suffix ":flatpak" if @info specifies a flatpak app
511 * and if the desktop file has a StartupWMClass
512 *
513 * Returns: (transfer none): the startup WM class, or %NULL if none is set
514 * in the desktop file.
515 */
516 const char * gmenu_desktopappinfo_get_startup_wm_class (GMenuDesktopAppInfo *appinfo)
517 {
518 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
519
520 return info->startup_wm_class;
521 }
522
523 /**
524 * gmenu_desktopappinfo_get_is_hidden:
525 * @appinfo: a #GMenuDesktopAppInfo.
526 *
527 * A desktop file is hidden if the Hidden key in it is
528 * set to True.
529 *
530 * Returns: %TRUE if hidden, %FALSE otherwise.
531 **/
532 gboolean gmenu_desktopappinfo_get_is_hidden (GMenuDesktopAppInfo *appinfo)
533 {
534 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
535 return g_desktop_app_info_get_is_hidden (info->super_appinfo);
536 }
537
538 /**
539 * gmenu_desktopappinfo_has_key:
540 * @appinfo: a #GMenuDesktopAppInfo
541 * @key: the key to look up
542 *
543 * Returns whether @key exists in the "Desktop Entry" group
544 * of the keyfile backing @info.
545 *
546 * Returns: %TRUE if the @key exists
547 */
548 gboolean gmenu_desktopappinfo_has_key (GMenuDesktopAppInfo *appinfo, const char *key)
549 {
550 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
551 return g_desktop_app_info_has_key (info->super_appinfo, key);
552 }
553
554 /**
555 * gmenu_desktopappinfo_get_string:
556 * @appinfo: a #GMenuDesktopAppInfo
557 * @key: the key to look up
558 *
559 * Looks up a string value in the keyfile backing @info.
560 *
561 * The @key is looked up in the "Desktop Entry" group.
562 *
563 * Returns: a newly allocated string, or %NULL if the key
564 * is not found
565 */
566 char * gmenu_desktopappinfo_get_string (GMenuDesktopAppInfo *appinfo, const char *key)
567 {
568 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
569 return g_desktop_app_info_get_string (info->super_appinfo, key);
570 }
571
572 /**
573 * gmenu_desktopappinfo_get_locale_string:
574 * @appinfo: a #GMenuDesktopAppInfo
575 * @key: the key to look up
576 *
577 * Looks up a localized string value in the keyfile backing @info
578 * translated to the current locale.
579 *
580 * The @key is looked up in the "Desktop Entry" group.
581 *
582 * Returns: (nullable): a newly allocated string, or %NULL if the key
583 * is not found
584 */
585 char * gmenu_desktopappinfo_get_locale_string (GMenuDesktopAppInfo *appinfo, const char *key)
586 {
587 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
588 return g_desktop_app_info_get_locale_string (info->super_appinfo, key);
589 }
590
591 /**
592 * gmenu_desktopappinfo_get_boolean:
593 * @appinfo: a #GMenuDesktopAppInfo
594 * @key: the key to look up
595 *
596 * Looks up a boolean value in the keyfile backing @info.
597 *
598 * The @key is looked up in the "Desktop Entry" group.
599 *
600 * Returns: the boolean value, or %FALSE if the key
601 * is not found
602 */
603 gboolean gmenu_desktopappinfo_get_boolean (GMenuDesktopAppInfo *appinfo, const char *key)
604 {
605 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
606 return g_desktop_app_info_get_boolean (info->super_appinfo, key);
607 }
608
609 /**
610 * gmenu_desktopappinfo_list_actions:
611 * @appinfo: a #GMenuDesktopAppInfo
612 *
613 * Returns the list of "additional application actions" supported on the
614 * desktop file, as per the desktop file specification.
615 *
616 * As per the specification, this is the list of actions that are
617 * explicitly listed in the "Actions" key of the [Desktop Entry] group.
618 *
619 * Returns: (array zero-terminated=1) (element-type utf8) (transfer none): a list of strings, always non-%NULL
620 **/
621 const gchar * const * gmenu_desktopappinfo_list_actions (GMenuDesktopAppInfo *appinfo)
622 {
623 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
624 return g_desktop_app_info_list_actions (info->super_appinfo);
625 }
626
627 /**
628 * gmenu_desktopappinfo_launch_action:
629 * @appinfo: a #GMenuDesktopAppInfo
630 * @action_name: the name of the action as from
631 * g_desktop_app_info_list_actions()
632 * @launch_context: (nullable): a #GAppLaunchContext
633 *
634 * Activates the named application action.
635 *
636 * You may only call this function on action names that were
637 * returned from g_desktop_app_info_list_actions().
638 *
639 * Note that if the main entry of the desktop file indicates that the
640 * application supports startup notification, and @launch_context is
641 * non-%NULL, then startup notification will be used when activating the
642 * action (and as such, invocation of the action on the receiving side
643 * must signal the end of startup notification when it is completed).
644 * This is the expected behaviour of applications declaring additional
645 * actions, as per the desktop file specification.
646 *
647 * As with g_app_info_launch() there is no way to detect failures that
648 * occur while using this function.
649 */
650 void gmenu_desktopappinfo_launch_action (GMenuDesktopAppInfo *appinfo, const gchar *action_name, GAppLaunchContext *launch_context)
651 {
652 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
653 g_desktop_app_info_launch_action (info->super_appinfo, action_name, launch_context);
654 }
655
656 /**
657 * gmenu_desktopappinfo_get_action_name:
658 * @appinfo: a #GMenuDesktopAppInfo
659 * @action_name: the name of the action as from
660 * gmenu_desktopappinfo_list_actions()
661 *
662 * Gets the user-visible display name of the "additional application
663 * action" specified by @action_name.
664 *
665 * This corresponds to the "Name" key within the keyfile group for the
666 * action.
667 *
668 * Returns: (transfer full): the locale-specific action name
669 *
670 * Since: 2.38
671 */
672 gchar * gmenu_desktopappinfo_get_action_name (GMenuDesktopAppInfo *appinfo, const gchar *action_name)
673 {
674 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
675 return g_desktop_app_info_get_action_name (info->super_appinfo, action_name);
676 }
677
678 /**
679 * gmenu_desktopappinfo_launch_uris_as_manager:
680 * @appinfo: a #GMenuDesktopAppInfo
681 * @uris: (element-type utf8): List of URIs
682 * @launch_context: (nullable): a #GAppLaunchContext
683 * @spawn_flags: #GSpawnFlags, used for each process
684 * @user_setup: (scope async) (nullable): a #GSpawnChildSetupFunc, used once
685 * for each process.
686 * @user_setup_data: (closure user_setup) (nullable): User data for @user_setup
687 * @pid_callback: (scope call) (nullable): Callback for child processes
688 * @pid_callback_data: (closure pid_callback) (nullable): User data for @callback
689 * @error: return location for a #GError, or %NULL
690 *
691 * This function performs the equivalent of g_app_info_launch_uris(),
692 * but is intended primarily for operating system components that
693 * launch applications. Ordinary applications should use
694 * g_app_info_launch_uris().
695 *
696 * If the application is launched via GSpawn, then @spawn_flags, @user_setup
697 * and @user_setup_data are used for the call to g_spawn_async().
698 * Additionally, @pid_callback (with @pid_callback_data) will be called to
699 * inform about the PID of the created process. See g_spawn_async_with_pipes()
700 * for information on certain parameter conditions that can enable an
701 * optimized posix_spawn() codepath to be used.
702 *
703 * If application launching occurs via some other mechanism (eg: D-Bus
704 * activation) then @spawn_flags, @user_setup, @user_setup_data,
705 * @pid_callback and @pid_callback_data are ignored.
706 *
707 * Returns: %TRUE on successful launch, %FALSE otherwise.
708 */
709 gboolean gmenu_desktopappinfo_launch_uris_as_manager (GMenuDesktopAppInfo *appinfo,
710 GList *uris,
711 GAppLaunchContext *launch_context,
712 GSpawnFlags spawn_flags,
713 GSpawnChildSetupFunc user_setup,
714 gpointer user_setup_data,
715 GDesktopAppLaunchCallback pid_callback,
716 gpointer pid_callback_data,
717 GError **error)
718 {
719 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
720 return g_desktop_app_info_launch_uris_as_manager (info->super_appinfo,
721 uris,
722 launch_context,
723 spawn_flags,
724 user_setup,
725 user_setup_data,
726 pid_callback,
727 pid_callback_data,
728 error);
729 }
730
731 /**
732 * gmenu_desktopappinfo_get_is_flatpak:
733 * @appinfo: a #GMenuMenuDesktopAppInfo
734 *
735 * Returns: %TRUE if @info specifies a flatpak app, %FALSE otherwise
736 */
737 gboolean gmenu_desktopappinfo_get_is_flatpak (GMenuDesktopAppInfo *appinfo)
738 {
739 return appinfo->is_flatpak;
740 }
741
742 /**
743 * gmenu_desktopappinfo_get_flatpak_app_id:
744 * @appinfo: a #GMenuMenuDesktopAppInfo
745 *
746 * This function looks up the "X-Flatpak" key of the [Desktop Entry] group,
747 * which contains the Flatpak App ID
748 *
749 * Returns: (nullable): the flatpak app id or %NULL
750 */
751 const char *
752 gmenu_desktopappinfo_get_flatpak_app_id (GMenuDesktopAppInfo *appinfo)
753 {
754 return appinfo->flatpak_app_id;
755 }
0 /*
1 * gmenu-desktop-app-info.h
2 * Copyright (C) 2020 Lars Mueller <lmueller@cobinja.fritz.box>
3 *
4 * gmenutest is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * gmenutest is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18
19 #ifndef _GMENU_DESKTOPAPPINFO_H_
20 #define _GMENU_DESKTOPAPPINFO_H_
21
22 #ifndef GMENU_I_KNOW_THIS_IS_UNSTABLE
23 #error "libgnome-menu should only be used if you understand that it's subject to frequent change, and is not supported as a fixed API/ABI or as part of the platform"
24 #endif
25
26 #include <gio/gdesktopappinfo.h>
27
28 G_BEGIN_DECLS
29
30 #define GMENU_TYPE_DESKTOPAPPINFO (gmenu_desktopappinfo_get_type ())
31 #define GMENU_DESKTOPAPPINFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMENU_TYPE_DESKTOPAPPINFO, GMenuDesktopAppInfo))
32 #define GMENU_DESKTOPAPPINFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMENU_TYPE_DESKTOPAPPINFO, GMenuDesktopAppInfoClass))
33 #define GMENU_IS_DESKTOPAPPINFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMENU_TYPE_DESKTOPAPPINFO))
34 #define GMENU_IS_DESKTOPAPPINFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GMENU_TYPE_DESKTOPAPPINFO))
35 #define GMENU_DESKTOPAPPINFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMENU_TYPE_DESKTOPAPPINFO, GMenuDesktopAppInfoClass))
36
37 typedef struct _GMenuDesktopAppInfoClass GMenuDesktopAppInfoClass;
38 typedef struct _GMenuDesktopAppInfo GMenuDesktopAppInfo;
39
40 struct _GMenuDesktopAppInfoClass
41 {
42 GObjectClass parent_class;
43 };
44
45 #define GMENU_DESKTOPAPPINFO_FLATPAK_SUFFIX ":flatpak"
46
47 GType gmenu_desktopappinfo_get_type (void) G_GNUC_CONST;
48
49 GMenuDesktopAppInfo* gmenu_desktopappinfo_new_from_filename (gchar *filename);
50 GMenuDesktopAppInfo *gmenu_desktopappinfo_new_from_keyfile (GKeyFile *key_file);
51
52 const char * gmenu_desktopappinfo_get_filename (GMenuDesktopAppInfo *appinfo);
53 const char * gmenu_desktopappinfo_get_generic_name (GMenuDesktopAppInfo *appinfo);
54 const char * gmenu_desktopappinfo_get_categories (GMenuDesktopAppInfo *appinfo);
55 const char * const *gmenu_desktopappinfo_get_keywords (GMenuDesktopAppInfo *appinfo);
56 gboolean gmenu_desktopappinfo_get_nodisplay (GMenuDesktopAppInfo *appinfo);
57 gboolean gmenu_desktopappinfo_get_show_in (GMenuDesktopAppInfo *appinfo, const gchar *desktop_env);
58 const char * gmenu_desktopappinfo_get_startup_wm_class (GMenuDesktopAppInfo *appinfo);
59 GMenuDesktopAppInfo *gmenu_desktopappinfo_new (const char *desktop_id);
60 gboolean gmenu_desktopappinfo_get_is_hidden (GMenuDesktopAppInfo *appinfo);
61 gboolean gmenu_desktopappinfo_has_key (GMenuDesktopAppInfo *appinfo, const char *key);
62 char * gmenu_desktopappinfo_get_string (GMenuDesktopAppInfo *appinfo, const char *key);
63 char * gmenu_desktopappinfo_get_locale_string (GMenuDesktopAppInfo *appinfo, const char *key);
64 gboolean gmenu_desktopappinfo_get_boolean (GMenuDesktopAppInfo *appinfo, const char *key);
65 const gchar * const * gmenu_desktopappinfo_list_actions (GMenuDesktopAppInfo *appinfo);
66 void gmenu_desktopappinfo_launch_action (GMenuDesktopAppInfo *appinfo, const gchar *action_name, GAppLaunchContext *launch_context);
67 gchar * gmenu_desktopappinfo_get_action_name (GMenuDesktopAppInfo *appinfo, const gchar *action_name);
68 gboolean gmenu_desktopappinfo_launch_uris_as_manager (GMenuDesktopAppInfo *appinfo,
69 GList *uris,
70 GAppLaunchContext *launch_context,
71 GSpawnFlags spawn_flags,
72 GSpawnChildSetupFunc user_setup,
73 gpointer user_setup_data,
74 GDesktopAppLaunchCallback pid_callback,
75 gpointer pid_callback_data,
76 GError **error);
77
78 gboolean gmenu_desktopappinfo_get_is_flatpak (GMenuDesktopAppInfo *appinfo);
79 const char * gmenu_desktopappinfo_get_flatpak_app_id (GMenuDesktopAppInfo *appinfo);
80
81 G_END_DECLS
82
83 #endif /* _GMENU_DESKTOPAPPINFO_H_ */
84
129129
130130 guint is_excluded : 1;
131131 guint is_unallocated : 1;
132 guint is_flatpak : 1;
132133 };
133134
134135 struct GMenuTreeSeparator
12641265 * gmenu_tree_entry_get_app_info:
12651266 * @entry: a #GMenuTreeEntry
12661267 *
1267 * Returns: (transfer none): The #GDesktopAppInfo for this entry
1268 * Returns: (transfer none): The #GMenuDesktopAppInfo for this entry
12681269 */
1269 GDesktopAppInfo *
1270 GMenuDesktopAppInfo *
12701271 gmenu_tree_entry_get_app_info (GMenuTreeEntry *entry)
12711272 {
12721273 g_return_val_if_fail (entry != NULL, NULL);
12941295 gmenu_tree_entry_get_is_nodisplay_recurse (GMenuTreeEntry *entry)
12951296 {
12961297 GMenuTreeDirectory *directory;
1297 GDesktopAppInfo *app_info;
1298 GMenuDesktopAppInfo *app_info;
12981299
12991300 g_return_val_if_fail (entry != NULL, FALSE);
13001301
13011302 app_info = gmenu_tree_entry_get_app_info (entry);
13021303
1303 if (g_desktop_app_info_get_nodisplay (app_info))
1304 if (gmenu_desktopappinfo_get_nodisplay (app_info))
13041305 return TRUE;
13051306
13061307 directory = entry->item.parent;
13131314 }
13141315
13151316 return FALSE;
1317 }
1318
1319 gboolean gmenu_tree_entry_get_is_flatpak (GMenuTreeEntry *entry)
1320 {
1321 GMenuDesktopAppInfo *app_info;
1322
1323 g_return_val_if_fail (entry != NULL, FALSE);
1324
1325 app_info = gmenu_tree_entry_get_app_info (entry);
1326
1327 return gmenu_desktopappinfo_get_is_flatpak (app_info);
13161328 }
13171329
13181330 gboolean
34653477 delete = TRUE;
34663478 }
34673479
3468 /* No need to filter out based on TryExec since GDesktopAppInfo cannot
3480 /* No need to filter out based on TryExec since GMenuDesktopAppInfo cannot
34693481 * deal with .desktop files with a failed TryExec. */
34703482
34713483 if (delete)
2323 #error "libgnome-menu should only be used if you understand that it's subject to frequent change, and is not supported as a fixed API/ABI or as part of the platform"
2424 #endif
2525
26 #include <gio/gdesktopappinfo.h>
26 #include "gmenu-desktopappinfo.h"
2727
2828 G_BEGIN_DECLS
2929
131131 GMenuTreeEntry *entry);
132132
133133
134 GDesktopAppInfo *gmenu_tree_entry_get_app_info (GMenuTreeEntry *entry);
134 GMenuDesktopAppInfo *gmenu_tree_entry_get_app_info (GMenuTreeEntry *entry);
135135 GMenuTreeDirectory *gmenu_tree_entry_get_parent (GMenuTreeEntry *entry);
136136 GMenuTree *gmenu_tree_entry_get_tree (GMenuTreeEntry *entry);
137137
141141 gboolean gmenu_tree_entry_get_is_nodisplay_recurse (GMenuTreeEntry *entry);
142142 gboolean gmenu_tree_entry_get_is_excluded (GMenuTreeEntry *entry);
143143 gboolean gmenu_tree_entry_get_is_unallocated (GMenuTreeEntry *entry);
144 gboolean gmenu_tree_entry_get_is_flatpak (GMenuTreeEntry *entry);
144145
145146 GMenuTreeDirectory *gmenu_tree_header_get_directory (GMenuTreeHeader *header);
146147 GMenuTree *gmenu_tree_header_get_tree (GMenuTreeHeader *header);
00 public_headers = [
11 'gmenu-tree.h',
2 'gmenu-desktopappinfo.h'
23 ]
34
45 public_sources = [
56 'gmenu-tree.c',
7 'gmenu-desktopappinfo.c',
68 public_headers,
79 ]
810
7274 identifier_prefix: 'GMenu',
7375 symbol_prefix: 'gmenu',
7476 includes: 'Gio-2.0',
75 header: 'gmenu-tree.h',
7677 install: true,
7778 install_dir_gir: join_paths(datadir, 'gir-1.0'),
7879 export_packages: 'libcinnamon-menu-3.0',