$NetBSD: patch-ac,v 1.3 2010/12/04 21:15:00 adam Exp $ Updated from http://git.gnome.org/browse/libegg/tree/libegg/smclient --- copy-n-paste/eggdesktopfile.c.orig 2010-12-04 08:22:19.000000000 +0000 +++ copy-n-paste/eggdesktopfile.c @@ -16,8 +16,9 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; see the file COPYING.LIB. - * If not, see . + * License along with this library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - + * Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H @@ -30,7 +31,10 @@ #include #include +#include +#if !defined(GDK_WINDOWING_QUARTZ) #include +#endif #include struct EggDesktopFile { @@ -430,6 +431,16 @@ egg_desktop_file_get_numeric (EggDesktop error); } +int +egg_desktop_file_get_integer (EggDesktopFile *desktop_file, + const char *key, + GError **error) +{ + return g_key_file_get_integer (desktop_file->key_file, + EGG_DESKTOP_FILE_GROUP, key, + error); +} + char ** egg_desktop_file_get_string_list (EggDesktopFile *desktop_file, const char *key, @@ -1273,8 +1284,8 @@ egg_desktop_file_launchv (EggDesktopFile out: if (env) { - g_strfreev ((char **)env->pdata); - g_ptr_array_free (env, FALSE); + g_ptr_array_foreach (env, (GFunc)g_free, NULL); + g_ptr_array_free (env, TRUE); } free_document_list (translated_documents); @@ -1385,6 +1396,8 @@ egg_desktop_file_launch (EggDesktopFile free_document_list (documents); break; + case EGG_DESKTOP_FILE_TYPE_UNRECOGNIZED: + case EGG_DESKTOP_FILE_TYPE_DIRECTORY: default: g_set_error (error, EGG_DESKTOP_FILE_ERROR, EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE, @@ -1407,23 +1420,9 @@ egg_desktop_file_error_quark (void) G_LOCK_DEFINE_STATIC (egg_desktop_file); static EggDesktopFile *egg_desktop_file; -/** - * egg_set_desktop_file: - * @desktop_file_path: path to the application's desktop file - * - * Creates an #EggDesktopFile for the application from the data at - * @desktop_file_path. This will also call g_set_application_name() - * with the localized application name from the desktop file, and - * gtk_window_set_default_icon_name() or - * gtk_window_set_default_icon_from_file() with the application's - * icon. Other code may use additional information from the desktop - * file. - * - * Note that for thread safety reasons, this function can only - * be called once. - **/ -void -egg_set_desktop_file (const char *desktop_file_path) +static void +egg_set_desktop_file_internal (const char *desktop_file_path, + gboolean set_defaults) { GError *error = NULL; @@ -1439,7 +1438,7 @@ egg_set_desktop_file (const char *deskto g_error_free (error); } - if (egg_desktop_file) { + if (set_defaults && egg_desktop_file != NULL) { /* Set localized application name and default window icon */ if (egg_desktop_file->name) g_set_application_name (egg_desktop_file->name); @@ -1456,6 +1455,51 @@ egg_set_desktop_file (const char *deskto } /** + * egg_set_desktop_file: + * @desktop_file_path: path to the application's desktop file + * + * Creates an #EggDesktopFile for the application from the data at + * @desktop_file_path. This will also call g_set_application_name() + * with the localized application name from the desktop file, and + * gtk_window_set_default_icon_name() or + * gtk_window_set_default_icon_from_file() with the application's + * icon. Other code may use additional information from the desktop + * file. + * See egg_set_desktop_file_without_defaults() for a variant of this + * function that does not set the application name and default window + * icon. + * + * Note that for thread safety reasons, this function can only + * be called once, and is mutually exclusive with calling + * egg_set_desktop_file_without_defaults(). + **/ +void +egg_set_desktop_file (const char *desktop_file_path) +{ + egg_set_desktop_file_internal (desktop_file_path, TRUE); +} + +/** + * egg_set_desktop_file_without_defaults: + * @desktop_file_path: path to the application's desktop file + * + * Creates an #EggDesktopFile for the application from the data at + * @desktop_file_path. + * See egg_set_desktop_file() for a variant of this function that + * sets the application name and default window icon from the information + * in the desktop file. + * + * Note that for thread safety reasons, this function can only + * be called once, and is mutually exclusive with calling + * egg_set_desktop_file(). + **/ +void +egg_set_desktop_file_without_defaults (const char *desktop_file_path) +{ + egg_set_desktop_file_internal (desktop_file_path, FALSE); +} + +/** * egg_get_desktop_file: * * Gets the application's #EggDesktopFile, as set by