Example #1
0
/* Returns the list containing exactly one INTERNET and one MMS access point */
static GSList *provision_normalize_apn_list(GSList *apns, const char* spn)
{
	static const struct provision_ap_defaults internet_defaults =
		{ OFONO_GPRS_CONTEXT_TYPE_INTERNET, "Internet", "internet" };
	static const struct provision_ap_defaults mms_defaults =
		{ OFONO_GPRS_CONTEXT_TYPE_MMS, "MMS", "mms" };

	GSList *internet_apns = NULL;
	GSList *mms_apns = NULL;

	/* Split internet and mms apns, delete all others */
	while (apns) {
		GSList *link = apns;
		struct ofono_gprs_provision_data *ap = link->data;

		apns = g_slist_remove_link(apns, link);
		if (ap->type == OFONO_GPRS_CONTEXT_TYPE_INTERNET) {
			internet_apns = g_slist_concat(internet_apns, link);
		} else if (ap->type == OFONO_GPRS_CONTEXT_TYPE_MMS) {
			mms_apns = g_slist_concat(mms_apns, link);
		} else {
			g_slist_free_full(link, provision_free_ap);
		}
	}

	/* Pick the best ap of each type and concatenate them */
	return g_slist_concat(
		provision_pick_best_ap(internet_apns, spn, &internet_defaults),
		provision_pick_best_ap(mms_apns, spn, &mms_defaults));
}
Example #2
0
/* apply changes from the edit list */
gboolean
color_filters_apply(GSList *tmp_cfl, GSList *edit_cfl, gchar** err_msg)
{
    gboolean ret = TRUE;

    *err_msg = NULL;

    /* "move" old entries to the deleted list
     * we must keep them until the dissection no longer needs them */
    color_filter_deleted_list = g_slist_concat(color_filter_deleted_list, color_filter_list);
    color_filter_list = NULL;

    /* clone all list entries from tmp/edit to normal list */
    color_filter_valid_list = NULL;
    color_filter_valid_list = color_filter_list_clone(tmp_cfl);
    color_filter_valid_list = g_slist_concat(color_filter_valid_list,
                                             color_filter_list_clone(edit_cfl) );

    /* compile all filter */
    g_slist_foreach(color_filter_valid_list, color_filter_validate_cb, err_msg);
    if (*err_msg != NULL) {
        ret = FALSE;
    }

    /* clone all list entries from tmp/edit to normal list */
    color_filter_list = color_filter_list_clone(color_filter_valid_list);

    /* compile all filter */
    g_slist_foreach(color_filter_list, color_filter_compile_cb, err_msg);
    if (*err_msg != NULL) {
        ret = FALSE;
    }

    return ret;
}
Example #3
0
/* Returns: TRUE if the notifier was removed, FALSE if it is still referenced. */
static gboolean
gconf_settings_backend_remove_notifier (GConfSettingsBackend *gconf,
                                        const gchar          *path)
{
  GConfSettingsBackendNotifier *notifier;

  notifier = gconf_settings_backend_find_notifier_or_parent (gconf, path);

  g_assert (notifier && g_str_equal (path, notifier->path));

  notifier->refcount -= 1;

  if (notifier->refcount > 0)
    return FALSE;

  /* Move subpaths to the parent, and add a notify handler for each of them if
   * they have no parent anymore. */
  if (notifier->parent)
    {
      GSList *l;

      for (l = notifier->subpaths; l != NULL; l = l->next)
        {
          GConfSettingsBackendNotifier *child = l->data;
          child->parent = notifier->parent;
        }

      notifier->parent->subpaths = g_slist_remove (notifier->parent->subpaths,
                                                   notifier);
      notifier->parent->subpaths = g_slist_concat (notifier->parent->subpaths,
                                                   notifier->subpaths);
    }
  else
    {
      GSList *l;

      for (l = notifier->subpaths; l != NULL; l = l->next)
        {
          GConfSettingsBackendNotifier *child = l->data;
          child->parent = NULL;
          child->notify_id = gconf_client_notify_add (gconf->priv->client, child->path,
                                                      (GConfClientNotifyFunc) gconf_settings_backend_notified, gconf,
                                                      NULL, NULL);
        }

      gconf->priv->notifiers = g_slist_remove (gconf->priv->notifiers,
                                               notifier);
      gconf->priv->notifiers = g_slist_concat (gconf->priv->notifiers,
                                               notifier->subpaths);
    }

  notifier->subpaths = NULL;

  gconf_settings_backend_free_notifier (notifier, gconf);

  return TRUE;
}
static GSList *
sort_and_concat_results (ShellAppSystem *system,
                         GSList         *multiple_matches,
                         GSList         *prefix_matches,
                         GSList         *substring_matches)
{
  multiple_matches = g_slist_sort_with_data (multiple_matches, shell_app_info_compare, system);
  prefix_matches = g_slist_sort_with_data (prefix_matches, shell_app_info_compare, system);
  substring_matches = g_slist_sort_with_data (substring_matches, shell_app_info_compare, system);
  return g_slist_concat (multiple_matches, g_slist_concat (prefix_matches, substring_matches));
}
Example #5
0
/**
 * parole_pl_parser_parse_all_from_file:
 * @filename: a filename
 * 
 * This function tries to parse a playlist without guessing the playlist format.
 * 
 * 
 * Returns: a #GSList containts a list of #Parolefile parsed from the playlist, 
 *          or NULL if no files were parsed.
 * 
 * Since: 0.2
 */
