~ubuntu-branches/ubuntu/quantal/ibus/quantal

« back to all changes in this revision

Viewing changes to src/ibusobject.c

  • Committer: Bazaar Package Importer
  • Author(s): Barry Warsaw
  • Date: 2011-08-11 17:00:57 UTC
  • mfrom: (6.2.14 sid)
  • Revision ID: james.westby@ubuntu.com-20110811170057-6dmbfs4s3cchzl7x
Tags: 1.3.99.20110419-1ubuntu1
* Merge with Debian unstable.  Remaining Ubuntu changes:
  - Indicator support:
    + Add 05_appindicator.patch: Use an indicator rather than a notification
      icon.
    + debian/control: Recommend python-appindicator.
  - debian/control: Install im-switch instead of im-config by default.
  - debian/README.source: Removed, it was outdated and no longer correct
  - debian/patches/01_ubuntu_desktop: Fix "Desktop entry needs the
    X-Ubuntu-Gettext-Domain key"  (LP: #457632)
  - debian/patches/02_title_update.patch: Rename "IBus Preferences" to
    "Keyboard Input Methods"
  - debian/patches/06_locale_parser.patch: Cherry-picked from upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 */
22
22
 
23
23
#include "ibusobject.h"
 
24
#include "ibusmarshalers.h"
24
25
#include "ibusinternal.h"
25
26
 
26
27
#define IBUS_OBJECT_GET_PRIVATE(o)  \
31
32
    LAST_SIGNAL,
32
33
};
33
34
 
34
 
typedef struct _IBusObjectPrivate IBusObjectPrivate;
35
35
struct _IBusObjectPrivate {
36
36
    gpointer pad;
37
37
};
55
55
 
56
56
G_DEFINE_TYPE (IBusObject, ibus_object, G_TYPE_INITIALLY_UNOWNED)
57
57
 
58
 
/**
59
 
 * ibus_object_new:
60
 
 *
61
 
 * Creates a new instance of an #IBusObject.
62
 
 *
63
 
 * Returns: a new instance of #IBusObject.
64
 
 */
65
 
IBusObject *
66
 
ibus_object_new (void)
67
 
{
68
 
    return IBUS_OBJECT (g_object_new (IBUS_TYPE_OBJECT, NULL));
69
 
}
70
 
 
71
58
static void
72
 
ibus_object_class_init     (IBusObjectClass *klass)
 
59
ibus_object_class_init     (IBusObjectClass *class)
73
60
{
74
 
    GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
75
 
 
76
 
    g_type_class_add_private (klass, sizeof (IBusObjectPrivate));
 
61
    GObjectClass *gobject_class = G_OBJECT_CLASS (class);
77
62
 
78
63
    gobject_class->constructor = ibus_object_constructor;
79
64
    gobject_class->dispose = (GObjectFinalizeFunc) ibus_object_dispose;
80
65
    gobject_class->finalize = (GObjectFinalizeFunc) ibus_object_finalize;
81
66
 
82
 
    klass->destroy = ibus_object_real_destroy;
 
67
    class->destroy = ibus_object_real_destroy;
83
68
 
84
69
    /* install signals */
85
70
    /**
98
83
            G_SIGNAL_RUN_LAST,
99
84
            G_STRUCT_OFFSET (IBusObjectClass, destroy),
100
85
            NULL, NULL,
101
 
            ibus_marshal_VOID__VOID,
 
86
            _ibus_marshal_VOID__VOID,
102
87
            G_TYPE_NONE, 0);
 
88
 
 
89
    g_type_class_add_private (class, sizeof (IBusObjectPrivate));
 
90
 
103
91
#ifdef DEBUG_MEMORY
104
92
    _count_table = g_hash_table_new (g_direct_hash, g_direct_equal);
105
93
#endif
106
 
 
107
94
}
108
95
 
109
96
static void
110
97
ibus_object_init (IBusObject *obj)
111
98
{
112
 
    IBusObjectPrivate *priv;
113
 
    priv = IBUS_OBJECT_GET_PRIVATE (obj);
114
 
 
115
99
    obj->flags = 0;
116
 
 
 
100
    obj->priv = IBUS_OBJECT_GET_PRIVATE (obj);
117
101
}
118
102
 
119
103
 
160
144
static void
161
145
ibus_object_finalize (IBusObject *obj)
162
146
{
163
 
#ifdef DEBUG_MEMORY 
 
147
#ifdef DEBUG_MEMORY
164
148
    guint count;
165
149
 
166
150
    _count --;
178
162
    g_signal_handlers_destroy (obj);
179
163
}
180
164
 
 
165
/**
 
166
 * ibus_object_new:
 
167
 *
 
168
 * Creates a new instance of an #IBusObject.
 
169
 *
 
170
 * Returns: a new instance of #IBusObject.
 
171
 */
 
172
IBusObject *
 
173
ibus_object_new (void)
 
174
{
 
175
    GObject *object = g_object_new (IBUS_TYPE_OBJECT, NULL);
 
176
    return IBUS_OBJECT (object);
 
177
}
 
178
 
181
179
void
182
180
ibus_object_destroy (IBusObject *obj)
183
181
{
184
 
    IBusObjectPrivate *priv;
185
 
    priv = IBUS_OBJECT_GET_PRIVATE (obj);
 
182
    g_return_if_fail (IBUS_IS_OBJECT (obj));
186
183
 
187
184
    if (! (IBUS_OBJECT_FLAGS (obj) & IBUS_IN_DESTRUCTION)) {
188
185
        g_object_run_dispose (G_OBJECT (obj));