Mercurial > pidgin
comparison console/gntblist.c @ 13896:a621329e8c85
[gaim-migrate @ 16381]
Changes in GntTextView. Things go somewhat 'smooth' when run inside
valgrind. Otherwise, it's kind of flaky. I don't mind a single bit
if someone gave me a hint :)
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 01 Jul 2006 00:56:05 +0000 |
parents | 582aaa4e287e |
children | eaaf73de9188 |
comparison
equal
deleted
inserted
replaced
13895:8f910263b4bb | 13896:a621329e8c85 |
---|---|
4 #include <signal.h> | 4 #include <signal.h> |
5 #include <util.h> | 5 #include <util.h> |
6 | 6 |
7 #include "gntgaim.h" | 7 #include "gntgaim.h" |
8 #include "gntbox.h" | 8 #include "gntbox.h" |
9 #include "gntlabel.h" | |
9 #include "gnttree.h" | 10 #include "gnttree.h" |
10 | 11 |
11 #include "gntblist.h" | 12 #include "gntblist.h" |
12 #include <string.h> | 13 #include <string.h> |
13 | 14 |
236 } | 237 } |
237 | 238 |
238 static void | 239 static void |
239 selection_activate(GntWidget *widget, GGBlist *ggblist) | 240 selection_activate(GntWidget *widget, GGBlist *ggblist) |
240 { | 241 { |
241 gnt_widget_set_focus(widget, FALSE); | 242 GntTree *tree = GNT_TREE(ggblist->tree); |
243 GaimBlistNode *node = gnt_tree_get_selection_data(tree); | |
244 | |
245 if (GAIM_BLIST_NODE_IS_BUDDY(node)) | |
246 { | |
247 GaimBuddy *buddy = (GaimBuddy *)node; | |
248 gaim_conversation_new(GAIM_CONV_TYPE_IM, | |
249 gaim_buddy_get_account(buddy), | |
250 gaim_buddy_get_name(buddy)); | |
251 } | |
252 else if (GAIM_BLIST_NODE_IS_CHAT(node)) | |
253 { | |
254 GaimChat *chat = (GaimChat*)node; | |
255 serv_join_chat(chat->account->gc, chat->components); | |
256 } | |
242 } | 257 } |
243 | 258 |
244 static void | 259 static void |
245 draw_tooltip(GGBlist *ggblist) | 260 draw_tooltip(GGBlist *ggblist) |
246 { | 261 { |
262 return; | |
247 GaimBlistNode *node; | 263 GaimBlistNode *node; |
248 int x, y, top, width; | 264 int x, y, top, width; |
249 GString *str; | 265 GString *str; |
250 GaimPlugin *prpl; | 266 GaimPlugin *prpl; |
251 GaimPluginProtocolInfo *prpl_info; | 267 GaimPluginProtocolInfo *prpl_info; |
252 GaimAccount *account; | 268 GaimAccount *account; |
253 GntTree *tree; | 269 GntTree *tree; |
254 GntWidget *widget, *box, *label; | 270 GntWidget *widget, *box; |
255 char *title = NULL; | 271 char *title = NULL; |
256 | 272 |
257 widget = ggblist->tree; | 273 widget = ggblist->tree; |
258 tree = GNT_TREE(widget); | 274 tree = GNT_TREE(widget); |
275 | |
276 if (!gnt_widget_has_focus(ggblist->tree)) | |
277 return; | |
259 | 278 |
260 if (ggblist->tooltip) | 279 if (ggblist->tooltip) |
261 { | 280 { |
262 /* XXX: Once we can properly redraw on expose events, this can be removed at the end | 281 /* XXX: Once we can properly redraw on expose events, this can be removed at the end |
263 * to avoid the blinking*/ | 282 * to avoid the blinking*/ |
330 box = gnt_box_new(FALSE, FALSE); | 349 box = gnt_box_new(FALSE, FALSE); |
331 gnt_box_set_toplevel(GNT_BOX(box), TRUE); | 350 gnt_box_set_toplevel(GNT_BOX(box), TRUE); |
332 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_NO_SHADOW); | 351 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_NO_SHADOW); |
333 gnt_box_set_title(GNT_BOX(box), title); | 352 gnt_box_set_title(GNT_BOX(box), title); |
334 | 353 |
335 gnt_box_add_widget(GNT_BOX(box), GNT_WIDGET(gnt_label_new(str->str))); | 354 gnt_box_add_widget(GNT_BOX(box), gnt_label_new(str->str)); |
336 | 355 |
337 gnt_widget_set_position(box, x, y); | 356 gnt_widget_set_position(box, x, y); |
338 gnt_widget_draw(box); | 357 gnt_widget_draw(box); |
339 | 358 |
340 g_free(title); | 359 g_free(title); |
361 if (ggblist->tooltip) | 380 if (ggblist->tooltip) |
362 { | 381 { |
363 gnt_widget_destroy(ggblist->tooltip); | 382 gnt_widget_destroy(ggblist->tooltip); |
364 ggblist->tooltip = NULL; | 383 ggblist->tooltip = NULL; |
365 return TRUE; | 384 return TRUE; |
366 } | |
367 } | |
368 else if (text[0] == '\r' && text[1] == '\0') | |
369 { | |
370 GntTree *tree = GNT_TREE(ggblist->tree); | |
371 GaimBlistNode *node = gnt_tree_get_selection_data(tree); | |
372 | |
373 if (GAIM_BLIST_NODE_IS_BUDDY(node)) | |
374 { | |
375 GaimBuddy *buddy = (GaimBuddy *)node; | |
376 gaim_conversation_new(GAIM_CONV_TYPE_IM, | |
377 gaim_buddy_get_account(buddy), | |
378 gaim_buddy_get_name(buddy)); | |
379 } | |
380 else if (GAIM_BLIST_NODE_IS_CHAT(node)) | |
381 { | |
382 GaimChat *chat = (GaimChat*)node; | |
383 serv_join_chat(chat->account->gc, chat->components); | |
384 } | 385 } |
385 } | 386 } |
386 | 387 |
387 return FALSE; | 388 return FALSE; |
388 } | 389 } |