Example #1
0
void pending_reads_send_all (struct tgl_state *TLS) {
  if (! purple_account_get_bool (tls_get_pa (TLS), TGP_KEY_SEND_READ_NOTIFICATIONS,
      TGP_DEFAULT_SEND_READ_NOTIFICATIONS)) {
    debug ("automatic read recipes disabled, not sending recipes");
    return;
  }
  if (! p2tgl_status_is_present (purple_account_get_active_status (tls_get_pa (TLS)))) {
    debug ("user is not present, not sending recipes");
    return;
  }
  debug ("sending all pending recipes");
  g_hash_table_foreach (tls_get_data (TLS)->pending_reads, tgl_do_mark_read_gw, TLS);
  g_hash_table_remove_all (tls_get_data (TLS)->pending_reads);
}
Example #2
0
static void
eog_exif_details_reset (EogExifDetails *exif_details)
{
	int i;
	EogExifDetailsPrivate *priv = exif_details->priv;

	gtk_tree_store_clear (GTK_TREE_STORE (priv->model));

	g_hash_table_remove_all (priv->id_path_hash);
	g_hash_table_remove_all (priv->id_path_hash_mnote);

	for (i = 0; exif_categories [i].label != NULL; i++) {
		char *translated_string;

		translated_string = gettext (exif_categories[i].label);

		set_row_data (GTK_TREE_STORE (priv->model),
			      exif_categories[i].path,
			      NULL,
			      translated_string,
			      NULL);
	}
}
Example #3
0
void
sql_reserved_query_free(sql_reserved_query *srq)
{
    if (srq == NULL) return ;

    g_hash_table_remove_all(srq->ht_reserved_query);
    g_hash_table_destroy(srq->ht_reserved_query);
    g_queue_free(srq->gq_reserved_long_query);
    g_queue_free(srq->gq_reserved_short_query);

    g_rw_lock_clear(&srq->rq_lock);

    g_free(srq);
}
Example #4
0
static void fec_dec_cleanup(fec_dec *dec)
{
    /*
    NOT clearing recovered_packets here
    cleanup is called right after recovery was completed,
    the user is then supposed to call fec_dec_pop_recovered_packet() to get
    all recovered packets.

    Also, blacklisted_snbase is used to drop any FEC packets that may come up with the current snbase.
    */
    dec->blacklisted_snbase = dec->cur_snbase;
    dec->has_snbase = FALSE;
    dec->received_media_packet_mask = 0;
    dec->num_received_media_packets = 0;
    dec->num_received_fec_packets = 0;
    dec->max_packet_size = 0;
    g_queue_foreach(dec->media_packets, fec_dec_clear_packet, NULL);
    g_queue_foreach(dec->fec_packets, fec_dec_clear_packet, NULL);
    g_queue_clear(dec->media_packets);
    g_queue_clear(dec->fec_packets);
    g_hash_table_remove_all(dec->media_packet_set);
    g_hash_table_remove_all(dec->fec_packet_set);
}
Example #5
0
static int adapter_start_poll(struct near_adapter *adapter)
{
	int err;
	uint32_t im_protos, tm_protos;

	if (g_hash_table_size(adapter->tags) > 0) {
		DBG("Clearing tags");

		g_hash_table_remove_all(adapter->tags);
	}

	if (g_hash_table_size(adapter->devices) > 0) {
		DBG("Clearing devices");

		g_hash_table_remove_all(adapter->devices);
	}

	DBG("Poll mode 0x%x", adapter->poll_mode);

	im_protos = tm_protos = 0;

	if (adapter->poll_mode & NEAR_ADAPTER_MODE_INITIATOR)
		im_protos = adapter->protocols;

	if (adapter->poll_mode & NEAR_ADAPTER_MODE_TARGET)
		tm_protos = adapter->protocols;

	err = __near_netlink_start_poll(adapter->idx, im_protos, tm_protos);
	if (err < 0)
		return err;

	adapter->polling = true;

	polling_changed(adapter);

	return 0;
}
Example #6
0
void
gtkhtml_editor_private_dispose (GtkhtmlEditor *editor)
{
	GtkhtmlEditorPrivate *priv = editor->priv;

	/* Disconnect signal handlers from the color
	 * state object since it may live on. */
	if (priv->text_color != NULL) {
		g_signal_handlers_disconnect_matched (
			priv->text_color, G_SIGNAL_MATCH_DATA,
			0, 0, NULL, NULL, editor);
	}

	DISPOSE (priv->manager);
	DISPOSE (priv->core_actions);
	DISPOSE (priv->html_actions);
	DISPOSE (priv->context_actions);
	DISPOSE (priv->html_context_actions);
	DISPOSE (priv->language_actions);
	DISPOSE (priv->spell_check_actions);
	DISPOSE (priv->suggestion_actions);
	DISPOSE (priv->builder);

	DISPOSE (priv->html_painter);
	DISPOSE (priv->plain_painter);

	g_hash_table_remove_all (priv->available_spell_checkers);

	g_list_foreach (
		priv->active_spell_checkers,
		(GFunc) g_object_unref, NULL);
	g_list_free (priv->active_spell_checkers);
	priv->active_spell_checkers = NULL;

	DISPOSE (priv->main_menu);
	DISPOSE (priv->main_toolbar);
	DISPOSE (priv->edit_toolbar);
	DISPOSE (priv->html_toolbar);
	DISPOSE (priv->edit_area);

	DISPOSE (priv->color_combo_box);
	DISPOSE (priv->mode_combo_box);
	DISPOSE (priv->size_combo_box);
	DISPOSE (priv->style_combo_box);
	DISPOSE (priv->scrolled_window);

	DISPOSE (priv->palette);
	DISPOSE (priv->text_color);
}
Example #7
0
/* pyshark_Iter_iternext() gets registered as PyTypeObject.tp_iternext */
PyObject *
pyshark_Iter_iternext(PyObject *self)
{
    pyshark_Iter *p = (pyshark_Iter *)self;

    // catch access of iterator after last element (i.e. after the iterator has been cleaned up)
    if (p->stdata == NULL) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }

    gboolean pkt_exists = sharktools_iter_next(p->stdata);

    if(pkt_exists) {
        PyObject *tmp = pyshark_getDict(p);
        gsize i;

        /* Reset tree_values */
        g_ptr_array_free(p->stdata->tree_values, TRUE);
        p->stdata->tree_values = g_ptr_array_new();
        for(i = 0; i < p->stdata->fieldnames->len; i++) {
            g_ptr_array_add(p->stdata->tree_values, g_ptr_array_new());
        }

        /* Reset wtree_values
         * Call our helper method to deallocate the pointer arrays that are set
         * as values in the hash table
         */
        g_hash_table_foreach(p->stdata->wtree_values, my_ht_value_ptrarray_free_fn, NULL);

        g_hash_table_remove_all(p->stdata->wtree_values);

        return tmp;
    }
    else {
        /* We're done with the iterator, and hence, and {pyshark,sharktools}-specific
         * data, so run the cleanup routine.
         *
         * NB: We also call this in pyshark_Iter_dealloc().
         * NB: This is called to aggressively remove the decode_as string, if set.
         */
        pyshark_iter_cleanup(p);

        /* Raise a standard StopIteration exception with empty value. */
        PyErr_SetNone(PyExc_StopIteration);

        return NULL;
    }
}
static gboolean
remove_connections (gpointer user_data)
{
	NMRemoteSettings *self = NM_REMOTE_SETTINGS (user_data);
	NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (self);
	GHashTableIter iter;
	gpointer value;

	g_hash_table_iter_init (&iter, priv->connections);
	while (g_hash_table_iter_next (&iter, NULL, &value))
		g_signal_emit_by_name (NM_REMOTE_CONNECTION (value), "removed");

	g_hash_table_remove_all (priv->connections);
	return FALSE;
}
Example #9
0
static void
decorator_cancel_active_tasks (TrackerDecorator *decorator)
{
	TrackerDecoratorPrivate *priv = decorator->priv;
	GHashTableIter iter;
	GTask *task;

	g_hash_table_iter_init (&iter, priv->tasks);

	while (g_hash_table_iter_next (&iter, NULL, (gpointer*) &task)) {
		g_cancellable_cancel (g_task_get_cancellable (task));
	}

	g_hash_table_remove_all (priv->tasks);
}
Example #10
0
/* lock must be held */
static void __cookie_cache_check_swap(struct cookie_cache *c) {
	if (poller_now - c->swap_time >= 30) {
		g_hash_table_remove_all(c->old.cookies);
#if GLIB_CHECK_VERSION(2,14,0)
		g_string_chunk_clear(c->old.chunks);
		swap_ptrs(&c->old.chunks, &c->current.chunks);
#else
		g_string_chunk_free(c->old.chunks);
		c->old.chunks = c->current.chunks;
		c->current.chunks = g_string_chunk_new(4 * 1024);
#endif
		swap_ptrs(&c->old.cookies, &c->current.cookies);
		c->swap_time = poller_now;
	}
}
Example #11
0
static void
_cancel_request_cb (DawatiBtShell *shell)
{
  DawatiBtShellPrivate *priv = GET_PRIVATE (shell);
  ClutterActorIter iter;
  ClutterActor *child;

  clutter_actor_iter_init (&iter, priv->request_box);
  while (clutter_actor_iter_next (&iter, &child))
    clutter_actor_remove_child (priv->request_box, child);

  g_hash_table_remove_all (priv->requests);

  notify_notification_close (priv->notification, NULL);
}
Example #12
0
BT_HIDDEN
int bt_ctf_event_register_stream_clock_values(struct bt_ctf_event *event)
{
	int ret = 0;
	struct bt_ctf_stream *stream;

	stream = bt_ctf_event_get_stream(event);
	assert(stream);
	g_hash_table_remove_all(event->clock_values);
	g_hash_table_foreach(stream->clock_values,
		insert_stream_clock_value_into_event_clock_values, event);
	BT_PUT(stream);

	return ret;
}
Example #13
0
GSAPI void
gs_graph_iterator_bfs_reset_from_root(GSIterator   *iterator,
				      const GSNode *root)
{
  if(iterator) {
    GSIteratorBFS *bfs;
    bfs = (GSIteratorBFS*) iterator;

    g_hash_table_remove_all(bfs->closed);
    g_list_free(bfs->candidats);
    bfs->depth_max = 0;
    bfs->candidats = g_list_append(NULL, root);
    _bfs_set_depth(bfs, root, 0);
  }
}
/**
 * soup_message_headers_clear:
 * @hdrs: a #SoupMessageHeaders
 *
 * Clears @hdrs.
 **/
