[libegg] smclient: Add egg_set_desktop_file_without_defaults()
- From: Christian Persch <chpe src gnome org>
- To: svn-commits-list gnome org
- Subject: [libegg] smclient: Add egg_set_desktop_file_without_defaults()
- Date: Thu, 25 Jun 2009 18:06:37 +0000 (UTC)
commit b0ec0c9ee5fb89191ffc1556bf43a1b1cd39f411
Author: Christian Persch <chpe gnome org>
Date: Thu Jun 25 19:35:56 2009 +0200
smclient: Add egg_set_desktop_file_without_defaults()
Add a variant of egg_set_desktop_file() that does not set the
application namd and default window icon from the desktop file.
Bug #586128.
libegg/smclient/eggdesktopfile.c | 67 +++++++++++++++++++++++++++----------
libegg/smclient/eggdesktopfile.h | 5 ++-
2 files changed, 52 insertions(+), 20 deletions(-)
---
diff --git a/libegg/smclient/eggdesktopfile.c b/libegg/smclient/eggdesktopfile.c
index b99f35e..af8a98e 100644
--- a/libegg/smclient/eggdesktopfile.c
+++ b/libegg/smclient/eggdesktopfile.c
@@ -1410,23 +1410,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;
@@ -1442,7 +1428,7 @@ egg_set_desktop_file (const char *desktop_file_path)
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);
@@ -1459,6 +1445,51 @@ egg_set_desktop_file (const char *desktop_file_path)
}
/**
+ * 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
diff --git a/libegg/smclient/eggdesktopfile.h b/libegg/smclient/eggdesktopfile.h
index f8a3d3e..18fe463 100644
--- a/libegg/smclient/eggdesktopfile.h
+++ b/libegg/smclient/eggdesktopfile.h
@@ -150,8 +150,9 @@ typedef enum {
} EggDesktopFileError;
/* Global application desktop file */
-void egg_set_desktop_file (const char *desktop_file_path);
-EggDesktopFile *egg_get_desktop_file (void);
+void egg_set_desktop_file (const char *desktop_file_path);
+void egg_set_desktop_file_without_defaults (const char *desktop_file_path);
+EggDesktopFile *egg_get_desktop_file (void);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]