Пример #1
0
static void soy_bodies_light_finalize (GObject* obj) {
	soybodiesLight * self;
	soyscenesScene* _tmp0_;
	GeeHashSet* _tmp1_;
	gboolean _tmp2_ = FALSE;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SOY_BODIES_TYPE_LIGHT, soybodiesLight);
	_tmp0_ = ((soybodiesBody*) self)->scene;
	_tmp1_ = _tmp0_->lights;
	_tmp2_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp1_, self);
	if (_tmp2_) {
		soyscenesScene* _tmp3_;
		soyscenesScene* _tmp4_;
		GeeHashSet* _tmp5_;
		soyscenesScene* _tmp6_;
		_tmp3_ = ((soybodiesBody*) self)->scene;
		g_rw_lock_writer_lock (&_tmp3_->stepLock);
		_tmp4_ = ((soybodiesBody*) self)->scene;
		_tmp5_ = _tmp4_->lights;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp5_, self);
		_tmp6_ = ((soybodiesBody*) self)->scene;
		g_rw_lock_writer_unlock (&_tmp6_->stepLock);
	}
	self->priv->_ambient = (g_free (self->priv->_ambient), NULL);
	self->priv->_diffuse = (g_free (self->priv->_diffuse), NULL);
	self->priv->_specular = (g_free (self->priv->_specular), NULL);
	_g_object_unref0 (self->priv->_texture);
	G_OBJECT_CLASS (soy_bodies_light_parent_class)->finalize (obj);
}
Пример #2
0
GeeArrayList *
FcListFamilies(void)
{
    int          i;
    FcPattern    * pattern;
    FcFontSet    * fontset;
    FcObjectSet  * objectset = 0;
    GeeArrayList * famlist = gee_array_list_new(G_TYPE_STRING,
                                                (GBoxedCopyFunc) g_strdup,
                                                (GDestroyNotify) g_free0,
                                                NULL,
                                                NULL,
                                                NULL);
    g_assert(FcInit());
    pattern = FcNameParse((FcChar8 *) ":");
    objectset = FcObjectSetBuild (FC_FAMILY, NULL);
    fontset = FcFontList(NULL, pattern, objectset);

    for (i = 0; i < fontset->nfont; i++) {
        FcChar8 * family;
        if (FcPatternGetString(fontset->fonts[i], FC_FAMILY, 0, &family) == FcResultMatch) {
            if (gee_abstract_collection_contains((GeeAbstractCollection *) famlist, family))
                continue;
            else
                gee_abstract_collection_add((GeeAbstractCollection *) famlist, family);
        }
    }

    if (objectset)
        FcObjectSetDestroy(objectset);
    if (pattern)
        FcPatternDestroy(pattern);
    if (fontset)
        FcFontSetDestroy(fontset);

    return famlist;
}
static void
rygel_media_export_harvester_on_file_added (RygelMediaExportHarvester *self,
                                            GFile                     *file) {
  gchar *uri;
  GError *error;
  RygelMediaExportMediaCache *cache;
  GFileInfo *info;
  RygelMediaExportHarvesterPrivate *priv;

  g_return_if_fail (RYGEL_MEDIA_EXPORT_IS_HARVESTER (self));
  g_return_if_fail (G_IS_FILE (file));

  uri = g_file_get_uri (file);
  g_debug ("Filesystem events settled for %s, scheduling extraction…", uri);
  g_free (uri);
  cache = rygel_media_export_media_cache_get_default ();
  priv = self->priv;
  error = NULL;
  info = g_file_query_info (file,
                            G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
                            G_FILE_QUERY_INFO_NONE,
                            priv->cancellable,
                            &error);
  if (error) {
    g_warning ("Failed to query file: %s", error->message);
    g_error_free (error);
    error = NULL;

    goto out;
  }
  if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY ||
      rygel_media_export_harvester_is_eligible (info)) {
    RygelMediaContainer *parent_container = NULL;
    GFile *current = g_object_ref (file);
    GeeAbstractCollection *abstract_locations = GEE_ABSTRACT_COLLECTION (priv->locations);

    do {
      GFile *parent = g_file_get_parent (current);
      gchar *id = rygel_media_export_media_cache_get_id (parent);
      RygelMediaObject *tmp_object = rygel_media_export_media_cache_get_object (cache, id, &error);

      if (error) {
        g_warning (_("Error fetching object '%s' from database: %s"),
                   id,
                   error->message);
        g_free (id);
        g_object_unref (parent);

        g_error_free (error);
        error = NULL;

        goto inner_out;
      }
      g_free (id);
      if (parent_container) {
        g_object_unref (parent_container);
        parent_container = NULL;
      }
      if (RYGEL_IS_MEDIA_CONTAINER (tmp_object)) {
        parent_container = RYGEL_MEDIA_CONTAINER (tmp_object);
      } else {
        g_object_unref (tmp_object);
      }
      if (!parent_container) {
        g_object_ref (parent);
        g_object_unref (current);
        current = parent;
      }
      g_object_unref (parent);
      if (!parent_container &&
          gee_abstract_collection_contains (abstract_locations, current)) {
        RygelMediaObject* another_object = rygel_media_export_media_cache_get_object (cache,
                                                                                      RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_FILESYSTEM_FOLDER_ID,
                                                                                      &error);

        if (error) {
          goto inner_out;
        }
        if (parent_container) {
          g_object_unref (parent_container);
          parent_container = NULL;
        }
        if (RYGEL_IS_MEDIA_CONTAINER (another_object)) {
          parent_container = RYGEL_MEDIA_CONTAINER (another_object);
        }

        break;
      }
    } while (!parent_container);
    rygel_media_export_harvester_schedule (self, current, parent_container, NULL);
  inner_out:

    g_object_unref (current);
    if (parent_container) {
      g_object_unref (parent_container);
    }
  } else {
    gchar* file_uri = g_file_get_uri (file);

    g_debug ("%s is not eligible for extraction", file_uri);
    g_free (file_uri);
  }
 out:
  g_object_unref (cache);
}
Пример #4
0
GeeArrayList* settings_manager_fetch_interested (SettingsManager* self) {
	GeeArrayList* result = NULL;
	gint _tmp0_ = 0;
	gchar** _tmp1_ = NULL;
	gchar** blacklisted;
	gint blacklisted_length1;
	gint _blacklisted_size_;
	GSettings* _tmp2_;
	gchar** _tmp3_;
	gchar** _tmp4_ = NULL;
	gchar** interested;
	gint interested_length1;
	gint _interested_size_;
	GeeArrayList* _tmp5_;
	GeeArrayList* list;
	gchar** _tmp6_;
	gint _tmp6__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = settings_manager_fetch_blacklist (self, &_tmp0_);
	blacklisted = _tmp1_;
	blacklisted_length1 = _tmp0_;
	_blacklisted_size_ = blacklisted_length1;
	_tmp2_ = self->priv->settings;
	_tmp4_ = _tmp3_ = g_settings_get_strv (_tmp2_, "interested-media-players");
	interested = _tmp4_;
	interested_length1 = _vala_array_length (_tmp3_);
	_interested_size_ = interested_length1;
	_tmp5_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
	list = _tmp5_;
	_tmp6_ = interested;
	_tmp6__length1 = interested_length1;
	{
		gchar** s_collection = NULL;
		gint s_collection_length1 = 0;
		gint _s_collection_size_ = 0;
		gint s_it = 0;
		s_collection = _tmp6_;
		s_collection_length1 = _tmp6__length1;
		for (s_it = 0; s_it < _tmp6__length1; s_it = s_it + 1) {
			gchar* _tmp7_;
			gchar* s = NULL;
			_tmp7_ = g_strdup (s_collection[s_it]);
			s = _tmp7_;
			{
				const gchar* _tmp8_;
				GeeArrayList* _tmp10_;
				const gchar* _tmp11_;
				gboolean _tmp12_ = FALSE;
				const gchar* _tmp13_;
				gchar** _tmp14_;
				gint _tmp14__length1;
				GeeArrayList* _tmp15_;
				const gchar* _tmp16_;
				_tmp8_ = s;
				if (g_strcmp0 (_tmp8_, "banshee-1") == 0) {
					gchar* _tmp9_;
					_tmp9_ = g_strdup ("banshee");
					_g_free0 (s);
					s = _tmp9_;
				}
				_tmp10_ = list;
				_tmp11_ = s;
				_tmp12_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp10_, _tmp11_);
				if (_tmp12_) {
					_g_free0 (s);
					continue;
				}
				_tmp13_ = s;
				_tmp14_ = blacklisted;
				_tmp14__length1 = blacklisted_length1;
				if (_vala_string_array_contains (_tmp14_, _tmp14__length1, _tmp13_)) {
					_g_free0 (s);
					continue;
				}
				_tmp15_ = list;
				_tmp16_ = s;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp15_, _tmp16_);
				_g_free0 (s);
			}
		}
	}
	result = list;
	interested = (_vala_array_free (interested, interested_length1, (GDestroyNotify) g_free), NULL);
	blacklisted = (_vala_array_free (blacklisted, blacklisted_length1, (GDestroyNotify) g_free), NULL);
	return result;
}
Пример #5
0
GeeArrayList* settings_manager_fetch_preferred (SettingsManager* self) {
	GeeArrayList* result = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* list;
	GSettings* _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_ = NULL;
	gchar** preferred;
	gint preferred_length1;
	gint _preferred_size_;
	GeeArrayList* _tmp4_ = NULL;
	GeeArrayList* interested;
	gchar** _tmp5_;
	gint _tmp5__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
	list = _tmp0_;
	_tmp1_ = self->priv->settings;
	_tmp3_ = _tmp2_ = g_settings_get_strv (_tmp1_, "preferred-media-players");
	preferred = _tmp3_;
	preferred_length1 = _vala_array_length (_tmp2_);
	_preferred_size_ = preferred_length1;
	_tmp4_ = settings_manager_fetch_interested (self);
	interested = _tmp4_;
	_tmp5_ = preferred;
	_tmp5__length1 = preferred_length1;
	{
		gchar** s_collection = NULL;
		gint s_collection_length1 = 0;
		gint _s_collection_size_ = 0;
		gint s_it = 0;
		s_collection = _tmp5_;
		s_collection_length1 = _tmp5__length1;
		for (s_it = 0; s_it < _tmp5__length1; s_it = s_it + 1) {
			gchar* _tmp6_;
			gchar* s = NULL;
			_tmp6_ = g_strdup (s_collection[s_it]);
			s = _tmp6_;
			{
				gboolean _tmp7_ = FALSE;
				GeeArrayList* _tmp8_;
				const gchar* _tmp9_;
				gboolean _tmp10_ = FALSE;
				gboolean _tmp14_;
				_tmp8_ = list;
				_tmp9_ = s;
				_tmp10_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp8_, _tmp9_);
				if (!_tmp10_) {
					GeeArrayList* _tmp11_;
					const gchar* _tmp12_;
					gboolean _tmp13_ = FALSE;
					_tmp11_ = interested;
					_tmp12_ = s;
					_tmp13_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp11_, _tmp12_);
					_tmp7_ = _tmp13_;
				} else {
					_tmp7_ = FALSE;
				}
				_tmp14_ = _tmp7_;
				if (_tmp14_) {
					GeeArrayList* _tmp15_;
					const gchar* _tmp16_;
					_tmp15_ = list;
					_tmp16_ = s;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp15_, _tmp16_);
				}
				_g_free0 (s);
			}
		}
	}
	result = list;
	_g_object_unref0 (interested);
	preferred = (_vala_array_free (preferred, preferred_length1, (GDestroyNotify) g_free), NULL);
	return result;
}