comparison finch/libgnt/pygnt/dbus-gnt @ 18841:03a0054954bb

"Bless me father for I have sinned." "You use 4-space tabs?! OMG! Me too!"
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 08 Aug 2007 01:35:56 +0000
parents ed50c9745b1d
children 6df41719037c
comparison
equal deleted inserted replaced
18840:75a6fdc7f622 18841:03a0054954bb
22 22
23 def conv_closed(conv): 23 def conv_closed(conv):
24 key = get_dict_key(conv) 24 key = get_dict_key(conv)
25 stuff = convwins[key] 25 stuff = convwins[key]
26 stuff[0].destroy() 26 stuff[0].destroy()
27 # if a conv window is closed, then reopened, this thing crashes 27 # if a conv window is closed, then reopened, this thing crashes
28 convwins[key] = None 28 convwins[key] = None
29 29
30 def wrote_msg(account, who, msg, conv, flags): 30 def wrote_msg(account, who, msg, conv, flags):
31 stuff = show_conversation(conv) 31 stuff = show_conversation(conv)
32 tv = stuff[1] 32 tv = stuff[1]
74 else: 74 else:
75 chatdata = purple.PurpleConversationGetChatData(conv) 75 chatdata = purple.PurpleConversationGetChatData(conv)
76 purple.PurpleConvChatSend(chatdata, entry.get_text()) 76 purple.PurpleConvChatSend(chatdata, entry.get_text())
77 entry.clear() 77 entry.clear()
78 78
79 def conv_window_destroyed(win, key):
80 del convwins[key]
81
79 def show_conversation(conv): 82 def show_conversation(conv):
80 key = get_dict_key(conv) 83 key = get_dict_key(conv)
81 if key in convwins: 84 if key in convwins:
82 return convwins[key] 85 return convwins[key]
83 win = gnt.Window() 86 win = gnt.Window()
93 vbox.add_widget(entry) 96 vbox.add_widget(entry)
94 entry.connect("key_pressed", send_im_cb, conv) 97 entry.connect("key_pressed", send_im_cb, conv)
95 tv.clear() 98 tv.clear()
96 win.show() 99 win.show()
97 convwins[key] = [win, tv, entry] 100 convwins[key] = [win, tv, entry]
98 # XXX: listen to "destroy" for the window, and reset the key 101 win.connect("destroy", conv_window_destroyed, key)
99 return convwins[key] 102 return convwins[key]
100 103
101 def show_buddylist(): 104 def show_buddylist():
102 win = gnt.Window() 105 win = gnt.Window()
103 tree = gnt.Tree() 106 tree = gnt.Tree()
104 tree.set_property("columns", 1) 107 tree.set_property("columns", 1)
105 win.add_widget(tree) 108 win.add_widget(tree)
106 node = purple.PurpleBlistGetRoot() 109 node = purple.PurpleBlistGetRoot()
107 while node: 110 while node:
108 if purple.PurpleBlistNodeIsGroup(node): 111 if purple.PurpleBlistNodeIsGroup(node):
109 sys.stderr.write(str(node) + "\n") 112 sys.stderr.write(str(node) + "\n")
110 tree.add_row_after(str(node), ["asd", ""], None, None) 113 tree.add_row_after(str(node), ["asd", ""], None, None)
111 #tree.add_row_after(node, [str(purple.PurpleGroupGetName(node)), ""], None, None) 114 #tree.add_row_after(node, [str(purple.PurpleGroupGetName(node)), ""], None, None)
112 #tree.add_row_after(node, ["aasd", ""], None, None) 115 #tree.add_row_after(node, ["aasd", ""], None, None)
113 elif purple.PurpleBlistNodeIsContact(node): 116 elif purple.PurpleBlistNodeIsContact(node):
114 buddy = purple.PurpleContactGetPriorityBuddy(node) 117 buddy = purple.PurpleContactGetPriorityBuddy(node)
115 group = purple.PurpleBuddyGetGroup(buddy) 118 group = purple.PurpleBuddyGetGroup(buddy)
116 #tree.add_row_after(node, [str(purple.PurpleBuddyGetName(buddy)), ""], group, None) 119 #tree.add_row_after(node, [str(purple.PurpleBuddyGetName(buddy)), ""], group, None)
117 120
118 node = purple.PurpleBlistNodeNext(node, False) 121 node = purple.PurpleBlistNodeNext(node, False)
119 win.show() 122 win.show()
120 123
121 gnt.gnt_init() 124 gnt.gnt_init()
122 125
123 # show_buddylist() 126 # show_buddylist()
124 127