GSList *parole_pl_parser_parse_all_from_file (const gchar *filename)
{
    GSList *list = NULL;
    
    list = parole_pl_parser_parse_asx (filename);
    list = g_slist_concat (list, parole_pl_parser_parse_m3u (filename));
    list = g_slist_concat (list, parole_pl_parser_parse_pls (filename));
    list = g_slist_concat (list, parole_pl_parser_parse_xspf (filename));
    
    return list;
}
Example #6
0
/**
 * if timeout_to_step or timeout_to_overall = -1: 
 * used default value
 */
static GError*
_m2v2_request_ex(const gchar *url, GByteArray *req, 
				gdouble timeout_to_step, gdouble timeout_to_overall,
				GSList **out)
{
	GError *err = NULL;
	struct client_s *client;

	gboolean _cb(gpointer ctx, struct message_s *reply) {
		GSList *l = NULL;
		GError *e = NULL;
		if (0 < message_has_BODY(reply, NULL)) {
			e = message_extract_body_encoded(reply, &l, bean_sequence_decoder);
		}
		if (!e) {
			if (l) {
				*((GSList**)ctx) = g_slist_concat(*((GSList**)ctx), l);
			}
			return TRUE;
		}
		else {
			GRID_DEBUG("Callback error : %s", e->message);
			err = e;
			return FALSE;
		}
	}
Example #7
0
/**
 * Parse a list of countries until closing brace.
 * @return list containing the parsed country code, an empty list if invalid.
 */
static GSList *
ctl_parse_countries(struct ctl_string *s)
{
	GSList *sl = NULL;

	for (;;) {
		struct ctl_tok *tok = ctl_next_token(s);

		switch (tok->type) {
		case CTL_TOK_COMMA:
			ctl_token_free_null(&tok);
			continue;
		case CTL_TOK_RBRACE:
			ctl_token_free_null(&tok);
			goto out;
		case CTL_TOK_ID:
			sl = g_slist_concat(sl, ctl_parse_country(s, tok));
			ctl_token_free_null(&tok);
			break;
		case CTL_TOK_EOF:
		default:
			ctl_error(s, tok, "country or '}'");
			ctl_token_free_null(&tok);
			goto out;
		}
	}

out:
	return sl;
}
Example #8
0
/**
 * cinnamon_app_system_subsearch:
 * @system: A #CinnamonAppSystem
 * @previous_results: (element-type CinnamonApp): List of previous results
 * @terms: (element-type utf8): List of terms, logical AND
 *
 * Search through a previous result set; for more information, see
 * js/ui/search.js.  Note the value of @prefs must be
 * the same as passed to cinnamon_app_system_initial_search().  Note that returned
 * strings are only valid until a return to the main loop.
 *
 * Returns: (transfer container) (element-type CinnamonApp): List of application identifiers
 */
GSList *
cinnamon_app_system_subsearch (CinnamonAppSystem   *system,
                            GSList           *previous_results,
                            GSList           *terms)
{
  GSList *iter;
  GSList *prefix_results = NULL;
  GSList *substring_results = NULL;
  GSList *normalized_terms = normalize_terms (terms);

  for (iter = previous_results; iter; iter = iter->next)
    {
      CinnamonApp *app = iter->data;
      
      _cinnamon_app_do_match (app, normalized_terms,
                           &prefix_results,
                           &substring_results);
    }
  g_slist_foreach (normalized_terms, (GFunc)g_free, NULL);
  g_slist_free (normalized_terms);

  /* Note that a shorter term might have matched as a prefix, but
     when extended only as a substring, so we have to redo the
     sort rather than reusing the existing ordering */
  return g_slist_concat (prefix_results, substring_results);
}
Example #9
0
gboolean
color_filters_reload(gchar** err_msg, color_filter_add_cb_func add_cb)
{
    /* "move" old entries to the deleted list
     * we must keep them until the dissection no longer needs them */
    color_filter_deleted_list = g_slist_concat(color_filter_deleted_list, color_filter_list);
    color_filter_list = NULL;

    /* start the list with the temporary colorizing rules */
    color_filters_add_tmp(&color_filter_list);

    /* try to read the users filters */
    if (!read_users_filters(&color_filter_list, err_msg, add_cb)) {
        gchar* local_err_msg = NULL;

        /* if that failed, try to read the global filters */
        if (!color_filters_read_globals(&color_filter_list, &local_err_msg, add_cb)) {
            /* Show the first error */
            g_free(local_err_msg);
        }

        return (*err_msg == NULL);
    }
    return TRUE;
}
Example #10
0
/**
 * Standard scan() callback API helper.
 *
 * This function can be used to perform common tasks required by a driver's
 * scan() callback. It will initialize the driver for each device on the list
 * and add the devices on the list to the driver's device instance list.
 * Usually it should be used as the last step in the scan() callback, right
 * before returning.
 *
 * Note: This function can only be used if std_init() has been called
 * previously by the driver.
 *
 * Example:
 * @code{c}
 * static GSList *scan(struct sr_dev_driver *di, GSList *options)
 * {
 *     struct GSList *device;
 *     struct sr_dev_inst *sdi;
 *
 *     sdi = g_new0(sr_dev_inst, 1);
 *     sdi->vendor = ...;
 *     ...
 *     devices = g_slist_append(devices, sdi);
 *     ...
 *     return std_scan_complete(di, devices);
 * }
 * @endcode
 *
 * @param di The driver instance to use. Must not be NULL.
 * @param devices List of newly discovered devices (struct sr_dev_inst).
 *
 * @return The @p devices list.
 */
SR_PRIV GSList *std_scan_complete(struct sr_dev_driver *di, GSList *devices)
{
	struct drv_context *drvc;
	GSList *l;

	if (!di) {
		sr_err("Invalid driver instance (di), cannot complete scan.");
		return NULL;
	}

	drvc = di->context;

	for (l = devices; l; l = l->next) {
		struct sr_dev_inst *sdi = l->data;
		if (!sdi) {
			sr_err("Invalid driver instance, cannot complete scan.");
			return NULL;
		}
		sdi->driver = di;
	}

	drvc->instances = g_slist_concat(drvc->instances, g_slist_copy(devices));

	return devices;
}
static GSList *
add_classes (GSList      *list,
             gchar const *classes,
             gboolean     enabled)
{
	gchar **parts;
	gchar **ptr;
	GSList *newlist = NULL;

	if (classes == NULL)
	{
		return list;
	}

	parts = ptr = g_strsplit (classes, " ", -1);

	while (*ptr)
	{
		GtkSourceContextClass *ctx = gtk_source_context_class_new (*ptr, enabled);
		newlist = g_slist_prepend (newlist, ctx);

		++ptr;
	}

	g_strfreev (parts);
	return g_slist_concat (list, g_slist_reverse (newlist));
}
static void
rejilla_search_beagle_hit_added_cb (BeagleQuery *query,
				    BeagleHitsAddedResponse *response,
				    RejillaSearchBeagle *search)
{
	GSList *list;
	GSList *iter;
	RejillaSearchBeaglePrivate *priv;

	priv = REJILLA_SEARCH_BEAGLE_PRIVATE (search);

	/* NOTE : list must not be modified nor freed */
	list = beagle_hits_added_response_get_hits (response);
	list = g_slist_copy (list);

	if (priv->hits)
		priv->hits = g_slist_concat (priv->hits, list);
	else
		priv->hits = list;

	for (iter = list; iter; iter = iter->next) {
		BeagleHit *hit;

		hit = iter->data;
		beagle_hit_ref (hit);

		rejilla_search_engine_hit_added (REJILLA_SEARCH_ENGINE (search), hit);
	}
}
Example #13
0
static GSList *
search_tree (CinnamonAppSystem *self,
             GSList         *terms,
             GHashTable     *apps)
{
  GSList *prefix_results = NULL;
  GSList *substring_results = NULL;
  GSList *normalized_terms;
  GHashTableIter iter;
  gpointer key, value;

  normalized_terms = normalize_terms (terms);

  g_hash_table_iter_init (&iter, apps);
  while (g_hash_table_iter_next (&iter, &key, &value))
    {
      const char *id = key;
      CinnamonApp *app = value;
      (void)id;
      _cinnamon_app_do_match (app, normalized_terms,
                           &prefix_results,
                           &substring_results);
    }
  g_slist_foreach (normalized_terms, (GFunc)g_free, NULL);
  g_slist_free (normalized_terms);

  return g_slist_concat (prefix_results, substring_results);
}
static GSList *
folder_tree_flatten (CamelFolderInfo * ftree, int type, GSList ** def)
{
    CamelFolderInfo *iter;
    GSList *list;

    list = NULL;

    for (iter = ftree; iter; iter = iter->next) {

        if (((iter->flags & CAMEL_SCALIX_SFOLDER_MASK) == type)) {
            list = g_slist_prepend (list, iter);

            if (iter->flags & CAMEL_FOLDER_IS_DEFAULT) {
                *def = list;
            }
        }

        if (iter->child) {
            GSList *clist = NULL;

            clist = folder_tree_flatten (iter->child, type, def);
            list = g_slist_concat (list, clist);
        }
    }

    return list;
}
Example #15
0
/**
 * range_fragment:
 * @a: GnmRange a
 * @b: GnmRange b
 *
 * Fragments the ranges into totaly non-overlapping regions,
 *
 * Return value: A list of fragmented ranges or at minimum
 * simply a and b.
 **/
GSList *
range_fragment (GnmRange const *a, GnmRange const *b)
{
	GSList *split, *ans = NULL;

	split = range_split_ranges (a, b);
	ans   = g_slist_concat (ans, split);

	split = range_split_ranges (b, a);
	if (split) {
		g_free (split->data);
		split = g_slist_remove (split, split->data);
	}
	ans = g_slist_concat (ans, split);

	return ans;
}
Example #16
0
/**
 * Scan for Modbus devices which match a probing function.
 *
 * @param drvc The driver context doing the scan.
 * @param options The scan options to find devies.
 * @param probe_device The callback function that will be called for each
 *                     found device to validate whether this device matches
 *                     what we are scanning for.
 *
 * @return A list of the devices found or NULL if no devices were found.
 */
SR_PRIV GSList *sr_modbus_scan(struct drv_context *drvc, GSList *options,
                               struct sr_dev_inst *(*probe_device)(struct sr_modbus_dev_inst *modbus))
{
    GSList *resources, *l, *devices;
    struct sr_dev_inst *sdi;
    const char *resource = NULL;
    const char *serialcomm = NULL;
    int modbusaddr = 1;
    gchar **res;
    unsigned int i;

    for (l = options; l; l = l->next) {
        struct sr_config *src = l->data;
        switch (src->key) {
        case SR_CONF_CONN:
            resource = g_variant_get_string(src->data, NULL);
            break;
        case SR_CONF_SERIALCOMM:
            serialcomm = g_variant_get_string(src->data, NULL);
            break;
        case SR_CONF_MODBUSADDR:
            modbusaddr = g_variant_get_uint64(src->data);
            break;
        }
    }

    devices = NULL;
    for (i = 0; i < modbus_devs_size; i++) {
        if ((resource && strcmp(resource, modbus_devs[i]->prefix))
                || !modbus_devs[i]->scan)
            continue;
        resources = modbus_devs[i]->scan(modbusaddr);
        for (l = resources; l; l = l->next) {
            res = g_strsplit(l->data, ":", 2);
            if (res[0] && (sdi = sr_modbus_scan_resource(res[0],
                                 serialcomm ? serialcomm : res[1],
                                 modbusaddr, probe_device))) {
                devices = g_slist_append(devices, sdi);
                sdi->connection_id = g_strdup(l->data);
            }
            g_strfreev(res);
        }
        g_slist_free_full(resources, g_free);
    }

    if (!devices && resource) {
        sdi = sr_modbus_scan_resource(resource, serialcomm, modbusaddr,
                                      probe_device);
        if (sdi)
            devices = g_slist_append(NULL, sdi);
    }

    /* Tack a copy of the newly found devices onto the driver list. */
    if (devices)
        drvc->instances = g_slist_concat(drvc->instances, g_slist_copy(devices));

    return devices;
}
Example #17
0
File: news.c Project: Mortal/claws
static GSList *news_get_msginfos(Folder *folder, FolderItem *item, GSList *msgnum_list)
{
	NewsSession *session;
	GSList *elem, *msginfo_list = NULL, *tmp_msgnum_list, *tmp_msginfo_list;
	guint first, last, next;
	
	cm_return_val_if_fail(folder != NULL, NULL);
	cm_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, NULL);
	cm_return_val_if_fail(msgnum_list != NULL, NULL);
	cm_return_val_if_fail(item != NULL, NULL);
	
	session = news_session_get(folder);
	cm_return_val_if_fail(session != NULL, NULL);

	tmp_msgnum_list = g_slist_copy(msgnum_list);
	tmp_msgnum_list = g_slist_sort(tmp_msgnum_list, g_int_compare);

	progressindicator_start(PROGRESS_TYPE_NETWORK);

	first = GPOINTER_TO_INT(tmp_msgnum_list->data);
	last = first;
	
	news_folder_lock(NEWS_FOLDER(item->folder));
	
	for(elem = g_slist_next(tmp_msgnum_list); elem != NULL; elem = g_slist_next(elem)) {
		next = GPOINTER_TO_INT(elem->data);
		if(next != (last + 1)) {
			tmp_msginfo_list = news_get_msginfos_for_range(session, item, first, last);
			msginfo_list = g_slist_concat(msginfo_list, tmp_msginfo_list);
			first = next;
		}
		last = next;
	}
	
	news_folder_unlock(NEWS_FOLDER(item->folder));
	
	tmp_msginfo_list = news_get_msginfos_for_range(session, item, first, last);
	msginfo_list = g_slist_concat(msginfo_list, tmp_msginfo_list);

	g_slist_free(tmp_msgnum_list);
	
	progressindicator_stop(PROGRESS_TYPE_NETWORK);

	return msginfo_list;
}
Example #18
0
static void
fill_one_level (Package *pkg, GetListFunc func, GSList **listp)
{
  GSList *copy;

  copy = g_slist_copy ((*func)(pkg));

  *listp = g_slist_concat (*listp, copy);
}
/**
 * gda_sql_statement_insert_take_1_values_list
 * @stmt: a #GdaSqlStatement pointer
 * @list: a list of #GSList of #GdaSqlExpr pointers
 *
 * Sets a list of list of values to be inserted by @stmt. @list's 
 * ownership is transferred to
 * @stmt (which means @stmt is then responsible for freeing it when no longer needed).
 */
