Mercurial > pidgin
annotate console/libgnt/gntmenuitemcheck.c @ 15814:1c8f1dc50685
Enable DEBUG_CFLAGS in libgnt and fix up a number of compile warnings and
errors this showed up
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sun, 18 Mar 2007 17:28:21 +0000 |
parents | 97977138cf29 |
children |
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 */ |
15814
1c8f1dc50685
Enable DEBUG_CFLAGS in libgnt and fix up a number of compile warnings and
Stu Tomlinson <stu@nosnilmot.com>
parents:
14843
diff
changeset
|
39 NULL /* value_table */ |
14843
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 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 type = g_type_register_static(GNT_TYPE_MENUITEM, |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 "GntMenuItemCheck", |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 &info, 0); |
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 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 return type; |
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 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 GntMenuItem *gnt_menuitem_check_new(const char *text) |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 { |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 GntMenuItem *item = g_object_new(GNT_TYPE_MENUITEM_CHECK, NULL); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 GntMenuItem *menuitem = GNT_MENUITEM(item); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 menuitem->text = g_strdup(text); |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 return item; |
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 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 gboolean gnt_menuitem_check_get_checked(GntMenuItemCheck *item) |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 { |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 return item->checked; |
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 |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 void gnt_menuitem_check_set_checked(GntMenuItemCheck *item, gboolean set) |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 { |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 item->checked = set; |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 } |
97977138cf29
[gaim-migrate @ 17612]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 |