0

I recentely started to program in Python and making a script/plugin for Pidgin,i need to access PurpleConversationUiOps and use the has_focus field,based in some examples in documentation of Pidgin i made this:

    #!/usr/bin/env python
    import dbus, gobject
    from dbus.mainloop.glib import DBusGMainLoop

    def view(conv):
     if conv == 1: #if has focus
       print "Has Focus"

    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
    bus = dbus.SessionBus()
    bus.add_signal_receiver(view,
                    dbus_interface="im.pidgin.purple.PurpleConversationUiOps",
                    signal_name="HasFocus")
    loop = gobject.MainLoop()
    loop.run()

He gives no error but I don't receive any signal,so how can i access the has_focus field?

Mr Alles
  • 11
  • 3

1 Answers1

0

I have inspected my Pidgin 2.10.0 with d-feet and therer is only one interface, im.pidgin.purple.PurpleInterface. It seems that the API you are looking for is the method (not signal) PurpleConversationHasFocus(int32 conv) -> int32.

To get the conversations, there's PurpleGetConversations -> Array of int32, or a signal ConversationCreated(int32).

$ dbus-send --print-reply --dest=im.pidgin.purple.PurpleService  /im/pidgin/purple/PurpleObject im.pidgin.purple.PurpleInterface.PurpleGetConversations
method return sender=:1.165 -> dest=:1.172 reply_serial=2
   array [
      int32 22042
   ]
$ dbus-send --print-reply --dest=im.pidgin.purple.PurpleService  /im/pidgin/purple/PurpleObject im.pidgin.purple.PurpleInterface.PurpleConversationHasFocus int32:22042
method return sender=:1.165 -> dest=:1.174 reply_serial=2
   int32 0
Martin Vidner
  • 2,307
  • 16
  • 31