[gnome-user-share] obexpush: make obex_agent_up() and obex_agent_down() symmetric



commit cfbcbe50a7ad927ea10639fd3dfa0e9836ed8f7c
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Nov 10 03:58:42 2014 -0800

    obexpush: make obex_agent_up() and obex_agent_down() symmetric
    
    Make these two functions idempotent and symmetric in return value;
    obex_agent_up() cannot return NULL since obex_agent_new() won't ever
    return a NULL GObject.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=739872

 src/obexpush.c |    7 ++++---
 src/obexpush.h |    2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/obexpush.c b/src/obexpush.c
index 30b2b68..7263dc4 100644
--- a/src/obexpush.c
+++ b/src/obexpush.c
@@ -799,6 +799,9 @@ obex_agent_new (void)
 void
 obex_agent_down (void)
 {
+       if (agent == NULL)
+               return;
+
        g_dbus_connection_call (agent->connection,
                                MANAGER_SERVICE,
                                MANAGER_PATH,
@@ -815,7 +818,7 @@ obex_agent_down (void)
        g_clear_object (&agent);
 }
 
-gboolean
+void
 obex_agent_up (void)
 {
        if (agent == NULL)
@@ -824,8 +827,6 @@ obex_agent_up (void)
        if (!notify_init("gnome-user-share")) {
                g_warning("Unable to initialize the notification system");
        }
-
-       return agent != NULL;
 }
 
 void
diff --git a/src/obexpush.h b/src/obexpush.h
index fa23c02..dbdf59e 100644
--- a/src/obexpush.h
+++ b/src/obexpush.h
@@ -53,7 +53,7 @@ GType obex_agent_get_type (void);
 #define IS_OBEX_AGENT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), OBEX_AGENT_TYPE))
 #define OBEX_AGENT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), OBEX_AGENT_TYPE, ObexAgentClass))
 
-gboolean obex_agent_up (void);
+void     obex_agent_up (void);
 void     obex_agent_down (void);
 void     obex_agent_set_accept_files_policy (AcceptSetting setting);
 void     obex_agent_set_notify (gboolean enabled);


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