Пример #1
0
/**
 * egg_icon_chooser_get_icon:
 * @chooser: the chooser to examine.
 *
 * Retrieves the themed icon name string corresponding to the selected icon.
 *
 * Returns: a newly-allocated icon name string, which should be freed with
 *  g_free().
 * 
 * Since: 2.8
 **/
gchar *
egg_icon_chooser_get_icon (EggIconChooser *chooser)
{
  EggIconChooserIface *iface;
  GSList *list;
  gchar *retval;

  g_return_val_if_fail (EGG_IS_ICON_CHOOSER (chooser), NULL);

  iface = EGG_ICON_CHOOSER_GET_IFACE (chooser);

  g_return_val_if_fail (iface->get_icons != NULL, NULL);

  list = (*iface->get_icons) (chooser);

  if (list != NULL)
    {
      retval = list->data;

      list = g_slist_remove_link (list, list);
      while (list != NULL)
	{
	  g_free (list->data);
	  list = g_slist_remove_link (list, list);
	}
    }
  else
    {
      retval = NULL;
    }

  return retval;
}
Пример #2
0
static int handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi, int idx)
{
	float temperature, humidity;
	struct sr_datafeed_packet packet;
	struct sr_datafeed_analog analog;
	struct sr_analog_encoding encoding;
	struct sr_analog_meaning meaning;
	struct sr_analog_spec spec;
	struct dev_context *devc;
	GSList *l;
	int ret;

	(void)idx;

	devc = sdi->priv;

	ret = packet_parse((const char *)buf, idx, &temperature, &humidity);
	if (ret < 0) {
		sr_err("Failed to parse packet.");
		return SR_ERR;
	}

	sr_analog_init(&analog, &encoding, &meaning, &spec, 3);

	/* Common values for both channels. */
	packet.type = SR_DF_ANALOG;
	packet.payload = &analog;
	analog.num_samples = 1;

	/* Temperature. */
	l = g_slist_copy(sdi->channels);
	l = g_slist_remove_link(l, g_slist_nth(l, 1));
	meaning.channels = l;
	meaning.mq = SR_MQ_TEMPERATURE;
	meaning.unit = SR_UNIT_CELSIUS; /* TODO: Use C/F correctly. */
	analog.data = &temperature;
	sr_session_send(sdi, &packet);
	g_slist_free(l);

	/* Humidity. */
	if (mic_devs[idx].has_humidity) {
		l = g_slist_copy(sdi->channels);
		l = g_slist_remove_link(l, g_slist_nth(l, 0));
		meaning.channels = l;
		meaning.mq = SR_MQ_RELATIVE_HUMIDITY;
		meaning.unit = SR_UNIT_PERCENTAGE;
		analog.data = &humidity;
		sr_session_send(sdi, &packet);
		g_slist_free(l);
	}

	devc->num_samples++;

	return SR_OK;
}
static gint
timeout (C2NetworkTraffic *nt)
{
	gint current_recv, current_send, record;
	gint seconds_to_display; /* This is a dynamic value, the
							  * SECONDS_TO_DISPLAY constant
							  * is about how much we WISH to
							  * display, not how much we WILL
							  * display.
							  */
	GtkWidget *widget = GTK_WIDGET (nt);

	seconds_to_display = widget->allocation.width / PIXELS_PER_SECOND;

	current_recv = c2_net_speed_tracker_recv ();
	current_send = c2_net_speed_tracker_send ();

	if (g_slist_length (nt->recv) > seconds_to_display)
		nt->recv = g_slist_remove_link (nt->recv, g_slist_last (nt->recv));
	nt->recv = g_slist_prepend (nt->recv, (gpointer) current_recv);

	if (g_slist_length (nt->send) > seconds_to_display)
		nt->send = g_slist_remove_link (nt->send, g_slist_last (nt->send));
	nt->send = g_slist_prepend (nt->send, (gpointer) current_send);

	/* Update the maximum speed */
	record = current_send > current_recv ? current_send : current_recv;
	if (record > nt->top_speed)
		nt->top_speed = record;
	else
	{
		GSList *l;

		nt->top_speed = 1024;

		for (l = nt->send; l; l = g_slist_next (l))
			if (GPOINTER_TO_INT (l->data) > nt->top_speed)
				nt->top_speed = GPOINTER_TO_INT (l->data);
		for (l = nt->recv; l; l = g_slist_next (l))
			if (GPOINTER_TO_INT (l->data) > nt->top_speed)
				nt->top_speed = GPOINTER_TO_INT (l->data);
	}

	/* Time to draw */
	draw_background (nt);
	draw_top_speed (nt);
	draw_list (nt, nt->send);
	draw_list (nt, nt->recv);
	draw_screen (nt);
	
	return TRUE;
}
Пример #4
0
__EXPORT void lttvwindow_events_request_remove_all(Tab       *tab,
                                          gconstpointer   viewer)
{
  GSList *element = tab->events_requests;
  
  while((element = 
            g_slist_find_custom(element, viewer,
                                (GCompareFunc)find_viewer))
              != NULL) {
    EventsRequest *events_request = (EventsRequest *)element->data;
    // Modified so a viewer being destroyed won't have its after_request
    // called. Not so important anyway. Note that a viewer that call this
    // remove_all function will not get its after_request called.
    //if(events_request->servicing == TRUE) {
    //  lttv_hooks_call(events_request->after_request, NULL);
    //}
    events_request_free(events_request);
    //g_free(events_request);
    tab->events_requests = g_slist_remove_link(tab->events_requests, element);
    element = g_slist_next(element);
    if(element == NULL) break;   /* end of list */
  }
  if(g_slist_length(tab->events_requests) == 0) {
    tab->events_request_pending = FALSE;
    g_idle_remove_by_data(tab);
  }

}
Пример #5
0
/* Purge server output, either all or for specified target */
void irc_server_purge_output(IRC_SERVER_REC *server, const char *target)
{
	GSList *tmp, *next, *link;
        REDIRECT_REC *redirect;
	char *cmd;

	if (target != NULL && *target == '\0')
                target = NULL;

	for (tmp = server->cmdqueue; tmp != NULL; tmp = next) {
		next = tmp->next->next;
		cmd = tmp->data;
                redirect = tmp->next->data;

		if ((target == NULL || command_has_target(cmd, target)) &&
		    g_ascii_strncasecmp(cmd, "PONG ", 5) != 0) {
                        /* remove the redirection */
                        link = tmp->next;
			server->cmdqueue =
				g_slist_remove_link(server->cmdqueue, link);
                        g_slist_free_1(link);

			if (redirect != NULL)
                                server_redirect_destroy(redirect);

                        /* remove the command */
			server->cmdqueue =
				g_slist_remove(server->cmdqueue, cmd);
                        g_free(cmd);
                        server->cmdcount--;
		}
	}
}
Пример #6
0
/**
 * main: Starts with an RPTable of 10 resources and fetches
 * them randomly by the ResourceId and compares them against the original
 * resource. A failed comparison means the test failed,
 * otherwise the test passed.
 *
 * Return value: 0 on success, 1 on failure
 **/
