Adding _write_im_cb to MainWindow class
authorRagner Magalhaes <ragner.magalhaes@openbossa.org>
Tue, 2 Dec 2008 20:39:30 +0000 (20:39 +0000)
committerAnderson Briglia <anderson.briglia@openbossa.org>
Sat, 28 Feb 2009 21:11:12 +0000 (17:11 -0400)
Adding _write_im_cb to update the conversation message at UI

Signed-off-by: Ragner Magalhaes <ragner.magalhaes@indt.org.br>

git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1333 596f6dd7-e928-0410-a184-9e12fd12cf7e

conversation_cbs.pxd
nullclient-ecore.py

index 4688985..8e68883 100644 (file)
@@ -57,7 +57,7 @@ cdef void write_im (conversation.PurpleConversation *conv, const_char *who,
                     time_t mtime):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation", "write_im\n")
     try:
                     time_t mtime):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation", "write_im\n")
     try:
-        (<object>conversation_cbs["write_im"])("write_im")
+        (<object>conversation_cbs["write_im"])(conv.account.username, <char *> message)
     except KeyError:
         pass
 
     except KeyError:
         pass
 
index aa283ec..207d42d 100644 (file)
@@ -61,7 +61,6 @@ def conv_callback(name):
 conv_cbs["create_conversation"] = conv_callback
 conv_cbs["destroy_conversation"] = conv_callback
 conv_cbs["write_chat"] = conv_callback
 conv_cbs["create_conversation"] = conv_callback
 conv_cbs["destroy_conversation"] = conv_callback
 conv_cbs["write_chat"] = conv_callback
-conv_cbs["write_im"] = conv_callback
 conv_cbs["write_conv"] = conv_callback
 conv_cbs["chat_add_users"] = conv_callback
 conv_cbs["chat_rename_user"] = conv_callback
 conv_cbs["write_conv"] = conv_callback
 conv_cbs["chat_add_users"] = conv_callback
 conv_cbs["chat_rename_user"] = conv_callback
@@ -117,8 +116,10 @@ signal_cbs["receiving_im_msg"] = receiving_im_msg_cb
 
 class MainWindow:
     def __init__(self, quit_cb):
 
 class MainWindow:
     def __init__(self, quit_cb):
+        global conv_cbs
         self.bt_cbs = {}
         self.quit_cb = quit_cb
         self.bt_cbs = {}
         self.quit_cb = quit_cb
+        conv_cbs["write_im"] = self._write_im_cb
 
     def init_window(self):
         # Main vbox
 
     def init_window(self):
         # Main vbox
@@ -149,6 +150,8 @@ class MainWindow:
 
         vbox_txt_area = etk.VBox()
         self.txt_area = etk.Label()
 
         vbox_txt_area = etk.VBox()
         self.txt_area = etk.Label()
+        self.txt_area.text = "<br> "
+
         vbox_txt_area.append(self.txt_area, etk.VBox.START, etk.VBox.EXPAND_FILL, 0)
 
         hbox_panel.append(vbox_txt_area, etk.HBox.START, etk.HBox.EXPAND_FILL, 0)
         vbox_txt_area.append(self.txt_area, etk.VBox.START, etk.VBox.EXPAND_FILL, 0)
 
         hbox_panel.append(vbox_txt_area, etk.HBox.START, etk.HBox.EXPAND_FILL, 0)
@@ -208,6 +211,10 @@ class MainWindow:
         if callable(cb):
             self.quit_cb = cb
 
         if callable(cb):
             self.quit_cb = cb
 
+    def _write_im_cb(self, name, message):
+        self.txt_area.text +=  str(name) + ": " + str(message) + "<br> "
+        self._window.show_all()
+
 
 class NullClientPurple:
     def __init__(self):
 
 class NullClientPurple:
     def __init__(self):
@@ -219,6 +226,7 @@ class NullClientPurple:
         self.username = "carmanplugintest@gmail.com"
         self.password = "abc123def"
 
         self.username = "carmanplugintest@gmail.com"
         self.password = "abc123def"
 
+
         global cbs
         global signal_cbs
         cbs["blist"]["update"] = self._purple_blist_new_cb
         global cbs
         global signal_cbs
         cbs["blist"]["update"] = self._purple_blist_new_cb
@@ -270,4 +278,4 @@ class NullClientPurple:
 if __name__ == '__main__':
 
     nullpurple = NullClientPurple()
 if __name__ == '__main__':
 
     nullpurple = NullClientPurple()
-    ecore.main_loop_begin()
\ No newline at end of file
+    ecore.main_loop_begin()