~ubuntu-branches/ubuntu/utopic/ibus/utopic

« back to all changes in this revision

Viewing changes to src/tests/ibus-config.c

  • Committer: Package Import Robot
  • Author(s): Aron Xu
  • Date: 2014-08-18 19:25:16 UTC
  • mfrom: (39.1.12 utopic-proposed)
  • Revision ID: package-import@ubuntu.com-20140818192516-yyvq2gzp8iy2grcf
Tags: 1.5.8-2ubuntu1
* Merge from Debian (LP: #1352805), remaining changes:
  - Build with dh-translations
  - ubuntu-title-update.patch: 
    Rename "IBus Preferences" to "Keyboard Input Methods"
  - ubuntu-no-notification.patch: Don't show the notification if not
    actually upgrading from a previous version.
  - ubuntu-disable-trigger.patch: Disable input method switching under
    Unity; it's handled by gnome-settings-daemon.
  - ubuntu-forward-panel-properties.patch:
    Augment the panel service D-Bus interface so that external consumers
    can detect when the panel service properties are changed. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
static int create_config_count = 0;
8
8
 
9
9
static void
10
 
finish_create_config_async_sucess (GObject      *source_object,
11
 
                                   GAsyncResult *res,
12
 
                                   gpointer      user_data)
 
10
finish_create_config_async_success (GObject      *source_object,
 
11
                                    GAsyncResult *res,
 
12
                                    gpointer      user_data)
13
13
{
14
14
    GMainLoop *loop = (GMainLoop *)user_data;
15
15
    GError *error = NULL;
54
54
    loop = g_main_loop_new (NULL, TRUE);
55
55
    ibus_config_new_async (ibus_bus_get_connection (bus),
56
56
                           NULL,
57
 
                           finish_create_config_async_sucess,
 
57
                           finish_create_config_async_success,
58
58
                           loop);
59
59
    g_main_loop_run (loop);
60
60
    g_main_loop_unref (loop);
135
135
 
136
136
typedef struct {
137
137
    GMainLoop *loop;
 
138
    guint timeout_id;
138
139
    gchar *section;
139
140
    gchar *name;
140
141
} WatchData;
264
265
{
265
266
    WatchData *data = (WatchData *) user_data;
266
267
    g_main_loop_quit (data->loop);
 
268
    data->timeout_id = 0;
267
269
    return FALSE;
268
270
}
269
271
 
276
278
                 WatchData   *data)
277
279
{
278
280
    gboolean retval;
279
 
    guint timeout_id;
280
281
    GVariant *var;
281
282
 
282
283
    data->section = NULL;
294
295
        g_variant_unref (var);
295
296
    }
296
297
 
297
 
    timeout_id = g_timeout_add (1, timeout_cb, data);
 
298
    data->timeout_id = g_timeout_add (1, timeout_cb, data);
298
299
    g_main_loop_run (data->loop);
299
 
    g_source_remove (timeout_id);
 
300
    if (data->timeout_id != 0) {
 
301
        g_source_remove (data->timeout_id);
 
302
    }
300
303
 
301
304
    retval = ibus_config_set_value (config, section, name,
302
305
                                    g_variant_new_int32 (1));
303
306
    g_assert (retval);
304
307
 
305
 
    timeout_id = g_timeout_add (1, timeout_cb, data);
 
308
    data->timeout_id = g_timeout_add (1, timeout_cb, data);
306
309
    g_main_loop_run (data->loop);
307
 
    g_source_remove (timeout_id);
 
310
    if (data->timeout_id != 0) {
 
311
        g_source_remove (data->timeout_id);
 
312
    }
308
313
 
309
314
    g_assert_cmpstr (data->section, ==, expected_section);
310
315
    g_assert_cmpstr (data->name, ==, expected_name);