/* when receive/send is complete */
static void
receive_done (gint still_more, gpointer data)
{
	struct _send_info *info = data;
	const gchar *uid;

	uid = camel_service_get_uid (info->service);
	g_return_if_fail (uid != NULL);

	/* if we've been called to run again - run again */
	if (info->type == SEND_SEND && info->state == SEND_ACTIVE && info->again) {
		EMailSession *session;
		CamelFolder *local_outbox;

		session = info->session;
		local_outbox =
			e_mail_session_get_local_folder (
			session, E_MAIL_LOCAL_FOLDER_OUTBOX);

		g_return_if_fail (CAMEL_IS_TRANSPORT (info->service));

		info->again = 0;
		mail_send_queue (
			info->session,
			local_outbox,
			CAMEL_TRANSPORT (info->service),
			E_FILTER_SOURCE_OUTGOING,
			info->cancellable,
			receive_get_folder, info,
			receive_status, info,
			send_done, info);
		return;
	}

	//FIXME Set SEND completed here
	/*	if (info->state == SEND_CANCELLED)
			text = _("Canceled.");
		else {
			text = _("Complete.");
			info->state = SEND_COMPLETE;
		}
	*/

	/* remove/free this active download */
	d(printf("%s: freeing info %p\n", G_STRFUNC, info));
	if (info->type == SEND_SEND)
		g_hash_table_steal (info->data->active, SEND_URI_KEY);
	else
		g_hash_table_steal (info->data->active, uid);
	info->data->infos = g_list_remove (info->data->infos, info);

	if (g_hash_table_size (info->data->active) == 0) {
		//FIXME: THIS MEANS SEND RECEIVE IS COMPLETED
		free_send_data ();
	}

	free_send_info (info);
}
Beispiel #2
0
/* when receive/send is complete */
static void
receive_done (char *uri, void *data)
{
	struct _send_info *info = data;

	/* if we've been called to run again - run again */
	if (info->type == SEND_SEND && info->state == SEND_ACTIVE && info->again) {
		info->again = 0;
		mail_send_queue (mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX),
				 info->uri,
				 FILTER_SOURCE_OUTGOING,
				 info->cancel,
				 receive_get_folder, info,
				 receive_status, info,
				 receive_done, info);
		return;
	}

	if (info->progress_bar) {
		const gchar *text;

		gtk_progress_bar_set_fraction(
			GTK_PROGRESS_BAR (info->progress_bar), 1.0);

		if (info->state == SEND_CANCELLED)
			text = _("Canceled.");
		else {
			text = _("Complete.");
			info->state = SEND_COMPLETE;
		}

		gtk_label_set_text (GTK_LABEL (info->status_label), text);
	}

	if (info->cancel_button)
		gtk_widget_set_sensitive (info->cancel_button, FALSE);

	/* remove/free this active download */
	d(printf("%s: freeing info %p\n", G_STRFUNC, info));
	if (info->type == SEND_SEND)
		g_hash_table_steal(info->data->active, SEND_URI_KEY);
	else
		g_hash_table_steal(info->data->active, info->uri);
	info->data->infos = g_list_remove(info->data->infos, info);

	if (g_hash_table_size(info->data->active) == 0) {
		if (info->data->gd)
			gtk_widget_destroy((GtkWidget *)info->data->gd);
		free_send_data();
	}

	free_send_info(info);
}
Beispiel #3
0
static gboolean
remove_or_steal_one(GHashTable *hash,
                    void      **key_p,
                    void      **value_p,
                    gboolean    steal)
{
    StoreOneData sod;

    sod.key = NULL;
    sod.value = NULL;
    g_hash_table_find(hash, get_first_one_predicate, &sod);

    if (sod.key == NULL)
        return FALSE;

    if (key_p)
        *key_p = sod.key;
    if (value_p)
        *value_p = sod.value;

    if (steal)
        g_hash_table_steal(hash, sod.key);
    else
        g_hash_table_remove(hash, sod.key);

    return sod.value != NULL;
}
Beispiel #4
0
static void read_all_frames (VFSFile * handle, int version, bool_t syncsafe,
 int data_size, GHashTable * dict)
{
    int pos;

    for (pos = 0; pos < data_size; )
    {
        int frame_size, size;
        char key[5];
        char * data;
        GenericFrame * frame;

        if (! read_frame (handle, data_size - pos, version, syncsafe,
         & frame_size, key, & data, & size))
            break;

        pos += frame_size;

        frame = g_slice_new (GenericFrame);
        strcpy (frame->key, key);
        frame->data = data;
        frame->size = size;

        void * key2, * list = NULL;

        if (g_hash_table_lookup_extended (dict, key, & key2, & list))
            g_hash_table_steal (dict, key);
        else
            key2 = str_get (key);

        list = g_list_append (list, frame);
        g_hash_table_insert (dict, key2, list);
    }
}
Beispiel #5
0
static void
track_element_added_cb (GESClip * clip,
    GESTrackElement * track_element, GHashTable * props_table)
{
  GESPitiviFormatter *formatter;

  formatter = GES_PITIVI_FORMATTER (g_hash_table_lookup (props_table,
          "current-formatter"));
  if (formatter) {
    GESPitiviFormatterPrivate *priv = formatter->priv;

    /* Make sure the hack to get a ref to the formatter
     * doesn't break everything */
    g_hash_table_steal (props_table, "current-formatter");

    priv->sources_to_load = g_list_remove (priv->sources_to_load, clip);
    if (!priv->sources_to_load && GES_FORMATTER (formatter)->project)
      ges_project_set_loaded (GES_FORMATTER (formatter)->project,
          GES_FORMATTER (formatter));
  }

  /* Disconnect the signal */
  g_signal_handlers_disconnect_by_func (clip, track_element_added_cb,
      props_table);
}
static void
desktop_cancel_callback (CajaDirectory *directory,
                         CajaDirectoryCallback callback,
                         gpointer callback_data)
{
    CajaDesktopDirectory *desktop;
    MergedCallback search_key, *merged_callback;
    GList *node;

    desktop = CAJA_DESKTOP_DIRECTORY (directory);

    /* Find the entry in the table. */
    search_key.callback = callback;
    search_key.callback_data = callback_data;
    merged_callback = g_hash_table_lookup (desktop->details->callbacks, &search_key);
    if (merged_callback == NULL)
    {
        return;
    }

    /* Remove from the hash table before working with it. */
    g_hash_table_steal (merged_callback->desktop_dir->details->callbacks, merged_callback);

    /* Tell all the directories to cancel the call. */
    for (node = merged_callback->non_ready_directories; node != NULL; node = node->next)
    {
        caja_directory_cancel_callback
        (node->data,
         directory_ready_callback, merged_callback);
    }
    merged_callback_destroy (merged_callback);
}
Beispiel #7
0
static void 
git_ref_command_insert_ref (GitRefCommand *self, const gchar *sha, GitRef *ref)
{
	GList *ref_list;
	gchar *name;
	gchar *old_sha;
	
	name = git_ref_get_name (ref);
	
	ref_list = g_hash_table_lookup (self->priv->refs, sha);
	
	ref_list = g_list_append (ref_list, ref);
	
	if (g_hash_table_lookup_extended (self->priv->refs, sha, 
									  (gpointer) &old_sha, NULL))
	{
		/* Change the list head for this SHA without destroying it */
		g_hash_table_steal (self->priv->refs, sha); 
		
		g_free (old_sha);
	}
	
	g_hash_table_insert (self->priv->refs, g_strdup (sha), ref_list);
	
	g_free (name);
}
Beispiel #8
0
static void
children_remove (node_t *p, node_t *f)
{
    FN_W ("%s %s %s\n", __func__, NODE_NAME(p), f->basename);
    g_hash_table_steal (p->children, f->basename);
    NODE_PARENT(f) = NULL;
}
Beispiel #9
0
static void	ug_selector_page_add_filter (UgSelectorPage* page, GtkListStore* filter_store, gchar* key, UgSelectorItem* value)
{
	GtkTreeIter		iter;
	UgSelectorItem*	filter_item;
	GList*			filter_list;
	gchar*			orig_key;

	if (g_hash_table_lookup_extended (page->filter.hash, key,
			(gpointer*) &orig_key, (gpointer*) &filter_list) == FALSE)
	{
		filter_item = g_slice_alloc (sizeof (UgSelectorItem));
		filter_item->uri  = key;
		filter_item->mark = TRUE;
		filter_item->dataset = NULL;
		gtk_list_store_append (filter_store, &iter);
		gtk_list_store_set (filter_store, &iter, 0, filter_item, -1);
		filter_list = NULL;
	}
	else {
		g_hash_table_steal (page->filter.hash, key);
		g_free (key);
		key = orig_key;
	}
	filter_list = g_list_prepend (filter_list, value);
	g_hash_table_insert (page->filter.hash, key, filter_list);
}
Beispiel #10
0
static GHashTable *
meta_wayland_compositor_update_outputs (MetaWaylandCompositor *compositor,
                                        MetaMonitorManager    *monitors)
{
  unsigned int i;
  GHashTable *new_table;
  MetaMonitorInfo *monitor_infos;
  unsigned int n_monitor_infos;

  monitor_infos = meta_monitor_manager_get_monitor_infos (monitors, &n_monitor_infos);
  new_table = g_hash_table_new_full (NULL, NULL, NULL, wayland_output_destroy_notify);

  for (i = 0; i < n_monitor_infos; i++)
    {
      MetaMonitorInfo *info = &monitor_infos[i];
      MetaWaylandOutput *wayland_output;

      if (info->winsys_id == 0)
        continue;
      wayland_output = g_hash_table_lookup (compositor->outputs, GSIZE_TO_POINTER (info->winsys_id));

      if (wayland_output)
        {
          g_hash_table_steal (compositor->outputs, GSIZE_TO_POINTER (info->winsys_id));
        }
      else
        wayland_output = meta_wayland_output_new (compositor, info);

      wayland_output_update_for_output (wayland_output, info);
      g_hash_table_insert (new_table, GSIZE_TO_POINTER (info->winsys_id), wayland_output);
    }

  g_hash_table_destroy (compositor->outputs);
  return new_table;
}
Beispiel #11
0
/**
 * camel_object_bag_rekey:
 * @bag: a #CamelObjectBag
 * @object: a #GObject
 * @new_key: a new key for @object
 *
 * Changes the key for @object to @new_key, atomically.
 *
 * It is considered a programming error if @object is not found in @bag.
 * In such case the function will emit a terminal warning and return.
 **/
