Beispiel #1
0
/**
 * i3ipc_con_find_focused:
 * @self: an #i3ipcCon
 *
 * Returns: (transfer none): The focused Con, or NULL if not found in this Con.
 *
 */
i3ipcCon *i3ipc_con_find_focused(i3ipcCon *self) {
  GList *descendents;
  GList *cmp_result;
  i3ipcCon *retval = NULL;

  descendents = i3ipc_con_descendents(self);

  if (descendents == NULL)
    return NULL;

  cmp_result = g_list_find_custom(descendents, NULL, i3ipc_con_focused_cmp_func);

  if (cmp_result != NULL)
    retval = I3IPC_CON(cmp_result->data);

  g_list_free(descendents);

  return retval;
}
Beispiel #2
0
void del_interface(GtkWidget *button, gpointer data)
{
	GtkTreeIter iter;
  	GtkTreeView *treeview = (GtkTreeView *)data;
  	GtkTreeModel *model = gtk_tree_view_get_model (treeview);
  	GtkTreeSelection *selection = gtk_tree_view_get_selection (treeview);
	char *nameif;

  	if (gtk_tree_selection_get_selected (selection, NULL, &iter))
        {
  	  gtk_tree_model_get (model, &iter, 1, &nameif, -1);
	  GList * elem = g_list_find_custom(interfaceslist, (gconstpointer) nameif, cmp_str);
    	  gint i = g_list_position(interfaceslist, elem); 
	  interfaceslist =  g_list_delete_link (interfaceslist, g_list_nth(interfaceslist, i));
	  interfaceslist =  g_list_delete_link (interfaceslist, g_list_nth(interfaceslist, i));
	 
     	  gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
    	}	
}
static gchar *
mh_profile_entry_get_value( GList *profile, const gchar *component )
{
    MHProfileEntry          *entry;
    GList                   *li;

    DBG( "--> %s", component );
    
    li = g_list_find_custom( profile, component, mh_profile_entry_compare );
    if ( !li ) {
        DBG( "NULL" );
        return ( NULL );
    }
    entry = li->data;

    g_assert( entry != NULL );

    return ( g_strdup( entry->value ) );
}
Beispiel #4
0
static int
get_op_total_timeout(remote_fencing_op_t * op, st_query_result_t * chosen_peer, int default_timeout)
{
    stonith_topology_t *tp = g_hash_table_lookup(topology, op->target);
    int total_timeout = 0;

    if (is_set(op->call_options, st_opt_topology) && tp) {
        int i;
        GListPtr device_list = NULL;
        GListPtr iter = NULL;

        /* Yep, this looks scary, nested loops all over the place.
         * Here is what is going on.
         * Loop1: Iterate through fencing levels.
         * Loop2: If a fencing level has devices, loop through each device
         * Loop3: For each device in a fencing level, see what peer owns it
         *        and what that peer has reported the timeout is for the device.
         */
        for (i = 0; i < ST_LEVEL_MAX; i++) {
            if (!tp->levels[i]) {
                continue;
            }
            for (device_list = tp->levels[i]; device_list; device_list = device_list->next) {
                for (iter = op->query_results; iter != NULL; iter = iter->next) {
                    st_query_result_t *peer = iter->data;

                    if (g_list_find_custom(peer->device_list, device_list->data, sort_strings)) {
                        total_timeout +=
                            get_device_timeout(peer, device_list->data, default_timeout);
                        break;
                    }
                }               /* End Loop3: match device with peer that owns device, find device's timeout period */
            }                   /* End Loop2: iterate through devices at a specific level */
        }                       /*End Loop1: iterate through fencing levels */

    } else if (chosen_peer) {
        total_timeout = get_peer_timeout(chosen_peer, default_timeout);
    } else {
        total_timeout = default_timeout;
    }

    return total_timeout ? total_timeout : default_timeout;
}
/**
 * gst_encoding_container_profile_add_profile:
 * @container: the #GstEncodingContainerProfile to use
 * @profile: (transfer full): the #GstEncodingProfile to add.
 *
 * Add a #GstEncodingProfile to the list of profiles handled by @container.
 *
 * No copy of @profile will be made, if you wish to use it elsewhere after this
 * method you should increment its reference count.
 *
 * Returns: %TRUE if the @stream was properly added, else %FALSE.
 */
