diff --git a/sflphone-client-gnome/src/config/audioconf.c b/sflphone-client-gnome/src/config/audioconf.c index f8a6cb6b82cdaa771e2ed67a157a532ae3dbb64e..7d4e0ee0ac17c483cbc30b82fe3dfe4e1455c93d 100644 --- a/sflphone-client-gnome/src/config/audioconf.c +++ b/sflphone-client-gnome/src/config/audioconf.c @@ -656,7 +656,7 @@ GtkWidget* api_box() gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(alsa), SHOW_ALSA_CONF ); gtk_box_pack_end( GTK_BOX(ret) , alsa , TRUE , TRUE , 1); g_signal_connect(G_OBJECT(alsa), "clicked", G_CALLBACK(select_audio_manager), NULL); - gtk_misc_set_alignment(GTK_MISC(alsa), 0.2, 0.4); + // gtk_misc_set_alignment(GTK_MISC(alsa), 0.2, 0.4); gtk_widget_show_all(ret); return ret; @@ -756,7 +756,7 @@ GtkWidget* ringtones_box() // check button to enable ringtones ret = gtk_hbox_new( TRUE , 1); enableTone = gtk_check_button_new_with_mnemonic( _("_Enable ringtones")); - gtk_misc_set_alignment(GTK_MISC(enableTone), 0.2, 0.5); + // gtk_misc_set_alignment(GTK_MISC(enableTone), 0.2, 0.5); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enableTone), dbus_is_ringtone_enabled() ); gtk_box_pack_start( GTK_BOX(ret) , enableTone , TRUE , TRUE , 1); g_signal_connect(G_OBJECT( enableTone) , "clicked" , G_CALLBACK( ringtone_enabled ) , NULL); diff --git a/sflphone-client-gnome/src/config/hooks-config.c b/sflphone-client-gnome/src/config/hooks-config.c index 1972ba583ada061c2316ab18a688429b142e2cfe..4d9ece57aee93ab4d5dc109dc0dfce7ecfd6b265 100644 --- a/sflphone-client-gnome/src/config/hooks-config.c +++ b/sflphone-client-gnome/src/config/hooks-config.c @@ -131,61 +131,62 @@ GtkWidget* create_hooks_settings (){ gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); gtk_widget_show (frame); - table = gtk_table_new ( 6, 3, FALSE/* homogeneous */); + table = gtk_table_new ( 6, 2, FALSE/* homogeneous */); gtk_table_set_row_spacings( GTK_TABLE(table), 10); gtk_table_set_col_spacings( GTK_TABLE(table), 10); gtk_widget_show(table); gtk_container_add( GTK_CONTAINER (frame) , table ); label = gtk_label_new(_("SFLphone can run custom commands if incoming calls come with an URL attached.\nIn this case, %s will be replaced with the passed URL.")); - gtk_table_attach ( GTK_TABLE( table ), label, 0, 3, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_table_attach ( GTK_TABLE( table ), label, 0, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); widg = gtk_check_button_new_with_mnemonic( _("Trigger on specific _SIP header")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widg), (g_strcasecmp (_urlhook_config->sip_enabled, "1")==0)?TRUE:FALSE); g_signal_connect (G_OBJECT(widg) , "clicked" , G_CALLBACK (sip_enabled_cb), NULL); - gtk_table_attach ( GTK_TABLE( table ), widg, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_table_attach ( GTK_TABLE( table ), widg, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - label = gtk_label_new_with_mnemonic (_("FIXME: ")); - gtk_table_attach ( GTK_TABLE( table ), label, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + // label = gtk_label_new_with_mnemonic (_("FIXME: ")); + // gtk_table_attach ( GTK_TABLE( table ), label, 1, 2, 1, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); field = gtk_entry_new (); gtk_label_set_mnemonic_widget (GTK_LABEL (label), field); gtk_entry_set_text(GTK_ENTRY(field), _urlhook_config->sip_field); - gtk_table_attach ( GTK_TABLE( table ), field, 2, 3, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_table_attach ( GTK_TABLE( table ), field, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); widg = gtk_check_button_new_with_mnemonic( _("Trigger on _IAX2 URL")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widg), (g_strcasecmp (_urlhook_config->iax2_enabled, "1")==0)?TRUE:FALSE); g_signal_connect (G_OBJECT(widg) , "clicked" , G_CALLBACK (iax2_enabled_cb), NULL); - gtk_table_attach ( GTK_TABLE( table ), widg, 0, 3, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_table_attach ( GTK_TABLE( table ), widg, 0, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); label = gtk_label_new_with_mnemonic (_("_Command to run: ")); - gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 4, 5, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_misc_set_alignment(GTK_MISC(label), 0.05, 0.5); + gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); command = gtk_entry_new (); gtk_label_set_mnemonic_widget (GTK_LABEL (label), command); gtk_entry_set_text(GTK_ENTRY(command), _urlhook_config->command); - gtk_table_attach ( GTK_TABLE( table ), command, 1, 2, 4, 5, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 10); + gtk_table_attach ( GTK_TABLE( table ), command, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 10); gnome_main_section_new (_("Phone Number Rewriting"), &frame); gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0); gtk_widget_show (frame); - table = gtk_table_new ( 2, 2, FALSE/* homogeneous */); + table = gtk_table_new ( 4, 2, FALSE/* homogeneous */); gtk_table_set_row_spacings( GTK_TABLE(table), 10); gtk_table_set_col_spacings( GTK_TABLE(table), 10); gtk_widget_show(table); gtk_container_add( GTK_CONTAINER (frame) , table ); - widg = gtk_check_button_new_with_mnemonic( _("_Prefix dialed numbers with")); + widg = gtk_check_button_new_with_mnemonic( _("_Prefix dialed numbers with:")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widg), (g_strcasecmp (_urlhook_config->phone_number_enabled, "1")==0)?TRUE:FALSE); g_signal_connect (G_OBJECT(widg) , "clicked" , G_CALLBACK (phone_number_enabled_cb), NULL); - gtk_table_attach ( GTK_TABLE( table ), widg, 0, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_table_attach ( GTK_TABLE( table ), widg, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - label = gtk_label_new_with_mnemonic (_("_FIXME: ")); - gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + // label = gtk_label_new (_("Prepend: ")); + // gtk_table_attach ( GTK_TABLE( table ), label, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); prefix = gtk_entry_new (); gtk_label_set_mnemonic_widget (GTK_LABEL (label), prefix); gtk_entry_set_text(GTK_ENTRY(prefix), _urlhook_config->phone_number_prefix); gtk_widget_set_sensitive (GTK_WIDGET (prefix), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (widg))); - gtk_table_attach ( GTK_TABLE( table ), prefix, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 10); + gtk_table_attach ( GTK_TABLE( table ), prefix, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 10); gtk_widget_show_all(ret); diff --git a/sflphone-client-gnome/src/config/hooks-config.h b/sflphone-client-gnome/src/config/hooks-config.h index fe9c92c62f0be2ea37ba16869303e481297d6ef6..d4651fbe3729deb99910b26ef0cd2bf2ab4bcb8c 100644 --- a/sflphone-client-gnome/src/config/hooks-config.h +++ b/sflphone-client-gnome/src/config/hooks-config.h @@ -28,7 +28,7 @@ G_BEGIN_DECLS #define DEFAULT_SIP_URL_FIELD "X-sflphone-url" -#define DEFAULT_URL_COMMAND "x-www-browser" +#define DEFAULT_URL_COMMAND "xdg-open \"%s\"" #define URLHOOK_COMMAND "URLHOOK_COMMAND" #define URLHOOK_SIP_FIELD "URLHOOK_SIP_FIELD" #define URLHOOK_SIP_ENABLED "URLHOOK_SIP_ENABLED" diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index cad464f7fa70eae723aed7cdfc9c98b4e3f8e1f2..5f4ba6f6b3d5b0d3c757ea96e6e4f6db31b21498 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -203,7 +203,7 @@ dbus_connect () g_type_init (); - connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error); + connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); if (error) { @@ -215,22 +215,34 @@ dbus_connect () /* Create a proxy object for the "bus driver" (name "org.freedesktop.DBus") */ - // instanceProxy = dbus_g_proxy_new_for_name (connection, + /* + instanceProxy = dbus_g_proxy_new_for_name (connection, + "org.sflphone.SFLphone", + "/org/sflphone/SFLphone/Instance", + "org.sflphone.SFLphone.Instance"); + */ instanceProxy = dbus_g_proxy_new_for_name_owner (connection, "org.sflphone.SFLphone", "/org/sflphone/SFLphone/Instance", "org.sflphone.SFLphone.Instance", &error); + if (instanceProxy==NULL) { ERROR ("Failed to get proxy to Instance"); return FALSE; } + DEBUG ("DBus connected to Instance"); + /* + callManagerProxy = dbus_g_proxy_new_for_name (connection, + "org.sflphone.SFLphone", + "/org/sflphone/SFLphone/CallManager", + "org.sflphone.SFLphone.CallManager"); - // callManagerProxy = dbus_g_proxy_new_for_name (connection, + */ callManagerProxy = dbus_g_proxy_new_for_name_owner (connection, "org.sflphone.SFLphone", "/org/sflphone/SFLphone/CallManager", @@ -287,7 +299,14 @@ dbus_connect () dbus_g_proxy_connect_signal (callManagerProxy, "volumeChanged", G_CALLBACK(volume_changed_cb), NULL, NULL); - // configurationManagerProxy = dbus_g_proxy_new_for_name (connection, + /* + configurationManagerProxy = dbus_g_proxy_new_for_name (connection, + "org.sflphone.SFLphone", + "/org/sflphone/SFLphone/ConfigurationManager", + "org.sflphone.SFLphone.ConfigurationManager"); + */ + + configurationManagerProxy = dbus_g_proxy_new_for_name_owner (connection, "org.sflphone.SFLphone", "/org/sflphone/SFLphone/ConfigurationManager", diff --git a/tools/pysflphone/pysflphone_testdbus.py b/tools/pysflphone/pysflphone_testdbus.py index 7ef75d729f9f2419e3874d5dafc88ee8ca8eb292..52f58ba132bc940815836cc344ea286132d55d4d 100644 --- a/tools/pysflphone/pysflphone_testdbus.py +++ b/tools/pysflphone/pysflphone_testdbus.py @@ -27,12 +27,12 @@ class SflPhoneTests(SflPhoneCtrlSimple): print " " + account print "\n" - def test_codecs_methods + # def test_codecs_methods(self): - print "--- getCodecList() ---" - for codec int self.getCodecList(): - print " " + codec - print "\n" +# print "--- getCodecList() ---" +# for codec int self.getCodecList(): +# print " " + codec +# print "\n" sfl = SflPhoneTests() diff --git a/tools/pysflphone/sflphonectrlsimple.py b/tools/pysflphone/sflphonectrlsimple.py index 377f57a0204c9bb7369b848c4a785d5d00ca93f0..a11a9597672693e8956add6ce8a88db34f510f88 100755 --- a/tools/pysflphone/sflphonectrlsimple.py +++ b/tools/pysflphone/sflphonectrlsimple.py @@ -43,92 +43,99 @@ except ImportError, e: class SflPhoneCtrlSimple(object): - """Simple class for controlling SflPhoned through DBUS""" - - # list of active calls (known by the client) - activeCalls = {} - - def __init__(self, name=sys.argv[0]): - # current active account - self.account = None - # client name - self.name = name - # client registered to sflphoned ? - self.registered = False - - self.register() - - - def __del__(self): - if self.registered: - self.unregister() - - - def register(self): - if self.registered: - return - - try: - # register the main loop for d-bus events - DBusGMainLoop(set_as_default=True) - self.bus = dbus.SessionBus() - except dbus.DBusException, e: - raise SPdbusError("Unable to connect DBUS session bus") - - dbus_objects = dbus.Interface(self.bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'), 'org.freedesktop.DBus').ListNames() - if not "org.sflphone.SFLphone" in dbus_objects: - raise SPdbusError("Unable to find org.sflphone.SFLphone in DBUS. Check if sflphoned is running") - - try: - proxy_instance = self.bus.get_object("org.sflphone.SFLphone", - "/org/sflphone/SFLphone/Instance", - introspect=False) - proxy_callmgr = self.bus.get_object("org.sflphone.SFLphone", - "/org/sflphone/SFLphone/CallManager", - introspect=False) - proxy_confmgr = self.bus.get_object("org.sflphone.SFLphone", - "/org/sflphone/SFLphone/ConfigurationManager", - introspect=False) - self.instance = dbus.Interface(proxy_instance, - "org.sflphone.SFLphone.Instance") - self.callmanager = dbus.Interface(proxy_callmgr, - "org.sflphone.SFLphone.CallManager") - self.configurationmanager = dbus.Interface(proxy_confmgr, - "org.sflphone.SFLphone.ConfigurationManager") - except dbus.DBusException, e: - raise SPdbusError("Unable to bind to sflphoned api, ask core-dev team to implement getVersion method and start to pray.") - - try: - self.instance.Register(os.getpid(), self.name) - self.registered = True - except: - raise SPdaemonError("Client registration failed") - - try: - proxy_callmgr.connect_to_signal('incomingCall', self.onIncomingCall) - proxy_callmgr.connect_to_signal('callStateChanged', self.onCallStateChanged) - except dbus.DBusException, e: - print e + """Simple class for controlling SflPhoned through DBUS""" + + # list of active calls (known by the client) + activeCalls = {} + + def __init__(self, name=sys.argv[0]): + # current active account + self.account = None + # client name + self.name = name + # client registered to sflphoned ? + self.registered = False + + self.register() + + + def __del__(self): + if self.registered: + self.unregister() + + + def register(self): + if self.registered: + return + + try: + # register the main loop for d-bus events + DBusGMainLoop(set_as_default=True) + self.bus = dbus.SessionBus() + except dbus.DBusException, e: + raise SPdbusError("Unable to connect DBUS session bus") + + dbus_objects = dbus.Interface(self.bus.get_object( + 'org.freedesktop.DBus', '/org/freedesktop/DBus'), + 'org.freedesktop.DBus').ListNames() + + if not "org.sflphone.SFLphone" in dbus_objects: + raise SPdbusError("Unable to find org.sflphone.SFLphone in DBUS. Check if sflphoned is running") + + try: + proxy_instance = self.bus.get_object("org.sflphone.SFLphone", + "/org/sflphone/SFLphone/Instance", introspect=False) + proxy_callmgr = self.bus.get_object("org.sflphone.SFLphone", + "/org/sflphone/SFLphone/CallManager", introspect=False) + proxy_confmgr = self.bus.get_object("org.sflphone.SFLphone", + "/org/sflphone/SFLphone/ConfigurationManager", + introspect=False) + + self.instance = dbus.Interface(proxy_instance, + "org.sflphone.SFLphone.Instance") + self.callmanager = dbus.Interface(proxy_callmgr, + "org.sflphone.SFLphone.CallManager") + self.configurationmanager = dbus.Interface(proxy_confmgr, + "org.sflphone.SFLphone.ConfigurationManager") + + except dbus.DBusException, e: + + raise SPdbusError("Unable to bind to sflphoned api, + ask core-dev team to implement getVersion method and + start to pray.") + + try: + self.instance.Register(os.getpid(), self.name) + self.registered = True + except: + raise SPdaemonError("Client registration failed") + + try: + proxy_callmgr.connect_to_signal('incomingCall', self.onIncomingCall) + proxy_callmgr.connect_to_signal('callStateChanged', self.onCallStateChanged) + except dbus.DBusException, e: + print e - def unregister(self): - if not self.registered: - return - #raise SflPhoneError("Not registered !") - try: - self.instance.Unregister(os.getpid()) - self.registered = False - except: - raise SPdaemonError("Client unregistration failed") + def unregister(self): + if not self.registered: + return + #raise SflPhoneError("Not registered !") + try: + self.instance.Unregister(os.getpid()) + self.registered = False + except: + raise SPdaemonError("Client unregistration failed") - def isRegistered(self): - return self.registered + def isRegistered(self): + return self.registered - # - # Signal handling - # + + # + # Signal handling + # # On incoming call event, add the call to the list of active calls def onIncomingCall(self, account, callid, to):