int main(int argc, char **argv)
{
        RPTable *rptable = (RPTable *)g_malloc0(sizeof(RPTable));
        guint i = 0, k = 0;
        GSList *resources = NULL;

        for (i = 0; rptentries[i].ResourceId != 0; i++) {
                if (oh_add_resource(rptable, rptentries + i, NULL, 0))
                        return 1;
                else
                        resources = g_slist_append(resources, rptentries + i);
        }
        
        for (; resources; i--) {
                SaHpiRptEntryT *randentry = NULL, *tmpentry = NULL;
                GSList *tmpnode = NULL;
                
                k = (guint) (((gfloat)i)*rand()/(RAND_MAX+1.0));                
                tmpnode = g_slist_nth(resources, k);
                randentry = (SaHpiRptEntryT *)tmpnode->data;
                
                tmpentry =
                        oh_get_resource_by_id(rptable, randentry->ResourceId);
                        
                if (!tmpentry ||
                    memcmp(randentry, tmpentry, sizeof(SaHpiRptEntryT)))
                        return 1;
                else {
                        resources = g_slist_remove_link(resources, tmpnode);
                        g_slist_free_1(tmpnode);
                }
        }
                
        return 0;
}
Пример #7
0
/**
 * Deliver all the signals queued so far for the task.
 */
