示例#1
0
文件: plugin.c 项目: plundstr/ngfd
void
profile_plugin_reconnect (NCore *core, DBusConnection *session_bus)
{
    profile_connection_set (session_bus);

    query_current_profile (core);
    query_current_values (core);
}
示例#2
0
profile_plugin * init_profile()
{
    profile_plugin *plugin = g_new0(profile_plugin, 1);
    char *profile = NULL;
    profileval_t *values = NULL;

    if (!plugin) {
        return NULL;
    }

    
    /* let libprofile know the correct bus connection */
    profile_connection_set(bus_conn);
    
    /* get current profile */
    profile = profile_get_profile();

    /* start tracking profile changes */
    if (profile && subscribe_to_service()) {
        values = profile_get_values(profile);
    }
    else {
        g_free(plugin);
        plugin = NULL;
        goto end;
    }

    if (!profile_create_fact(profile, values)) {
        g_free(plugin);
        plugin = NULL;
        goto end;
    }

end:

    free(profile);
    profile_free_values(values);

    return plugin;
}
示例#3
0
文件: plugin.c 项目: kvahlman/ngfd
static gboolean
setup_session_bus_connection (NCore *core)
{
    /* setup the session bus connection */
    DBusError error;
    dbus_error_init(&error);

    if (!session_bus) {
        session_bus = dbus_bus_get(DBUS_BUS_SESSION, &error);
        if (dbus_error_is_set(&error)) {
            N_DEBUG (LOG_CAT "Could not connect to DBus session bus.");
            return FALSE;
        }
    }

    N_DEBUG (LOG_CAT "Connected to DBus session bus.");
    profile_connection_set (session_bus);

    query_current_profile (core);
    query_current_values (core);

    return TRUE;
}
示例#4
0
static void reconnect_profile(void)
{
    profile_connection_set(bus_conn);
}