void
gda_sql_statement_insert_take_extra_values_list (GdaSqlStatement *stmt, GSList *list)
{
	GSList *l1, *l2;
	GdaSqlStatementInsert *insert = (GdaSqlStatementInsert *) stmt->contents;
	for (l1 = list; l1; l1 = l1->next) {
		for (l2 = (GSList *) l1->data; l2; l2 = l2->next)
			gda_sql_any_part_set_parent (l2->data, insert);
	}
	insert->values_list = g_slist_concat (insert->values_list, list);
}
Example #20
0
/**
 * mega_filesystem_glob:
 * @filesystem: a #MegaFilesystem
 * @glob: A glob pattern
 *
 * Get list of nodes matching glob pattern.
 *
 * Returns: (transfer full) (element-type MegaNode): List of nodes.
 */
GSList* mega_filesystem_glob(MegaFilesystem* filesystem, const gchar* glob)
{
  gchar** glob_parts;
  gchar** next_pattern;

  g_return_val_if_fail(MEGA_IS_FILESYSTEM(filesystem), NULL);
  g_return_val_if_fail(glob != NULL, NULL);

  // skip relative glob paterns
  next_pattern = glob_parts = remotepath_split(glob);
  if (glob_parts == NULL)
    return NULL;

  // create list of root nodes filtered by pattern
  GSList *full_list = NULL, *filtered_list = NULL, *iter;
  while (*next_pattern)  
  {
    // create list of nodes for filtering
    g_slist_free_full(full_list, g_object_unref);
    if (next_pattern == glob_parts)
    {
      full_list = mega_filesystem_get_root_nodes(filesystem);
    }
    else
    {
      full_list = NULL;
      for (iter = filtered_list; iter; iter = iter->next)
      {
        MegaNode* node = iter->data;

        full_list = g_slist_concat(full_list, mega_node_get_children(node));
      }
    }

    // clear fitlered list
    g_slist_free_full(filtered_list, g_object_unref);
    filtered_list = NULL;

    for (iter = full_list; iter; iter = iter->next)
    {
      MegaNode* node = iter->data;

      if (g_pattern_match_simple(*next_pattern, mega_node_get_name(node)))
        filtered_list = g_slist_prepend(filtered_list, g_object_ref(node));
    }

    next_pattern++;
  }

  g_slist_free_full(full_list, g_object_unref);
  g_strfreev(glob_parts);

  return g_slist_reverse(filtered_list);
}
Example #21
0
static void primary_by_uuid_cb(guint8 status, const guint8 *ipdu,
					guint16 iplen, gpointer user_data)

