Package list cinnamon-menus / 8309f2f
Prevent a crash when changing a desktop file to a malformed format This prevents a crash due to an oversight of a certain developer (me, myself and I) during improvements for flatpak integration Lars Mueller authored 6 months ago Michael Webster committed 6 months ago
1 changed file(s) with 77 addition(s) and 33 deletion(s). Raw diff Collapse all Expand all
7979 static GAppInfo *
8080 gmenu_desktopappinfo_dup (GAppInfo *appinfo)
8181 {
82 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
83
8284 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
8385 GMenuDesktopAppInfo *new_info;
8486
108110 static const char *
109111 gmenu_desktopappinfo_get_id (GAppInfo *appinfo)
110112 {
113 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
114
111115 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
112116
113117 return info->desktop_id;
116120 static const char *
117121 gmenu_desktopappinfo_get_name (GAppInfo *appinfo)
118122 {
123 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
124
119125 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
120126 return g_app_info_get_name (G_APP_INFO(info->super_appinfo));
121127 }
123129 static const char *
124130 gmenu_desktopappinfo_get_description (GAppInfo *appinfo)
125131 {
132 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
133
126134 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
127135 return g_app_info_get_description (G_APP_INFO(info->super_appinfo));
128136 }
130138 static const char *
131139 gmenu_desktopappinfo_get_executable (GAppInfo *appinfo)
132140 {
141 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
142
133143 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
134144 return g_app_info_get_executable (G_APP_INFO(info->super_appinfo));
135145 }
137147 static GIcon *
138148 gmenu_desktopappinfo_get_icon (GAppInfo *appinfo)
139149 {
150 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
151
140152 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
141153 return g_app_info_get_icon (G_APP_INFO(info->super_appinfo));
142154 }
144156 static gboolean
145157 gmenu_desktopappinfo_launch (GAppInfo *appinfo, GList *files, GAppLaunchContext *launch_context, GError **error)
146158 {
159 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
160
147161 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
148162 return g_app_info_launch (G_APP_INFO(info->super_appinfo), files, launch_context, error);
149163 }
151165 static gboolean
152166 gmenu_desktopappinfo_supports_uris (GAppInfo *appinfo)
153167 {
168 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
169
154170 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
155171 return g_app_info_supports_uris (G_APP_INFO(info->super_appinfo));
156172 }
158174 static gboolean
159175 gmenu_desktopappinfo_supports_files (GAppInfo *appinfo)
160176 {
177 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
178
161179 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
162180 return g_app_info_supports_files (G_APP_INFO(info->super_appinfo));
163181 }
168186 GAppLaunchContext *launch_context,
169187 GError **error)
170188 {
189 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
190
171191 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
172192 return g_app_info_launch_uris (G_APP_INFO(info->super_appinfo), uris, launch_context, error);
173193 }
175195 static gboolean
176196 gmenu_desktopappinfo_should_show (GAppInfo *appinfo)
177197 {
198 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
199
178200 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
179201 return g_app_info_should_show (G_APP_INFO(info->super_appinfo));
180202 }
184206 const char *content_type,
185207 GError **error)
186208 {
209 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
210
187211 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
188212 return g_app_info_set_as_default_for_type (G_APP_INFO(info->super_appinfo), content_type, error);
189213 }
193217 const char *extension,
194218 GError **error)
195219 {
220 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
221
196222 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
197223 return g_app_info_set_as_default_for_extension (G_APP_INFO(info->super_appinfo), extension, error);
198224 }
202228 const char *content_type,
203229 GError **error)
204230 {
231 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
232
205233 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
206234 return g_app_info_add_supports_type (G_APP_INFO(info->super_appinfo), content_type, error);
207235 }
209237 static gboolean
210238 gmenu_desktopappinfo_can_remove_supports_type (GAppInfo *appinfo)
211239 {
240 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
241
212242 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
213243 return g_app_info_can_remove_supports_type (G_APP_INFO(info->super_appinfo));
214244 }
218248 const char *content_type,
219249 GError **error)
220250 {
251 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
252
221253 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
222254 return g_app_info_remove_supports_type (G_APP_INFO(info->super_appinfo), content_type, error);
223255 }
225257 static gboolean
226258 gmenu_desktopappinfo_can_delete (GAppInfo *appinfo)
227259 {
260 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
261
228262 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
229263 return g_app_info_can_delete (G_APP_INFO(info->super_appinfo));
230264 }
232266 static gboolean
233267 gmenu_desktopappinfo_delete (GAppInfo *appinfo)
234268 {
269 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
270
235271 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
236272 return g_app_info_delete (G_APP_INFO(info->super_appinfo));
237273 }
239275 static const char *
240276 gmenu_desktopappinfo_get_commandline (GAppInfo *appinfo)
241277 {
278 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
279
242280 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
243281 return g_app_info_get_commandline (G_APP_INFO(info->super_appinfo));
244282 }
246284 static const char *
247285 gmenu_desktopappinfo_get_display_name (GAppInfo *appinfo)
248286 {
287 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
288
249289 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
250290 return g_app_info_get_display_name (G_APP_INFO(info->super_appinfo));
251291 }
255295 const char *content_type,
256296 GError **error)
257297 {
298 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
299
258300 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
259301 return g_app_info_set_as_last_used_for_type (G_APP_INFO(info->super_appinfo), content_type, error);
260302 }
262304 static const char **
263305 gmenu_desktopappinfo_get_supported_types (GAppInfo *appinfo)
264306 {
307 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
308
265309 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
266310 return g_app_info_get_supported_types (G_APP_INFO(info->super_appinfo));
267311 }
411455 */
412456 const char * gmenu_desktopappinfo_get_filename (GMenuDesktopAppInfo *appinfo)
413457 {
414 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
415 return g_desktop_app_info_get_filename (info->super_appinfo);
458 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
459 return g_desktop_app_info_get_filename (appinfo->super_appinfo);
416460 }
417461
418462 /**
425469 */
426470 const char * gmenu_desktopappinfo_get_generic_name (GMenuDesktopAppInfo *appinfo)
427471 {
428 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
429 return g_desktop_app_info_get_generic_name (info->super_appinfo);
472 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
473 return g_desktop_app_info_get_generic_name (appinfo->super_appinfo);
430474 }
431475
432476 /**
440484 */
441485 const char * gmenu_desktopappinfo_get_categories (GMenuDesktopAppInfo *appinfo)
442486 {
443 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
444 return g_desktop_app_info_get_categories (info->super_appinfo);
487 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
488 return g_desktop_app_info_get_categories (appinfo->super_appinfo);
445489 }
446490
447491 /**
454498 */
455499 const char * const *gmenu_desktopappinfo_get_keywords (GMenuDesktopAppInfo *appinfo)
456500 {
457 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
458 return g_desktop_app_info_get_keywords (info->super_appinfo);
501 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
502 return g_desktop_app_info_get_keywords (appinfo->super_appinfo);
459503 }
460504
461505 /**
470514 */
471515 gboolean gmenu_desktopappinfo_get_nodisplay (GMenuDesktopAppInfo *appinfo)
472516 {
473 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
474 return g_desktop_app_info_get_nodisplay (info->super_appinfo);
517 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
518 return g_desktop_app_info_get_nodisplay (appinfo->super_appinfo);
475519 }
476520
477521 /**
497541 */
498542 gboolean gmenu_desktopappinfo_get_show_in (GMenuDesktopAppInfo *appinfo, const gchar *desktop_env)
499543 {
500 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
501 return g_desktop_app_info_get_show_in (info->super_appinfo, desktop_env);
544 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
545 return g_desktop_app_info_get_show_in (appinfo->super_appinfo, desktop_env);
502546 }
503547
504548 /**
517561 */
518562 const char * gmenu_desktopappinfo_get_startup_wm_class (GMenuDesktopAppInfo *appinfo)
519563 {
520 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
521
522 return info->startup_wm_class;
564 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
565
566 return appinfo->startup_wm_class;
523567 }
524568
525569 /**
533577 **/
534578 gboolean gmenu_desktopappinfo_get_is_hidden (GMenuDesktopAppInfo *appinfo)
535579 {
536 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
537 return g_desktop_app_info_get_is_hidden (info->super_appinfo);
580 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
581 return g_desktop_app_info_get_is_hidden (appinfo->super_appinfo);
538582 }
539583
540584 /**
549593 */
550594 gboolean gmenu_desktopappinfo_has_key (GMenuDesktopAppInfo *appinfo, const char *key)
551595 {
552 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
553 return g_desktop_app_info_has_key (info->super_appinfo, key);
596 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
597 return g_desktop_app_info_has_key (appinfo->super_appinfo, key);
554598 }
555599
556600 /**
567611 */
568612 char * gmenu_desktopappinfo_get_string (GMenuDesktopAppInfo *appinfo, const char *key)
569613 {
570 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
571 return g_desktop_app_info_get_string (info->super_appinfo, key);
614 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
615 return g_desktop_app_info_get_string (appinfo->super_appinfo, key);
572616 }
573617
574618 /**
586630 */
587631 char * gmenu_desktopappinfo_get_locale_string (GMenuDesktopAppInfo *appinfo, const char *key)
588632 {
589 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
590 return g_desktop_app_info_get_locale_string (info->super_appinfo, key);
633 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
634 return g_desktop_app_info_get_locale_string (appinfo->super_appinfo, key);
591635 }
592636
593637 /**
604648 */
605649 gboolean gmenu_desktopappinfo_get_boolean (GMenuDesktopAppInfo *appinfo, const char *key)
606650 {
607 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
608 return g_desktop_app_info_get_boolean (info->super_appinfo, key);
651 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
652 return g_desktop_app_info_get_boolean (appinfo->super_appinfo, key);
609653 }
610654
611655 /**
622666 **/
623667 const gchar * const * gmenu_desktopappinfo_list_actions (GMenuDesktopAppInfo *appinfo)
624668 {
625 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
626 return g_desktop_app_info_list_actions (info->super_appinfo);
669 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
670 return g_desktop_app_info_list_actions (appinfo->super_appinfo);
627671 }
628672
629673 /**
651695 */
652696 void gmenu_desktopappinfo_launch_action (GMenuDesktopAppInfo *appinfo, const gchar *action_name, GAppLaunchContext *launch_context)
653697 {
654 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
655 g_desktop_app_info_launch_action (info->super_appinfo, action_name, launch_context);
698 g_return_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo));
699 g_desktop_app_info_launch_action (appinfo->super_appinfo, action_name, launch_context);
656700 }
657701
658702 /**
673717 */
674718 gchar * gmenu_desktopappinfo_get_action_name (GMenuDesktopAppInfo *appinfo, const gchar *action_name)
675719 {
676 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
677 return g_desktop_app_info_get_action_name (info->super_appinfo, action_name);
720 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), NULL);
721 return g_desktop_app_info_get_action_name (appinfo->super_appinfo, action_name);
678722 }
679723
680724 /**
718762 gpointer pid_callback_data,
719763 GError **error)
720764 {
721 GMenuDesktopAppInfo *info = GMENU_DESKTOPAPPINFO (appinfo);
722 return g_desktop_app_info_launch_uris_as_manager (info->super_appinfo,
765 g_return_val_if_fail (GMENU_IS_DESKTOPAPPINFO (appinfo), FALSE);
766 return g_desktop_app_info_launch_uris_as_manager (appinfo->super_appinfo,
723767 uris,
724768 launch_context,
725769 spawn_flags,