void
camel_object_bag_rekey (CamelObjectBag *bag,
                        gpointer object,
                        gconstpointer new_key)
{
	gpointer key;
	ObjRef *ref;

	g_return_if_fail (bag != NULL);
	g_return_if_fail (G_IS_OBJECT (object));
	g_return_if_fail (new_key != NULL);

	g_mutex_lock (&bag->mutex);

	key = g_hash_table_lookup (bag->key_table, object);
	if (key != NULL) {
		/* Remove the old key. */
		ref = g_hash_table_lookup (bag->object_table, key);
		g_hash_table_steal (bag->object_table, key);
		g_hash_table_remove (bag->key_table, object);

		/* Insert the new key. */
		key = bag->key_copy_func (new_key);
		g_hash_table_insert (bag->object_table, key, ref);
		g_hash_table_insert (bag->key_table, object, key);
	} else
		g_warn_if_reached ();

	g_mutex_unlock (&bag->mutex);
}
Beispiel #12
0
/* Hash operations */
void
gdbmi_value_hash_insert (GDBMIValue* val, const gchar *key, GDBMIValue *value)
{
	gpointer orig_key;
	gpointer orig_value;

	g_return_if_fail (val != NULL);
	g_return_if_fail (key != NULL);
	g_return_if_fail (value != NULL);
	g_return_if_fail (val->type == GDBMI_DATA_HASH);

	/* GDBMI hash table could contains several data with the same
	 * key (output of -thread-list-ids)
	 * Keep old value under a random name, we get them using
	 * foreach function */
	if (g_hash_table_lookup_extended (val->data.hash, key, &orig_key, &orig_value))
	{
		/* Key already exist, remove it and insert value with
		 * another name */
		g_hash_table_steal (val->data.hash, key);
		g_free (orig_key);
		gchar *new_key = g_strdup_printf("[%d]", GDBMI_deleted_hash_value++);
		g_hash_table_insert (val->data.hash, new_key, orig_value);

	}
	g_hash_table_insert (val->data.hash, g_strdup (key), value);
}
Beispiel #13
0
/**
 * expr_name_set_pos:
 * @nexpr : the named expression
 * @pp: the new position
 *
 * Returns a translated error string which the caller must free if something
 * goes wrong.
 **/
