summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Jon McCann <jmccann@redhat.com>2011-01-17 16:40:17 -0500
committerWilliam Jon McCann <jmccann@redhat.com>2011-01-17 16:40:17 -0500
commita967c61e5b802b260fd6be23601a4dab579144c9 (patch)
treeaef74d3cd3fcf7587ae6a1c0fdd7e3f4fd9e6091
parent277f40c8725d3c75a8c24438d633167286dbcaa5 (diff)
downloadlibnotify-a967c61e5b802b260fd6be23601a4dab579144c9.tar.gz
Add a way to set or change the application name
May be useful for presenting different message sources within a single process.
-rw-r--r--libnotify/notify.c18
-rw-r--r--libnotify/notify.h1
2 files changed, 17 insertions, 2 deletions
diff --git a/libnotify/notify.c b/libnotify/notify.c
index 1ee0fde..efe8bd8 100644
--- a/libnotify/notify.c
+++ b/libnotify/notify.c
@@ -119,6 +119,21 @@ _notify_update_spec_version (GError **error)
return TRUE;
}
+
+/**
+ * notify_set_app_name:
+ * @app_name: The name of the application
+ *
+ * Sets the application name.
+ *
+ */
+void
+notify_set_app_name (const char *app_name)
+{
+ g_free (_app_name);
+ _app_name = g_strdup (app_name);
+}
+
/**
* notify_init:
* @app_name: The name of the application initializing libnotify.
@@ -136,8 +151,7 @@ notify_init (const char *app_name)
if (_initted)
return TRUE;
- g_free (_app_name);
- _app_name = g_strdup (app_name);
+ notify_set_app_name (app_name);
g_type_init ();
diff --git a/libnotify/notify.h b/libnotify/notify.h
index 5167435..7bb5114 100644
--- a/libnotify/notify.h
+++ b/libnotify/notify.h
@@ -35,6 +35,7 @@ void notify_uninit (void);
gboolean notify_is_initted (void);
const char *notify_get_app_name (void);
+void notify_set_app_name (const char *app_name);
GList *notify_get_server_caps (void);