changeset 2884:4128ae5633e4

disable play button while pairing - some cleanups
author Paula Stanciu <paula.stanciu@gmail.com>
date Sat, 09 Aug 2008 20:46:49 +0300
parents 67d527114af5
children 7a1bc6c600e0
files src/bluetooth/agent.c src/bluetooth/bluetooth.c src/bluetooth/scan_gui.c
diffstat 3 files changed, 15 insertions(+), 76 deletions(-) [+]
line wrap: on
line diff
--- a/src/bluetooth/agent.c	Thu Aug 07 20:39:35 2008 +0300
+++ b/src/bluetooth/agent.c	Sat Aug 09 20:46:49 2008 +0300
@@ -27,8 +27,8 @@
 #include "agent.h"
 #include "gui.h"
 
-#define PASSKEY_AGENT_PATH	"/org/bluez/audacious_passkey"
-#define AUTH_AGENT_PATH		"/org/bluez/audacious_auth"
+#define PASSKEY_AGENT_PATH	"/org/bluez/passkey_agent"
+#define AUTH_AGENT_PATH		"/org/bluez/auth_agent"
 
 static GtkWidget *agent_window = NULL;
 static GtkWidget *window_box = NULL;
@@ -204,56 +204,9 @@
     }
 
     input_free(input);
-}
-
-/*static void confirm_callback(gint response, gpointer user_data)
-{
-    struct input_data *input = user_data;
-
-    if (response != GTK_RESPONSE_YES) {
-        GError *error;
-        error = g_error_new(AGENT_ERROR, AGENT_ERROR_REJECT,
-                "Confirmation request rejected");
-        dbus_g_method_return_error(input->context, error);
-    } else
-        dbus_g_method_return(input->context);
+    printf("return\n");
+ }
 
-    input_free(input);
-}
-*/
-/*
-static void set_trusted(struct input_data *input)
-{
-    DBusGProxy *object;
-    //aways set trusted -- we dont have yet an active button -
-    //maybe I'll add one	
-    object = dbus_g_proxy_new_for_name(connection, "org.bluez",
-            input->path, "org.bluez.Adapter");
-
-    dbus_g_proxy_call(object, "SetTrusted", NULL,
-            G_TYPE_STRING, input->address, G_TYPE_INVALID,
-            G_TYPE_INVALID);
-}
-*/
-/*
-static void auth_callback(gint response, gpointer user_data)
-{
-
-    struct input_data *input = user_data;
-
-    if (response == GTK_RESPONSE_YES) {
-        set_trusted(input);
-        dbus_g_method_return(input->context);
-    } else {
-        GError *error;
-        error = g_error_new(AGENT_ERROR, AGENT_ERROR_REJECT,
-                "Authorization request rejected");
-        dbus_g_method_return_error(input->context, error);
-    }
-
-    input_free(input);
-}
-*/
 
 static void passkey_dialog(const char *path, const char *address,
         const gchar *device, DBusGMethodInvocation *context)
@@ -269,26 +222,6 @@
 
     input->context = context;
 
-
-
-    /*
-       g_signal_connect(G_OBJECT(entry), "changed",
-       G_CALLBACK(changed_callback), input);
-
-
-       g_signal_connect(G_OBJECT(button), "toggled",
-       G_CALLBACK(toggled_callback), input);
-
-       gtk_container_add(GTK_CONTAINER(vbox), button);
-
-       input_list = g_list_append(input_list, input);
-
-       g_signal_connect(G_OBJECT(dialog), "response",
-       G_CALLBACK(passkey_callback), input);
-
-       enable_blinking();
-       */
-    printf("passkey callback\n");
     passkey_callback(GTK_RESPONSE_ACCEPT,input);
 
 
@@ -298,7 +231,8 @@
         const char *value, const gchar *device,
         DBusGMethodInvocation *context)
 {
-    struct input_data *input;
+   printf("confirm dialog \n");
+   struct input_data *input;
 
     input = g_try_malloc0(sizeof(*input));
     if (!input)
@@ -308,8 +242,6 @@
     input->address = g_strdup(address);
 
     input->context = context;
-
-printf("confirm dialog\n");
     //	g_signal_connect(G_OBJECT(dialog), "response",
     //				G_CALLBACK(confirm_callback), input);
 
@@ -437,6 +369,7 @@
         const char *path, const char *address,
         const char *value, DBusGMethodInvocation *context)
 {
+    printf("passkey agent confirm \n");
     DBusGProxy *object;
     const char *adapter = NULL, *name = NULL;
     gchar *device, *line;
@@ -476,6 +409,7 @@
 static gboolean passkey_agent_cancel(PasskeyAgent *agent,
         const char *path, const char *address, GError **error)
 {
+    printf("passkey agent cancel \n");
     GList *list;
     GError *result;
     struct input_data *input;
@@ -512,6 +446,7 @@
 
 static gboolean passkey_agent_release(PasskeyAgent *agent, GError **error)
 {
+    printf("pass agent release \n");
     registered_passkey = 0;
 
     return TRUE;
@@ -570,6 +505,7 @@
         const char *path, const char *address, const char *service,
         const char *uuid, DBusGMethodInvocation *context)
 {
+    printf("auth agent authorize \n");
     DBusGProxy *object;
     const char *adapter = NULL, *name = NULL;
     gchar *device, *profile, *line;
@@ -717,6 +653,7 @@
 
 int setup_agents(DBusGConnection *conn)
 {
+    printf("setup agents\n");
     void *agent;
 
     connection = dbus_g_connection_ref(conn);
@@ -739,6 +676,7 @@
 
 void cleanup_agents(void)
 {
+    printf("clean up agents \n");
     unregister_agents();
 
     dbus_g_connection_unref(connection);
--- a/src/bluetooth/bluetooth.c	Thu Aug 07 20:39:35 2008 +0300
+++ b/src/bluetooth/bluetooth.c	Sat Aug 09 20:46:49 2008 +0300
@@ -130,9 +130,7 @@
 static void remove_bonding()
 {
     dbus_g_object_register_marshaller(marshal_VOID__STRING_UINT_INT, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID);
-    g_mutex_lock(bonded_dev_mutex);
     dbus_g_proxy_call(obj,"RemoveBonding",NULL,G_TYPE_STRING,bonded_dev,G_TYPE_INVALID,G_TYPE_INVALID); 
-    g_mutex_unlock(bonded_dev_mutex);
 
 }
 void refresh_call(void)
--- a/src/bluetooth/scan_gui.c	Thu Aug 07 20:39:35 2008 +0300
+++ b/src/bluetooth/scan_gui.c	Sat Aug 09 20:46:49 2008 +0300
@@ -52,6 +52,8 @@
                 if(window){
                     gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar),1);
                     show_pairing_ok();
+                    gtk_widget_set_sensitive(rescan_buttton,TRUE);
+
                 }
                 return 0;
             }
@@ -137,6 +139,7 @@
         }else{
             rescan_buttton = gtk_button_new_with_mnemonic(_("Play"));
             g_signal_connect(rescan_buttton,"clicked",G_CALLBACK (play_call),NULL);
+            gtk_widget_set_sensitive(rescan_buttton,FALSE);
         }