static void
bg_task_deliver_signals(struct bgtask *bt)
{
	bg_task_check(bt);
	g_assert(bt->flags & TASK_F_RUNNING);

	/*
	 * Stop when list is empty or task has exited.
	 *
	 * Note that it is possible for a task to enqueue another signal
	 * whilst it is processing another.
	 */

	while (bt->signals != NULL) {
		GSList *lnk = bt->signals;
		bgsig_t sig = (bgsig_t) GPOINTER_TO_UINT(lnk->data);

		/*
		 * If signal kills the thread (it calls bg_task_exit() from the
		 * handler), then we won't come back.
		 */

		bg_task_kill(bt, sig);

		bt->signals = g_slist_remove_link(bt->signals, lnk);
		g_slist_free_1(lnk);
	}
}
Пример #8
0
static void
cb_pm_button_directory_delete_clicked (PluginManagerGUI *pm_gui)
{
	GtkTreeIter iter;
	char     *dir_name = NULL;
	gboolean  is_system = TRUE;
	GSList *extra_dirs, *res;

	if (!gtk_tree_selection_get_selected (pm_gui->selection_directory, NULL, &iter))
		return;

	gtk_tree_model_get (GTK_TREE_MODEL (pm_gui->model_directories), &iter,
			    DIR_NAME,		&dir_name,
			    DIR_IS_SYSTEM,	&is_system,
			    -1);

	extra_dirs = go_string_slist_copy (gnm_conf_get_plugins_extra_dirs ());
	res = is_system
		? NULL
		: g_slist_find_custom (extra_dirs, dir_name, go_str_compare);

	if (res) {
		extra_dirs = g_slist_remove_link (extra_dirs, res);
		g_free (res->data);
		g_slist_free_1 (res);

		gnm_conf_set_plugins_extra_dirs (extra_dirs);

		pm_gui_load_directory_page (pm_gui);
		cb_pm_button_rescan_directories_clicked (pm_gui);
	}

	g_slist_free_full (extra_dirs, g_free);
	g_free (dir_name);
}
Пример #9
0
/**
 * snmp_bc_get_event:
 * @hnd: Handler data pointer.
 * @event: Infra-structure event pointer. 
 *
 * Passes plugin events up to the infra-structure for processing.
 *
 * Return values:
 * 1 - events to be processed.
 * SA_OK - No events to be processed.
 * SA_ERR_HPI_INVALID_PARAMS - @event is NULL.
 **/