{
	struct discover_primary *dp = user_data;
	GSList *ranges, *last;
	struct att_range *range;
	uint8_t *buf;
	guint16 oplen;
	int err = 0;
	size_t buflen;

	if (status) {
		err = status == ATT_ECODE_ATTR_NOT_FOUND ? 0 : status;
		goto done;
	}

	ranges = dec_find_by_type_resp(ipdu, iplen);
	if (ranges == NULL)
		goto done;

	dp->primaries = g_slist_concat(dp->primaries, ranges);

	last = g_slist_last(ranges);
	range = last->data;

	if (range->end == 0xffff)
		goto done;

	/*
	 * If last handle is lower from previous start handle then it is smth
	 * wrong. Let's stop search, otherwise we might enter infinite loop.
	 */
	if (range->end < dp->start) {
		err = ATT_ECODE_UNLIKELY;
		goto done;
	}

	dp->start = range->end + 1;

	buf = g_attrib_get_buffer(dp->attrib, &buflen);
	oplen = encode_discover_primary(dp->start, 0xffff, &dp->uuid,
								buf, buflen);

	if (oplen == 0)
		goto done;

	g_attrib_send(dp->attrib, dp->id, buf, oplen, primary_by_uuid_cb,
			discover_primary_ref(dp), discover_primary_unref);
	return;

done:
	dp->cb(err, dp->primaries, dp->user_data);
}
Example #22
0
/*
 * Each NAIImporter interface may return some messages, specially if it
 * recognized but is not able to import the provided URI. But as long
 * we do not have yet asked to all available interfaces, we are not sure
 * of whether this URI is eventually importable or not.
 *
 * We so let each interface push its messages in the list, but be ready to
 * only keep the messages provided by the interface which has successfully
 * imported the item.
 */
