[libnotify] Add a way to set or change the application name



commit a967c61e5b802b260fd6be23601a4dab579144c9
Author: William Jon McCann <jmccann redhat com>
Date:   Mon Jan 17 16:40:17 2011 -0500

    Add a way to set or change the application name
    
    May be useful for presenting different message sources
    within a single process.

 libnotify/notify.c |   18 ++++++++++++++++--
 libnotify/notify.h |    1 +
 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);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]