gboolean
gst_encoding_container_profile_add_profile (GstEncodingContainerProfile *
    container, GstEncodingProfile * profile)
{
  g_return_val_if_fail (GST_IS_ENCODING_CONTAINER_PROFILE (container), FALSE);
  g_return_val_if_fail (GST_IS_ENCODING_PROFILE (profile), FALSE);

  if (g_list_find_custom (container->encodingprofiles, profile,
          (GCompareFunc) _compare_encoding_profiles)) {
    GST_ERROR
        ("Encoding profile already contains an identical GstEncodingProfile");
    return FALSE;
  }

  container->encodingprofiles =
      g_list_append (container->encodingprofiles, profile);

  return TRUE;
}
static void
on_g_volume_monitor_removed_event (GVolumeMonitor        *monitor,
                                   GMount                *mount,
                                   GrlOpticalMediaSource *source)
{
  GList *l;
  GrlMedia *media;

  l = g_list_find_custom (source->priv->list, mount, find_mount);
  if (!l)
    return;

  media = l->data;
  source->priv->list = g_list_remove (source->priv->list, media);
  if (source->priv->notify_changes) {
    grl_source_notify_change (GRL_SOURCE (source), media, GRL_CONTENT_REMOVED, FALSE);
  }
  g_object_unref (media);
}
Beispiel #7
0
static __inline__ void
__nmp_accept_dev_mng_timer(NmpAcceptDevMng *dev_mng)
{
	NmpMediaDevice *dev;
	GList *list;

	g_list_foreach(
		dev_mng->devices,
		nmp_accept_dev_1s_elapsed,
		NULL
	);

	for (;;)
	{
		list = g_list_find_custom(
			dev_mng->devices,
			NULL, 
			nmp_accept_dev_timeout
		);

		if (!list)
			break;

		dev = (NmpMediaDevice*)list->data;

		dev_mng->devices = g_list_delete_link(
			dev_mng->devices,
			list
		);

		g_mutex_unlock(dev_mng->lock);

		nmp_print(
			"Device '%p' removed by Accept-Timer.", dev
		);

		nmp_rtsp_device_set_illegal(dev);
		nmp_rtsp_device_unref(dev);

		g_mutex_lock(dev_mng->lock);
	}
}
Beispiel #8
0
static st_query_result_t *stonith_choose_peer(remote_fencing_op_t *op)
{
    GListPtr iter = NULL;
    do {
        if(op->devices) {
            crm_trace("Checking for someone to fence %s with %s", op->target, (char*)op->devices->data);
        } else {
            crm_trace("Checking for someone to fence %s", op->target);
        }
        for(iter = op->query_results; iter != NULL; iter = iter->next) {
            st_query_result_t *peer = iter->data;
            if(is_set(op->call_options, st_opt_topology)) {
                /* Do they have the next device of the current fencing level? */
                GListPtr match = NULL;
                if(op->devices) {
                    match = g_list_find_custom(peer->device_list, op->devices->data, sort_strings);
                }
                if(match) {
                    crm_trace("Removing %s from %s (%d remaining)", (char*)match->data, peer->host, g_list_length(peer->device_list));
                    peer->device_list = g_list_remove(peer->device_list, match->data);
                    return peer;
                }

            } else if(peer && peer->devices > 0) {
                /* No topology: Use the current best peer */
                crm_trace("Simple fencing");
                return peer;
            }
        }

        /* Try the next fencing level if there is one */
    } while(is_set(op->call_options, st_opt_topology)
            && stonith_topology_next(op) == pcmk_ok);

    if(op->devices) {
        crm_trace("Couldn't find anyone to fence %s with %s", op->target, (char*)op->devices->data);
    } else {
        crm_trace("Couldn't find anyone to fence %s", op->target);
    }

    return NULL;
}
static void
contact_widget_groups_populate_data (EmpathyContactWidget *information)
{
  GtkTreeView *view;
  GtkListStore *store;
  GtkTreeIter iter;
  GList *my_groups, *l;
  GList *all_groups;

  view = GTK_TREE_VIEW (information->treeview_groups);
  store = GTK_LIST_STORE (gtk_tree_view_get_model (view));
  gtk_list_store_clear (store);

  all_groups = empathy_contact_list_get_all_groups (
      EMPATHY_CONTACT_LIST (information->manager));
  my_groups = empathy_contact_list_get_groups (
      EMPATHY_CONTACT_LIST (information->manager),
      information->contact);

  for (l = all_groups; l; l = l->next)
    {
      const gchar *group_str;
      gboolean enabled;

      group_str = l->data;

      enabled = g_list_find_custom (my_groups,
          group_str, (GCompareFunc) strcmp) != NULL;

      gtk_list_store_append (store, &iter);
      gtk_list_store_set (store, &iter,
          COL_NAME, group_str,
          COL_EDITABLE, TRUE,
          COL_ENABLED, enabled,
          -1);
    }

  g_list_foreach (all_groups, (GFunc) g_free, NULL);
  g_list_foreach (my_groups, (GFunc) g_free, NULL);
  g_list_free (all_groups);
  g_list_free (my_groups);
}
Beispiel #10
0
static void general_unload (PluginHandle * plugin)
{
    GList * node = g_list_find_custom (loaded_general_plugins, plugin,
     (GCompareFunc) general_find_cb);
    if (node == NULL)
        return;

    AUDDBG ("Unloading %s.\n", plugin_get_name (plugin));
    LoadedGeneral * general = node->data;
    loaded_general_plugins = g_list_delete_link (loaded_general_plugins, node);

    if (general->widget != NULL)
    {
        AUDDBG ("Removing %s from interface.\n", plugin_get_name (plugin));
        interface_remove_plugin_widget (plugin, general->widget);
        g_return_if_fail (general->widget == NULL); /* not destroyed? */
    }

    g_slice_free (LoadedGeneral, general);
}
static GstGLWindowX11 *
_find_window_from_xcb_window (GstGLDisplayX11 * display_x11,
    xcb_window_t window_id)
{
  GstGLDisplay *display = GST_GL_DISPLAY (display_x11);
  GstGLWindowX11 *ret = NULL;
  GList *l;

  if (!window_id)
    return NULL;

  GST_OBJECT_LOCK (display);
  l = g_list_find_custom (display->windows, &window_id,
      (GCompareFunc) _compare_xcb_window);
  if (l)
    ret = gst_object_ref (l->data);
  GST_OBJECT_UNLOCK (display);

  return ret;
}
static void
contact_manager_get_all_groups_foreach (TpConnection          *connection,
					EmpathyTpContactList  *list,
					GList                **all_groups)
{
	GList *groups, *l;

	groups = empathy_contact_list_get_all_groups (EMPATHY_CONTACT_LIST (list));
	for (l = groups; l; l = l->next) {
		if (!g_list_find_custom (*all_groups,
					 l->data,
					 (GCompareFunc) strcmp)) {
			*all_groups = g_list_prepend (*all_groups, l->data);
		} else {
			g_free (l->data);
		}
	}

	g_list_free (groups);
}
Beispiel #13
0
void
gimp_filter_history_remove (Gimp          *gimp,
                            GimpProcedure *procedure)
{
  GList *link;

  g_return_if_fail (GIMP_IS_GIMP (gimp));
  g_return_if_fail (GIMP_IS_PROCEDURE (procedure));

  link = g_list_find_custom (gimp->filter_history, procedure,
                             (GCompareFunc) gimp_filter_history_compare);

  if (link)
    {
      g_object_unref (link->data);
      gimp->filter_history = g_list_delete_link (gimp->filter_history, link);

      gimp_filter_history_changed (gimp);
    }
}
Beispiel #14
0
static gboolean
get_merge_bases (SeafCommit *commit, void *vdata, gboolean *stop)
{
    MergeTraverseData *data = vdata;

    /* Found a common ancestor.
     * Dont traverse its parenets.
     */
    if (g_hash_table_lookup (data->commit_hash, commit->commit_id)) {
        if (!g_list_find_custom (data->result, commit, compare_commit)) {
            data->result = g_list_insert_sorted_with_data (data->result, commit,
                                                     compare_commit_by_time,
                                                     NULL);
            seaf_commit_ref (commit);
        }
        *stop = TRUE;
    }

    return TRUE;
}
Beispiel #15
0
/*! \brief Mark a configuration file as read.
 * \par Function Description
 * If the config file \a filename has not already been loaded, mark it
 * as loaded and return TRUE, storing \a filename in \a toplevel (\a
 * filename should not subsequently be freed).  Otherwise, return
 * FALSE, and set \a err appropriately.
 *
 * \note Should only be called by g_rc_parse_file().
 *
 * \param toplevel  The current #TOPLEVEL structure.
 * \param filename  The config file name to test.
 * \param err       Return location for errors, or NULL.
 * \return TRUE if \a filename not already loaded, FALSE otherwise.
 */