void
soup_message_headers_clear (SoupMessageHeaders *hdrs)
{
	SoupHeader *hdr_array = (SoupHeader *)hdrs->array->data;
	int i;

	for (i = 0; i < hdrs->array->len; i++)
		g_free (hdr_array[i].value);
	g_array_set_size (hdrs->array, 0);

	if (hdrs->concat)
		g_hash_table_remove_all (hdrs->concat);

	clear_special_headers (hdrs);
}
Example #15
0
int
bot_ctrans_add_frame(BotCTrans * ctrans, const char *id)
{
    assert(id);
    BotCTransFrame * frame = bot_ctrans_get_frame(ctrans, id);
    if(frame) {
        g_warning("%s: coordinate frame %s already exists\n", __FUNCTION__, id);
        return 0;
    } else {
        frame = _frame_new(id);
        g_hash_table_insert(ctrans->frames, frame->id, frame);
        g_hash_table_remove_all(ctrans->path_cache);
        return 1;
    }
}
Example #16
0
static void
cockpit_polkit_agent_dispose (GObject *object)
{
  CockpitPolkitAgent *self = COCKPIT_POLKIT_AGENT (object);

  if (self->control_sig)
    {
      g_signal_handler_disconnect (self->transport, self->control_sig);
      self->control_sig = 0;
    }

  g_hash_table_remove_all (self->callers);

  G_OBJECT_CLASS (cockpit_polkit_agent_parent_class)->dispose (object);
}
static void
bluez_cleanup (NMBluez5Manager *self, gboolean do_signal)
{
	NMBluez5ManagerPrivate *priv = NM_BLUEZ5_MANAGER_GET_PRIVATE (self);

	if (priv->proxy) {
		g_signal_handlers_disconnect_by_func (priv->proxy, G_CALLBACK (name_owner_changed_cb), self);
		g_clear_object (&priv->proxy);
	}

	if (do_signal)
		remove_all_devices (self);
	else
		g_hash_table_remove_all (priv->devices);
}
Example #18
0
void
lrm_state_reset_tables(lrm_state_t * lrm_state)
{
    if (lrm_state->resource_history) {
        crm_trace("Re-setting history op cache with %d members",
                  g_hash_table_size(lrm_state->resource_history));
        g_hash_table_remove_all(lrm_state->resource_history);
    }
    if (lrm_state->deletion_ops) {
        crm_trace("Re-setting deletion op cache with %d members",
                  g_hash_table_size(lrm_state->deletion_ops));
        g_hash_table_remove_all(lrm_state->deletion_ops);
    }
    if (lrm_state->pending_ops) {
        crm_trace("Re-setting pending op cache with %d members",
                  g_hash_table_size(lrm_state->pending_ops));
        g_hash_table_remove_all(lrm_state->pending_ops);
    }
    if (lrm_state->rsc_info_cache) {
        crm_trace("Re-setting rsc info cache with %d members",
                  g_hash_table_size(lrm_state->rsc_info_cache));
        g_hash_table_remove_all(lrm_state->rsc_info_cache);
    }
}
Example #19
0
static gboolean
demarshal_dhcp6_options (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field)
{
	NMDHCP6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (object);
	GHashTable *new_options;

	g_hash_table_remove_all (priv->options);

	new_options = g_value_get_boxed (value);
	if (new_options)
		g_hash_table_foreach (new_options, copy_options, priv->options);

	_nm_object_queue_notify (object, NM_DHCP6_CONFIG_OPTIONS);
	return TRUE;
}
Example #20
0
static void
dispose (GObject *object)
{
	NMBluezAdapter *self = NM_BLUEZ_ADAPTER (object);
	NMBluezAdapterPrivate *priv = NM_BLUEZ_ADAPTER_GET_PRIVATE (self);
	GHashTableIter iter;
	NMBluezDevice *device;

	g_hash_table_iter_init (&iter, priv->devices);
	while (g_hash_table_iter_next (&iter, NULL, (gpointer) &device))
		g_signal_emit (self, signals[DEVICE_REMOVED], 0, device);
	g_hash_table_remove_all (priv->devices);

	G_OBJECT_CLASS (nm_bluez_adapter_parent_class)->dispose (object);
}
static void
ring_text_manager_dispose(GObject *object)
{
  RingTextManager *self = RING_TEXT_MANAGER(object);
  RingTextManagerPrivate *priv = self->priv;

  ring_signal_disconnect (priv->connection, &priv->signals.status_changed);

  ring_text_manager_disconnect (self);

  g_hash_table_foreach (priv->channels, foreach_dispose, NULL);
  g_hash_table_remove_all (priv->channels);

  G_OBJECT_CLASS(ring_text_manager_parent_class)->dispose(object);
}
Example #22
0
/* Preprocess files, including embedded hardlinks.  Any embedded hardlinks
 * that are "other lint" types are sent to rm_pp_handle_other_lint.  If the
 * file itself is "other lint" types it is likewise sent to rm_pp_handle_other_lint.
 * If there are no files left after this then return TRUE so that the
 * cluster can be deleted from the node_table hash table.
 * NOTE: we rely on rm_file_list_insert to select an RM_LINT_TYPE_DUPE_CANDIDATE as head
 * file (unless ALL the files are "other lint"). */