SaErrorT snmp_bc_get_event(void *hnd, struct oh_event *event)
{
        SaErrorT err;
        struct oh_handler_state *handle = (struct oh_handler_state *)hnd;
        
        if (!event || !hnd) {
                dbg("Invalid parameter");
                return(SA_ERR_HPI_INVALID_PARAMS);
        }
	
	struct snmp_bc_hnd *custom_handle = (struct snmp_bc_hnd *)handle->data;
	
     	snmp_bc_lock_handler(custom_handle);	
	err = snmp_bc_check_selcache(handle, 1, SAHPI_NEWEST_ENTRY);
	
	/* If err is encountered during el cache sync, */
	/* log error but take no corrected action.      */
	/* New entry will still be there next time      */
	if (err) {
		dbg("Event Log cache build/sync failed. Error=%s", oh_lookup_error(err));
		/* return(err); */
	}

        if (g_slist_length(handle->eventq) > 0) {
                memcpy(event, handle->eventq->data, sizeof(*event));
                free(handle->eventq->data);
                handle->eventq = g_slist_remove_link(handle->eventq, handle->eventq);
                snmp_bc_unlock_handler(custom_handle);
                return(1);
        } 

	/* No events for infra-structure to process */
        snmp_bc_unlock_handler(custom_handle);
	return(SA_OK);
}
Пример #10
0
static void
cspi_internal_event_remove (const InternalEvent *e)
{
  GSList *link = g_slist_find_custom (_cspi_event_queue, e, cspi_event_compare);
  if (link)
    _cspi_event_queue = g_slist_remove_link (_cspi_event_queue, link);
}
Пример #11
0
static GSList *
file_paths_to_strings (GtkFileSystem *fs,
                       GSList        *paths,
                       gchar *      (*convert_func) (GtkFileSystem *fs, const GtkFilePath *path))
{
  GSList *strings;

  strings = NULL;

  while (paths != NULL)
    {
      GtkFilePath *path;
      gchar *string;

      path = paths->data;
      string = (* convert_func) (fs, path);

      /* Eat the list */
      gtk_file_path_free (path);
      paths = g_slist_remove_link (paths, paths);

      if (string)
        strings = g_slist_prepend (strings, string);
    }

  return g_slist_reverse (strings);
}
Пример #12
0
Файл: free.c Проект: SICOM/rlib
void rlib_free_variables(rlib *r, struct rlib_element *e) {
	struct rlib_element *save;

	for (; e != NULL; save = e, e = e->next, g_free(save)) {
		struct rlib_report_variable *rv = e->data;

		rlib_pcode_free(r, rv->code);
		rlib_pcode_free(r, rv->ignore_code);

		xmlFree(rv->xml_name.xml);
		xmlFree(rv->xml_str_type.xml);
		xmlFree(rv->xml_value.xml);
		xmlFree(rv->xml_resetonbreak.xml);
		xmlFree(rv->xml_precalculate.xml);
		xmlFree(rv->xml_ignore.xml);

		if(rv->precalculated_values != NULL) {
			g_free(rv->precalculated_values->data);
			rv->precalculated_values = g_slist_remove_link (rv->precalculated_values, rv->precalculated_values);
		}

		g_free(rv);
		e->data = NULL;
	}
}
Пример #13
0
/**
 * snmp_bc_get_event:
 * @hnd: Handler data pointer.
 * @event: Infra-structure event pointer. 
 *
 * Passes plugin events up to the infra-structure for processing.
 *
 * Return values:
 * 1 - events to be processed.
 * SA_OK - No events to be processed.
 * SA_ERR_HPI_INVALID_PARAMS - @event is NULL.
 **/