static gboolean
g_rc_try_mark_read (TOPLEVEL *toplevel, gchar *filename, GError **err)
{
  GList *found = NULL;
  g_return_val_if_fail ((toplevel != NULL), FALSE);
  g_return_val_if_fail ((filename != NULL), FALSE);

  /* Test if marked read already */
  found = g_list_find_custom (toplevel->RC_list, filename,
                              (GCompareFunc) strcmp);
  if (found != NULL) {
    g_set_error (err, EDA_ERROR, EDA_ERROR_RC_TWICE,
                 _("Config file already loaded"));
    return FALSE;
  }

  toplevel->RC_list = g_list_append (toplevel->RC_list, filename);
  /* N.b. don't free name_norm here; it's stored in the TOPLEVEL. */
  return TRUE;
}
Beispiel #16
0
/** Invoked when a value of a property is changed. */
static void _camera_property_value_changed(const dt_camera_t *camera, const char *name, const char *value,
                                           void *data)
{
  dt_lib_camera_t *lib = (dt_lib_camera_t *)data;
  // Find the property in lib->data.properties, update value
  GList *citem;
  if((citem = g_list_find_custom(lib->gui.properties, name, _compare_property_by_name)) != NULL)
  {
    dt_lib_camera_property_t *prop = (dt_lib_camera_property_t *)citem->data;
    int i = 0;
    for(const GList *iter = dt_bauhaus_combobox_get_labels(prop->values); iter; iter = g_list_next(iter), i++)
    {
      if(!g_strcmp0((gchar*)iter->data, value))
      {
        dt_bauhaus_combobox_set(prop->values, i);
        return;
      }
    }
  }
}
Beispiel #17
0
static GList*
tagged_token_list_insert (GList *list, AmTokenType type, AnjutaToken *token)
{
	GList *existing;

	existing = g_list_find_custom (list, GINT_TO_POINTER (type), tagged_token_item_compare);
	if (existing == NULL)
	{
		/* Add a new item */
		TaggedTokenItem *item;

		item = tagged_token_item_new (type);
		list = g_list_prepend (list, item);
		existing = list;
	}

	((TaggedTokenItem *)(existing->data))->tokens = g_list_prepend (((TaggedTokenItem *)(existing->data))->tokens, token);

	return list;
}
static void fp_libcalls(struct btp_strbuf *buffer, GList *insns,
        uintptr_t begin, uintptr_t end, GHashTable *call_graph, GHashTable *plt)
{
    GList *it, *sym = NULL;

    /* Look up begin in call graph */
    GList *callees = g_hash_table_lookup(call_graph, &begin);

    /* Resolve addresses to names if they are in PLT */
    for (it = callees; it != NULL; it = g_list_next(it))
    {
        char *s = g_hash_table_lookup(plt, it->data);
        if (s && !g_list_find_custom(sym, s, (GCompareFunc)strcmp))
        {
            sym = g_list_insert_sorted(sym, s, (GCompareFunc)strcmp);
        }
    }

    /* Format the result */
    fingerprint_add_list(buffer, "libcalls", sym);
}
/**
 * Find a server from the service by the server's UDN.
 *
 * @param service The service to search from
 * @param udn The UDN of the server to look for
 * @return A SIBServer* or NULL
 */
