Mercurial > pidgin
annotate console/libgnt/gntmenuitemcheck.c @ 15469:4fcf3a17f03e
merge of '9047f755d6c146b4f110727b63ed0f3dacbbe398'
and 'df9e73e952c29bcf2bf3d2f7c6e1f89e622fc8dc'
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 31 Jan 2007 01:51:58 +0000 |
parents | 97977138cf29 |
children | 1c8f1dc50685 |
rev | line source |
---|---|
14843
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #include "gntmenuitemcheck.h" |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 static GntMenuItemClass *parent_class = NULL; |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 static void |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 gnt_menuitem_check_class_init(GntMenuItemCheckClass *klass) |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 { |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 parent_class = GNT_MENUITEM_CLASS(klass); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 GNTDEBUG; |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 } |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 static void |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 gnt_menuitem_check_init(GTypeInstance *instance, gpointer class) |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 { |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 GNTDEBUG; |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 } |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 /****************************************************************************** |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 * GntMenuItemCheck API |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 *****************************************************************************/ |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 GType |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
23 gnt_menuitem_check_get_gtype(void) |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 { |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 static GType type = 0; |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 if(type == 0) |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 { |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 static const GTypeInfo info = { |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 sizeof(GntMenuItemCheckClass), |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 NULL, /* base_init */ |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 NULL, /* base_finalize */ |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 (GClassInitFunc)gnt_menuitem_check_class_init, |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 NULL, /* class_finalize */ |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 NULL, /* class_data */ |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 sizeof(GntMenuItemCheck), |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 0, /* n_preallocs */ |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 gnt_menuitem_check_init, /* instance_init */ |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 }; |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 type = g_type_register_static(GNT_TYPE_MENUITEM, |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 "GntMenuItemCheck", |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 &info, 0); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 } |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 return type; |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 } |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 GntMenuItem *gnt_menuitem_check_new(const char *text) |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 { |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 GntMenuItem *item = g_object_new(GNT_TYPE_MENUITEM_CHECK, NULL); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 GntMenuItem *menuitem = GNT_MENUITEM(item); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 menuitem->text = g_strdup(text); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 return item; |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 } |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 gboolean gnt_menuitem_check_get_checked(GntMenuItemCheck *item) |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 { |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 return item->checked; |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 } |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 void gnt_menuitem_check_set_checked(GntMenuItemCheck *item, gboolean set) |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 { |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 item->checked = set; |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 } |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 |