SaErrorT snmp_bc_get_event(void *hnd, struct oh_event *event)
{
	SaErrorT err;
        struct oh_handler_state *handle = (struct oh_handler_state *)hnd;

	if (!event) {
		dbg("Invalid parameter");
		return(SA_ERR_HPI_INVALID_PARAMS);
	}

	err = snmp_bc_check_selcache(handle, 1, SAHPI_NEWEST_ENTRY);
	if (err) {
		dbg("Event Log cache build/sync failed. Error=%s", oh_lookup_error(err));
		return(err);
	}

        if (g_slist_length(handle->eventq) > 0) {
                memcpy(event, handle->eventq->data, sizeof(*event));
                free(handle->eventq->data);
                handle->eventq = g_slist_remove_link(handle->eventq, handle->eventq);
                return(1);
        } 

	/* No events for infra-structure to process */
	return(SA_OK);
}
Пример #14
0
static void
cg_combo_flags_cell_layout_reorder (GtkCellLayout *layout,
                                    GtkCellRenderer *cell,
                                    gint position)
{
	CgComboFlags *combo;
	CgComboFlagsPrivate *priv;
	CgComboFlagsCellInfo *info;
	GSList *link;

	combo = CG_COMBO_FLAGS (layout);
	priv = CG_COMBO_FLAGS_PRIVATE (combo);

	info = cg_combo_flags_get_cell_info (combo, cell);
	g_return_if_fail (info != NULL);

	link = g_slist_find (priv->cells, info);
	g_return_if_fail (link != NULL);

	priv->cells = g_slist_remove_link (priv->cells, link);
	priv->cells = g_slist_insert (priv->cells, info, position);

	if (priv->column != NULL)
		gtk_cell_layout_reorder (GTK_CELL_LAYOUT (priv->column), cell, position);

	gtk_widget_queue_draw (GTK_WIDGET (combo));
}
Пример #15
0
void
libnm_glib_unregister_callback (libnm_glib_ctx *ctx,
                                guint id)
{
	GSList *elem;

	g_return_if_fail (ctx != NULL);
	g_return_if_fail (id > 0);

	g_mutex_lock (ctx->callbacks_lock);
	elem = ctx->callbacks;
	while (elem)
	{
		libnm_glib_callback *callback = (libnm_glib_callback *)(elem->data);
		if (callback && (callback->id == id))
		{
			_libnm_glib_unschedule_single_callback (ctx, callback);
			ctx->callbacks = g_slist_remove_link (ctx->callbacks, elem);
			break;
		}

		elem = g_slist_next (elem);
	}
	g_mutex_unlock (ctx->callbacks_lock);
}
Пример #16
0
void
gimp_plug_in_manager_history_add (GimpPlugInManager   *manager,
                                  GimpPlugInProcedure *procedure)
{
  GSList *list;
  gint    history_size;

  g_return_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager));
  g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (procedure));

  /* return early if the procedure is already at the top */
  if (manager->history && manager->history->data == procedure)
    return;

  history_size = gimp_plug_in_manager_history_size (manager);

  manager->history = g_slist_remove (manager->history, procedure);
  manager->history = g_slist_prepend (manager->history, procedure);

  list = g_slist_nth (manager->history, history_size);

  if (list)
    {
      manager->history = g_slist_remove_link (manager->history, list);
      g_slist_free (list);
    }

  gimp_plug_in_manager_history_changed (manager);
}
Пример #17
0
/**
 * clutter_binding_pool_remove_action:
 * @pool: a #ClutterBindingPool
 * @key_val: a key symbol
 * @modifiers: a bitmask for the modifiers
 *
 * Removes the action matching the given @key_val, @modifiers pair,
 * if any exists.
 *
 * Since: 1.0
 */