SIBServer* sib_service_find_server(SIBService* service, const guchar *udn)
{
  SIBServer* server = NULL;
  GList* item = NULL;
  whiteboard_log_debug_fb();
  g_return_val_if_fail(service != NULL, NULL);
  
  item = g_list_find_custom(service->siblist, udn, 
 			    sib_server_compare_udn); 
  
  if (item != NULL) 
    { 
      server = (SIBServer*) item->data; 
    } 
  else 
    { 
      server = NULL; 
    } 
  whiteboard_log_debug_fe();
  return server;
}
static gboolean
server_has_actions (void)
{
        gboolean has;
        GList   *caps;
        GList   *l;

        caps = notify_get_server_caps ();
        if (caps == NULL) {
                fprintf (stderr, "Failed to receive server caps.\n");
                return FALSE;
        }

        l = g_list_find_custom (caps, "actions", (GCompareFunc)strcmp);
        has = l != NULL;

        g_list_foreach (caps, (GFunc) g_free, NULL);
        g_list_free (caps);

        return has;
}
void
caja_clipboard_clear_if_colliding_uris (GtkWidget *widget,
                                        const GList *item_uris,
                                        GdkAtom copied_files_atom)
{
    GtkSelectionData *data;
    GList *clipboard_item_uris, *l;
    gboolean collision;

    collision = FALSE;
    data = gtk_clipboard_wait_for_contents (caja_clipboard_get (widget),
                                            copied_files_atom);
    if (data == NULL)
    {
        return;
    }

    clipboard_item_uris = caja_clipboard_get_uri_list_from_selection_data (data, NULL,
                          copied_files_atom);

    for (l = (GList *) item_uris; l; l = l->next)
    {
        if (g_list_find_custom ((GList *) item_uris, l->data,
                                (GCompareFunc) g_strcmp0))
        {
            collision = TRUE;
            break;
        }
    }

    if (collision)
    {
        gtk_clipboard_clear (caja_clipboard_get (widget));
    }

    if (clipboard_item_uris)
    {
        eel_g_list_free_deep (clipboard_item_uris);
    }
}
OMX_ERRORTYPE
gst_omx_buf_tab_mark_buffer (GstOmxBufTab * buftab,
    OMX_BUFFERHEADERTYPE * buffer, gboolean busy)
{
  OMX_ERRORTYPE error;
  GList *toreturn;
  GstOmxBufTabNode *node;

  g_return_val_if_fail (buftab, OMX_ErrorBadParameter);
  g_return_val_if_fail (buffer, OMX_ErrorBadParameter);

  error = OMX_ErrorNone;
  toreturn = NULL;
  node = NULL;
  GST_LOG ("Marking buffer ... ");
  g_mutex_lock (&buftab->tabmutex);

  toreturn = g_list_find_custom (buftab->table, (gconstpointer) buffer,
      (GCompareFunc) gst_omx_buf_tab_compare);
  if (!toreturn)
    goto notfound;
  node = (GstOmxBufTabNode *) toreturn->data;
  GST_LOG ("Marking Buffer %p -> %p as %s ", node->buffer,
      node->buffer->pBuffer, busy ? "Used" : "Free");
  if (node->busy != busy) {
    node->busy = busy;
    buftab->tabused += busy ? 1 : -1;
  }
  GST_LOG ("Buffer %p -> %p set as %s ", node->buffer, node->buffer->pBuffer,
      busy ? "Used" : "Free");
  g_cond_signal (&buftab->tabcond);
  g_mutex_unlock (&buftab->tabmutex);

  return error;

notfound:
  g_mutex_unlock (&buftab->tabmutex);
  error = OMX_ErrorResourcesLost;
  return error;
}
Beispiel #23
0
/*!
 * \internal
 * \brief Determine if all the devices in the topology are found or not
 */
