Esempio n. 1
0
static void fcitx_input_method_init(FcitxInputMethod *im) {
    /* Sets the expected interface */
    g_dbus_proxy_set_interface_info(G_DBUS_PROXY(im),
                                    _fcitx_input_method_get_interface_info());
}
Esempio n. 2
0
static void fcitx_kbd_init(FcitxKbd *im) {
    /* Sets the expected interface */
    g_dbus_proxy_set_interface_info(G_DBUS_PROXY(im),
                                    _fcitx_kbd_get_interface_info());
}
Esempio n. 3
0
static void
accounts_user_init (AccountsUser *user)
{
  /* Sets the expected interface */
  g_dbus_proxy_set_interface_info (G_DBUS_PROXY (user), accounts_user_get_interface_info ());
}
static void
e_gdbus_book_factory_proxy_init (EGdbusBookFactoryProxy *proxy)
{
	g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), (GDBusInterfaceInfo *) &_e_gdbus_book_factory_interface_info);
}
int main(int argc, char *argv[])
{
    GDBusConnection *connection;
    GError *error = NULL;
    GDBusProxy *proxy;
    gchar *name;
    gchar *object_path;
    gchar *interface_name;
    GDBusProxyFlags flags;

    g_type_init();

    connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
    if (connection == NULL) {
        if (error != NULL) {
            g_printerr("get connection error: %s\n", error->message);
            g_error_free(error);
            
        } else {
            g_printerr("get connection error: unknown error\n");
        }
        return -1;

    } else {
        g_print("get connection success\n");
    }

    name = "net.connman";
    object_path = "/";
    interface_name = "net.connman.Manager";

#if 0
    GDBusProxy *g_dbus_proxy_new_sync (GDBusConnection *connection,
                                       GDBusProxyFlags flags,
                                       GDBusInterfaceInfo *info,
                                       const gchar *name,
                                       const gchar *object_path,
                                       const gchar *interface_name,
                                       GCancellable *cancellable,
                                       GError **error);
#endif

    proxy = g_dbus_proxy_new_sync(connection,
                                  G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START
                                  | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
                                  NULL,
                                  name,
                                  object_path,
                                  interface_name,
                                  NULL,
                                  &error);
    if (proxy == NULL) {
        if (error != NULL) {
            g_printerr("get proxy failed: %s\n", error->message);
        } else {
            g_printerr("get proxy failed: %s\n", "unknown error");
        }
    }
    g_print("get proxy success\n");

    flags = g_dbus_proxy_get_flags(proxy);
    g_print("flags: %d\n", (int)flags);
    proxy_flags_print(flags);

    /**
     * get cached property
     */
    GVariant *val;
#if 0
    GDBusNodeInfo *introspection_data;
    GDBusInterfaceInfo *info;

    introspection_data = g_dbus_node_info_new_for_xml(connman_manager_xml, NULL);
    if (introspection_data == NULL) {
        g_printerr("get introspection_data failed\n");
        return -1;
    }
    info = introspection_data->interfaces[0];
    g_dbus_proxy_set_interface_info(proxy, info);
#endif

    //GVariant *g_dbus_proxy_get_cached_property (GDBusProxy *proxy,
    //const gchar *property_name);
    val = g_dbus_proxy_get_cached_property(proxy, "ActiveProfile");
    if (val == NULL) {
        g_print("get val failed\n");
        return -1;
    }
    g_print("get val success\n");

    return 0;
}