static NAImporterResult *
import_from_uri( const NAPivot *pivot, GList *modules, const gchar *uri )
{
	NAImporterResult *result;
	NAIImporterImportFromUriParmsv2 provider_parms;
	GList *im;
	guint code;
	GSList *all_messages;
	NAIImporter *provider;

	result = NULL;
	all_messages = NULL;
	provider = NULL;
	code = IMPORTER_CODE_NOT_WILLING_TO;

	memset( &provider_parms, '\0', sizeof( NAIImporterImportFromUriParmsv2 ));
	provider_parms.version = 2;
	provider_parms.content = 1;
	provider_parms.uri = uri;

	for( im = modules ;
			im && ( code == IMPORTER_CODE_NOT_WILLING_TO || code == IMPORTER_CODE_NOT_LOADABLE ) ;
			im = im->next ){

		code = na_iimporter_import_from_uri( NA_IIMPORTER( im->data ), &provider_parms );

		if( code == IMPORTER_CODE_NOT_WILLING_TO ){
			all_messages = g_slist_concat( all_messages, provider_parms.messages );
			provider_parms.messages = NULL;

		} else if( code == IMPORTER_CODE_NOT_LOADABLE ){
			na_core_utils_slist_free( all_messages );
			all_messages = NULL;
			na_core_utils_slist_free( provider_parms.messages );
			provider_parms.messages = NULL;
			na_core_utils_slist_add_message( &all_messages, ERR_NOT_LOADABLE, ( const gchar * ) uri );

		} else {
			na_core_utils_slist_free( all_messages );
			all_messages = provider_parms.messages;
			provider = NA_IIMPORTER( im->data );
		}
	}

	result = g_new0( NAImporterResult, 1 );
	result->uri = g_strdup( uri );
	result->imported = provider_parms.imported;
	result->importer = provider;
	result->messages = all_messages;

	return( result );
}
Example #23
0
static GnmExpr const *
xlsx_func_binominv_handler (G_GNUC_UNUSED GnmConventions const *convs, G_GNUC_UNUSED Workbook *scope, GnmExprList *args)
/* BINOM.INV(a,b,c) --> R.QBINOM(c,a,b) */
{
	GnmFunc  *f = gnm_func_lookup_or_add_placeholder ("r.qbinom");
	GnmExprList *arg;

	arg = g_slist_nth (args, 2);
	args = g_slist_remove_link (args, arg);
	args = g_slist_concat (arg, args);

	return gnm_expr_new_funcall (f, args);
}
Example #24
0
/**
 * go_error_info_add_details:
 * @error: #GOErrorInfo
 * @details:  #GOErrorInfo to add
 *
 * Adds an existing #GOErrorInfo instance to @error.
 **/