char *
expr_name_set_pos (GnmNamedExpr *nexpr, GnmParsePos const *pp)
{
	GnmNamedExprCollection *old_scope, *new_scope;
	const char *name;

	g_return_val_if_fail (nexpr != NULL, NULL);
	g_return_val_if_fail (nexpr->scope != NULL, NULL);
	g_return_val_if_fail (pp != NULL, NULL);

	old_scope = nexpr->scope;
	new_scope = pp->sheet ? pp->sheet->names : pp->wb->names;

	name = nexpr->name->str;
	if (old_scope != new_scope &&
	    (g_hash_table_lookup (new_scope->placeholders, name) ||
	     g_hash_table_lookup (new_scope->names, name))) {
		const char *fmt = pp->sheet
			? _("'%s' is already defined in sheet")
			: _("'%s' is already defined in workbook");
		return g_strdup_printf (fmt, name);
	}

	g_hash_table_steal (
		nexpr->is_placeholder ? old_scope->placeholders : old_scope->names,
		name);

	nexpr->pos = *pp;
	gnm_named_expr_collection_insert (new_scope, nexpr);
	return NULL;
}
Beispiel #14
0
/* This function does not unref the weak reference, because the object
 * is beeing destroyed currently. */
static void
on_animated_widget_destruction (gpointer data, GObject *object)
{
	/* steal the animation info from the hash table (destroying it would
	 * result in the weak reference to be unrefed, which does not work
	 * as the widget is already destroyed. */
	g_hash_table_steal (animated_widgets, object);
	animation_info_destroy ((AnimationInfo*) data);
}
Beispiel #15
0
void
expert_deregister_expertinfo (const char *abbrev)
{
	expert_field_info *expinfo = (expert_field_info*)g_hash_table_lookup(gpa_name_map, abbrev);
	if (expinfo) {
		g_ptr_array_add(deregistered_expertinfos, gpa_expertinfo.ei[expinfo->id]);
		g_hash_table_steal(gpa_name_map, abbrev);
	}
}
Beispiel #16
0
/*
 * Does the right thing when removing from one of the conversation hash tables,
 * taking into account ordering and hash chains and all that good stuff.
 */
