Mercurial > pidgin.yaz
annotate console/libgnt/gntline.c @ 15307:e9db26a103eb
[gaim-migrate @ 18097]
Keep track of my level. Don't send an empty get_levels packet when we don't have any buddies because the server won't ack it. Refreshing buddy levels every 10 minutes is overki ll, don't do it.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Huetsch <markhuetsch> |
---|---|
date | Tue, 09 Jan 2007 21:16:58 +0000 |
parents | bfcdd361357e |
children | 1c8f1dc50685 |
rev | line source |
---|---|
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #include "gntline.h" |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 enum |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 SIGS = 1, |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 }; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 static GntWidgetClass *parent_class = NULL; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 static void |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 gnt_line_draw(GntWidget *widget) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 GntLine *line = GNT_LINE(widget); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 if (line->vertical) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 mvwvline(widget->window, 1, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
16 widget->priv.height - 2); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 else |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 mvwhline(widget->window, 0, 1, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
19 widget->priv.width - 2); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 static void |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
23 gnt_line_size_request(GntWidget *widget) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 if (GNT_LINE(widget)->vertical) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 widget->priv.width = 1; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 widget->priv.height = 5; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 else |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 widget->priv.width = 5; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 widget->priv.height = 1; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 static void |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 gnt_line_map(GntWidget *widget) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 if (widget->priv.width == 0 || widget->priv.height == 0) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 gnt_widget_size_request(widget); |
14432
3ac156db9cb6
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
42 GNTDEBUG; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 static void |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 gnt_line_class_init(GntLineClass *klass) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 parent_class = GNT_WIDGET_CLASS(klass); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 parent_class->draw = gnt_line_draw; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 parent_class->map = gnt_line_map; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 parent_class->size_request = gnt_line_size_request; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 |
14432
3ac156db9cb6
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
53 GNTDEBUG; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 static void |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 gnt_line_init(GTypeInstance *instance, gpointer class) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 GntWidget *widget = GNT_WIDGET(instance); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_SHADOW | GNT_WIDGET_NO_BORDER); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 widget->priv.minw = 1; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 widget->priv.minh = 1; |
14432
3ac156db9cb6
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
63 GNTDEBUG; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 /****************************************************************************** |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 * GntLine API |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 *****************************************************************************/ |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 GType |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 gnt_line_get_gtype(void) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 static GType type = 0; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 if(type == 0) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 static const GTypeInfo info = { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 sizeof(GntLineClass), |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 NULL, /* base_init */ |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 NULL, /* base_finalize */ |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 (GClassInitFunc)gnt_line_class_init, |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
81 NULL, /* class_finalize */ |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
82 NULL, /* class_data */ |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 sizeof(GntLine), |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 0, /* n_preallocs */ |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 gnt_line_init, /* instance_init */ |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 }; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 type = g_type_register_static(GNT_TYPE_WIDGET, |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 "GntLine", |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 &info, 0); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 return type; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
95 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
96 GntWidget *gnt_line_new(gboolean vertical) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
97 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
98 GntWidget *widget = g_object_new(GNT_TYPE_LINE, NULL); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
99 GntLine *line = GNT_LINE(widget); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
100 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
101 line->vertical = vertical; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
102 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
103 if (vertical) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
104 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
105 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_GROW_Y); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
106 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
107 else |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
108 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
109 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_GROW_X); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
110 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
111 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
112 return widget; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
113 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
114 |