void
go_error_info_add_details (GOErrorInfo *error, GOErrorInfo *details)
{
	g_return_if_fail (error != NULL);

	if (details == NULL)
		;
	else if (details->msg == NULL) {
		error->details = g_slist_concat (error->details, details->details);
		g_free (details);
	} else
		error->details = g_slist_append (error->details, details);
}
Example #25
0
static GSList *
sort_and_concat_results (ShellAppSystem *system,
                         GSList         *prefix_matches,
                         GSList         *substring_matches)
{
  prefix_matches = g_slist_sort_with_data (prefix_matches,
                                           compare_apps_by_usage,
                                           system);
  substring_matches = g_slist_sort_with_data (substring_matches,
                                              compare_apps_by_usage,
                                              system);
  return g_slist_concat (prefix_matches, substring_matches);
}
Example #26
0
GSList *
category_group_get_templates_list (FormatTemplateCategoryGroup *category_group,
				   GOCmdContext *cc)
{
	GSList *templates = NULL;
	GList *l;

	for (l = category_group->categories; l != NULL; l = l->next)
		templates = g_slist_concat (templates,
			category_get_templates_list (l->data, cc));

	return g_slist_sort (templates, format_template_compare_name);
}
Example #27
0
static void
ews_set_threading_data (CamelMessageInfo *mi,
                        EEwsItem *item)
{
	const gchar *references_str, *inreplyto_str;
	const gchar *message_id;
	GSList *refs, *irt, *link;
	guint8 *digest;
	gchar *msgid;
	CamelSummaryMessageID tmp_msgid;
	GArray *references;

	/* set message id */
	message_id = e_ews_item_get_msg_id (item);
	msgid = camel_header_msgid_decode (message_id);
	if (msgid) {
		digest = get_md5_digest ((const guchar *) msgid);
		memcpy (tmp_msgid.id.hash, digest, sizeof (tmp_msgid.id.hash));
		g_free (digest);
		g_free (msgid);

		camel_message_info_set_message_id (mi, tmp_msgid.id.id);
	}

	/* Process References: header */
	references_str = e_ews_item_get_references (item);
	refs = camel_header_references_decode (references_str);

	/* Prepend In-Reply-To: contents to References: for summary info */
	inreplyto_str = e_ews_item_get_in_replyto (item);
	irt = camel_header_references_decode (inreplyto_str);
	if (irt) {
		refs = g_slist_concat (irt, refs);
	}
	if (!refs)
		return;

	references = g_array_sized_new (FALSE, FALSE, sizeof (guint64), g_slist_length (refs));

	for (link = refs; link; link = g_slist_next (link)) {
		digest = get_md5_digest ((const guchar *) link->data);
		memcpy (tmp_msgid.id.hash, digest, sizeof (tmp_msgid.id.hash));
		g_free (digest);

		g_array_append_val (references, tmp_msgid.id.id);
	}

	g_slist_free_full (refs, g_free);

	camel_message_info_take_references (mi, references);
}
Example #28
0
RESULT
test_slist_concat ()
{
	GSList *foo = g_slist_prepend (NULL, "foo");
	GSList *bar = g_slist_prepend (NULL, "bar");

	GSList *list = g_slist_concat (foo, bar);

	if (g_slist_length (list) != 2)
		return FAILED ("Concat failed.");

	g_slist_free (list);
	return OK;
}
//Combining, reversing, and all that
int main(int argc, char** argv) {
  GSList* list1 = NULL;
  list1 = g_slist_append(list1, "first");
  list1 = g_slist_append(list1, "second");
  GSList* list2 = NULL;
  list2 = g_slist_append(list2, "third");
  list2 = g_slist_append(list2, "fourth");
  GSList* both = g_slist_concat(list1, list2);
  printf("The third item in the concatenated list is '%s'\n", g_slist_nth_data(both, 2));
  GSList* reversed = g_slist_reverse(both);
  printf("The first item in the reversed list is '%s'\n", reversed->data);
  g_slist_free(reversed);
  return 0;
}
Example #30
0
/* apply changes from the edit list */
void
color_filters_apply(GSList *tmp_cfl, GSList *edit_cfl)
{
    /* "move" old entries to the deleted list
     * we must keep them until the dissection no longer needs them */
    color_filter_deleted_list = g_slist_concat(color_filter_deleted_list, color_filter_list);
    color_filter_list = NULL;

    /* clone all list entries from tmp/edit to normal list */
    color_filter_valid_list = NULL;
    color_filter_valid_list = color_filter_list_clone(tmp_cfl);
    color_filter_valid_list = g_slist_concat(color_filter_valid_list,
                                             color_filter_list_clone(edit_cfl) );

    /* compile all filter */
    g_slist_foreach(color_filter_valid_list, color_filter_validate_cb, NULL);

    /* clone all list entries from tmp/edit to normal list */
    color_filter_list = color_filter_list_clone(color_filter_valid_list);

    /* compile all filter */
    g_slist_foreach(color_filter_list, color_filter_compile_cb, NULL);
}