static gboolean rm_pp_handle_inode_clusters(_UNUSED gpointer key, GQueue *inode_cluster,
                                            RmSession *session) {
    RmCfg *cfg = session->cfg;

    if(inode_cluster->length > 1) {
        /* there is a cluster of inode matches */

        /* remove path doubles */
        session->total_filtered_files -=
            rm_util_queue_foreach_remove(inode_cluster, (RmRFunc)rm_pp_check_path_double,
                                         session->tables->unique_paths_table);
        /* clear the hashtable ready for the next cluster */
        g_hash_table_remove_all(session->tables->unique_paths_table);
    }

    /* process and remove other lint */
    session->total_filtered_files -= rm_util_queue_foreach_remove(
        inode_cluster, (RmRFunc)rm_pp_handle_other_lint, (RmSession *)session);

    if(inode_cluster->length > 1) {
        /* bundle or free the non-head files */
        RmFile *headfile = inode_cluster->head->data;
        if(cfg->find_hardlinked_dupes) {
            /* prepare to bundle files under the hardlink head */
            headfile->hardlinks.files = g_queue_new();
            headfile->hardlinks.is_head = TRUE;
        }

        /* hardlink cluster are counted as filtered files since they are either
         * ignored or treated as automatic duplicates depending on settings (so
         * no effort eaither way); rm_pp_handle_hardlink will either free or bundle
         * the hardlinks depending on value of headfile->hardlinks.is_head.
         */
        session->total_filtered_files -= rm_util_queue_foreach_remove(
            inode_cluster, (RmRFunc)rm_pp_handle_hardlink, headfile);
    }

    /* update counters */
    rm_fmt_set_state(session->formats, RM_PROGRESS_STATE_PREPROCESS);

    rm_assert_gentle(inode_cluster->length <= 1);
    if(inode_cluster->length == 1) {
        session->tables->size_groups->data = g_slist_prepend(
            session->tables->size_groups->data, inode_cluster->head->data);
    }

    return TRUE;
}
Example #23
0
static void
data_model_flush_notifications(DDMDataModel *model)
{
    DDMClientNotificationSet *notification_set;
    
    if (g_hash_table_size(model->changed_resources) == 0)
        return;

    notification_set = _ddm_client_notification_set_new(model);

    g_hash_table_foreach(model->changed_resources, flush_notifications_foreach, notification_set);
    g_hash_table_remove_all(model->changed_resources);

    _ddm_client_notification_set_add_work_items(notification_set);
    _ddm_client_notification_set_unref(notification_set);
}
Example #24
0
static void
_wec_config_blacklist_update(gpointer data, struct t_config_option *option)
{
    g_return_if_fail(option == _wec_context.config.restrictions.blacklist);

    g_hash_table_remove_all(_wec_context.blacklist);

    const gchar *nick, *s;
    nick = weechat_config_string(option);
    while ( ( s = g_utf8_strchr(nick, -1, ' ') ) != NULL )
    {
        g_hash_table_add(_wec_context.blacklist, g_strndup(nick, s - nick));
        nick = s + 1;
    }
    g_hash_table_add(_wec_context.blacklist, g_strdup(nick));
}
Example #25
0
void sendForceValue(FttVector pf, FttVector vf, FttVector pm, FttVector vm, int step, double time) {
    ValueController valueToSend;
    // FORCE TYPE
    valueToSend.type = 0;
    valueToSend.time = time;
    valueToSend.step = step;
    valueToSend.data.forceValue.pf = pf;
    valueToSend.data.forceValue.vf = vf;
    valueToSend.data.forceValue.pm = pm;
    valueToSend.data.forceValue.vm = vm;
    // Send it through FIFO.
    write(valuesFd,&valueToSend,sizeof(valueToSend));
    if(debug)
        printf("Sending pf.x: %f pf.y: %f pf.z: %f vm.x: %f vm.y: %f vm.z: %f  time: %f step %d \n", valueToSend.data.forceValue.pf.x,valueToSend.data.forceValue.pf.y,valueToSend.data.forceValue.pf.z,valueToSend.data.forceValue.vm.x,valueToSend.data.forceValue.vm.y,valueToSend.data.forceValue.vm.z, valueToSend.time, valueToSend.step);
    g_hash_table_remove_all (hash);
}
Example #26
0
void
camel_session_set_junk_headers (CamelSession *session, const char **headers, const char **values, int len)
{
	int i;

	if (session->priv->junk_headers) {
		g_hash_table_remove_all (session->priv->junk_headers);
		g_hash_table_destroy (session->priv->junk_headers);
	}

	session->priv->junk_headers = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);

	for (i=0; i<len; i++) {
		g_hash_table_insert (session->priv->junk_headers, g_strdup (headers[i]), g_strdup(values[i]));
	}
}
Example #27
0
static void
check_providers_status (NautilusSearchEngine *engine)
{
    NautilusSearchEnginePrivate *priv;
    gint num_finished;

    priv = nautilus_search_engine_get_instance_private (engine);
    num_finished = priv->providers_error + priv->providers_finished;

    if (num_finished < priv->providers_running)
    {
        return;
    }

    if (num_finished == priv->providers_error)
    {
        DEBUG ("Search engine error");
        nautilus_search_provider_error (NAUTILUS_SEARCH_PROVIDER (engine),
                                        _("Unable to complete the requested search"));
    }
    else
    {
        if (priv->restart)
        {
            DEBUG ("Search engine finished and restarting");
        }
        else
        {
            DEBUG ("Search engine finished");
        }
        nautilus_search_provider_finished (NAUTILUS_SEARCH_PROVIDER (engine),
                                           priv->restart ? NAUTILUS_SEARCH_PROVIDER_STATUS_RESTARTING :
                                           NAUTILUS_SEARCH_PROVIDER_STATUS_NORMAL);
    }

    priv->running = FALSE;
    g_object_notify (G_OBJECT (engine), "running");

    g_hash_table_remove_all (priv->uris);

    if (priv->restart)
    {
        nautilus_search_engine_start (NAUTILUS_SEARCH_PROVIDER (engine));
    }

    g_object_unref (engine);
}
Example #28
0
static void update_title_substitute_table(MacMenu* mmb)
{
  gchar* ts_list_path = g_build_filename(g_get_home_dir(), TS_LIST_FILENAME, NULL);
  struct stat sbuf;
  if (g_stat(ts_list_path, &sbuf))
  {
    FILE* nf = g_fopen(ts_list_path, "w");
    if (nf == NULL)
      fprintf(stderr, "Unable to create %s\n", ts_list_path);
    else
    {
      fwrite(TS_LIST_DEFAULT, 1, strlen(TS_LIST_DEFAULT), nf);
      sbuf.st_mtime = time(NULL);
      fclose(nf);
      fprintf(stdout, "New %s created\n", ts_list_path);
    }
  }
  // update if the file has been modified
  if (sbuf.st_mtime > mmb->ts_mtime)
  {
    GIOChannel* ioc = g_io_channel_new_file(ts_list_path, "r", NULL);
    if (ioc == NULL)
      fprintf(stderr, "Unable to open %s for reading list after successful stat()\n", ts_list_path);
    else
    {
      g_hash_table_remove_all(mmb->title_subs);
      gsize line_len, line_term;
      gchar* line_str;
      while (g_io_channel_read_line(ioc, &line_str, &line_len, &line_term,
                                    NULL) == G_IO_STATUS_NORMAL)
      {
        char* sep_pos;
        if (line_str != NULL && (sep_pos = rindex(line_str, '=')) != NULL)
        {
          gchar* key = line_str;
          gchar* value = sep_pos + 1;
          sep_pos[0] = 0;
          line_str[line_term] = 0;
          g_hash_table_insert(mmb->title_subs, key, value);
        }
      }
      g_io_channel_shutdown(ioc, FALSE, NULL);
    }
  }
  mmb->ts_mtime = sbuf.st_mtime;
  g_free(ts_list_path);
}
Example #29
0
static gboolean
load_assertions (GkmXdgTrust *self, GNode *asn)
{
	GHashTable *assertions;
	GkmAssertion *assertion;
	GBytes *key;
	GNode *node;
	guint count, i;

	g_assert (self);
	g_assert (asn);

	assertions = self->pv->assertions;
	self->pv->assertions = create_assertions ();

	count = egg_asn1x_count (egg_asn1x_node (asn, "assertions", NULL));

	for (i = 0; i < count; ++i) {
		node = egg_asn1x_node (asn, "assertions", i + 1, NULL);
		g_return_val_if_fail (node != NULL, FALSE);

		/* We use the raw DER encoding as an assertion */
		key = egg_asn1x_get_element_raw (node);
		g_return_val_if_fail (key != NULL, FALSE);

		/* Already have this assertion? */
		assertion = g_hash_table_lookup (assertions, key);
		if (assertion) {
			if (!g_hash_table_steal (assertions, key))
				g_assert_not_reached ();

		/* Create a new assertion */
		} else {
			assertion = create_assertion (self, node);
		}

		add_assertion_to_trust (self, assertion, NULL);
		g_bytes_unref (key);
		g_object_unref (assertion);
	}

	/* Override the stored assertions and netscape trust */
	g_hash_table_remove_all (assertions);
	g_hash_table_unref (assertions);

	return TRUE;
}
static gboolean
ck_load_cache (GHashTable *cache)
{
	GKeyFile *keyfile = g_key_file_new ();
	char **groups = NULL;
	GError *error = NULL;
	gsize i, len;
	gboolean finished = FALSE;

	if (!g_key_file_load_from_file (keyfile, CKDB_PATH, G_KEY_FILE_NONE, &error))
		goto out;

	if (!(groups = g_key_file_get_groups (keyfile, &len))) {
		nm_log_err (LOGD_CORE, "Could not load groups from " CKDB_PATH);
		goto out;
	}

	g_hash_table_remove_all (cache);

	for (i = 0; i < len; i++) {
		guint uid = G_MAXUINT;
		CkSession session = { .active = FALSE };

		if (!g_str_has_prefix (groups[i], "CkSession "))
			continue;

		uid = g_key_file_get_integer (keyfile, groups[i], "uid", &error);
		if (error)
			goto out;

		session.active = g_key_file_get_boolean (keyfile, groups[i], "is_active", &error);
		if (error)
			goto out;

		g_hash_table_insert (cache, GUINT_TO_POINTER (uid), g_memdup (&session, sizeof session));
	}

	finished = TRUE;
out:
	if (error)
		nm_log_err (LOGD_CORE, "ConsoleKit: Failed to load database: %s", error->message);
	g_clear_error (&error);
	g_clear_pointer (&groups, g_strfreev);
	g_clear_pointer (&keyfile, g_key_file_free);

	return finished;
}