Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ | 1 /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ |
2 /* vim:set et sts=4: */ | 2 /* vim:set et sts=4: */ |
3 /* ibus - The Input Bus | 3 /* ibus - The Input Bus |
4 * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com> | 4 * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com> |
5 * Copyright (C) 2008-2010 Red Hat, Inc. | 5 * Copyright (C) 2008-2010 Red Hat, Inc. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1374 IBUS_INTERFACE_IBUS, | 1374 IBUS_INTERFACE_IBUS, |
1375 active_engines_only ? "ListActiveEngines" : "Li stEngines", | 1375 active_engines_only ? "ListActiveEngines" : "Li stEngines", |
1376 NULL, | 1376 NULL, |
1377 G_VARIANT_TYPE ("(av)")); | 1377 G_VARIANT_TYPE ("(av)")); |
1378 | 1378 |
1379 if (result) { | 1379 if (result) { |
1380 GVariantIter *iter = NULL; | 1380 GVariantIter *iter = NULL; |
1381 g_variant_get (result, "(av)", &iter); | 1381 g_variant_get (result, "(av)", &iter); |
1382 GVariant *var; | 1382 GVariant *var; |
1383 while (g_variant_iter_loop (iter, "v", &var)) { | 1383 while (g_variant_iter_loop (iter, "v", &var)) { |
1384 retval = g_list_append (retval, ibus_serializable_deserialize (var)) ; | 1384 IBusSerializable *serializable = ibus_serializable_deserialize (var) ; |
1385 g_object_ref_sink (serializable); | |
Yusuke Sato
2012/02/25 15:55:43
Should we backport this fix to 1.4? If so, please
Peng
2012/02/26 21:52:14
I think we should back port it.
| |
1386 retval = g_list_append (retval, serializable); | |
1385 } | 1387 } |
1386 g_variant_iter_free (iter); | 1388 g_variant_iter_free (iter); |
1387 g_variant_unref (result); | 1389 g_variant_unref (result); |
1388 } | 1390 } |
1389 | 1391 |
1390 return retval; | 1392 return retval; |
1391 } | 1393 } |
1392 | 1394 |
1393 GList * | 1395 GList * |
1394 ibus_bus_list_engines (IBusBus *bus) | 1396 ibus_bus_list_engines (IBusBus *bus) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1428 if (g_simple_async_result_propagate_error (simple, error)) | 1430 if (g_simple_async_result_propagate_error (simple, error)) |
1429 return NULL; | 1431 return NULL; |
1430 GVariant *variant = g_simple_async_result_get_op_res_gpointer (simple); | 1432 GVariant *variant = g_simple_async_result_get_op_res_gpointer (simple); |
1431 g_return_val_if_fail (variant != NULL, NULL); | 1433 g_return_val_if_fail (variant != NULL, NULL); |
1432 | 1434 |
1433 GList *retval = NULL; | 1435 GList *retval = NULL; |
1434 GVariantIter *iter = NULL; | 1436 GVariantIter *iter = NULL; |
1435 g_variant_get (variant, "(av)", &iter); | 1437 g_variant_get (variant, "(av)", &iter); |
1436 GVariant *var; | 1438 GVariant *var; |
1437 while (g_variant_iter_loop (iter, "v", &var)) { | 1439 while (g_variant_iter_loop (iter, "v", &var)) { |
1438 retval = g_list_append (retval, ibus_serializable_deserialize (var)); | 1440 IBusSerializable *serializable = ibus_serializable_deserialize (var); |
1441 g_object_ref_sink (serializable); | |
Yusuke Sato
2012/02/25 15:55:43
ditto
Peng
2012/02/26 21:52:14
same
| |
1442 retval = g_list_append (retval, serializable); | |
1439 } | 1443 } |
1440 g_variant_iter_free (iter); | 1444 g_variant_iter_free (iter); |
1441 return retval; | 1445 return retval; |
1442 } | 1446 } |
1443 | 1447 |
1444 GList * | 1448 GList * |
1445 ibus_bus_list_active_engines (IBusBus *bus) | 1449 ibus_bus_list_active_engines (IBusBus *bus) |
1446 { | 1450 { |
1447 return ibus_bus_do_list_engines (bus, TRUE); | 1451 return ibus_bus_do_list_engines (bus, TRUE); |
1448 } | 1452 } |
(...skipping 22 matching lines...) Expand all Loading... | |
1471 } | 1475 } |
1472 | 1476 |
1473 GList * | 1477 GList * |
1474 ibus_bus_list_active_engines_async_finish (IBusBus *bus, | 1478 ibus_bus_list_active_engines_async_finish (IBusBus *bus, |
1475 GAsyncResult *res, | 1479 GAsyncResult *res, |
1476 GError **error) | 1480 GError **error) |
1477 { | 1481 { |
1478 return ibus_bus_list_engines_async_finish (bus, res, error); | 1482 return ibus_bus_list_engines_async_finish (bus, res, error); |
1479 } | 1483 } |
1480 | 1484 |
1485 IBusEngineDesc ** | |
1486 ibus_bus_get_engines_by_names (IBusBus *bus, | |
1487 const gchar * const *names) | |
1488 { | |
1489 g_return_val_if_fail (IBUS_IS_BUS (bus), NULL); | |
1490 | |
1491 GVariant *result; | |
1492 result = ibus_bus_call_sync (bus, | |
1493 IBUS_SERVICE_IBUS, | |
1494 IBUS_PATH_IBUS, | |
1495 IBUS_INTERFACE_IBUS, | |
1496 "GetEnginesByNames", | |
1497 g_variant_new("(^as)", names), | |
1498 G_VARIANT_TYPE ("(av)")); | |
1499 if (result == NULL) | |
1500 return NULL; | |
1501 ···· | |
1502 GArray *array = g_array_new (TRUE, TRUE, sizeof (IBusEngineDesc *)); | |
1503 GVariantIter *iter = NULL; | |
1504 g_variant_get (result, "(av)", &iter); | |
1505 GVariant *var; | |
1506 while (g_variant_iter_loop (iter, "v", &var)) { | |
1507 IBusEngineDesc *desc = (IBusEngineDesc *) ibus_serializable_deserialize (var); | |
1508 g_object_ref_sink (desc); | |
1509 g_array_append_val (array, desc); | |
1510 } | |
1511 g_variant_iter_free (iter); | |
1512 g_variant_unref (result); | |
1513 | |
1514 return (IBusEngineDesc **)g_array_free (array, FALSE); | |
1515 } | |
1516 | |
1481 static void | 1517 static void |
1482 _config_destroy_cb (IBusConfig *config, | 1518 _config_destroy_cb (IBusConfig *config, |
1483 IBusBus *bus) | 1519 IBusBus *bus) |
1484 { | 1520 { |
1485 IBusBusPrivate *priv; | 1521 IBusBusPrivate *priv; |
1486 priv = IBUS_BUS_GET_PRIVATE (bus); | 1522 priv = IBUS_BUS_GET_PRIVATE (bus); |
1487 | 1523 |
1488 g_assert (priv->config == config); | 1524 g_assert (priv->config == config); |
1489 | 1525 |
1490 g_object_unref (config); | 1526 g_object_unref (config); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1899 interface, | 1935 interface, |
1900 member, | 1936 member, |
1901 parameters, | 1937 parameters, |
1902 reply_type, | 1938 reply_type, |
1903 G_DBUS_CALL_FLAGS_NO_AUTO_START, | 1939 G_DBUS_CALL_FLAGS_NO_AUTO_START, |
1904 timeout_msec, | 1940 timeout_msec, |
1905 cancellable, | 1941 cancellable, |
1906 (GAsyncReadyCallback) ibus_bus_call_async_done, | 1942 (GAsyncReadyCallback) ibus_bus_call_async_done, |
1907 simple); | 1943 simple); |
1908 } | 1944 } |
OLD | NEW |