changeset 2869:638c3d599f20

Automated merge with ssh://paula@hg.atheme.org//hg/audacious-plugins
author Paula Stanciu <paula.stanciu@gmail.com>
date Thu, 07 Aug 2008 12:12:12 +0300
parents a31410f560cf (current diff) 9e9293b87392 (diff)
children c3df7556d85a
files
diffstat 4 files changed, 30 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/bluetooth/Makefile	Wed Aug 06 22:56:25 2008 +0100
+++ b/src/bluetooth/Makefile	Thu Aug 07 12:12:12 2008 +0300
@@ -1,9 +1,8 @@
 PLUGIN = bluetooth${PLUGIN_SUFFIX}
 
-SRCS = bluetooth.c gui.c marshal.c scan_gui.c agent.c
+SRCS = bluetooth.c gui.c marshal.c scan_gui.c agent.c 
 include ../../buildsys.mk
 include ../../extra.mk
-
 plugindir := ${plugindir}/${GENERAL_PLUGIN_DIR}
 CFLAGS += ${PLUGIN_CFLAGS}
 CPPFLAGS += ${PLUGIN_CPPFLAGS} ${BEEP_DEFINES} ${MOWGLI_CFLAGS} ${DBUS_CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS} ${DBUS_GLIB_CFLAGS} ${PANGO_CFLAGS} -I../../intl -I../.. ${BLUEZ_CFLAGS}
--- a/src/bluetooth/agent.c	Wed Aug 06 22:56:25 2008 +0100
+++ b/src/bluetooth/agent.c	Thu Aug 07 12:12:12 2008 +0300
@@ -199,6 +199,7 @@
         GError *error;
         error = g_error_new(AGENT_ERROR, AGENT_ERROR_REJECT,
                 "Pairing request rejected");
+        printf("passkey error\n");
         dbus_g_method_return_error(input->context, error);
     }
 
@@ -339,10 +340,11 @@
     /* translators: Whether to grant access to a particular service
      * to the device mentioned */
 
-    //	g_signal_connect(G_OBJECT(dialog), "response",
-    //				G_CALLBACK(auth_callback), input);
+   /* 	g_signal_connect(G_OBJECT(dialog), "response",
+    				G_CALLBACK(auth_callback), input);
 
-    //enable_blinking();
+    enable_blinking();
+    */
 }
 
 typedef struct {
@@ -392,9 +394,6 @@
     g_printf("new passkey agent \n");
     return agent;
 }
-
-
-
 static gboolean passkey_agent_request(PasskeyAgent *agent,
         const char *path, const char *address,
         DBusGMethodInvocation *context)
@@ -816,6 +815,7 @@
 	text = g_strdup_printf(_("Removed bonding with %s"), device);
 
 	g_free(device);
+    printf("bonding removed");
 
 //	show_notification(adapter ? adapter : _("Bluetooth device"),
 //						text, NULL, 6000, NULL);
--- a/src/bluetooth/bluetooth.c	Wed Aug 06 22:56:25 2008 +0100
+++ b/src/bluetooth/bluetooth.c	Thu Aug 07 12:12:12 2008 +0300
@@ -24,6 +24,7 @@
 #include "gui.h"
 #include "scan_gui.h"
 #include "agent.h"
+#include <audacious/plugin.h>
 #define DEBUG 1
 static gboolean plugin_active = FALSE,exiting=FALSE;
 GList * current_device = NULL;
@@ -44,7 +45,7 @@
 void discover_devices(void);
 void disconnect_dbus_signals(void);
 static void show_restart_dialog(void);
-
+static void remove_bonding();
 GeneralPlugin bluetooth_gp =
 {
     .description = "Bluetooth audio support",
@@ -72,6 +73,7 @@
         close_window();
         config =0;
     }
+    remove_bonding();
     if(discover_finish == 2) {
         dbus_g_connection_flush (bus);
         dbus_g_connection_unref(bus);
@@ -118,7 +120,12 @@
     audio_devices = NULL;
     //g_list_free(current_device);
 }
+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);
+    dbus_g_proxy_call(obj,"RemoveBonding",NULL,G_TYPE_STRING,"00:0D:3C:B1:1C:7A",G_TYPE_INVALID,G_TYPE_INVALID); 
 
+}
 void refresh_call(void)
 {
     printf("refresh function called\n");
@@ -172,8 +179,6 @@
     temp_file_name = g_strconcat(home,"/temp_bt",NULL);
     file = fopen(file_name,"r");
     temp_file = fopen(temp_file_name,"w");
-    /* hardcoded address TO REMOVE after testing */
-    //   current_address = "00:0D:3C:B1:1C:7A";
     device_line = g_strdup_printf("device %s\n",current_address);
     if ( file != NULL )
     {
@@ -213,21 +218,23 @@
 
     printf("play callback\n");
     close_window();
-    show_restart_dialog();
+    aud_output_plugin_cleanup();
+    audacious_drct_stop();
+    audacious_drct_play();
 
 
 }
 static void show_restart_dialog()
 {
-static GtkWidget *window = NULL;
- GtkWidget *dialog;
-  dialog = gtk_message_dialog_new (GTK_WINDOW (window),
-				   GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-				   GTK_MESSAGE_INFO,
-				   GTK_BUTTONS_OK,
-				   "Please restart the player to apply the bluetooth audio settings!");
-   gtk_dialog_run (GTK_DIALOG (dialog));
-   gtk_widget_destroy (dialog);
+    static GtkWidget *window = NULL;
+    GtkWidget *dialog;
+    dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+            GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+            GTK_MESSAGE_INFO,
+            GTK_BUTTONS_OK,
+            "Please restart the player to apply the bluetooth audio settings!");
+    gtk_dialog_run (GTK_DIALOG (dialog));
+    gtk_widget_destroy (dialog);
 }
 
 static void remote_device_found(DBusGProxy *object, char *address, const unsigned int class, const int rssi, gpointer user_data)
--- a/src/bluetooth/bluetooth.h	Wed Aug 06 22:56:25 2008 +0100
+++ b/src/bluetooth/bluetooth.h	Thu Aug 07 12:12:12 2008 +0300
@@ -28,7 +28,9 @@
 #include <dbus/dbus-glib.h>
 #include <glib-object.h>
 #include <stdio.h>
-
+#include <audacious/configdb.h>
+#include <audacious/i18n.h>
+#include <audacious/util.h>
 #include "gui.h"
 typedef struct {
     guint class;