Mercurial > pidgin
comparison finch/gntdebug.c @ 16124:ab3f93232a2d
Add a utility function to assist scrolling in a textview.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sun, 15 Apr 2007 05:42:14 +0000 |
parents | 6dc5dc83a61b |
children | 0f0832c13fcb |
comparison
equal
deleted
inserted
replaced
16123:bc280c341679 | 16124:ab3f93232a2d |
---|---|
43 GntWidget *window; | 43 GntWidget *window; |
44 GntWidget *tview; | 44 GntWidget *tview; |
45 gboolean paused; | 45 gboolean paused; |
46 gboolean timestamps; | 46 gboolean timestamps; |
47 } debug; | 47 } debug; |
48 | |
49 static gboolean | |
50 debug_window_kpress_cb(GntWidget *wid, const char *key, GntTextView *view) | |
51 { | |
52 if (key[0] == 27) | |
53 { | |
54 if (strcmp(key, GNT_KEY_DOWN) == 0) | |
55 gnt_text_view_scroll(view, 1); | |
56 else if (strcmp(key, GNT_KEY_UP) == 0) | |
57 gnt_text_view_scroll(view, -1); | |
58 else if (strcmp(key, GNT_KEY_PGDOWN) == 0) | |
59 gnt_text_view_scroll(view, wid->priv.height - 2); | |
60 else if (strcmp(key, GNT_KEY_PGUP) == 0) | |
61 gnt_text_view_scroll(view, -(wid->priv.height - 2)); | |
62 else | |
63 return FALSE; | |
64 return TRUE; | |
65 } | |
66 return FALSE; | |
67 } | |
68 | 48 |
69 static void | 49 static void |
70 finch_debug_print(PurpleDebugLevel level, const char *category, | 50 finch_debug_print(PurpleDebugLevel level, const char *category, |
71 const char *args) | 51 const char *args) |
72 { | 52 { |
263 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_GROW_Y); | 243 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_GROW_Y); |
264 | 244 |
265 gnt_widget_set_name(debug.window, "debug-window"); | 245 gnt_widget_set_name(debug.window, "debug-window"); |
266 | 246 |
267 g_signal_connect(G_OBJECT(debug.window), "destroy", G_CALLBACK(reset_debug_win), NULL); | 247 g_signal_connect(G_OBJECT(debug.window), "destroy", G_CALLBACK(reset_debug_win), NULL); |
268 g_signal_connect(G_OBJECT(debug.window), "key_pressed", G_CALLBACK(debug_window_kpress_cb), debug.tview); | 248 gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(debug.tview), debug.window); |
269 } | 249 } |
270 | 250 |
271 gnt_widget_show(debug.window); | 251 gnt_widget_show(debug.window); |
272 } | 252 } |
273 | 253 |