static gboolean
all_topology_devices_found(remote_fencing_op_t * op)
{
    GListPtr device = NULL;
    GListPtr iter = NULL;
    GListPtr match = NULL;
    stonith_topology_t *tp = NULL;
    gboolean skip_target = FALSE;
    int i;

    tp = g_hash_table_lookup(topology, op->target);

    if (!tp) {
        return FALSE;
    }
    if (safe_str_eq(op->action, "off") || safe_str_eq(op->action, "reboot")) {
        /* Don't count the devices on the target node if we are killing
         * the target node. */
        skip_target = TRUE;
    }

    for (i = 0; i < ST_LEVEL_MAX; i++) {
        for (device = tp->levels[i]; device; device = device->next) {
            match = FALSE;
            for (iter = op->query_results; iter != NULL; iter = iter->next) {
                st_query_result_t *peer = iter->data;

                if (skip_target && safe_str_eq(peer->host, op->target)) {
                    continue;
                }
                match = g_list_find_custom(peer->device_list, device->data, sort_strings);
            }
            if (!match) {
                return FALSE;
            }
        }
    }

    return TRUE;
}
Beispiel #24
0
bool mgmt_cancel(struct mgmt *mgmt, unsigned int id)
{
	struct mgmt_request *request;
	GList *list;

	if (!mgmt || !id)
		return false;

	list = g_queue_find_custom(mgmt->request_queue, GUINT_TO_POINTER(id),
							compare_request_id);
	if (list) {
		request = list->data;
		g_queue_delete_link(mgmt->request_queue, list);
		goto done;
	}

	list = g_queue_find_custom(mgmt->reply_queue, GUINT_TO_POINTER(id),
							compare_request_id);
	if (list) {
		request = list->data;
		g_queue_delete_link(mgmt->reply_queue, list);
		goto done;
	}

	list = g_list_find_custom(mgmt->pending_list, GUINT_TO_POINTER(id),
							compare_request_id);
	if (!list)
		return false;

	request = list->data;

	mgmt->pending_list = g_list_delete_link(mgmt->pending_list, list);

done:
	destroy_request(request, NULL);

	wakeup_writer(mgmt);

	return true;
}
Beispiel #25
0
static int signal_node_removed(LassiConnection *lc, DBusMessage *m) {
    const char *id, *address;
    DBusError e;
    LassiConnection *k;
    gboolean remove_from_order;
    LassiServer *ls = lc->server;

    dbus_error_init(&e);

    if (!(dbus_message_get_args(m, &e,
                                DBUS_TYPE_STRING, &id,
                                DBUS_TYPE_STRING, &address,
                                DBUS_TYPE_BOOLEAN, &remove_from_order,
                                DBUS_TYPE_INVALID))) {
        g_warning("Received invalid message: %s", e.message);
        dbus_error_free(&e);
        return -1;
    }

    if (strcmp(id, lc->server->id) == 0) {
        g_debug("We've been kicked ourselves.");

        server_disconnect_all(lc->server, TRUE);
        return 0;
    }

    if (remove_from_order) {
        GList *i = g_list_find_custom(ls->order, id, (GCompareFunc) strcmp);

        if (i)
            ls->order = g_list_delete_link(ls->order, i);
    }

    if ((k = g_hash_table_lookup(lc->server->connections_by_id, id)))
        connection_unlink(k, remove_from_order);

    server_broadcast(ls, m, lc == k ? NULL : lc);

    return 0;
}
static GHashTable *
build_model_table (const char *mount_path)
{
	const Itdb_IpodInfo *table;
	const Itdb_IpodInfo *model_info;
	GHashTable *models;
	gdouble ipod_capacity;

	ipod_capacity = get_rounded_ipod_capacity (mount_path);
	models = g_hash_table_new_full (g_int_hash, g_int_equal,
					NULL, (GDestroyNotify)g_list_free);
	table = itdb_info_get_ipod_info_table ();
	for (model_info = table;
	     model_info->model_number != NULL;
	     model_info++) {
		GList *infos;

		infos = g_hash_table_lookup (models,
					     &model_info->ipod_generation);
		if (g_list_find_custom (infos, model_info, model_equals)) {
			continue;
		}
		if (model_info->capacity == ipod_capacity) {
			/* Steal the key from the hash table since we don't 
			 * want 'infos' to be g_list_freed by the hash
			 * table destroy notify function
			 */
			g_hash_table_steal (models,
					    &model_info->ipod_generation);
			infos = g_list_prepend (infos, (gpointer)model_info);

			g_hash_table_insert (models, 
					     (gpointer)&model_info->ipod_generation, 
					     infos);
		}
	}

	return models;
}
static void
on_device_removed (DBusGProxy *proxy,
                   char       *device_path,
                   gpointer    user_data)
{
        GList *device_node;
        NMDevice *nm_device;
        GUPnPNetworkManagerPrivate *priv;

        priv = GUPNP_NETWORK_MANAGER (user_data)->priv;

        device_node = g_list_find_custom (priv->nm_devices,
                                          device_path,
                                          (GCompareFunc) compare_device_path);
        if (G_UNLIKELY (device_node == NULL))
                return;

        nm_device = (NMDevice *) device_node->data;

        priv->nm_devices = g_list_remove (priv->nm_devices, nm_device);
        nm_device_free (nm_device);
}
Beispiel #28
0
/**
 * gtk_level_bar_get_offset_value:
 * @self: a #GtkLevelBar
 * @name: (allow-none): the name of an offset in the bar
 * @value: (out): location where to store the value
 *
 * Fetches the value specified for the offset marker @name in @self,
 * returning %TRUE in case an offset named @name was found.
 *
 * Returns: %TRUE if the specified offset is found
 *
 * Since: 3.6
 */
