diff options
Diffstat (limited to 'libindicator')
-rw-r--r-- | libindicator/indicator-desktop-shortcuts.c | 34 | ||||
-rw-r--r-- | libindicator/indicator-image-helper.c | 6 |
2 files changed, 17 insertions, 23 deletions
diff --git a/libindicator/indicator-desktop-shortcuts.c b/libindicator/indicator-desktop-shortcuts.c index 70d964e..740d7e1 100644 --- a/libindicator/indicator-desktop-shortcuts.c +++ b/libindicator/indicator-desktop-shortcuts.c @@ -625,46 +625,34 @@ indicator_desktop_shortcuts_nick_exec_with_context (IndicatorDesktopShortcuts * NULL, NULL); - /* Build a new desktop file with the name and exec in the desktop - group. We have to do this with data as apparently there isn't - and add_group function in g_key_file. Go figure. */ - gchar * desktopdata = g_strdup_printf("[" G_KEY_FILE_DESKTOP_GROUP "]\n" - G_KEY_FILE_DESKTOP_KEY_TYPE "=" G_KEY_FILE_DESKTOP_TYPE_APPLICATION "\n" - G_KEY_FILE_DESKTOP_KEY_NAME "=%s\n" - G_KEY_FILE_DESKTOP_KEY_EXEC "=%s\n" - G_KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY "=%s\n", - name, exec, launch_context ? "true" : "false"); + GAppInfoCreateFlags flags = G_APP_INFO_CREATE_NONE; - g_free(name); g_free(exec); - /* g_debug("Desktop file: \n%s", desktopdata); */ + if (launch_context) { + flags |= G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION; + } - GKeyFile * launcher = g_key_file_new(); - g_key_file_load_from_data(launcher, desktopdata, -1, G_KEY_FILE_NONE, &error); - g_free(desktopdata); + GAppInfo * appinfo = g_app_info_create_from_commandline(exec, name, flags, &error); + g_free(name); g_free(exec); if (error != NULL) { - g_warning("Unable to build desktop keyfile for executing shortcut '%s': %s", nick, error->message); + g_warning("Unable to build Command line App info: %s", error->message); g_error_free(error); return FALSE; } - GDesktopAppInfo * appinfo = g_desktop_app_info_new_from_keyfile(launcher); if (appinfo == NULL) { - g_warning("Unable to build Desktop App info (unknown)"); - g_key_file_free(launcher); + g_warning("Unable to build Command line App info (unknown)"); return FALSE; } - gboolean launched = g_app_info_launch(G_APP_INFO(appinfo), NULL, launch_context, &error); + + gboolean launched = g_app_info_launch(appinfo, NULL, launch_context, &error); if (error != NULL) { g_warning("Unable to launch file from nick '%s': %s", nick, error->message); - g_error_free(error); - g_key_file_free(launcher); - return FALSE; + g_clear_error(&error); } g_object_unref(appinfo); - g_key_file_free(launcher); return launched; } diff --git a/libindicator/indicator-image-helper.c b/libindicator/indicator-image-helper.c index aff9e39..9f48895 100644 --- a/libindicator/indicator-image-helper.c +++ b/libindicator/indicator-image-helper.c @@ -119,7 +119,13 @@ refresh_image (GtkImage * image) } if (icon_info != NULL) { +#if GTK_CHECK_VERSION(3, 8, 0) + g_object_unref(icon_info); +#else + /* NOTE: Leaving this in for lower version as it seems + the object_unref() doesn't work on earlier versions. */ gtk_icon_info_free (icon_info); +#endif } } |