[gnome-user-share] obex: Reject transfers in one place



commit b69ed8c1674f964e0f9ec12a9f9e033433675818
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Nov 15 00:35:07 2013 +0100

    obex: Reject transfers in one place
    
    So we can ensure we clean up after ourselves.

 src/obexpush.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/src/obexpush.c b/src/obexpush.c
index 1da17bc..f514db1 100644
--- a/src/obexpush.c
+++ b/src/obexpush.c
@@ -180,6 +180,13 @@ show_notification (const char *filename)
 }
 
 static void
+reject_transfer (GDBusMethodInvocation *invocation)
+{
+       g_dbus_method_invocation_return_dbus_error (invocation,
+               "org.bluez.obex.Error.Rejected", "Not Authorized");
+}
+
+static void
 ask_user_transfer_accepted (NotifyNotification *notification,
                            char *action,
                            GDBusMethodInvocation *invocation)
@@ -198,9 +205,7 @@ ask_user_transfer_rejected (NotifyNotification *notification,
                            GDBusMethodInvocation *invocation)
 {
        g_debug ("Notification: transfer rejected! rejecting transfer");
-
-       g_dbus_method_invocation_return_dbus_error (invocation,
-               "org.bluez.obex.Error.Rejected", "Not Authorized");
+       reject_transfer (invocation);
 }
 
 static void
@@ -208,9 +213,7 @@ ask_user_on_close (NotifyNotification *notification,
                   GDBusMethodInvocation *invocation)
 {
        g_debug ("Notification closed! rejecting transfer");
-
-       g_dbus_method_invocation_return_dbus_error (invocation,
-               "org.bluez.obex.Error.Rejected", "Not Authorized");
+       reject_transfer (invocation);
 }
 
 static void
@@ -360,8 +363,7 @@ on_session_acquired (GObject *object,
 
 out:
        g_debug ("Rejecting transfer");
-       g_dbus_method_invocation_return_dbus_error (invocation,
-               "org.bluez.obex.Error.Rejected", "Not Authorized");
+       reject_transfer (invocation);
 }
 
 static void
@@ -388,8 +390,7 @@ check_if_bonded (GDBusProxy *transfer,
        } else {
                g_debug ("Could not get session path for the transfer, "
                         "rejecting the transfer");
-               g_dbus_method_invocation_return_dbus_error (invocation,
-                       "org.bluez.obex.Error.Rejected", "Not Authorized");
+               reject_transfer (invocation);
        }
 }
 


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