gboolean
gtk_level_bar_get_offset_value (GtkLevelBar *self,
                                const gchar *name,
                                gdouble     *value)
{
  GList *existing;
  GtkLevelBarOffset *offset = NULL;

  g_return_val_if_fail (GTK_IS_LEVEL_BAR (self), 0.0);

  existing = g_list_find_custom (self->priv->offsets, name, offset_find_func);
  if (existing)
    offset = existing->data;

  if (!offset)
    return FALSE;

  if (value)
    *value = offset->value;

  return TRUE;
}
static void
_zmq2agent_manage_ack (struct _zmq2agent_ctx_s *ctx, zmq_msg_t *msg)
{
	if (zmq_msg_size (msg) != HEADER_SIZE)
		return;

	gchar strid[1+(2*HEADER_SIZE)];
	void *d = zmq_msg_data (msg);
	oio_str_bin2hex(d, HEADER_SIZE, strid, sizeof(strid));

	GList *li = g_list_find_custom (ctx->pending_events, d, _cmp);
	if (!li) {
		GRID_INFO("EVT:OUT %s", strid);
		++ ctx->q->counter_ack_notfound;
	} else {
		GRID_DEBUG("EVT:ACK %s", strid);
		ctx->pending_events = g_list_remove_link (ctx->pending_events, li);
		g_list_free_full (li, g_free);
		-- ctx->q->gauge_pending;
		++ ctx->q->counter_ack;
	}
}
Beispiel #30
0
void xdk_display_add_event_filter(
	XdkDisplay * self,
	XdkEventFilter filter,
	gpointer user_data)
{
	g_return_if_fail(filter);
	
	if(NULL == self) {
		self = xdk_display_get_default();
	}
	
	XdkDisplayPrivate * priv = self->priv;
	XdkEventFilterNode node = {
		.filter = filter,
		.user_data = user_data
	};
	if(g_list_find_custom(priv->event_filters, & node, xdk_event_filter_node_compare)) {
		return;
	}

	priv->event_filters = g_list_prepend(priv->event_filters, xdk_event_filter_node_dup(& node));
}