void
clutter_binding_pool_remove_action (ClutterBindingPool  *pool,
                                    guint                key_val,
                                    ClutterModifierType  modifiers)
{
  ClutterBindingEntry remove_entry = { 0, };
  GSList *l;

  g_return_if_fail (pool != NULL);
  g_return_if_fail (key_val != 0);

  modifiers = modifiers & BINDING_MOD_MASK;

  remove_entry.key_val = key_val;
  remove_entry.modifiers = modifiers;

  for (l = pool->entries; l != NULL; l = l->data)
    {
      ClutterBindingEntry *e = l->data;

      if (e->key_val == remove_entry.key_val &&
          e->modifiers == remove_entry.modifiers)
        {
          pool->entries = g_slist_remove_link (pool->entries, l);
          break;
        }
    }

  g_hash_table_remove (pool->entries_hash, &remove_entry);
}
void nm_firewall_manager_cancel_call (NMFirewallManager *self, NMFirewallPendingCall call)
{
	NMFirewallManagerPrivate *priv = NM_FIREWALL_MANAGER_GET_PRIVATE (self);
	GSList *pending;
	CBInfo *info;

	g_return_if_fail (NM_IS_FIREWALL_MANAGER (self));

	if (call == PENDING_CALL_DUMMY)
		return;

	pending = g_slist_find (priv->pending_calls, call);

	if (!pending)
		return;
	priv->pending_calls = g_slist_remove_link (priv->pending_calls, pending);

	info = (CBInfo *) call;
	if (info->idle_id)
		info->idle_id = 0;
	else {
		dbus_g_proxy_cancel_call (NM_FIREWALL_MANAGER_GET_PRIVATE (self)->proxy,
		                          info->dbus_call);
	}
}
Пример #19
0
void eee_accounts_manager_enable_account(EeeAccountsManager *self, const char *name)
{
    GSList *accounts;
    GSList *item;

    g_return_if_fail(IS_EEE_ACCOUNTS_MANAGER(self));
    g_return_if_fail(name != NULL);

    accounts = gconf_client_get_list(self->priv->gconf, EEE_KEY "disabled_accounts", GCONF_VALUE_STRING, NULL);

    while (TRUE)
    {
        item = g_slist_find_custom(accounts, name, (GCompareFunc)strcmp);
        if (item == NULL)
        {
            break;
        }
        g_free(item->data);
        accounts = g_slist_remove_link(accounts, item);
    }

    gconf_client_set_list(self->priv->gconf, EEE_KEY "disabled_accounts", GCONF_VALUE_STRING, accounts, NULL);
    g_slist_foreach(accounts, (GFunc)g_free, NULL);
    g_slist_free(accounts);
}
static void
remove_selected_layout (GtkWidget * button, GtkBuilder * dialog)
{
	gint idx = find_selected_layout_idx (dialog);

	if (idx != -1) {
		GSList *layouts_list = xkb_layouts_get_selected_list ();
		char *id = NULL;
		GSList *node2Remove = g_slist_nth (layouts_list, idx);

		layouts_list =
		    g_slist_remove_link (layouts_list, node2Remove);

		id = (char *) node2Remove->data;
		g_slist_free_1 (node2Remove);
		g_free (id);

		if (default_group > idx)
			xkb_save_default_group (default_group - 1);
		else if (default_group == idx)
			xkb_save_default_group (-1);

		xkb_layouts_set_selected_list (layouts_list);
		clear_xkb_elements_list (layouts_list);
	}
}
Пример #21
0
static void
message_cancelled (NaTrayManager *manager,
                   GtkWidget     *icon,
                   glong          id,
                   TraysScreen   *trays_screen)
{
  IconTip       *icontip;
  IconTipBuffer  find_buffer;
  GSList        *cancel_buffer_l;
  IconTipBuffer *cancel_buffer;

  icontip = g_hash_table_lookup (trays_screen->tip_table, icon);
  if (icontip == NULL)
    return;

  if (icontip->id == id)
    {
      icon_tip_show_next (icontip);
      return;
    }

  find_buffer.id = id;
  cancel_buffer_l = g_slist_find_custom (icontip->buffer, &find_buffer,
                                         icon_tip_buffer_compare);
  if (cancel_buffer_l == NULL)
    return;

  cancel_buffer = cancel_buffer_l->data;
  icon_tip_buffer_free (cancel_buffer, NULL);

  icontip->buffer = g_slist_remove_link (icontip->buffer, cancel_buffer_l);
  g_slist_free_1 (cancel_buffer_l);
}
Пример #22
0
/**
 * ilo2_ribcl_get_event:
 * @hnd: Handler data pointer.
 * @event: Infra-structure event pointer. 
 *
 * Passes plugin events up to the infra-structure for processing.
 *
 * Return values:
 * 1 - events to be processed.
 * SA_OK - No events to be processed.
 * SA_ERR_HPI_INVALID_PARAMS - @event is NULL.
 **/
