gosxappinfo: Fix some const-correctness issues

This is technically an API break, as the following assignment may now
raise warnings in user code:
```
gchar *filename = g_osx_app_info_get_filename (app_info);
```

However, from code search it seems like the number of users of that
function is zero.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2020-12-09 11:41:38 +00:00
parent c3f613af0c
commit 1862a900b1
2 changed files with 7 additions and 6 deletions

View File

@ -43,7 +43,7 @@ GLIB_AVAILABLE_IN_2_52
GType g_osx_app_info_get_type (void) G_GNUC_CONST; GType g_osx_app_info_get_type (void) G_GNUC_CONST;
GLIB_AVAILABLE_IN_2_52 GLIB_AVAILABLE_IN_2_52
char * g_osx_app_info_get_filename (GOsxAppInfo *info); const char *g_osx_app_info_get_filename (GOsxAppInfo *info);
GLIB_AVAILABLE_IN_2_52 GLIB_AVAILABLE_IN_2_52
GList * g_osx_app_info_get_all_for_scheme (const gchar *scheme); GList * g_osx_app_info_get_all_for_scheme (const gchar *scheme);

View File

@ -226,8 +226,8 @@ url_escape_hostname (const char *url)
} }
static CFURLRef static CFURLRef
create_url_from_cstr (gchar *cstr, create_url_from_cstr (const gchar *cstr,
gboolean is_file) gboolean is_file)
{ {
gchar *puny_cstr; gchar *puny_cstr;
CFStringRef str; CFStringRef str;
@ -280,7 +280,7 @@ create_urlspec_for_appinfo (GOsxAppInfo *info,
gboolean are_files) gboolean are_files)
{ {
LSLaunchURLSpec *urlspec = g_new0 (LSLaunchURLSpec, 1); LSLaunchURLSpec *urlspec = g_new0 (LSLaunchURLSpec, 1);
gchar *app_cstr = g_osx_app_info_get_filename (info); const gchar *app_cstr = g_osx_app_info_get_filename (info);
/* Strip file:// from app url but ensure filesystem url */ /* Strip file:// from app url but ensure filesystem url */
urlspec->appURL = create_url_from_cstr (app_cstr + 7, TRUE); urlspec->appURL = create_url_from_cstr (app_cstr + 7, TRUE);
@ -402,7 +402,7 @@ g_osx_app_info_get_executable (GAppInfo *appinfo)
return info->executable; return info->executable;
} }
char * const char *
g_osx_app_info_get_filename (GOsxAppInfo *info) g_osx_app_info_get_filename (GOsxAppInfo *info)
{ {
g_return_val_if_fail (info != NULL, NULL); g_return_val_if_fail (info != NULL, NULL);
@ -431,7 +431,8 @@ g_osx_app_info_get_icon (GAppInfo *appinfo)
if (!info->icon) if (!info->icon)
{ {
gchar *icon_name, *app_uri, *icon_uri; const gchar *app_uri;
gchar *icon_name, *icon_uri;
GFile *file; GFile *file;
icon_name = get_bundle_string_value (info->bundle, @"CFBundleIconFile"); icon_name = get_bundle_string_value (info->bundle, @"CFBundleIconFile");