static void
conversation_remove_from_hashtable(GHashTable *hashtable, conversation_t *conv)
{
	conversation_t *chain_head, *cur, *prev;

	chain_head = (conversation_t *)g_hash_table_lookup(hashtable, conv->key_ptr);

	if (conv == chain_head) {
		/* We are currently the front of the chain */
		if (NULL == conv->next) {
			/* We are the only conversation in the chain, no need to
			 * update next pointer, but do not call
			 * g_hash_table_remove() either because the conv data
			 * will be re-inserted. The memory is released when
			 * conversion_cleanup() is called. */
			g_hash_table_steal(hashtable, conv->key_ptr);
		}
		else {
			/* Update the head of the chain */
			chain_head = conv->next;
			chain_head->last = conv->last;

			if (conv->latest_found == conv)
				chain_head->latest_found = NULL;
			else
				chain_head->latest_found = conv->latest_found;

			g_hash_table_insert(hashtable, chain_head->key_ptr, chain_head);
		}
	}
	else {
		/* We are not the front of the chain. Loop through to find us.
		 * Start loop at chain_head->next rather than chain_head because
		 * we already know we're not at the head. */
		cur = chain_head->next;
		prev = chain_head;

		for (; (cur != conv) && cur->next; prev=cur, cur=cur->next)
			;

		if (cur != conv) {
			/* XXX: Conversation not found. Wrong hashtable? */
			return;
		}

		prev->next = conv->next;

		if (NULL == conv->next) {
			/* We're at the very end of the list. */
			chain_head->last = prev;
		}

		if (chain_head->latest_found == conv)
			chain_head->latest_found = prev;
	}
}
Beispiel #17
0
static void
fb_data_image_dispose(GObject *obj)
{
	FbDataImage *img = FB_DATA_IMAGE(obj);
	FbDataImagePrivate *priv = img->priv;
	FbData *fata = priv->fata;

	g_free(priv->url);
	g_hash_table_steal(fata->priv->imgs, img);
}
static void
on_helper_close (CockpitPipe *pipe,
                 const gchar *problem,
                 gpointer user_data)
{
  ReauthorizeCaller *caller = user_data;
  GSimpleAsyncResult *result;
  gint status;
  int res;

  g_warn_if_fail (g_hash_table_steal (caller->self->callers, caller->cookie));

  if (caller->result)
    {
      result = caller->result;
      caller->result = NULL;

      if (problem)
        {
          g_message ("cockpit-polkit helper had problem: %s", problem);
          res = 1;
        }
      else
        {
          status = cockpit_pipe_exit_status (pipe);
          if (WIFEXITED (status))
            {
              g_message ("cockpit-polkit helper exited with status: %d", (int)WEXITSTATUS (status));
              res = WEXITSTATUS (status);
            }
          else if (WIFSIGNALED (status))
            {
              g_message ("cockpit-polkit helper was terminated with signal: %d", (int)WTERMSIG (status));
              res = 1;
            }
          else
            {
              g_message ("cockpit-polkit helper terminated unexpectedly");
              res = 1;
            }
        }

      if (res != 0)
        {
          g_simple_async_result_set_error (result, POLKIT_ERROR, POLKIT_ERROR_FAILED,
                                           "Cockpit polkit agent helper failed");
        }
      g_simple_async_result_complete (result);
      g_object_unref (result);
    }

  g_debug ("closing agent authentication");
  caller_free (caller);
}
Beispiel #19
0
/**
 * gsf_doc_meta_data_steal:
 * @meta: #GsfDocMetaData
 * @name:
 *
 * Returns: (nullable) (transfer full): the property with @name in @meta.
 **/