SaErrorT ilo2_ribcl_get_event(void *handler)
{

        struct oh_handler_state *oh_handler =
		(struct oh_handler_state *) handler;
        ilo2_ribcl_handler_t *ilo2_ribcl_handler;
	
        if (!handler) {
                err("ilo2 ribcl get event: Invalid parameter");
                return(SA_ERR_HPI_INVALID_PARAMS);
        }

        ilo2_ribcl_handler = (ilo2_ribcl_handler_t *) oh_handler->data;
	if(! ilo2_ribcl_handler) {
		err("ilo2 ribcl get event: Invalid parameter.");
		return(SA_ERR_HPI_INVALID_PARAMS);
	}
	
        if (g_slist_length(ilo2_ribcl_handler->eventq) > 0) {
                struct oh_event *e = ilo2_ribcl_handler->eventq->data;
                e->hid = oh_handler->hid;
                oh_evt_queue_push(oh_handler->eventq, e);
                ilo2_ribcl_handler->eventq = 
			g_slist_remove_link(ilo2_ribcl_handler->eventq,
				ilo2_ribcl_handler->eventq);
                return(ILO2_RIBCL_EVENTS_PENDING);
        } 

	/* No events for infrastructure to process */
	return(SA_OK);
}
Пример #23
0
void gtk_clist_remove(GtkCList *clist, gint row)
{
  if (row >= 0 && row < clist->rows) {
    GSList *dellink;
    GtkCListRow *delrow;
    int i;

    gtk_clist_unselect_row(clist, row, 0);
    dellink = g_slist_nth(clist->rowdata, row);
    delrow = (GtkCListRow *)dellink->data;
    for (i = 0; i < clist->cols; i++) {
      g_free(delrow->text[i]);
    }
    g_free(delrow->text);
    clist->rowdata = g_slist_remove_link(clist->rowdata, dellink);
    g_free(dellink);

    clist->rows = g_slist_length(clist->rowdata);

    if (GTK_WIDGET_REALIZED(GTK_WIDGET(clist))) {
      HWND hWnd = GTK_WIDGET(clist)->hWnd;

      SendMessage(hWnd, LB_DELETESTRING, (WPARAM)row, 0);
    }
  }
}
Пример #24
0
static void
_tarif_clear(gint tarif_id)
{
  GSList **tarif = NULL;
  GSList *link = NULL;
  CCL_tarifpart *tp = NULL;
  GData *freed = NULL;

  tarif = g_new0(GSList *, 1);
  *tarif = g_datalist_id_get_data(&ccl->tarifs, tarif_id);

  g_assert(NULL != tarif);
  
  g_datalist_init(&freed);

  while ((link = g_slist_last(*tarif)) && *tarif)
    {
      *tarif = g_slist_remove_link(*tarif, link);
      tp = (CCL_tarifpart *) link->data;
      if (!g_datalist_id_get_data(&freed, GPOINTER_TO_INT(tp->prices)))
	{
	  g_datalist_clear(tp->prices);
	  g_datalist_id_set_data(&freed, GPOINTER_TO_INT(tp->prices),
				 (void *)tp->prices);
	  g_free(tp->prices);
	}
      g_slist_free_1(link);
      g_free(tp);
    }
  g_datalist_clear(&freed);
  *tarif = NULL;
  g_datalist_id_remove_data(&ccl->tarifs, tarif_id);
  g_free(tarif);
}
void
nm_act_request_cancel_secrets (NMActRequest *self, guint32 call_id)
{
	NMActRequestPrivate *priv;
	GSList *iter;

	g_return_if_fail (self);
	g_return_if_fail (NM_IS_ACT_REQUEST (self));
	g_return_if_fail (call_id > 0);

	priv = NM_ACT_REQUEST_GET_PRIVATE (self);

	for (iter = priv->secrets_calls; iter; iter = g_slist_next (iter)) {
		GetSecretsInfo *info = iter->data;

		/* Remove the matching info */
		if (info->call_id == call_id) {
			priv->secrets_calls = g_slist_remove_link (priv->secrets_calls, iter);
			g_slist_free (iter);

			nm_settings_connection_cancel_secrets (NM_SETTINGS_CONNECTION (priv->connection), call_id);
			g_free (info);
			break;
		}
	}
}
Пример #26
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));
}
void
grg_recent_dox_push (const guchar * file)
{
	GSList *cur, *tmp;

	if (file == NULL)
		return;

	tmp = grg_recent_dox;
	while (tmp)
	{
		cur = tmp;
		tmp = tmp->next;
		if (STR_EQ (cur->data, file) ||
		    (g_slist_position (grg_recent_dox, cur) >=
		     GRG_RECENT_LIMIT - 1))
		{
			grg_recent_dox =
				g_slist_remove_link (grg_recent_dox, cur);
			g_free (cur->data);
			g_slist_free_1 (cur);
		}
	}

	grg_recent_dox =
		g_slist_prepend (grg_recent_dox, g_strdup ((guchar *) file));

	recent_dox_save ();
	grg_menu_update ();
}
static void
impl_MateComponent_EventSource_removeListener (PortableServer_Servant servant,
					const MateComponent_Listener  listener,
					CORBA_Environment     *ev)
{
	GSList                   *l, *next;
	MateComponentEventSourcePrivate *priv;

	priv = matecomponent_event_source_from_servant (servant)->priv;

	for (l = priv->listeners; l; l = next) {
		ListenerDesc *desc = l->data;

		next = l->next;

		if (CORBA_Object_is_equivalent (listener, desc->listener, ev)) {
			priv->listeners = g_slist_remove_link (
				priv->listeners, l);
			g_slist_free_1 (l);
			desc_free (desc, ev);
			return;
		}
	}

	CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
			     ex_MateComponent_EventSource_UnknownListener, 
			     NULL);
}
Пример #29
0
GSList*
g_slist_delete_link (GSList *list, GSList *link)
{
	list = g_slist_remove_link (list, link);
	g_slist_free_1 (link);

	return list;
}
Пример #30
0
GIOPSendBuffer *
giop_send_buffer_use (GIOPVersion giop_version)
{
	GIOPSendBuffer *buf;

	g_return_val_if_fail (
		((int) giop_version) >= 0 &&
		giop_version < GIOP_NUM_VERSIONS, NULL);

	LINK_MUTEX_LOCK (send_buffer_list_lock);
	if (send_buffer_list) {
		GSList *ltmp;

		ltmp = send_buffer_list;
		send_buffer_list = g_slist_remove_link (
			send_buffer_list, ltmp);

		LINK_MUTEX_UNLOCK (send_buffer_list_lock);

		buf = ltmp->data;
		g_slist_free_1 (ltmp);
		buf->num_used = buf->indirect_left = 0;

		if (giop_blank_wire_data) {
			int i;

			for (i = 0; i < buf->num_indirects_used; i++)
				memset (buf->indirects [i].ptr, 0,
					buf->indirects [i].size);
		}

		buf->num_indirects_used = 0;
	} else {
		LINK_MUTEX_UNLOCK (send_buffer_list_lock);

		buf = g_new0 (GIOPSendBuffer, 1);

		memcpy (buf->msg.header.magic, "GIOP", 4);
		buf->msg.header.flags = GIOP_FLAG_ENDIANNESS;
		buf->num_alloced = 8;
		buf->iovecs = g_new (struct iovec, 8);
	}


	memcpy (buf->msg.header.version,
		giop_version_ids [giop_version], 2);
	buf->giop_version = giop_version;

	g_assert (sizeof (buf->msg.header) == 12);
	giop_send_buffer_append_real (
		buf, (guchar *)&buf->msg.header, 12);

	buf->msg.header.message_size = 0;
	buf->header_size = 12;

	return buf;
}