Codebase list cinnamon-menus / 783bf05
Update upstream source from tag 'upstream/4.8.0' Update to upstream version '4.8.0' with Debian dir 9194c0824dbad47f7f33f1d444b45d150fca74fc Norbert Preining 3 years ago
10 changed file(s) with 919 addition(s) and 45 deletion(s). Raw diff Collapse all Expand all
3737 fi
3838
3939 jobs:
40 "mint19":
40 "mint20":
4141 <<: *shared
4242 docker:
43 - image: linuxmintd/mint19-amd64
43 - image: linuxmintd/mint20-amd64
4444
45 "lmde3":
45 "lmde4":
4646 <<: *shared
4747 docker:
48 - image: linuxmintd/lmde3-amd64
48 - image: linuxmintd/lmde4-amd64
4949
5050 workflows:
5151 version: 2
5252 build:
5353 jobs:
54 - "mint19"
55 - "lmde3"
54 - "mint20"
55 - "lmde4"
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 <cobinja@yahoo.de>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110, USA.
18 */
19
20 #include "gmenu-desktopappinfo.h"
21 #include <gio/gdesktopappinfo.h>
22
23 struct _GMenuDesktopAppInfo
24 {
25 GObject parent_instance;
26
27 GDesktopAppInfo *super_appinfo;
28 gchar *desktop_id;
29 gboolean is_flatpak;
30 gchar *startup_wm_class;
31 gchar *flatpak_app_id;
32 };
33
34 // This function sets desktop id and startup wm class and adds ":flatpak" for flatpak apps
35 static void
36 update_app_data (GMenuDesktopAppInfo *info)
37 {
38 const gchar *exec;
39 const gchar *id;
40 const gchar *startup_wm_class;
41
42 g_free (info->desktop_id);
43 info->desktop_id = NULL;
44
45 g_free (info->startup_wm_class);
46 info->startup_wm_class = NULL;
47
48 g_free (info->flatpak_app_id);
49 info->flatpak_app_id = NULL;
50
51 if (info->super_appinfo != NULL)
52 {
53 exec = g_app_info_get_executable (G_APP_INFO (info->super_appinfo));
54 id = g_app_info_get_id (G_APP_INFO (info->super_appinfo));
55 startup_wm_class = g_desktop_app_info_get_startup_wm_class (info->super_appinfo);
56
57 if (strstr (exec, "flatpak") || strstr (exec, "bwrap"))
58 {
59 info->desktop_id = g_strconcat (id, GMENU_DESKTOPAPPINFO_FLATPAK_SUFFIX, NULL);
60 if (startup_wm_class)
61 {
62 info->startup_wm_class = g_strconcat (startup_wm_class, GMENU_DESKTOPAPPINFO_FLATPAK_SUFFIX, NULL);
63 }
64
65 // if (g_desktop_app_info_has_key (info->super_appinfo, "X-Flatpak"))
66 // {
67 info->flatpak_app_id = g_desktop_app_info_get_string (info->super_appinfo, "X-Flatpak");
68 // }
69
70 info->is_flatpak = TRUE;
71 } else {
72 info->desktop_id = g_strdup (id);
73 info->is_flatpak = FALSE;
74 info->startup_wm_class = g_strdup (startup_wm_class);
75 }
76 }
77 }
78
79 static GAppInfo *
80 gmenu_desktopappinfo_dup (GAppInfo *appinfo)
81 {
82 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
83 GMenuDesktopAppInfo *new_info;
84
85 new_info = g_object_new (GMENU_TYPE_DESKTOPAPPINFO, NULL);
86
87 new_info->super_appinfo = G_DESKTOP_APP_INFO (g_app_info_dup(G_APP_INFO(info->super_appinfo)));
88
89 update_app_data (new_info);
90
91 return G_APP_INFO (new_info);
92 }
93
94 static gboolean
95 gmenu_desktopappinfo_equal (GAppInfo *appinfo1,
96 GAppInfo *appinfo2)
97 {
98 GMenuDesktopAppInfo *info1 = GMENU_DESKTOPAPPINFO (appinfo1);
99 GMenuDesktopAppInfo *info2 = GMENU_DESKTOPAPPINFO (appinfo2);
100
101 if (info1->desktop_id == NULL ||
102 info2->desktop_id == NULL)
103 return info1 == info2;
104
105 return strcmp (info1->desktop_id, info2->desktop_id) == 0;
106 }
107
108 static const char *
109 gmenu_desktopappinfo_get_id (GAppInfo *appinfo)
110 {
111 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
112
113 return info->desktop_id;
114 }
115
116 static const char *
117 gmenu_desktopappinfo_get_name (GAppInfo *appinfo)
118 {
119 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
120 return g_app_info_get_name (G_APP_INFO(info->super_appinfo));
121 }
122
123 static const char *
124 gmenu_desktopappinfo_get_description (GAppInfo *appinfo)
125 {
126 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
127 return g_app_info_get_description (G_APP_INFO(info->super_appinfo));
128 }
129
130 static const char *
131 gmenu_desktopappinfo_get_executable (GAppInfo *appinfo)
132 {
133 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
134 return g_app_info_get_executable (G_APP_INFO(info->super_appinfo));
135 }
136
137 static GIcon *
138 gmenu_desktopappinfo_get_icon (GAppInfo *appinfo)
139 {
140 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
141 return g_app_info_get_icon (G_APP_INFO(info->super_appinfo));
142 }
143
144 static gboolean
145 gmenu_desktopappinfo_launch (GAppInfo *appinfo, GList *files, GAppLaunchContext *launch_context, GError **error)
146 {
147 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
148 return g_app_info_launch (G_APP_INFO(info->super_appinfo), files, launch_context, error);
149 }
150
151 static gboolean
152 gmenu_desktopappinfo_supports_uris (GAppInfo *appinfo)
153 {
154 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
155 return g_app_info_supports_uris (G_APP_INFO(info->super_appinfo));
156 }
157
158 static gboolean
159 gmenu_desktopappinfo_supports_files (GAppInfo *appinfo)
160 {
161 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
162 return g_app_info_supports_files (G_APP_INFO(info->super_appinfo));
163 }
164
165 static gboolean
166 gmenu_desktopappinfo_launch_uris (GAppInfo *appinfo,
167 GList *uris,
168 GAppLaunchContext *launch_context,
169 GError **error)
170 {
171 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
172 return g_app_info_launch_uris (G_APP_INFO(info->super_appinfo), uris, launch_context, error);
173 }
174
175 static gboolean
176 gmenu_desktopappinfo_should_show (GAppInfo *appinfo)
177 {
178 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
179 return g_app_info_should_show (G_APP_INFO(info->super_appinfo));
180 }
181
182 static gboolean
183 gmenu_desktopappinfo_set_as_default_for_type (GAppInfo *appinfo,
184 const char *content_type,
185 GError **error)
186 {
187 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
188 return g_app_info_set_as_default_for_type (G_APP_INFO(info->super_appinfo), content_type, error);
189 }
190
191 static gboolean
192 gmenu_desktopappinfo_set_as_default_for_extension (GAppInfo *appinfo,
193 const char *extension,
194 GError **error)
195 {
196 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
197 return g_app_info_set_as_default_for_extension (G_APP_INFO(info->super_appinfo), extension, error);
198 }
199
200 static gboolean
201 gmenu_desktopappinfo_add_supports_type (GAppInfo *appinfo,
202 const char *content_type,
203 GError **error)
204 {
205 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
206 return g_app_info_add_supports_type (G_APP_INFO(info->super_appinfo), content_type, error);
207 }
208
209 static gboolean
210 gmenu_desktopappinfo_can_remove_supports_type (GAppInfo *appinfo)
211 {
212 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
213 return g_app_info_can_remove_supports_type (G_APP_INFO(info->super_appinfo));
214 }
215
216 static gboolean
217 gmenu_desktopappinfo_remove_supports_type (GAppInfo *appinfo,
218 const char *content_type,
219 GError **error)
220 {
221 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
222 return g_app_info_remove_supports_type (G_APP_INFO(info->super_appinfo), content_type, error);
223 }
224
225 static gboolean
226 gmenu_desktopappinfo_can_delete (GAppInfo *appinfo)
227 {
228 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
229 return g_app_info_can_delete (G_APP_INFO(info->super_appinfo));
230 }
231
232 static gboolean
233 gmenu_desktopappinfo_delete (GAppInfo *appinfo)
234 {
235 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
236 return g_app_info_delete (G_APP_INFO(info->super_appinfo));
237 }
238
239 static const char *
240 gmenu_desktopappinfo_get_commandline (GAppInfo *appinfo)
241 {
242 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
243 return g_app_info_get_commandline (G_APP_INFO(info->super_appinfo));
244 }
245
246 static const char *
247 gmenu_desktopappinfo_get_display_name (GAppInfo *appinfo)
248 {
249 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
250 return g_app_info_get_display_name (G_APP_INFO(info->super_appinfo));
251 }
252
253 static gboolean
254 gmenu_desktopappinfo_set_as_last_used_for_type (GAppInfo *appinfo,
255 const char *content_type,
256 GError **error)
257 {
258 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
259 return g_app_info_set_as_last_used_for_type (G_APP_INFO(info->super_appinfo), content_type, error);
260 }
261
262 static const char **
263 gmenu_desktopappinfo_get_supported_types (GAppInfo *appinfo)
264 {
265 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
266 return g_app_info_get_supported_types (G_APP_INFO(info->super_appinfo));
267 }
268
269 static void
270 gmenu_desktopappinfo_interface_init (GAppInfoIface *iface)
271 {
272 iface->dup = gmenu_desktopappinfo_dup;
273 iface->equal = gmenu_desktopappinfo_equal;
274 iface->get_id = gmenu_desktopappinfo_get_id;
275 iface->get_name = gmenu_desktopappinfo_get_name;
276 iface->get_description = gmenu_desktopappinfo_get_description;
277 iface->get_executable = gmenu_desktopappinfo_get_executable;
278 iface->get_icon = gmenu_desktopappinfo_get_icon;
279 iface->launch = gmenu_desktopappinfo_launch;
280 iface->supports_uris = gmenu_desktopappinfo_supports_uris;
281 iface->supports_files = gmenu_desktopappinfo_supports_files;
282 iface->launch_uris = gmenu_desktopappinfo_launch_uris;
283 iface->should_show = gmenu_desktopappinfo_should_show;
284 iface->set_as_default_for_type = gmenu_desktopappinfo_set_as_default_for_type;
285 iface->set_as_default_for_extension = gmenu_desktopappinfo_set_as_default_for_extension;
286 iface->add_supports_type = gmenu_desktopappinfo_add_supports_type;
287 iface->can_remove_supports_type = gmenu_desktopappinfo_can_remove_supports_type;
288 iface->remove_supports_type = gmenu_desktopappinfo_remove_supports_type;
289 iface->can_delete = gmenu_desktopappinfo_can_delete;
290 iface->do_delete = gmenu_desktopappinfo_delete;
291 iface->get_commandline = gmenu_desktopappinfo_get_commandline;
292 iface->get_display_name = gmenu_desktopappinfo_get_display_name;
293 iface->set_as_last_used_for_type = gmenu_desktopappinfo_set_as_last_used_for_type;
294 iface->get_supported_types = gmenu_desktopappinfo_get_supported_types;
295 }
296
297 G_DEFINE_TYPE_WITH_CODE (GMenuDesktopAppInfo, gmenu_desktopappinfo, G_TYPE_OBJECT,
298 G_IMPLEMENT_INTERFACE (G_TYPE_APP_INFO, gmenu_desktopappinfo_interface_init))
299
300 static void
301 gmenu_desktopappinfo_init (GMenuDesktopAppInfo *info)
302 {
303 info->super_appinfo = NULL;
304 info->desktop_id = NULL;
305 info->flatpak_app_id = NULL;
306 info->startup_wm_class = NULL;
307 }
308
309 static void
310 gmenu_desktopappinfo_finalize (GObject *object)
311 {
312 /* TODO: Add deinitalization code here */
313
314 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (object);
315
316 g_free (info->desktop_id);
317 g_free (info->startup_wm_class);
318 g_free (info->flatpak_app_id);
319
320 if (info->super_appinfo)
321 g_object_unref (info->super_appinfo);
322 }
323
324 static void
325 gmenu_desktopappinfo_class_init (GMenuDesktopAppInfoClass *klass)
326 {
327 GObjectClass* object_class = G_OBJECT_CLASS (klass);
328
329 object_class->finalize = gmenu_desktopappinfo_finalize;
330 }
331
332 /**
333 * gmenu_desktopappinfo_new:
334 * @desktop_id: the desktop file id
335 *
336 * This is currently unused in Cinnamon and does not make sense here
337 * because the desktop id as used here is not necessarily unique
338 *
339 * Returns: (nullable): %NULL
340 */
341 GMenuDesktopAppInfo*
342 gmenu_desktopappinfo_new (const char *desktop_id)
343 {
344 return NULL;
345 }
346
347 /**
348 * gmenu_desktopappinfo_new_from_filename:
349 * @filename: (type filename): the path of a desktop file, in the GLib
350 * filename encoding
351 *
352 * Creates a new #GMenuDesktopAppInfo.
353 *
354 * Returns: (nullable): a new #GMenuDesktopAppInfo or %NULL on error.
355 **/
356 GMenuDesktopAppInfo*
357 gmenu_desktopappinfo_new_from_filename (gchar *filename)
358 {
359 GMenuDesktopAppInfo *info = NULL;
360
361 info = g_object_new (GMENU_TYPE_DESKTOPAPPINFO, NULL);
362 info->super_appinfo = g_desktop_app_info_new_from_filename (filename);
363
364 if (info->super_appinfo)
365 {
366 update_app_data (info);
367 return info;
368 } else {
369 g_object_unref (info);
370 return NULL;
371 }
372 }
373
374 /**
375 * gmenu_desktopappinfo_new_from_keyfile:
376 * @key_file: an opened #GKeyFile
377 *
378 * Creates a new #GMenuDesktopAppInfo.
379 *
380 * Returns: (nullable): a new #GMenuDesktopAppInfo or %NULL on error.
381 **/
382 GMenuDesktopAppInfo*
383 gmenu_desktopappinfo_new_from_keyfile (GKeyFile *keyfile)
384 {
385 GMenuDesktopAppInfo *info = NULL;
386
387 info = g_object_new (GMENU_TYPE_DESKTOPAPPINFO, NULL);
388 info->super_appinfo = g_desktop_app_info_new_from_keyfile (keyfile);
389
390 if (info->super_appinfo)
391 {
392 update_app_data (info);
393 return info;
394 } else {
395 g_object_unref (info);
396 return NULL;
397 }
398 }
399
400 /**
401 * gmenu_desktopappinfo_get_filename:
402 * @appinfo: a #MenuGDesktopAppInfo
403 *
404 * When @info was created from a known filename, return it. In some
405 * situations such as the #GMenuDesktopAppInfo returned from
406 * gmenu_desktopappinfo_new_from_keyfile(), this function will return %NULL.
407 *
408 * Returns: (type filename): The full path to the file for @info,
409 * or %NULL if not known.
410 * Since: 2.24
411 */
412 const char * gmenu_desktopappinfo_get_filename (GMenuDesktopAppInfo *appinfo)
413 {
414 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
415 return g_desktop_app_info_get_filename (info->super_appinfo);
416 }
417
418 /**
419 * gmenu_desktopappinfo_get_generic_name:
420 * @appinfo: a #MenuGDesktopAppInfo
421 *
422 * Gets the generic name from the destkop file.
423 *
424 * Returns: The value of the GenericName key
425 */
426 const char * gmenu_desktopappinfo_get_generic_name (GMenuDesktopAppInfo *appinfo)
427 {
428 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
429 return g_desktop_app_info_get_generic_name (info->super_appinfo);
430 }
431
432 /**
433 * gmenu_desktopappinfo_get_categories:
434 * @appinfo: a #GMenuDesktopAppInfo
435 *
436 * Gets the categories from the desktop file.
437 *
438 * Returns: The unparsed Categories key from the desktop file;
439 * i.e. no attempt is made to split it by ';' or validate it.
440 */
441 const char * gmenu_desktopappinfo_get_categories (GMenuDesktopAppInfo *appinfo)
442 {
443 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
444 return g_desktop_app_info_get_categories (info->super_appinfo);
445 }
446
447 /**
448 * gmenu_desktopappinfo_get_keywords:
449 * @appinfo: a #GMenuDesktopAppInfo
450 *
451 * Gets the keywords from the desktop file.
452 *
453 * Returns: (transfer none): The value of the Keywords key
454 */
455 const char * const *gmenu_desktopappinfo_get_keywords (GMenuDesktopAppInfo *appinfo)
456 {
457 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
458 return g_desktop_app_info_get_keywords (info->super_appinfo);
459 }
460
461 /**
462 * gmenu_desktopappinfo_get_nodisplay:
463 * @appinfo: a #GMenuDesktopAppInfo
464 *
465 * Gets the value of the NoDisplay key, which helps determine if the
466 * application info should be shown in menus. See
467 * #G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY and g_app_info_should_show().
468 *
469 * Returns: The value of the NoDisplay key
470 */
471 gboolean gmenu_desktopappinfo_get_nodisplay (GMenuDesktopAppInfo *appinfo)
472 {
473 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
474 return g_desktop_app_info_get_nodisplay (info->super_appinfo);
475 }
476
477 /**
478 * gmenu_desktopappinfo_get_show_in:
479 * @appinfo: a #GMenuDesktopAppInfo
480 * @desktop_env: (nullable): a string specifying a desktop name
481 *
482 * Checks if the application info should be shown in menus that list available
483 * applications for a specific name of the desktop, based on the
484 * `OnlyShowIn` and `NotShowIn` keys.
485 *
486 * @desktop_env should typically be given as %NULL, in which case the
487 * `XDG_CURRENT_DESKTOP` environment variable is consulted. If you want
488 * to override the default mechanism then you may specify @desktop_env,
489 * but this is not recommended.
490 *
491 * Note that g_app_info_should_show() for @info will include this check (with
492 * %NULL for @desktop_env) as well as additional checks.
493 *
494 * Returns: %TRUE if the @info should be shown in @desktop_env according to the
495 * `OnlyShowIn` and `NotShowIn` keys, %FALSE
496 * otherwise.
497 */
498 gboolean gmenu_desktopappinfo_get_show_in (GMenuDesktopAppInfo *appinfo, const gchar *desktop_env)
499 {
500 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
501 return g_desktop_app_info_get_show_in (info->super_appinfo, desktop_env);
502 }
503
504 /**
505 * gmenu_desktopappinfo_get_startup_wm_class:
506 * @appinfo: a #GMenuDesktopAppInfo that supports startup notify
507 *
508 * Retrieves the StartupWMClass field from @info. This represents the
509 * WM_CLASS property of the main window of the application, if launched
510 * through @info.
511 *
512 * Note: The returned value contain the suffix ":flatpak" if @info specifies a flatpak app
513 * and if the desktop file has a StartupWMClass
514 *
515 * Returns: (transfer none): the startup WM class, or %NULL if none is set
516 * in the desktop file.
517 */
518 const char * gmenu_desktopappinfo_get_startup_wm_class (GMenuDesktopAppInfo *appinfo)
519 {
520 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
521
522 return info->startup_wm_class;
523 }
524
525 /**
526 * gmenu_desktopappinfo_get_is_hidden:
527 * @appinfo: a #GMenuDesktopAppInfo.
528 *
529 * A desktop file is hidden if the Hidden key in it is
530 * set to True.
531 *
532 * Returns: %TRUE if hidden, %FALSE otherwise.
533 **/
534 gboolean gmenu_desktopappinfo_get_is_hidden (GMenuDesktopAppInfo *appinfo)
535 {
536 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
537 return g_desktop_app_info_get_is_hidden (info->super_appinfo);
538 }
539
540 /**
541 * gmenu_desktopappinfo_has_key:
542 * @appinfo: a #GMenuDesktopAppInfo
543 * @key: the key to look up
544 *
545 * Returns whether @key exists in the "Desktop Entry" group
546 * of the keyfile backing @info.
547 *
548 * Returns: %TRUE if the @key exists
549 */
550 gboolean gmenu_desktopappinfo_has_key (GMenuDesktopAppInfo *appinfo, const char *key)
551 {
552 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
553 return g_desktop_app_info_has_key (info->super_appinfo, key);
554 }
555
556 /**
557 * gmenu_desktopappinfo_get_string:
558 * @appinfo: a #GMenuDesktopAppInfo
559 * @key: the key to look up
560 *
561 * Looks up a string value in the keyfile backing @info.
562 *
563 * The @key is looked up in the "Desktop Entry" group.
564 *
565 * Returns: a newly allocated string, or %NULL if the key
566 * is not found
567 */
568 char * gmenu_desktopappinfo_get_string (GMenuDesktopAppInfo *appinfo, const char *key)
569 {
570 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
571 return g_desktop_app_info_get_string (info->super_appinfo, key);
572 }
573
574 /**
575 * gmenu_desktopappinfo_get_locale_string:
576 * @appinfo: a #GMenuDesktopAppInfo
577 * @key: the key to look up
578 *
579 * Looks up a localized string value in the keyfile backing @info
580 * translated to the current locale.
581 *
582 * The @key is looked up in the "Desktop Entry" group.
583 *
584 * Returns: (nullable): a newly allocated string, or %NULL if the key
585 * is not found
586 */
587 char * gmenu_desktopappinfo_get_locale_string (GMenuDesktopAppInfo *appinfo, const char *key)
588 {
589 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
590 return g_desktop_app_info_get_locale_string (info->super_appinfo, key);
591 }
592
593 /**
594 * gmenu_desktopappinfo_get_boolean:
595 * @appinfo: a #GMenuDesktopAppInfo
596 * @key: the key to look up
597 *
598 * Looks up a boolean value in the keyfile backing @info.
599 *
600 * The @key is looked up in the "Desktop Entry" group.
601 *
602 * Returns: the boolean value, or %FALSE if the key
603 * is not found
604 */
605 gboolean gmenu_desktopappinfo_get_boolean (GMenuDesktopAppInfo *appinfo, const char *key)
606 {
607 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
608 return g_desktop_app_info_get_boolean (info->super_appinfo, key);
609 }
610
611 /**
612 * gmenu_desktopappinfo_list_actions:
613 * @appinfo: a #GMenuDesktopAppInfo
614 *
615 * Returns the list of "additional application actions" supported on the
616 * desktop file, as per the desktop file specification.
617 *
618 * As per the specification, this is the list of actions that are
619 * explicitly listed in the "Actions" key of the [Desktop Entry] group.
620 *
621 * Returns: (array zero-terminated=1) (element-type utf8) (transfer none): a list of strings, always non-%NULL
622 **/
623 const gchar * const * gmenu_desktopappinfo_list_actions (GMenuDesktopAppInfo *appinfo)
624 {
625 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
626 return g_desktop_app_info_list_actions (info->super_appinfo);
627 }
628
629 /**
630 * gmenu_desktopappinfo_launch_action:
631 * @appinfo: a #GMenuDesktopAppInfo
632 * @action_name: the name of the action as from
633 * g_desktop_app_info_list_actions()
634 * @launch_context: (nullable): a #GAppLaunchContext
635 *
636 * Activates the named application action.
637 *
638 * You may only call this function on action names that were
639 * returned from g_desktop_app_info_list_actions().
640 *
641 * Note that if the main entry of the desktop file indicates that the
642 * application supports startup notification, and @launch_context is
643 * non-%NULL, then startup notification will be used when activating the
644 * action (and as such, invocation of the action on the receiving side
645 * must signal the end of startup notification when it is completed).
646 * This is the expected behaviour of applications declaring additional
647 * actions, as per the desktop file specification.
648 *
649 * As with g_app_info_launch() there is no way to detect failures that
650 * occur while using this function.
651 */
652 void gmenu_desktopappinfo_launch_action (GMenuDesktopAppInfo *appinfo, const gchar *action_name, GAppLaunchContext *launch_context)
653 {
654 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
655 g_desktop_app_info_launch_action (info->super_appinfo, action_name, launch_context);
656 }
657
658 /**
659 * gmenu_desktopappinfo_get_action_name:
660 * @appinfo: a #GMenuDesktopAppInfo
661 * @action_name: the name of the action as from
662 * gmenu_desktopappinfo_list_actions()
663 *
664 * Gets the user-visible display name of the "additional application
665 * action" specified by @action_name.
666 *
667 * This corresponds to the "Name" key within the keyfile group for the
668 * action.
669 *
670 * Returns: (transfer full): the locale-specific action name
671 *
672 * Since: 2.38
673 */
674 gchar * gmenu_desktopappinfo_get_action_name (GMenuDesktopAppInfo *appinfo, const gchar *action_name)
675 {
676 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
677 return g_desktop_app_info_get_action_name (info->super_appinfo, action_name);
678 }
679
680 /**
681 * gmenu_desktopappinfo_launch_uris_as_manager:
682 * @appinfo: a #GMenuDesktopAppInfo
683 * @uris: (element-type utf8): List of URIs
684 * @launch_context: (nullable): a #GAppLaunchContext
685 * @spawn_flags: #GSpawnFlags, used for each process
686 * @user_setup: (scope async) (nullable): a #GSpawnChildSetupFunc, used once
687 * for each process.
688 * @user_setup_data: (closure user_setup) (nullable): User data for @user_setup
689 * @pid_callback: (scope call) (nullable): Callback for child processes
690 * @pid_callback_data: (closure pid_callback) (nullable): User data for @callback
691 * @error: return location for a #GError, or %NULL
692 *
693 * This function performs the equivalent of g_app_info_launch_uris(),
694 * but is intended primarily for operating system components that
695 * launch applications. Ordinary applications should use
696 * g_app_info_launch_uris().
697 *
698 * If the application is launched via GSpawn, then @spawn_flags, @user_setup
699 * and @user_setup_data are used for the call to g_spawn_async().
700 * Additionally, @pid_callback (with @pid_callback_data) will be called to
701 * inform about the PID of the created process. See g_spawn_async_with_pipes()
702 * for information on certain parameter conditions that can enable an
703 * optimized posix_spawn() codepath to be used.
704 *
705 * If application launching occurs via some other mechanism (eg: D-Bus
706 * activation) then @spawn_flags, @user_setup, @user_setup_data,
707 * @pid_callback and @pid_callback_data are ignored.
708 *
709 * Returns: %TRUE on successful launch, %FALSE otherwise.
710 */
711 gboolean gmenu_desktopappinfo_launch_uris_as_manager (GMenuDesktopAppInfo *appinfo,
712 GList *uris,
713 GAppLaunchContext *launch_context,
714 GSpawnFlags spawn_flags,
715 GSpawnChildSetupFunc user_setup,
716 gpointer user_setup_data,
717 GDesktopAppLaunchCallback pid_callback,
718 gpointer pid_callback_data,
719 GError **error)
720 {
721 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
722 return g_desktop_app_info_launch_uris_as_manager (info->super_appinfo,
723 uris,
724 launch_context,
725 spawn_flags,
726 user_setup,
727 user_setup_data,
728 pid_callback,
729 pid_callback_data,
730 error);
731 }
732
733 /**
734 * gmenu_desktopappinfo_get_is_flatpak:
735 * @appinfo: a #GMenuMenuDesktopAppInfo
736 *
737 * Returns: %TRUE if @info specifies a flatpak app, %FALSE otherwise
738 */
739 gboolean gmenu_desktopappinfo_get_is_flatpak (GMenuDesktopAppInfo *appinfo)
740 {
741 return appinfo->is_flatpak;
742 }
743
744 /**
745 * gmenu_desktopappinfo_get_flatpak_app_id:
746 * @appinfo: a #GMenuMenuDesktopAppInfo
747 *
748 * This function looks up the "X-Flatpak" key of the [Desktop Entry] group,
749 * which contains the Flatpak App ID
750 *
751 * Returns: (nullable): the flatpak app id or %NULL
752 */
753 const char *
754 gmenu_desktopappinfo_get_flatpak_app_id (GMenuDesktopAppInfo *appinfo)
755 {
756 return appinfo->flatpak_app_id;
757 }
0 /*
1 * gmenu-desktopappinfo.h
2 * Copyright (C) 2020 Lars Mueller <cobinja@yahoo.de>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110, USA.
18 */
19
20
21 #ifndef _GMENU_DESKTOPAPPINFO_H_
22 #define _GMENU_DESKTOPAPPINFO_H_
23
24 #ifndef GMENU_I_KNOW_THIS_IS_UNSTABLE
25 #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"
26 #endif
27
28 #include <gio/gdesktopappinfo.h>
29
30 G_BEGIN_DECLS
31
32 #define GMENU_TYPE_DESKTOPAPPINFO (gmenu_desktopappinfo_get_type ())
33 #define GMENU_DESKTOPAPPINFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMENU_TYPE_DESKTOPAPPINFO, GMenuDesktopAppInfo))
34 #define GMENU_DESKTOPAPPINFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMENU_TYPE_DESKTOPAPPINFO, GMenuDesktopAppInfoClass))
35 #define GMENU_IS_DESKTOPAPPINFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMENU_TYPE_DESKTOPAPPINFO))
36 #define GMENU_IS_DESKTOPAPPINFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GMENU_TYPE_DESKTOPAPPINFO))
37 #define GMENU_DESKTOPAPPINFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMENU_TYPE_DESKTOPAPPINFO, GMenuDesktopAppInfoClass))
38
39 typedef struct _GMenuDesktopAppInfoClass GMenuDesktopAppInfoClass;
40 typedef struct _GMenuDesktopAppInfo GMenuDesktopAppInfo;
41
42 struct _GMenuDesktopAppInfoClass
43 {
44 GObjectClass parent_class;
45 };
46
47 #define GMENU_DESKTOPAPPINFO_FLATPAK_SUFFIX ":flatpak"
48
49 GType gmenu_desktopappinfo_get_type (void) G_GNUC_CONST;
50
51 GMenuDesktopAppInfo* gmenu_desktopappinfo_new_from_filename (gchar *filename);
52 GMenuDesktopAppInfo *gmenu_desktopappinfo_new_from_keyfile (GKeyFile *key_file);
53
54 const char * gmenu_desktopappinfo_get_filename (GMenuDesktopAppInfo *appinfo);
55 const char * gmenu_desktopappinfo_get_generic_name (GMenuDesktopAppInfo *appinfo);
56 const char * gmenu_desktopappinfo_get_categories (GMenuDesktopAppInfo *appinfo);
57 const char * const *gmenu_desktopappinfo_get_keywords (GMenuDesktopAppInfo *appinfo);
58 gboolean gmenu_desktopappinfo_get_nodisplay (GMenuDesktopAppInfo *appinfo);
59 gboolean gmenu_desktopappinfo_get_show_in (GMenuDesktopAppInfo *appinfo, const gchar *desktop_env);
60 const char * gmenu_desktopappinfo_get_startup_wm_class (GMenuDesktopAppInfo *appinfo);
61 GMenuDesktopAppInfo *gmenu_desktopappinfo_new (const char *desktop_id);
62 gboolean gmenu_desktopappinfo_get_is_hidden (GMenuDesktopAppInfo *appinfo);
63 gboolean gmenu_desktopappinfo_has_key (GMenuDesktopAppInfo *appinfo, const char *key);
64 char * gmenu_desktopappinfo_get_string (GMenuDesktopAppInfo *appinfo, const char *key);
65 char * gmenu_desktopappinfo_get_locale_string (GMenuDesktopAppInfo *appinfo, const char *key);
66 gboolean gmenu_desktopappinfo_get_boolean (GMenuDesktopAppInfo *appinfo, const char *key);
67 const gchar * const * gmenu_desktopappinfo_list_actions (GMenuDesktopAppInfo *appinfo);
68 void gmenu_desktopappinfo_launch_action (GMenuDesktopAppInfo *appinfo, const gchar *action_name, GAppLaunchContext *launch_context);
69 gchar * gmenu_desktopappinfo_get_action_name (GMenuDesktopAppInfo *appinfo, const gchar *action_name);
70 gboolean gmenu_desktopappinfo_launch_uris_as_manager (GMenuDesktopAppInfo *appinfo,
71 GList *uris,
72 GAppLaunchContext *launch_context,
73 GSpawnFlags spawn_flags,
74 GSpawnChildSetupFunc user_setup,
75 gpointer user_setup_data,
76 GDesktopAppLaunchCallback pid_callback,
77 gpointer pid_callback_data,
78 GError **error);
79
80 gboolean gmenu_desktopappinfo_get_is_flatpak (GMenuDesktopAppInfo *appinfo);
81 const char * gmenu_desktopappinfo_get_flatpak_app_id (GMenuDesktopAppInfo *appinfo);
82
83 G_END_DECLS
84
85 #endif /* _GMENU_DESKTOPAPPINFO_H_ */
86
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',
0 project('cinnamon-menus', 'c', version : '4.6.1', meson_version: '>=0.40.0')
0 project('cinnamon-menus', 'c', version : '4.8.0', meson_version: '>=0.40.0')
11
22 gnome = import('gnome')
33