本文整理汇总了C++中g_list_copy函数的典型用法代码示例。如果您正苦于以下问题:C++ g_list_copy函数的具体用法?C++ g_list_copy怎么用?C++ g_list_copy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了g_list_copy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: bastile_keyserver_sync_show
/**
* bastile_keyserver_sync_show
* @keys: The keys to synchronize
*
* Shows a synchronize window.
*
* Returns the new window.
**/
GtkWindow*
bastile_keyserver_sync_show (GList *keys, GtkWindow *parent)
{
BastileWidget *swidget;
GtkWindow *win;
GtkWidget *w;
guint n, notify_id;
gchar *t;
swidget = bastile_widget_new_allow_multiple ("keyserver-sync", parent);
g_return_val_if_fail (swidget != NULL, NULL);
win = GTK_WINDOW (bastile_widget_get_widget (swidget, swidget->name));
/* The details message */
n = g_list_length (keys);
t = g_strdup_printf (ngettext ("<b>%d key is selected for synchronizing</b>",
"<b>%d keys are selected for synchronizing</b>", n), n);
w = GTK_WIDGET (bastile_widget_get_widget (swidget, "detail-message"));
g_return_val_if_fail (swidget != NULL, win);
gtk_label_set_markup (GTK_LABEL (w), t);
g_free (t);
/* The right help message */
update_message (swidget);
notify_id = bastile_mateconf_notify (PUBLISH_TO_KEY, mateconf_notify, swidget);
g_signal_connect (win, "destroy", G_CALLBACK (unhook_notification),
GINT_TO_POINTER (notify_id));
keys = g_list_copy (keys);
g_return_val_if_fail (!keys || BASTILE_IS_OBJECT (keys->data), win);
g_object_set_data_full (G_OBJECT (swidget), "publish-keys", keys,
(GDestroyNotify)g_list_free);
return win;
}
开发者ID:gfunkmonk2,项目名称:bastile,代码行数:45,代码来源:bastile-keyserver-sync.c
示例2: meta_stack_set_positions
void
meta_stack_set_positions (MetaStack *stack,
GList *windows)
{
int i;
GList *tmp;
/* Make sure any adds or removes aren't in limbo -- is this needed? */
stack_ensure_sorted (stack);
if (!lists_contain_same_windows (windows, stack->sorted))
{
meta_warning ("This list of windows has somehow changed; not resetting "
"positions of the windows.\n");
return;
}
g_list_free (stack->sorted);
stack->sorted = g_list_copy (windows);
stack->need_resort = TRUE;
stack->need_constrain = TRUE;
i = 0;
tmp = windows;
while (tmp != NULL)
{
MetaWindow *w = tmp->data;
w->stack_position = i++;
tmp = tmp->next;
}
meta_topic (META_DEBUG_STACK,
"Reset the stack positions of (nearly) all windows\n");
stack_sync_to_server (stack);
}
开发者ID:sonald,项目名称:deepin-metacity,代码行数:37,代码来源:stack.c
示例3: get_pages
/*! \brief obtain a list of pages for an operation
*
* Descends the heirarchy of pages, if selected, and removes duplicate pages.
*
* \param [in] pages the list of pages to begin search
* \param [in] descend alose locates subpages
* \return a list of all the pages
*/
static GSList*
get_pages (GList *pages, gboolean descend)
{
GList *input_list = g_list_copy (pages);
GSList *output_list = NULL;
GHashTable *visit_list = g_hash_table_new (NULL, NULL);
while (input_list != NULL) {
PAGE *page = (PAGE*) input_list->data;
input_list = g_list_delete_link (input_list, input_list);
if (page == NULL) {
g_warning ("NULL page encountered");
continue;
}
/** \todo the following function becomes available in glib 2.32 */
/* if (g_hash_table_contains (visit_list, page)) { */
if (g_hash_table_lookup_extended (visit_list, page, NULL, NULL)) {
continue;
}
output_list = g_slist_prepend (output_list, page);
g_hash_table_insert (visit_list, page, NULL);
if (descend) {
input_list = g_list_concat (input_list, get_subpages (page));
}
}
g_hash_table_destroy (visit_list);
return g_slist_reverse (output_list);
}
开发者ID:gareth8118,项目名称:geda-gaf,代码行数:44,代码来源:gschem_find_text_state.c
示例4: project_close
gboolean project_close (void) {
GList *tabs = NULL;
int i = 0;
tabs = g_list_copy(gummi_get_all_tabs());
// XXX: needs refactor
/* Disable compile thread to prevent it from compiling nonexisting editor */
motion_stop_compile_thread(gummi->motion);
tabmanager_set_active_tab(-1);
for (i = 0; i < g_list_length (tabs); i++) {
GuTabContext* tab = GU_TAB_CONTEXT (g_list_nth_data (tabs, i));
if (tab->editor->projfile != NULL)
on_menu_close_activate(NULL, tab);
}
g_list_free(tabs);
/* Resume compile by selecting an active tag */
if (gummi_get_all_tabs() != NULL)
tabmanager_set_active_tab(0);
motion_start_compile_thread(gummi->motion);
return TRUE;
}
开发者ID:JasonGross,项目名称:gummi,代码行数:24,代码来源:project.c
示例5: impl_delete_thyself
static void
impl_delete_thyself (RBSource *source)
{
GList *pl;
GList *p;
RBGenericPlayerSourcePrivate *priv = GENERIC_PLAYER_SOURCE_GET_PRIVATE (source);
/* take a copy of the list first, as playlist_deleted_cb modifies priv->playlists */
pl = g_list_copy (priv->playlists);
for (p = pl; p != NULL; p = p->next) {
RBSource *playlist = RB_SOURCE (p->data);
rb_source_delete_thyself (playlist);
}
g_list_free (priv->playlists);
g_list_free (pl);
priv->playlists = NULL;
if (priv->import_errors != NULL) {
rb_source_delete_thyself (priv->import_errors);
priv->import_errors = NULL;
}
RB_SOURCE_CLASS (rb_generic_player_source_parent_class)->impl_delete_thyself (source);
}
开发者ID:paulbellamy,项目名称:Rhythmbox-iPod-Plugin,代码行数:24,代码来源:rb-generic-player-source.c
示例6: handle_execute_for_all
void
handle_execute_for_all(void (*callback)(int idx, void *entry, void *p), void *param)
{
pthread_mutex_lock(&lock);
GList *tmp = g_hash_table_get_keys(vdp_handles);
GList *keys = g_list_copy(tmp);
g_list_free(tmp);
GList *ptr = g_list_first(keys);
while (ptr) {
HandleType handle = GPOINTER_TO_INT(ptr->data);
void *item = g_hash_table_lookup(vdp_handles, GINT_TO_POINTER(handle));
if (item) {
pthread_mutex_unlock(&lock);
// TODO: race condition. Supply integer handle instead of pointer to fix.
callback(handle, item, param);
pthread_mutex_lock(&lock);
}
ptr = g_list_next(ptr);
}
g_list_free(keys);
pthread_mutex_unlock(&lock);
}
开发者ID:HenryHu,项目名称:libvdpau-va-gl,代码行数:24,代码来源:handle-storage.c
示例7: emit_changed
static void
emit_changed (MetaPreference pref)
{
GList *tmp;
GList *copy;
meta_topic (META_DEBUG_PREFS, "Notifying listeners that pref %s changed\n",
meta_preference_to_string (pref));
copy = g_list_copy (listeners);
tmp = copy;
while (tmp != NULL)
{
MetaPrefsListener *l = tmp->data;
(* l->func) (pref, l->data);
tmp = tmp->next;
}
g_list_free (copy);
}
开发者ID:JazzGirl,项目名称:metacity,代码行数:24,代码来源:prefs.c
示例8: grl_metadata_store_source_store_metadata
static void
grl_metadata_store_source_store_metadata (GrlSource *source,
GrlSourceStoreMetadataSpec *sms)
{
GRL_DEBUG ("grl_metadata_store_source_set_metadata");
const gchar *media_id, *source_id;
GError *error = NULL;
GList *failed_keys = NULL;
source_id = grl_media_get_source (sms->media);
media_id = grl_media_get_id (sms->media);
/* We need the source id */
if (!source_id) {
GRL_WARNING ("Failed to update metadata: source-id not available");
error = g_error_new (GRL_CORE_ERROR,
GRL_CORE_ERROR_STORE_METADATA_FAILED,
_("Failed to update metadata: %s"),
_("\"source-id\" not available"));
failed_keys = g_list_copy (sms->keys);
} else {
/* Special case for root categories */
if (!media_id) {
media_id = "";
}
failed_keys = write_keys (GRL_METADATA_STORE_SOURCE (source)->priv->db,
source_id, media_id, sms, &error);
}
sms->callback (sms->source, sms->media, failed_keys, sms->user_data, error);
g_clear_error (&error);
g_list_free (failed_keys);
}
开发者ID:guyou,项目名称:grilo-plugins,代码行数:36,代码来源:grl-metadata-store.c
示例9: _gst_buffer_list_copy
static GstBufferList *
_gst_buffer_list_copy (GstBufferList * list)
{
GstBufferList *list_copy;
GList *tmp;
g_return_val_if_fail (list != NULL, NULL);
list_copy = gst_buffer_list_new ();
/* shallow copy of list and pointers */
list_copy->buffers = g_list_copy (list->buffers);
/* ref all buffers in the list */
tmp = list_copy->buffers;
while (tmp) {
if (tmp->data != GROUP_START && tmp->data != STOLEN) {
tmp->data = gst_buffer_ref (GST_BUFFER_CAST (tmp->data));
}
tmp = g_list_next (tmp);
}
return list_copy;
}
开发者ID:spunktsch,项目名称:svtplayer,代码行数:24,代码来源:gstbufferlist.c
示例10: dt_camera_import_job_create
dt_job_t * dt_camera_import_job_create(const char *jobcode, GList *images, struct dt_camera_t *camera, time_t time_override)
{
dt_job_t *job = dt_control_job_create(&dt_camera_import_job_run, "import selected images from camera");
if(!job) return NULL;
dt_camera_import_t *params = (dt_camera_import_t *)calloc(1, sizeof(dt_camera_import_t));
if(!params)
{
dt_control_job_dispose(job);
return NULL;
}
dt_control_job_set_params(job, params);
/* intitialize import session for camera import job */
params->shared.session = dt_import_session_new();
dt_import_session_set_name(params->shared.session, jobcode);
if(time_override != 0)
dt_import_session_set_time(params->shared.session, time_override);
params->fraction=0;
params->images=g_list_copy(images);
params->camera=camera;
params->import_count=0;
return job;
}
开发者ID:PolarFox,项目名称:darktable,代码行数:24,代码来源:camera_jobs.c
示例11: impl_delete_thyself
static void
impl_delete_thyself (RBDisplayPage *page)
{
GList *pl;
GList *p;
RBGenericPlayerSourcePrivate *priv = GET_PRIVATE (page);
/* take a copy of the list first, as playlist_deleted_cb modifies priv->playlists */
pl = g_list_copy (priv->playlists);
for (p = pl; p != NULL; p = p->next) {
RBDisplayPage *playlist_page = RB_DISPLAY_PAGE (p->data);
rb_display_page_delete_thyself (playlist_page);
}
g_list_free (priv->playlists);
g_list_free (pl);
priv->playlists = NULL;
if (priv->import_errors != NULL) {
rb_display_page_delete_thyself (RB_DISPLAY_PAGE (priv->import_errors));
priv->import_errors = NULL;
}
RB_DISPLAY_PAGE_CLASS (rb_generic_player_source_parent_class)->delete_thyself (page);
}
开发者ID:bilboed,项目名称:rhythmbox,代码行数:24,代码来源:rb-generic-player-source.c
示例12: ibus_factory_destroy
static void
ibus_factory_destroy (IBusFactory *factory)
{
GList *list;
IBusFactoryPrivate *priv;
priv = IBUS_FACTORY_GET_PRIVATE (factory);
list = g_list_copy (priv->engine_list);
g_list_foreach (list, (GFunc) ibus_object_destroy, NULL);
g_list_free (priv->engine_list);
g_list_free (list);
priv->engine_list = NULL;
if (priv->engine_table) {
g_hash_table_destroy (priv->engine_table);
}
if (priv->connection) {
g_object_unref (priv->connection);
priv->connection = NULL;
}
IBUS_OBJECT_CLASS(ibus_factory_parent_class)->destroy (IBUS_OBJECT (factory));
}
开发者ID:hychen,项目名称:ibus,代码行数:24,代码来源:ibusfactory.c
示例13: sheet_delete_selection
/**
* remove the currently selected items from the sheet
* (especially their goocanvas representators)
*/
void sheet_delete_selection (Sheet *sheet)
{
GList *copy, *iter;
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
if (sheet->state != SHEET_STATE_NONE)
return;
copy = g_list_copy (sheet->priv->selected_objects);
for (iter = copy; iter; iter = iter->next) {
sheet_remove_item_in_sheet (SHEET_ITEM (iter->data), sheet);
goo_canvas_item_remove (GOO_CANVAS_ITEM (iter->data));
}
g_list_free (copy);
// function <sheet_remove_item_in_sheet>
// requires selected_objects, items, floating_objects
// to be not NULL!
g_list_free (sheet->priv->selected_objects);
sheet->priv->selected_objects = NULL;
}
开发者ID:felipebetancur,项目名称:oregano,代码行数:28,代码来源:sheet.c
示例14: anjuta_profile_set_property
static void
anjuta_profile_set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec)
{
AnjutaProfilePriv *priv = ANJUTA_PROFILE (object)->priv;
g_return_if_fail (ANJUTA_IS_PROFILE (object));
switch (prop_id)
{
case PROP_PLUGIN_MANAGER:
priv->plugin_manager = g_value_get_object (value);
break;
case PROP_PROFILE_NAME:
g_return_if_fail (g_value_get_string (value) != NULL);
g_free (priv->name);
priv->name = g_strdup (g_value_get_string (value));
break;
case PROP_PROFILE_PLUGINS:
if (priv->plugins)
g_list_free (priv->plugins);
if (g_value_get_pointer (value))
priv->plugins = g_list_copy (g_value_get_pointer (value));
else
priv->plugins = NULL;
break;
case PROP_SYNC_FILE:
if (priv->sync_file)
g_object_unref (priv->sync_file);
priv->sync_file = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
开发者ID:abderrahim,项目名称:anjuta,代码行数:36,代码来源:anjuta-profile.c
示例15: playlist_randomize
/**
* playlist_randomize:
* @self: A #LomoPlaylist
*
* Randomize playlist
*/
void
playlist_randomize (LomoPlaylist *self)
{
g_return_if_fail(LOMO_IS_PLAYLIST(self));
LomoPlaylistPrivate *priv = self->priv;
GList *copy = NULL;
GList *res = NULL;
gpointer data;
gint i, r, len = lomo_playlist_get_n_streams(self);
copy = g_list_copy((GList *) lomo_playlist_get_playlist(self));
for (i = 0; i < len; i++)
{
r = g_random_int_range(0, len - i);
data = g_list_nth_data(copy, r);
copy = g_list_remove(copy, data);
res = g_list_prepend(res, data);
}
g_list_free(priv->random_list);
priv->random_list = res;
}
开发者ID:ldotlopez,项目名称:eina,代码行数:30,代码来源:lomo-playlist.c
示例16: smtp_transport_query_auth_types_sync
static GList *
smtp_transport_query_auth_types_sync (CamelService *service,
GCancellable *cancellable,
GError **error)
{
CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service);
CamelServiceAuthType *authtype;
CamelProvider *provider;
GList *types, *t, *next;
if (!connect_to_server (service, cancellable, error))
return NULL;
if (!transport->authtypes) {
smtp_transport_disconnect_sync (
service, TRUE, cancellable, NULL);
return NULL;
}
provider = camel_service_get_provider (service);
types = g_list_copy (provider->authtypes);
for (t = types; t; t = next) {
authtype = t->data;
next = t->next;
if (!g_hash_table_lookup (transport->authtypes, authtype->authproto)) {
types = g_list_remove_link (types, t);
g_list_free_1 (t);
}
}
smtp_transport_disconnect_sync (service, TRUE, cancellable, NULL);
return types;
}
开发者ID:Oliver-Luo,项目名称:evolution-data-server,代码行数:36,代码来源:camel-smtp-transport.c
示例17: push_gcm_client_deliver_async
//.........这里部分代码省略.........
GList *iter;
GList *list;
gchar *str;
gsize length;
guint time_to_live;
ENTRY;
g_return_if_fail(PUSH_IS_GCM_CLIENT(client));
g_return_if_fail(identities);
g_return_if_fail(PUSH_IS_GCM_MESSAGE(message));
g_return_if_fail(!cancellable || G_IS_CANCELLABLE(cancellable));
g_return_if_fail(callback);
priv = client->priv;
request = soup_message_new("POST", PUSH_GCM_CLIENT_URL);
ar = json_array_new();
for (iter = identities; iter; iter = iter->next) {
g_assert(PUSH_IS_GCM_IDENTITY(iter->data));
registration_id = push_gcm_identity_get_registration_id(iter->data);
json_array_add_string_element(ar, registration_id);
}
str = g_strdup_printf("key=%s", priv->auth_token);
soup_message_headers_append(request->request_headers, "Authorization", str);
g_free(str);
soup_message_headers_append(request->request_headers,
"Accept",
"application/json");
data = json_object_new();
if ((collapse_key = push_gcm_message_get_collapse_key(message))) {
json_object_set_string_member(data, "collapse_key", collapse_key);
}
json_object_set_boolean_member(data,
"delay_while_idle",
push_gcm_message_get_delay_while_idle(message));
json_object_set_boolean_member(data,
"dry_run",
push_gcm_message_get_dry_run(message));
if ((time_to_live = push_gcm_message_get_time_to_live(message))) {
json_object_set_int_member(data, "time_to_live", time_to_live);
}
if ((mdata = push_gcm_message_get_data(message))) {
json_object_set_object_member(data, "data", mdata);
}
obj = json_object_new();
json_object_set_array_member(obj, "registration_ids", ar);
json_object_set_object_member(obj, "data", data);
node = json_node_new(JSON_NODE_OBJECT);
json_node_set_object(node, obj);
json_object_unref(obj);
g = json_generator_new();
json_generator_set_pretty(g, TRUE);
json_generator_set_indent(g, 2);
json_generator_set_root(g, node);
str = json_generator_to_data(g, &length);
json_node_free(node);
g_object_unref(g);
g_print("REQUEST: \"%s\"\n", str);
soup_message_set_request(request,
"application/json",
SOUP_MEMORY_TAKE,
str,
length);
simple = g_simple_async_result_new(G_OBJECT(client), callback, user_data,
push_gcm_client_deliver_async);
/*
* Keep the list of identities around until we receive our result.
* We need them to key with the resulting array.
*/
list = g_list_copy(identities);
g_list_foreach(list, (GFunc)g_object_ref, NULL);
g_object_set_data_full(G_OBJECT(simple),
"identities",
list,
_push_gcm_identities_free);
soup_session_queue_message(SOUP_SESSION(client),
request,
push_gcm_client_deliver_cb,
simple);
EXIT;
}
开发者ID:shadimsaleh,项目名称:push-glib,代码行数:101,代码来源:push-gcm-client.c
示例18: nautilus_directory_list_copy
/**
* nautilus_directory_list_copy
*
* Copy the list of directories, making a new ref of each,
* @list: GList of directories.
**/
GList *
nautilus_directory_list_copy (GList *list)
{
return g_list_copy (nautilus_directory_list_ref (list));
}
开发者ID:dtrebbien,项目名称:nautilus,代码行数:11,代码来源:nautilus-directory.c
示例19: insert_metric_result
static void
insert_metric_result (struct rspamd_task *task,
struct metric *metric,
const gchar *symbol,
double flag,
GList * opts,
gboolean single)
{
struct metric_result *metric_res;
struct symbol *s;
gdouble w, *gr_score = NULL;
struct rspamd_symbol_def *sdef;
struct rspamd_symbols_group *gr = NULL;
const ucl_object_t *mobj, *sobj;
metric_res = rspamd_create_metric_result (task, metric->name);
sdef = g_hash_table_lookup (metric->symbols, symbol);
if (sdef == NULL) {
w = 0.0;
}
else {
w = (*sdef->weight_ptr) * flag;
gr = sdef->gr;
if (gr != NULL) {
gr_score = g_hash_table_lookup (metric_res->sym_groups, gr);
if (gr_score == NULL) {
gr_score = rspamd_mempool_alloc (task->task_pool, sizeof (gdouble));
*gr_score = 0;
g_hash_table_insert (metric_res->sym_groups, gr, gr_score);
}
}
}
if (task->settings) {
mobj = ucl_object_find_key (task->settings, metric->name);
if (mobj) {
gdouble corr;
sobj = ucl_object_find_key (mobj, symbol);
if (sobj != NULL && ucl_object_todouble_safe (sobj, &corr)) {
msg_debug ("settings: changed weight of symbol %s from %.2f to %.2f",
symbol, w, corr);
w = corr * flag;
}
}
}
/* XXX: does not take grow factor into account */
if (gr != NULL && gr_score != NULL && gr->max_score > 0.0) {
if (*gr_score >= gr->max_score) {
msg_info ("maximum group score %.2f for group %s has been reached,"
" ignoring symbol %s with weight %.2f", gr->max_score,
gr->name, symbol, w);
return;
}
else if (*gr_score + w > gr->max_score) {
w = gr->max_score - *gr_score;
}
*gr_score += w;
}
/* Add metric score */
if ((s = g_hash_table_lookup (metric_res->symbols, symbol)) != NULL) {
if (sdef && sdef->one_shot) {
/*
* For one shot symbols we do not need to add them again, so
* we just force single behaviour here
*/
single = TRUE;
}
if (s->options && opts && opts != s->options) {
/* Append new options */
s->options = g_list_concat (s->options, g_list_copy (opts));
/*
* Note that there is no need to add new destructor of GList as elements of appended
* GList are used directly, so just free initial GList
*/
}
else if (opts) {
s->options = g_list_copy (opts);
rspamd_mempool_add_destructor (task->task_pool,
(rspamd_mempool_destruct_t) g_list_free, s->options);
}
if (!single) {
/* Handle grow factor */
if (metric_res->grow_factor && w > 0) {
w *= metric_res->grow_factor;
metric_res->grow_factor *= metric->grow_factor;
}
s->score += w;
metric_res->score += w;
}
else {
if (fabs (s->score) < fabs (w)) {
/* Replace less weight with a bigger one */
metric_res->score = metric_res->score - s->score + w;
//.........这里部分代码省略.........
开发者ID:amohanta,项目名称:rspamd,代码行数:101,代码来源:filter.c
示例20: get_files
/*
* get files list
*/
GList* get_files ()
{
return g_list_copy(files);
}
开发者ID:matbaj,项目名称:geany-plugins,代码行数:7,代码来源:dbm_gdb.c
注:本文中的g_list_copy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论