Mercurial > pidgin
annotate console/libgnt/gntwidget.c @ 14881:5228f8cf2a6a
[gaim-migrate @ 17650]
Print a debug message if someone tries to specify a binding for some non-existent action.
Make sure the conversation windows aren't too large to cause a crash.
raise(SIGABRT) instead of exit() to force a coredump if something goes wrong with stdin.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 01 Nov 2006 20:59:23 +0000 |
parents | 70623f0d5cdc |
children | 065e7ac30338 |
rev | line source |
---|---|
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 /* Stuff brutally ripped from Gflib */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 #include "gntwidget.h" |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
4 #include "gntstyle.h" |
13935
cd2da4b079cf
[gaim-migrate @ 16466]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13930
diff
changeset
|
5 #include "gntmarshal.h" |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 #include "gnt.h" |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 enum |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 SIG_DESTROY, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 SIG_DRAW, |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14432
diff
changeset
|
12 SIG_HIDE, |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 SIG_GIVE_FOCUS, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 SIG_LOST_FOCUS, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 SIG_KEY_PRESSED, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 SIG_MAP, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 SIG_ACTIVATE, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 SIG_EXPOSE, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 SIG_SIZE_REQUEST, |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
20 SIG_CONFIRM_SIZE, |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
21 SIG_SIZE_CHANGED, |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 SIG_POSITION, |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
23 SIG_CLICKED, |
14834
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
24 SIG_CONTEXT_MENU, |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 SIGS |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 }; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 static GObjectClass *parent_class = NULL; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 static guint signals[SIGS] = { 0 }; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
31 static void init_widget(GntWidget *widget); |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
32 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 gnt_widget_init(GTypeInstance *instance, gpointer class) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 GntWidget *widget = GNT_WIDGET(instance); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 widget->priv.name = NULL; |
14432
3ac156db9cb6
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
38 GNTDEBUG; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 gnt_widget_map(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 /* Get some default size for the widget */ |
14432
3ac156db9cb6
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
45 GNTDEBUG; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 g_signal_emit(widget, signals[SIG_MAP], 0); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_MAPPED); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 gnt_widget_dispose(GObject *obj) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 GntWidget *self = GNT_WIDGET(obj); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 if(!(GNT_WIDGET_FLAGS(self) & GNT_WIDGET_DESTROYING)) { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 GNT_WIDGET_SET_FLAGS(self, GNT_WIDGET_DESTROYING); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 g_signal_emit(self, signals[SIG_DESTROY], 0); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 GNT_WIDGET_UNSET_FLAGS(self, GNT_WIDGET_DESTROYING); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 parent_class->dispose(obj); |
14432
3ac156db9cb6
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
64 GNTDEBUG; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 gnt_widget_focus_change(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
69 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 if (GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_MAPPED) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 gnt_widget_draw(widget); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
74 static gboolean |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
75 gnt_widget_dummy_confirm_size(GntWidget *widget, int width, int height) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
76 { |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
77 if (width < widget->priv.minw || height < widget->priv.minh) |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
78 return FALSE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
79 if (widget->priv.width != width && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_X)) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
80 return FALSE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
81 if (widget->priv.height != height && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_Y)) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
82 return FALSE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
83 return TRUE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
84 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
85 |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
86 static gboolean |
14834
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
87 context_menu(GntWidget *widget, GList *null) |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
88 { |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
89 gboolean ret = FALSE; |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
90 g_signal_emit(widget, signals[SIG_CONTEXT_MENU], 0, &ret); |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
91 return ret; |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
92 } |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
93 |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
94 static gboolean |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
95 gnt_boolean_handled_accumulator(GSignalInvocationHint *ihint, |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
96 GValue *return_accu, |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
97 const GValue *handler_return, |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
98 gpointer dummy) |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
99 { |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
100 gboolean continue_emission; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
101 gboolean signal_handled; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
102 |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
103 signal_handled = g_value_get_boolean (handler_return); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
104 g_value_set_boolean (return_accu, signal_handled); |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
105 continue_emission = !signal_handled; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
106 |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
107 return continue_emission; |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
108 } |
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
109 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
110 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
111 gnt_widget_class_init(GntWidgetClass *klass) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
112 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
113 GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
114 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
115 parent_class = g_type_class_peek_parent(klass); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
116 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
117 obj_class->dispose = gnt_widget_dispose; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
118 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
119 klass->destroy = gnt_widget_destroy; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
120 klass->show = gnt_widget_show; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
121 klass->draw = gnt_widget_draw; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
122 klass->expose = gnt_widget_expose; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
123 klass->map = gnt_widget_map; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
124 klass->lost_focus = gnt_widget_focus_change; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
125 klass->gained_focus = gnt_widget_focus_change; |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
126 klass->confirm_size = gnt_widget_dummy_confirm_size; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
127 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
128 klass->key_pressed = NULL; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
129 klass->activate = NULL; |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
130 klass->clicked = NULL; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
131 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
132 signals[SIG_DESTROY] = |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
133 g_signal_new("destroy", |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
134 G_TYPE_FROM_CLASS(klass), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
135 G_SIGNAL_RUN_LAST, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
136 G_STRUCT_OFFSET(GntWidgetClass, destroy), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
137 NULL, NULL, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
138 g_cclosure_marshal_VOID__VOID, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
139 G_TYPE_NONE, 0); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
140 signals[SIG_GIVE_FOCUS] = |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
141 g_signal_new("gained-focus", |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
142 G_TYPE_FROM_CLASS(klass), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
143 G_SIGNAL_RUN_LAST, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
144 G_STRUCT_OFFSET(GntWidgetClass, gained_focus), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
145 NULL, NULL, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
146 g_cclosure_marshal_VOID__VOID, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
147 G_TYPE_NONE, 0); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
148 signals[SIG_LOST_FOCUS] = |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
149 g_signal_new("lost-focus", |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
150 G_TYPE_FROM_CLASS(klass), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
151 G_SIGNAL_RUN_LAST, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
152 G_STRUCT_OFFSET(GntWidgetClass, lost_focus), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
153 NULL, NULL, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
154 g_cclosure_marshal_VOID__VOID, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
155 G_TYPE_NONE, 0); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
156 signals[SIG_ACTIVATE] = |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
157 g_signal_new("activate", |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
158 G_TYPE_FROM_CLASS(klass), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
159 G_SIGNAL_RUN_LAST, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
160 G_STRUCT_OFFSET(GntWidgetClass, activate), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
161 NULL, NULL, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
162 g_cclosure_marshal_VOID__VOID, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
163 G_TYPE_NONE, 0); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
164 signals[SIG_MAP] = |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
165 g_signal_new("map", |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
166 G_TYPE_FROM_CLASS(klass), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
167 G_SIGNAL_RUN_LAST, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
168 G_STRUCT_OFFSET(GntWidgetClass, map), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
169 NULL, NULL, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
170 g_cclosure_marshal_VOID__VOID, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
171 G_TYPE_NONE, 0); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
172 signals[SIG_DRAW] = |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
173 g_signal_new("draw", |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
174 G_TYPE_FROM_CLASS(klass), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
175 G_SIGNAL_RUN_LAST, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
176 G_STRUCT_OFFSET(GntWidgetClass, draw), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
177 NULL, NULL, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
178 g_cclosure_marshal_VOID__VOID, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
179 G_TYPE_NONE, 0); |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14432
diff
changeset
|
180 signals[SIG_HIDE] = |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14432
diff
changeset
|
181 g_signal_new("hide", |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14432
diff
changeset
|
182 G_TYPE_FROM_CLASS(klass), |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14432
diff
changeset
|
183 G_SIGNAL_RUN_LAST, |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14432
diff
changeset
|
184 G_STRUCT_OFFSET(GntWidgetClass, hide), |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14432
diff
changeset
|
185 NULL, NULL, |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14432
diff
changeset
|
186 g_cclosure_marshal_VOID__VOID, |
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14432
diff
changeset
|
187 G_TYPE_NONE, 0); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
188 signals[SIG_EXPOSE] = |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
189 g_signal_new("expose", |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
190 G_TYPE_FROM_CLASS(klass), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
191 G_SIGNAL_RUN_LAST, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
192 G_STRUCT_OFFSET(GntWidgetClass, expose), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
193 NULL, NULL, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
194 gnt_closure_marshal_VOID__INT_INT_INT_INT, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
195 G_TYPE_NONE, 4, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
196 signals[SIG_POSITION] = |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
197 g_signal_new("position-set", |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
198 G_TYPE_FROM_CLASS(klass), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
199 G_SIGNAL_RUN_LAST, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
200 G_STRUCT_OFFSET(GntWidgetClass, set_position), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
201 NULL, NULL, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 gnt_closure_marshal_VOID__INT_INT, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
203 G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
204 signals[SIG_SIZE_REQUEST] = |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
205 g_signal_new("size_request", |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
206 G_TYPE_FROM_CLASS(klass), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
207 G_SIGNAL_RUN_LAST, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
208 G_STRUCT_OFFSET(GntWidgetClass, size_request), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
209 NULL, NULL, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
210 g_cclosure_marshal_VOID__VOID, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
211 G_TYPE_NONE, 0); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
212 signals[SIG_SIZE_CHANGED] = |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
213 g_signal_new("size_changed", |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
214 G_TYPE_FROM_CLASS(klass), |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
215 G_SIGNAL_RUN_LAST, |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
216 G_STRUCT_OFFSET(GntWidgetClass, size_changed), |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
217 NULL, NULL, |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
218 gnt_closure_marshal_VOID__INT_INT, |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
219 G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
220 signals[SIG_CONFIRM_SIZE] = |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
221 g_signal_new("confirm_size", |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
222 G_TYPE_FROM_CLASS(klass), |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
223 G_SIGNAL_RUN_LAST, |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
224 G_STRUCT_OFFSET(GntWidgetClass, confirm_size), |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
225 NULL, NULL, |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
226 gnt_closure_marshal_BOOLEAN__INT_INT, |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
227 G_TYPE_BOOLEAN, 2, G_TYPE_INT, G_TYPE_INT); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
228 signals[SIG_KEY_PRESSED] = |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
229 g_signal_new("key_pressed", |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
230 G_TYPE_FROM_CLASS(klass), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
231 G_SIGNAL_RUN_LAST, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
232 G_STRUCT_OFFSET(GntWidgetClass, key_pressed), |
14091
ae4cbed1b309
[gaim-migrate @ 16715]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14011
diff
changeset
|
233 gnt_boolean_handled_accumulator, NULL, |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
234 gnt_closure_marshal_BOOLEAN__STRING, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
235 G_TYPE_BOOLEAN, 1, G_TYPE_STRING); |
14239
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
236 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
237 signals[SIG_CLICKED] = |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
238 g_signal_new("clicked", |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
239 G_TYPE_FROM_CLASS(klass), |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
240 G_SIGNAL_RUN_LAST, |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
241 G_STRUCT_OFFSET(GntWidgetClass, clicked), |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
242 gnt_boolean_handled_accumulator, NULL, |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
243 gnt_closure_marshal_BOOLEAN__INT_INT_INT, |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
244 G_TYPE_BOOLEAN, 3, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT); |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
245 |
14834
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
246 signals[SIG_CONTEXT_MENU] = |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
247 g_signal_new("context-menu", |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
248 G_TYPE_FROM_CLASS(klass), |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
249 G_SIGNAL_RUN_LAST, |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
250 0, |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
251 gnt_boolean_handled_accumulator, NULL, |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
252 gnt_closure_marshal_BOOLEAN__VOID, |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
253 G_TYPE_BOOLEAN, 0); |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
254 |
14793
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
255 klass->actions = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
256 (GDestroyNotify)gnt_widget_action_free); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
257 klass->bindings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
258 (GDestroyNotify)gnt_widget_action_param_free); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
259 |
14834
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
260 /* This is relevant for all widgets */ |
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
261 gnt_widget_class_register_action(klass, "context-menu", context_menu, |
14876
70623f0d5cdc
[gaim-migrate @ 17645]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14847
diff
changeset
|
262 GNT_KEY_POPUP, NULL); |
14834
52022b0a9405
[gaim-migrate @ 17601]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14829
diff
changeset
|
263 |
14793
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
264 gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), klass); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
265 |
14432
3ac156db9cb6
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
266 GNTDEBUG; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
267 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
268 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
269 /****************************************************************************** |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
270 * GntWidget API |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
271 *****************************************************************************/ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
272 GType |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
273 gnt_widget_get_gtype(void) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
274 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
275 static GType type = 0; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
276 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
277 if(type == 0) { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
278 static const GTypeInfo info = { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
279 sizeof(GntWidgetClass), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
280 NULL, /* base_init */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
281 NULL, /* base_finalize */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
282 (GClassInitFunc)gnt_widget_class_init, |
14239
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
283 NULL, |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
284 NULL, /* class_data */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
285 sizeof(GntWidget), |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
286 0, /* n_preallocs */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
287 gnt_widget_init, /* instance_init */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
288 }; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
289 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
290 type = g_type_register_static(G_TYPE_OBJECT, |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
291 "GntWidget", |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
292 &info, G_TYPE_FLAG_ABSTRACT); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
293 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
294 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
295 return type; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
296 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
297 |
14239
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
298 static const char * |
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
299 gnt_widget_remap_keys(GntWidget *widget, const char *text) |
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
300 { |
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
301 const char *remap = NULL; |
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
302 GType type = G_OBJECT_TYPE(widget); |
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
303 GntWidgetClass *klass = GNT_WIDGET_CLASS(G_OBJECT_GET_CLASS(widget)); |
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
304 |
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
305 if (klass->remaps == NULL) |
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
306 { |
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
307 klass->remaps = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
308 gnt_styles_get_keyremaps(type, klass->remaps); |
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
309 } |
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
310 |
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
311 remap = g_hash_table_lookup(klass->remaps, text); |
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
312 |
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
313 return (remap ? remap : text); |
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
314 } |
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
315 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
316 static void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
317 gnt_widget_take_focus(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
318 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
319 gnt_screen_take_focus(widget); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
320 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
321 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
322 void gnt_widget_set_take_focus(GntWidget *widget, gboolean can) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
323 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
324 if (can) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
325 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_CAN_TAKE_FOCUS); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
326 else |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
327 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_CAN_TAKE_FOCUS); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
328 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
329 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
330 /** |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
331 * gnt_widget_destroy: |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
332 * @obj: The #GntWidget instance. |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
333 * |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
334 * Emits the "destroy" signal notifying all reference holders that they |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
335 * should release @obj. |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
336 */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
337 void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
338 gnt_widget_destroy(GntWidget *obj) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
339 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
340 g_return_if_fail(GNT_IS_WIDGET(obj)); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
341 |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
342 gnt_widget_hide(obj); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
343 delwin(obj->window); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
344 if(!(GNT_WIDGET_FLAGS(obj) & GNT_WIDGET_DESTROYING)) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
345 g_object_run_dispose(G_OBJECT(obj)); |
14432
3ac156db9cb6
[gaim-migrate @ 17146]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14343
diff
changeset
|
346 GNTDEBUG; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
347 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
348 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
349 void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
350 gnt_widget_show(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
351 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
352 /* Draw the widget and take focus */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
353 if (GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_CAN_TAKE_FOCUS) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
354 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
355 gnt_widget_take_focus(widget); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
356 } |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
357 gnt_widget_draw(widget); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
358 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
359 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
360 void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
361 gnt_widget_draw(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
362 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
363 /* Draw the widget */ |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
364 if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_DRAWING)) |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
365 return; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
366 |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
367 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_DRAWING); |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
368 if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_MAPPED)) |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
369 { |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
370 gnt_widget_map(widget); |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
371 gnt_screen_occupy(widget); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
372 } |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
373 |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
374 if (widget->window == NULL) |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
375 { |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
376 gboolean shadow = TRUE; |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
377 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
378 if (!gnt_widget_has_shadow(widget)) |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
379 shadow = FALSE; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
380 |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
381 widget->window = newwin(widget->priv.height + shadow, widget->priv.width + shadow, |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
382 widget->priv.y, widget->priv.x); |
14292
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
383 if (widget->window == NULL) /* The size is probably too large for the screen */ |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
384 { |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
385 int x = widget->priv.x, y = widget->priv.y; |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
386 int w = widget->priv.width + shadow, h = widget->priv.height + shadow; |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
387 int maxx, maxy; /* Max-X is cool */ |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
388 |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
389 getmaxyx(stdscr, maxy, maxx); |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
390 |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
391 if (x + w >= maxx) |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
392 x = MAX(0, maxx - w); |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
393 if (y + h >= maxy) |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
394 y = MAX(0, maxy - h); |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
395 |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
396 w = MIN(w, maxx); |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
397 h = MIN(h, maxy); |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
398 |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
399 widget->priv.x = x; |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
400 widget->priv.y = y; |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
401 widget->priv.width = w - shadow; |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
402 widget->priv.height = h - shadow; |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
403 |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
404 widget->window = newwin(widget->priv.height + shadow, widget->priv.width + shadow, |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
405 widget->priv.y, widget->priv.x); |
c111a7e718d0
[gaim-migrate @ 16982]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14239
diff
changeset
|
406 } |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
407 init_widget(widget); |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
408 } |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
409 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
410 g_signal_emit(widget, signals[SIG_DRAW], 0); |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
411 gnt_widget_queue_update(widget); |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
412 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_DRAWING); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
413 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
414 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
415 gboolean |
14793
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
416 gnt_widget_perform_action_named(GntWidget *widget, const char *name, ...) |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
417 { |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
418 GntWidgetClass *klass = GNT_WIDGET_CLASS(G_OBJECT_GET_CLASS(widget)); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
419 GList *list = NULL; |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
420 va_list args; |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
421 GntWidgetAction *action; |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
422 void *p; |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
423 |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
424 va_start(args, name); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
425 while ((p = va_arg(args, void *)) != NULL) |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
426 list = g_list_append(list, p); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
427 va_end(args); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
428 |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
429 action = g_hash_table_lookup(klass->actions, name); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
430 if (action && action->u.action) { |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
431 if (list) |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
432 return action->u.action(widget, list); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
433 else |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
434 return action->u.action_noparam(widget); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
435 } |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
436 return FALSE; |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
437 } |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
438 |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
439 static gboolean |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
440 gnt_widget_perform_action(GntWidget *widget, const char *keys) |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
441 { |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
442 GntWidgetClass *klass = GNT_WIDGET_CLASS(G_OBJECT_GET_CLASS(widget)); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
443 GntWidgetActionParam *param = g_hash_table_lookup(klass->bindings, keys); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
444 |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
445 if (param && param->action) { |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
446 if (param->list) |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
447 return param->action->u.action(widget, param->list); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
448 else |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
449 return param->action->u.action_noparam(widget); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
450 } |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
451 return FALSE; |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
452 } |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
453 |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
454 gboolean |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
455 gnt_widget_key_pressed(GntWidget *widget, const char *keys) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
456 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
457 gboolean ret; |
13855
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
458 if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_CAN_TAKE_FOCUS)) |
5b288502a382
[gaim-migrate @ 16314]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13850
diff
changeset
|
459 return FALSE; |
14239
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
460 |
14793
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
461 if (gnt_widget_perform_action(widget, keys)) |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
462 return TRUE; |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
463 |
14239
a0b1ab181316
[gaim-migrate @ 16921]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14091
diff
changeset
|
464 keys = gnt_widget_remap_keys(widget, keys); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
465 g_signal_emit(widget, signals[SIG_KEY_PRESSED], 0, keys, &ret); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
466 return ret; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
467 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
468 |
14343
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
469 gboolean |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
470 gnt_widget_clicked(GntWidget *widget, GntMouseEvent event, int x, int y) |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
471 { |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
472 gboolean ret; |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
473 g_signal_emit(widget, signals[SIG_CLICKED], 0, event, x, y, &ret); |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
474 return ret; |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
475 } |
0387a167f342
[gaim-migrate @ 17044]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14335
diff
changeset
|
476 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
477 void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
478 gnt_widget_expose(GntWidget *widget, int x, int y, int width, int height) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
479 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
480 g_signal_emit(widget, signals[SIG_EXPOSE], 0, x, y, width, height); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
481 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
482 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
483 void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
484 gnt_widget_hide(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
485 { |
14613
62bb53609a36
[gaim-migrate @ 17341]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14432
diff
changeset
|
486 g_signal_emit(widget, signals[SIG_HIDE], 0); |
13860
c1e3f7c75c3f
[gaim-migrate @ 16321]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13858
diff
changeset
|
487 wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); |
14298
6e2e9e84b99d
[gaim-migrate @ 16988]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14292
diff
changeset
|
488 #if 0 |
6e2e9e84b99d
[gaim-migrate @ 16988]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14292
diff
changeset
|
489 /* XXX: I have no clue why, but this seemed to be necessary. */ |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
490 if (gnt_widget_has_shadow(widget)) |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
491 mvwvline(widget->window, 1, widget->priv.width, ' ', widget->priv.height); |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
492 #endif |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
493 gnt_screen_release(widget); |
13980
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
494 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_INVISIBLE); |
13907
cc60d0861337
[gaim-migrate @ 16402]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
495 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_MAPPED); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
496 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
497 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
498 void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
499 gnt_widget_set_position(GntWidget *wid, int x, int y) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
500 { |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
501 g_signal_emit(wid, signals[SIG_POSITION], 0, x, y); |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
502 /* XXX: Need to install properties for these and g_object_notify */ |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
503 wid->priv.x = x; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
504 wid->priv.y = y; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
505 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
506 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
507 void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
508 gnt_widget_get_position(GntWidget *wid, int *x, int *y) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
509 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
510 if (x) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
511 *x = wid->priv.x; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
512 if (y) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
513 *y = wid->priv.y; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
514 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
515 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
516 void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
517 gnt_widget_size_request(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
518 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
519 g_signal_emit(widget, signals[SIG_SIZE_REQUEST], 0); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
520 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
521 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
522 void |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
523 gnt_widget_get_size(GntWidget *wid, int *width, int *height) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
524 { |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
525 gboolean shadow = TRUE; |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
526 if (!gnt_widget_has_shadow(wid)) |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
527 shadow = FALSE; |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
528 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
529 if (width) |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
530 *width = wid->priv.width + shadow; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
531 if (height) |
13927
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
532 *height = wid->priv.height + shadow; |
9309d27d780c
[gaim-migrate @ 16447]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13916
diff
changeset
|
533 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
534 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
535 |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
536 static void |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
537 init_widget(GntWidget *widget) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
538 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
539 gboolean shadow = TRUE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
540 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
541 if (!gnt_widget_has_shadow(widget)) |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
542 shadow = FALSE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
543 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
544 wbkgd(widget->window, COLOR_PAIR(GNT_COLOR_NORMAL)); |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
545 werase(widget->window); |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
546 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
547 if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_NO_BORDER)) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
548 { |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
549 /* - This is ugly. */ |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
550 /* - What's your point? */ |
14011
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
551 mvwvline(widget->window, 0, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.height); |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
552 mvwvline(widget->window, 0, widget->priv.width - 1, |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
553 ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.height); |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
554 mvwhline(widget->window, widget->priv.height - 1, 0, |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
555 ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.width); |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
556 mvwhline(widget->window, 0, 0, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.width); |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
557 mvwaddch(widget->window, 0, 0, ACS_ULCORNER | COLOR_PAIR(GNT_COLOR_NORMAL)); |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
558 mvwaddch(widget->window, 0, widget->priv.width - 1, |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
559 ACS_URCORNER | COLOR_PAIR(GNT_COLOR_NORMAL)); |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
560 mvwaddch(widget->window, widget->priv.height - 1, 0, |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
561 ACS_LLCORNER | COLOR_PAIR(GNT_COLOR_NORMAL)); |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
562 mvwaddch(widget->window, widget->priv.height - 1, widget->priv.width - 1, |
735c4e927eb8
[gaim-migrate @ 16603]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14010
diff
changeset
|
563 ACS_LRCORNER | COLOR_PAIR(GNT_COLOR_NORMAL)); |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
564 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
565 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
566 if (shadow) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
567 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
568 wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_SHADOW)); |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
569 mvwvline(widget->window, 1, widget->priv.width, ' ', widget->priv.height); |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
570 mvwhline(widget->window, widget->priv.height, 1, ' ', widget->priv.width); |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
571 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
572 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
573 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
574 gboolean |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
575 gnt_widget_set_size(GntWidget *widget, int width, int height) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
576 { |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
577 gboolean ret = TRUE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
578 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
579 if (gnt_widget_has_shadow(widget)) |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
580 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
581 width--; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
582 height--; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
583 } |
14847
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14836
diff
changeset
|
584 if (width <= 0) |
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14836
diff
changeset
|
585 width = widget->priv.width; |
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14836
diff
changeset
|
586 if (height <= 0) |
d478f3853671
[gaim-migrate @ 17616]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14836
diff
changeset
|
587 height = widget->priv.height; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
588 |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
589 if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_MAPPED)) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
590 { |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
591 ret = gnt_widget_confirm_size(widget, width, height); |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
592 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
593 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
594 if (ret) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
595 { |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
596 gboolean shadow = TRUE; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
597 int oldw, oldh; |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
598 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
599 if (!gnt_widget_has_shadow(widget)) |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
600 shadow = FALSE; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
601 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
602 oldw = widget->priv.width; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
603 oldh = widget->priv.height; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
604 |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
605 widget->priv.width = width; |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
606 widget->priv.height = height; |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
607 |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
608 g_signal_emit(widget, signals[SIG_SIZE_CHANGED], 0, oldw, oldh); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
609 |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
610 if (widget->window) |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
611 { |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
612 wresize(widget->window, height + shadow, width + shadow); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
613 init_widget(widget); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
614 } |
13930
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
615 if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_MAPPED)) |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
616 init_widget(widget); |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
617 else |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
618 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_MAPPED); |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
619 } |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
620 |
3dbcbc5e57e1
[gaim-migrate @ 16457]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13927
diff
changeset
|
621 return ret; |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
622 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
623 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
624 gboolean |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
625 gnt_widget_set_focus(GntWidget *widget, gboolean set) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
626 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
627 if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_CAN_TAKE_FOCUS)) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
628 return FALSE; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
629 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
630 if (set && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_HAS_FOCUS)) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
631 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
632 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_HAS_FOCUS); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
633 g_signal_emit(widget, signals[SIG_GIVE_FOCUS], 0); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
634 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
635 else if (!set) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
636 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
637 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_HAS_FOCUS); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
638 g_signal_emit(widget, signals[SIG_LOST_FOCUS], 0); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
639 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
640 else |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
641 return FALSE; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
642 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
643 return TRUE; |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
644 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
645 |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
646 void gnt_widget_set_name(GntWidget *widget, const char *name) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
647 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
648 g_free(widget->priv.name); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
649 widget->priv.name = g_strdup(name); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
650 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
651 |
14335
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14298
diff
changeset
|
652 const char *gnt_widget_get_name(GntWidget *widget) |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14298
diff
changeset
|
653 { |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14298
diff
changeset
|
654 return widget->priv.name; |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14298
diff
changeset
|
655 } |
b1b76fb9c739
[gaim-migrate @ 17031]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14298
diff
changeset
|
656 |
13850
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
657 void gnt_widget_activate(GntWidget *widget) |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
658 { |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
659 g_signal_emit(widget, signals[SIG_ACTIVATE], 0); |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
660 } |
0e1e59770cb0
[gaim-migrate @ 16308]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
661 |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
662 static gboolean |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
663 update_queue_callback(gpointer data) |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
664 { |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
665 GntWidget *widget = GNT_WIDGET(data); |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
666 |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
667 if (!g_object_get_data(G_OBJECT(widget), "gnt:queue_update")) |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
668 return FALSE; |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
669 gnt_screen_update(widget); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
670 g_object_set_data(G_OBJECT(widget), "gnt:queue_update", NULL); |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
671 return FALSE; |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
672 } |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
673 |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
674 void gnt_widget_queue_update(GntWidget *widget) |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
675 { |
13979
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
676 if (widget->window == NULL) |
a71678d2da16
[gaim-migrate @ 16540]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13943
diff
changeset
|
677 return; |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
678 while (widget->parent) |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
679 widget = widget->parent; |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
680 |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
681 if (!g_object_get_data(G_OBJECT(widget), "gnt:queue_update")) |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
682 { |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
683 int id = g_timeout_add(0, update_queue_callback, widget); |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
684 g_object_set_data_full(G_OBJECT(widget), "gnt:queue_update", GINT_TO_POINTER(id), |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
685 (GDestroyNotify)g_source_remove); |
13878
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
686 } |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
687 } |
0d0ab1e39d0a
[gaim-migrate @ 16355]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13869
diff
changeset
|
688 |
13943
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
689 gboolean gnt_widget_confirm_size(GntWidget *widget, int width, int height) |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
690 { |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
691 gboolean ret = FALSE; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
692 g_signal_emit(widget, signals[SIG_CONFIRM_SIZE], 0, width, height, &ret); |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
693 return ret; |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
694 } |
25be562aaca8
[gaim-migrate @ 16480]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13935
diff
changeset
|
695 |
13980
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
696 void gnt_widget_set_visible(GntWidget *widget, gboolean set) |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
697 { |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
698 if (set) |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
699 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_INVISIBLE); |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
700 else |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
701 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_INVISIBLE); |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
702 } |
c9509bd42d7a
[gaim-migrate @ 16542]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13979
diff
changeset
|
703 |
14010
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
704 gboolean gnt_widget_has_shadow(GntWidget *widget) |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
705 { |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
706 return (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_SHADOW) && |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
707 gnt_style_get_bool(GNT_STYLE_SHADOW, FALSE)); |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
708 } |
7573bd40a190
[gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13980
diff
changeset
|
709 |
14793
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
710 static void |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
711 register_binding(GntWidgetClass *klass, const char *name, const char *trigger, GList *list) |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
712 { |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
713 GntWidgetActionParam *param; |
14881
5228f8cf2a6a
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14876
diff
changeset
|
714 GntWidgetAction *action; |
14793
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
715 |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
716 if (name == NULL || *name == '\0') { |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
717 g_hash_table_remove(klass->bindings, (char*)trigger); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
718 return; |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
719 } |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
720 |
14881
5228f8cf2a6a
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14876
diff
changeset
|
721 action = g_hash_table_lookup(klass->actions, name); |
5228f8cf2a6a
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14876
diff
changeset
|
722 if (!action) { |
5228f8cf2a6a
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14876
diff
changeset
|
723 g_printerr("GntWidget: Invalid action name %s for %s\n", |
5228f8cf2a6a
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14876
diff
changeset
|
724 name, g_type_name(G_OBJECT_CLASS_TYPE(klass))); |
5228f8cf2a6a
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14876
diff
changeset
|
725 if (list) |
5228f8cf2a6a
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14876
diff
changeset
|
726 g_list_free(list); |
5228f8cf2a6a
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14876
diff
changeset
|
727 return; |
5228f8cf2a6a
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14876
diff
changeset
|
728 } |
5228f8cf2a6a
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14876
diff
changeset
|
729 |
14793
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
730 param = g_new0(GntWidgetActionParam, 1); |
14881
5228f8cf2a6a
[gaim-migrate @ 17650]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14876
diff
changeset
|
731 param->action = action; |
14793
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
732 param->list = list; |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
733 g_hash_table_replace(klass->bindings, g_strdup(trigger), param); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
734 } |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
735 |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
736 void gnt_widget_register_binding(GntWidgetClass *klass, const char *name, |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
737 const char *trigger, ...) |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
738 { |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
739 GList *list = NULL; |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
740 va_list args; |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
741 void *data; |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
742 |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
743 va_start(args, trigger); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
744 while ((data = va_arg(args, void *))) { |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
745 list = g_list_append(list, data); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
746 } |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
747 va_end(args); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
748 |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
749 register_binding(klass, name, trigger, list); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
750 } |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
751 |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
752 void gnt_widget_class_register_action(GntWidgetClass *klass, const char *name, |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
753 GntWidgetActionCallback callback, |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
754 const char *trigger, ...) |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
755 { |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
756 void *data; |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
757 va_list args; |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
758 GntWidgetAction *action = g_new0(GntWidgetAction, 1); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
759 GList *list; |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
760 |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
761 action->name = g_strdup(name); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
762 action->u.action = callback; |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
763 |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
764 g_hash_table_replace(klass->actions, g_strdup(name), action); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
765 |
14829
945936eaa74e
[gaim-migrate @ 17596]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14793
diff
changeset
|
766 if (trigger) { |
945936eaa74e
[gaim-migrate @ 17596]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14793
diff
changeset
|
767 list = NULL; |
945936eaa74e
[gaim-migrate @ 17596]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14793
diff
changeset
|
768 va_start(args, trigger); |
945936eaa74e
[gaim-migrate @ 17596]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14793
diff
changeset
|
769 while ((data = va_arg(args, void *))) { |
945936eaa74e
[gaim-migrate @ 17596]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14793
diff
changeset
|
770 list = g_list_append(list, data); |
945936eaa74e
[gaim-migrate @ 17596]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14793
diff
changeset
|
771 } |
945936eaa74e
[gaim-migrate @ 17596]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14793
diff
changeset
|
772 va_end(args); |
945936eaa74e
[gaim-migrate @ 17596]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14793
diff
changeset
|
773 |
945936eaa74e
[gaim-migrate @ 17596]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14793
diff
changeset
|
774 register_binding(klass, name, trigger, list); |
14793
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
775 } |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
776 } |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
777 |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
778 void gnt_widget_action_free(GntWidgetAction *action) |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
779 { |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
780 g_free(action->name); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
781 g_free(action); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
782 } |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
783 |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
784 void gnt_widget_action_param_free(GntWidgetActionParam *param) |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
785 { |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
786 g_list_free(param->list); /* XXX: There may be a leak here for string parameters */ |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
787 g_free(param); |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
788 } |
8a0cfee11af8
[gaim-migrate @ 17558]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14613
diff
changeset
|
789 |