GsfDocProp *
gsf_doc_meta_data_steal (GsfDocMetaData *meta, char const *name)
{
	GsfDocProp *prop;
	g_return_val_if_fail (IS_GSF_DOC_META_DATA (meta), NULL);
	g_return_val_if_fail (name != NULL, NULL);
	prop = g_hash_table_lookup (meta->table, name);
	if (NULL != prop)
		g_hash_table_steal (meta->table, name);
	return prop;
}
Beispiel #20
0
/**
 * Remove elem from table in in
 * \param in   Object with table to remove elem from
 * \param elem the element to remove. MUST be in list
 */
static void memTableRemove (ObitMemClassInfo *in, memTableElem *elem)
{
  /* remove from table */
  if (!g_hash_table_steal (in->memTable, elem->mem)) {
    /* element not removed */
    g_error ("ObitMem: failed to deallocate memory: %s",
	     elem->name);
  }
  in->number--; /* keep count */

} /* end memTableRemove  */
Beispiel #21
0
static gboolean
load_assertions (GkmXdgTrust *self, GNode *asn)
{
	gconstpointer element;
	GHashTable *assertions;
	GkmAssertion *assertion;
	gsize n_element;
	GByteArray *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, FALSE);

		/* We use the raw DER encoding as an assertion */
		element = egg_asn1x_get_raw_element (node, &n_element);
		g_return_val_if_fail (node, FALSE);

		/* Double check that this is valid, because it's how we hash */
		key = g_byte_array_new ();
		g_byte_array_append (key, element, n_element);

		/* 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_byte_array_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;
}
GHashTable *
nautilus_trashed_files_get_original_directories (GList *files,
        GList **unhandled_files)
{
    GHashTable *directories;
    NautilusFile *file, *original_file, *original_dir;
    GList *l, *m;

    directories = NULL;

    if (unhandled_files != NULL) {
        *unhandled_files = NULL;
    }

    for (l = files; l != NULL; l = l->next) {
        file = NAUTILUS_FILE (l->data);
        original_file = nautilus_file_get_trash_original_file (file);

        original_dir = NULL;
        if (original_file != NULL) {
            original_dir = nautilus_file_get_parent (original_file);
        }

        if (original_dir != NULL) {
            if (directories == NULL) {
                directories = g_hash_table_new_full (g_direct_hash, g_direct_equal,
                                                     (GDestroyNotify) nautilus_file_unref,
                                                     (GDestroyNotify) nautilus_file_list_unref);
            }
            nautilus_file_ref (original_dir);
            m = g_hash_table_lookup (directories, original_dir);
            if (m != NULL) {
                g_hash_table_steal (directories, original_dir);
                nautilus_file_unref (original_dir);
            }
            m = g_list_append (m, nautilus_file_ref (file));
            g_hash_table_insert (directories, original_dir, m);
        } else if (unhandled_files != NULL) {
            *unhandled_files = g_list_append (*unhandled_files, nautilus_file_ref (file));
        }

        if (original_file != NULL) {
            nautilus_file_unref (original_file);
        }

        if (original_dir != NULL) {
            nautilus_file_unref (original_dir);
        }
    }

    return directories;
}
Beispiel #23
0
PraghaPreparedStatement *
pragha_database_create_statement (PraghaDatabase *database, const gchar *sql)
{
	PraghaDatabasePrivate *priv = database->priv;
	PraghaPreparedStatement *cached = g_hash_table_lookup (priv->statements_cache, sql);

	if (cached) {
		g_hash_table_steal (priv->statements_cache, sql);
		return cached;
	}

	return new_statement (database, sql);
}
Beispiel #24
0
static MpegTSBaseProgram *
mpegts_base_steal_program (MpegTSBase * base, gint program_number)
{
  MpegTSBaseProgram *program;

  program = (MpegTSBaseProgram *) g_hash_table_lookup (base->programs,
      GINT_TO_POINTER ((gint) program_number));

  if (program)
    g_hash_table_steal (base->programs,
        GINT_TO_POINTER ((gint) program_number));

  return program;
}
Beispiel #25
0
static void libbalsa_imap_server_set_username(LibBalsaServer * server,
                                              const gchar * name)
{
    if(server->host && name) { /* we have been initialized... */
        LibBalsaImapServer *imap_server = LIBBALSA_IMAP_SERVER(server);
        
        g_mutex_lock(&imap_servers_lock);
        g_hash_table_steal(imap_servers, imap_server->key);
        g_free(imap_server->key);
        imap_server->key = g_strdup_printf("%s@%s", name, server->host);
        g_hash_table_insert(imap_servers, imap_server->key, imap_server);
        g_mutex_unlock(&imap_servers_lock);
    }
    (parent_class)->set_username(server, name);
}
Beispiel #26
0
void
_handler_directory_deleted(WildcardSourceDriver *self, const DirectoryMonitorEvent *event)
{
  gchar *key;
  DirectoryMonitor *monitor;
  gboolean found = g_hash_table_lookup_extended(self->directory_monitors, event->full_path,
                                                (gpointer *)&key, (gpointer *)&monitor);
  if (found)
    {
      msg_debug("Monitored directory is deleted", evt_tag_str("dir", event->full_path));
      g_hash_table_steal(self->directory_monitors, event->full_path);
      g_free(key);
      directory_monitor_schedule_destroy(monitor);
    }
}
Beispiel #27
0
static void
libbalsa_imap_server_set_host(LibBalsaServer * server,
                              const gchar * host, gboolean use_ssl)
{
    if(server->user && host) { /* we have been initialized... */
        LibBalsaImapServer *imap_server = LIBBALSA_IMAP_SERVER(server);
        g_mutex_lock(&imap_servers_lock);
        g_hash_table_steal(imap_servers, imap_server->key);
        g_free(imap_server->key);
        imap_server->key = g_strdup_printf("%s@%s", server->user, host);
        g_hash_table_insert(imap_servers, imap_server->key, imap_server);
        g_mutex_unlock(&imap_servers_lock);
    }
    (parent_class)->set_host(server, host, use_ssl);
}
static void
device_removed (GDBusProxy *proxy, const gchar *path, NMBluez5Manager *self)
{
	NMBluez5ManagerPrivate *priv = NM_BLUEZ5_MANAGER_GET_PRIVATE (self);
	NMBluezDevice *device;

	nm_log_dbg (LOGD_BT, "(%s): bluez device removed", path);

	device = g_hash_table_lookup (priv->devices, path);
	if (device) {
		g_hash_table_steal (priv->devices, nm_bluez_device_get_path (device));
		remove_device (NM_BLUEZ5_MANAGER (self), device);
		g_object_unref (device);
	}
}
Beispiel #29
0
/**
 * cm_node_unlink:
 * @node: the #CMNode to unlink, which becomes the root of a new tree
 *
 * Unlinks a #CMNode from a tree, resulting in two separate trees.
 */
void
cm_node_unlink (CMNode *node)
{
  g_return_if_fail (node != NULL);
  
  if (node->parent)
    {
      gint n;

      n = cm_node_child_position (node->parent, node);

      if (n >= 0)
        g_hash_table_steal (node->parent->children, GINT_TO_POINTER(n));
    }
  node->parent = NULL;
}
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;
}