本文整理汇总了C++中g_list_copy函数的典型用法代码示例。如果您正苦于以下问题:C++ g_list_copy函数的具体用法?C++ g_list_copy怎么用?C++ g_list_copy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了g_list_copy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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));
}
示例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;
}
示例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;
}
}
示例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;
}