aboutsummaryrefslogtreecommitdiff
path: root/src/familiar-players-db.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/familiar-players-db.c')
-rw-r--r--src/familiar-players-db.c697
1 files changed, 0 insertions, 697 deletions
diff --git a/src/familiar-players-db.c b/src/familiar-players-db.c
deleted file mode 100644
index 7b082a2..0000000
--- a/src/familiar-players-db.c
+++ /dev/null
@@ -1,697 +0,0 @@
-/* familiar-players-db.c generated by valac 0.11.2, the Vala compiler
- * generated from familiar-players-db.vala, do not modify */
-
-/*
-Copyright 2010 Canonical Ltd.
-
-Authors:
- Conor Curran <conor.curran@canonical.com>
-
-This program is free software: you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 3, as published
-by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranties of
-MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
-PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along
-with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gee.h>
-#include <stdlib.h>
-#include <string.h>
-#include <glib/gstdio.h>
-
-
-#define TYPE_FAMILIAR_PLAYERS_DB (familiar_players_db_get_type ())
-#define FAMILIAR_PLAYERS_DB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FAMILIAR_PLAYERS_DB, FamiliarPlayersDB))
-#define FAMILIAR_PLAYERS_DB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FAMILIAR_PLAYERS_DB, FamiliarPlayersDBClass))
-#define IS_FAMILIAR_PLAYERS_DB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FAMILIAR_PLAYERS_DB))
-#define IS_FAMILIAR_PLAYERS_DB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FAMILIAR_PLAYERS_DB))
-#define FAMILIAR_PLAYERS_DB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FAMILIAR_PLAYERS_DB, FamiliarPlayersDBClass))
-
-typedef struct _FamiliarPlayersDB FamiliarPlayersDB;
-typedef struct _FamiliarPlayersDBClass FamiliarPlayersDBClass;
-typedef struct _FamiliarPlayersDBPrivate FamiliarPlayersDBPrivate;
-#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-#define _g_free0(var) (var = (g_free (var), NULL))
-#define _g_key_file_free0(var) ((var == NULL) ? NULL : (var = (g_key_file_free (var), NULL)))
-#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
-
-struct _FamiliarPlayersDB {
- GObject parent_instance;
- FamiliarPlayersDBPrivate * priv;
-};
-
-struct _FamiliarPlayersDBClass {
- GObjectClass parent_class;
-};
-
-struct _FamiliarPlayersDBPrivate {
- GeeHashMap* players_DB;
- gchar* file_name;
- gchar* dir_name;
- GKeyFile* key_file;
- guint write_id;
-};
-
-
-static gpointer familiar_players_db_parent_class = NULL;
-
-GType familiar_players_db_get_type (void) G_GNUC_CONST;
-#define FAMILIAR_PLAYERS_DB_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_FAMILIAR_PLAYERS_DB, FamiliarPlayersDBPrivate))
-enum {
- FAMILIAR_PLAYERS_DB_DUMMY_PROPERTY
-};
-#define FAMILIAR_PLAYERS_DB_GROUP_NAME "Seen Database"
-#define FAMILIAR_PLAYERS_DB_KEY_NAME "DesktopFiles"
-#define FAMILIAR_PLAYERS_DB_DEFAULT_APP_DESKTOP "/usr/share/applications/banshee-1.desktop"
-FamiliarPlayersDB* familiar_players_db_new (void);
-FamiliarPlayersDB* familiar_players_db_construct (GType object_type);
-static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self);
-static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self);
-static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self);
-static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB* self);
-static void _vala_array_add1 (gchar*** array, int* length, int* size, gchar* value);
-void familiar_players_db_insert (FamiliarPlayersDB* self, const gchar* desktop);
-gboolean familiar_players_db_already_familiar (FamiliarPlayersDB* self, const gchar* desktop);
-static gboolean _familiar_players_db_write_db_gsource_func (gpointer self);
-GeeSet* familiar_players_db_records (FamiliarPlayersDB* self);
-gchar* familiar_players_db_fetch_icon_name (const gchar* desktop_path);
-static void familiar_players_db_finalize (GObject* obj);
-static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
-static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
-
-
-FamiliarPlayersDB* familiar_players_db_construct (GType object_type) {
- FamiliarPlayersDB * self = NULL;
- GeeHashMap* _tmp0_ = NULL;
- GeeHashMap* _tmp1_;
- gboolean _tmp2_;
- const gchar* _tmp3_ = NULL;
- gchar* _tmp4_ = NULL;
- gchar* _tmp5_;
- gchar* _tmp6_ = NULL;
- gchar* _tmp7_;
- gboolean _tmp8_ = FALSE;
- gboolean _tmp9_ = FALSE;
- gboolean _tmp10_;
- self = (FamiliarPlayersDB*) g_object_new (object_type, NULL);
- self->priv->write_id = (guint) 0;
- _tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_BOOLEAN, NULL, NULL, NULL, NULL, NULL);
- _tmp1_ = _tmp0_;
- _g_object_unref0 (self->priv->players_DB);
- self->priv->players_DB = _tmp1_;
- _tmp2_ = familiar_players_db_create_key_file (self);
- if (!_tmp2_) {
- gee_abstract_map_set ((GeeAbstractMap*) self->priv->players_DB, FAMILIAR_PLAYERS_DB_DEFAULT_APP_DESKTOP, GINT_TO_POINTER (TRUE));
- familiar_players_db_write_db (self);
- }
- _tmp3_ = g_get_user_cache_dir ();
- _tmp4_ = g_build_filename (_tmp3_, "indicators", "sound", NULL);
- _tmp5_ = _tmp4_;
- _g_free0 (self->priv->dir_name);
- self->priv->dir_name = _tmp5_;
- _tmp6_ = g_build_filename (self->priv->dir_name, "familiar-players-db.keyfile", NULL);
- _tmp7_ = _tmp6_;
- _g_free0 (self->priv->file_name);
- self->priv->file_name = _tmp7_;
- _tmp10_ = familiar_players_db_create_key_file (self);
- if (_tmp10_) {
- gboolean _tmp11_;
- _tmp11_ = familiar_players_db_check_for_keys (self);
- _tmp9_ = _tmp11_;
- } else {
- _tmp9_ = FALSE;
- }
- if (_tmp9_) {
- gboolean _tmp12_;
- _tmp12_ = familiar_players_db_load_data_from_key_file (self);
- _tmp8_ = _tmp12_;
- } else {
- _tmp8_ = FALSE;
- }
- if (_tmp8_) {
- g_debug ("familiar-players-db.vala:51: keyfiles in place and ready for action");
- } else {
- GKeyFile* _tmp13_;
- _tmp13_ = NULL;
- _g_key_file_free0 (self->priv->key_file);
- self->priv->key_file = _tmp13_;
- g_warning ("familiar-players-db.vala:55: FamiliarPlayersDB:: problems loading key " \
-"file - can't go any further");
- }
- return self;
-}
-
-
-FamiliarPlayersDB* familiar_players_db_new (void) {
- return familiar_players_db_construct (TYPE_FAMILIAR_PLAYERS_DB);
-}
-
-
-static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) {
- gboolean result = FALSE;
- gboolean _result_;
- gboolean _tmp0_;
- GError * _inner_error_ = NULL;
- g_return_val_if_fail (self != NULL, FALSE);
- _result_ = FALSE;
- _tmp0_ = g_file_test (self->priv->file_name, G_FILE_TEST_EXISTS);
- if (_tmp0_) {
- GKeyFile* _tmp1_ = NULL;
- GKeyFile* _tmp2_;
- gboolean _tmp3_;
- gboolean _tmp4_;
- _tmp1_ = g_key_file_new ();
- _tmp2_ = _tmp1_;
- _g_key_file_free0 (self->priv->key_file);
- self->priv->key_file = _tmp2_;
- _tmp3_ = g_key_file_load_from_file (self->priv->key_file, self->priv->file_name, G_KEY_FILE_NONE, &_inner_error_);
- _tmp4_ = _tmp3_;
- if (_inner_error_ != NULL) {
- if (_inner_error_->domain == G_KEY_FILE_ERROR) {
- goto __catch6_g_key_file_error;
- }
- if (_inner_error_->domain == G_FILE_ERROR) {
- goto __catch6_g_file_error;
- }
- g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return FALSE;
- }
- _result_ = _tmp4_;
- goto __finally6;
- __catch6_g_key_file_error:
- {
- GError * e;
- e = _inner_error_;
- _inner_error_ = NULL;
- g_warning ("familiar-players-db.vala:67: FamiliarPlayersDB::create_key_file() - Ke" \
-"yFileError");
- _g_error_free0 (e);
- }
- goto __finally6;
- __catch6_g_file_error:
- {
- GError * e;
- e = _inner_error_;
- _inner_error_ = NULL;
- g_warning ("familiar-players-db.vala:70: FamiliarPlayersDB::create_key_file() - Fi" \
-"leError");
- _g_error_free0 (e);
- }
- __finally6:
- if (_inner_error_ != NULL) {
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return FALSE;
- }
- }
- result = _result_;
- return result;
-}
-
-
-static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self) {
- gboolean result = FALSE;
- gboolean _tmp0_;
- gboolean _tmp1_;
- GError * _inner_error_ = NULL;
- g_return_val_if_fail (self != NULL, FALSE);
- _tmp0_ = g_key_file_has_key (self->priv->key_file, FAMILIAR_PLAYERS_DB_GROUP_NAME, FAMILIAR_PLAYERS_DB_KEY_NAME, &_inner_error_);
- _tmp1_ = _tmp0_;
- if (_inner_error_ != NULL) {
- if (_inner_error_->domain == G_KEY_FILE_ERROR) {
- goto __catch7_g_key_file_error;
- }
- g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return FALSE;
- }
- if (_tmp1_ == TRUE) {
- result = TRUE;
- return result;
- }
- goto __finally7;
- __catch7_g_key_file_error:
- {
- GError * e;
- e = _inner_error_;
- _inner_error_ = NULL;
- result = FALSE;
- _g_error_free0 (e);
- return result;
- }
- __finally7:
- if (_inner_error_ != NULL) {
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return FALSE;
- }
- g_warning ("familiar-players-db.vala:85: Seen DB '%s' does not have key '%s' in gr" \
-"oup '%s'", self->priv->file_name, FAMILIAR_PLAYERS_DB_KEY_NAME, FAMILIAR_PLAYERS_DB_GROUP_NAME);
- result = FALSE;
- return result;
-}
-
-
-static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB* self) {
- gboolean result = FALSE;
- gsize _tmp0_;
- gchar** _tmp1_ = NULL;
- gint desktops_length1;
- gint _desktops_size_;
- gchar** _tmp2_;
- gchar** desktops;
- GError * _inner_error_ = NULL;
- g_return_val_if_fail (self != NULL, FALSE);
- _tmp1_ = g_key_file_get_string_list (self->priv->key_file, FAMILIAR_PLAYERS_DB_GROUP_NAME, FAMILIAR_PLAYERS_DB_KEY_NAME, &_tmp0_, &_inner_error_);
- _tmp2_ = _tmp1_;
- desktops_length1 = _tmp0_;
- _desktops_size_ = desktops_length1;
- desktops = _tmp2_;
- if (_inner_error_ != NULL) {
- if (_inner_error_->domain == G_KEY_FILE_ERROR) {
- goto __catch8_g_key_file_error;
- }
- g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return FALSE;
- }
- {
- gchar** s_collection;
- int s_collection_length1;
- int s_it;
- s_collection = desktops;
- s_collection_length1 = desktops_length1;
- for (s_it = 0; s_it < desktops_length1; s_it = s_it + 1) {
- gchar* _tmp3_;
- gchar* s;
- _tmp3_ = g_strdup (s_collection[s_it]);
- s = _tmp3_;
- {
- gee_abstract_map_set ((GeeAbstractMap*) self->priv->players_DB, s, GINT_TO_POINTER (TRUE));
- _g_free0 (s);
- }
- }
- }
- result = TRUE;
- desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
- return result;
- desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
- goto __finally8;
- __catch8_g_key_file_error:
- {
- GError * _error_;
- _error_ = _inner_error_;
- _inner_error_ = NULL;
- g_warning ("familiar-players-db.vala:99: Error loading the Desktop string list");
- result = FALSE;
- _g_error_free0 (_error_);
- return result;
- }
- __finally8:
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return FALSE;
-}
-
-
-static void _vala_array_add1 (gchar*** array, int* length, int* size, gchar* value) {
- if ((*length) == (*size)) {
- *size = (*size) ? (2 * (*size)) : 4;
- *array = g_renew (gchar*, *array, (*size) + 1);
- }
- (*array)[(*length)++] = value;
- (*array)[*length] = NULL;
-}
-
-
-static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) {
- gboolean result = FALSE;
- GKeyFile* _tmp0_ = NULL;
- GKeyFile* keyfile;
- gchar** _tmp1_ = NULL;
- gint desktops_length1;
- gint _desktops_size_;
- gchar** _tmp2_;
- gchar** desktops;
- gsize data_length = 0UL;
- gchar* data;
- gsize _tmp10_;
- gchar* _tmp11_ = NULL;
- gchar* _tmp12_;
- gint _tmp13_;
- gboolean _tmp14_;
- gboolean _tmp15_;
- GError * _inner_error_ = NULL;
- g_return_val_if_fail (self != NULL, FALSE);
- _tmp0_ = g_key_file_new ();
- keyfile = _tmp0_;
- _tmp1_ = g_new0 (gchar*, 0 + 1);
- _tmp2_ = _tmp1_;
- desktops_length1 = 0;
- _desktops_size_ = desktops_length1;
- desktops = _tmp2_;
- {
- GeeSet* _tmp3_ = NULL;
- GeeSet* _tmp4_;
- GeeIterator* _tmp5_ = NULL;
- GeeIterator* _tmp6_;
- GeeIterator* _key_it;
- _tmp3_ = gee_map_get_keys ((GeeMap*) self->priv->players_DB);
- _tmp4_ = _tmp3_;
- _tmp5_ = gee_iterable_iterator ((GeeIterable*) _tmp4_);
- _key_it = (_tmp6_ = _tmp5_, _g_object_unref0 (_tmp4_), _tmp6_);
- while (TRUE) {
- gboolean _tmp7_;
- gpointer _tmp8_ = NULL;
- gchar* key;
- gchar* _tmp9_;
- _tmp7_ = gee_iterator_next (_key_it);
- if (!_tmp7_) {
- break;
- }
- _tmp8_ = gee_iterator_get (_key_it);
- key = (gchar*) _tmp8_;
- _tmp9_ = g_strdup (key);
- _vala_array_add1 (&desktops, &desktops_length1, &_desktops_size_, _tmp9_);
- _g_free0 (key);
- }
- _g_object_unref0 (_key_it);
- }
- g_key_file_set_string_list (keyfile, FAMILIAR_PLAYERS_DB_GROUP_NAME, FAMILIAR_PLAYERS_DB_KEY_NAME, (const gchar* const*) desktops, desktops_length1);
- data = NULL;
- _tmp11_ = g_key_file_to_data (keyfile, &_tmp10_, NULL);
- data_length = _tmp10_;
- _tmp12_ = _tmp11_;
- _g_free0 (data);
- data = _tmp12_;
- goto __finally9;
- __catch9_g_key_file_error:
- {
- GError * e;
- e = _inner_error_;
- _inner_error_ = NULL;
- g_warning ("familiar-players-db.vala:120: Problems dumping keyfile to a string");
- result = FALSE;
- _g_error_free0 (e);
- _g_free0 (data);
- desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
- _g_key_file_free0 (keyfile);
- return result;
- }
- __finally9:
- if (_inner_error_ != NULL) {
- _g_free0 (data);
- desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
- _g_key_file_free0 (keyfile);
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return FALSE;
- }
- _tmp13_ = g_mkdir_with_parents (self->priv->dir_name, 0700);
- if (_tmp13_ != 0) {
- g_warning ("familiar-players-db.vala:125: Unable to make directory: %s", self->priv->dir_name);
- result = FALSE;
- _g_free0 (data);
- desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
- _g_key_file_free0 (keyfile);
- return result;
- }
- _tmp14_ = g_file_set_contents (self->priv->file_name, data, (gssize) data_length, &_inner_error_);
- _tmp15_ = _tmp14_;
- if (_inner_error_ != NULL) {
- if (_inner_error_->domain == G_FILE_ERROR) {
- goto __catch10_g_file_error;
- }
- _g_free0 (data);
- desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
- _g_key_file_free0 (keyfile);
- g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return FALSE;
- }
- if (_tmp15_ == FALSE) {
- g_warning ("familiar-players-db.vala:131: Unable to write out file '%s'", self->priv->file_name);
- }
- goto __finally10;
- __catch10_g_file_error:
- {
- GError * err;
- err = _inner_error_;
- _inner_error_ = NULL;
- g_warning ("familiar-players-db.vala:135: Unable to write out file '%s'", self->priv->file_name);
- _g_error_free0 (err);
- }
- __finally10:
- if (_inner_error_ != NULL) {
- _g_free0 (data);
- desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
- _g_key_file_free0 (keyfile);
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return FALSE;
- }
- result = TRUE;
- _g_free0 (data);
- desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
- _g_key_file_free0 (keyfile);
- return result;
-}
-
-
-static gboolean _familiar_players_db_write_db_gsource_func (gpointer self) {
- gboolean result;
- result = familiar_players_db_write_db (self);
- return result;
-}
-
-
-void familiar_players_db_insert (FamiliarPlayersDB* self, const gchar* desktop) {
- gboolean _tmp0_;
- g_return_if_fail (self != NULL);
- g_return_if_fail (desktop != NULL);
- _tmp0_ = familiar_players_db_already_familiar (self, desktop);
- if (_tmp0_ == FALSE) {
- guint _tmp1_;
- gchar* _tmp2_ = NULL;
- gchar* _tmp3_;
- if (self->priv->write_id != 0) {
- g_source_remove (self->priv->write_id);
- self->priv->write_id = (guint) 0;
- }
- _tmp1_ = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 60, _familiar_players_db_write_db_gsource_func, g_object_ref (self), g_object_unref);
- self->priv->write_id = _tmp1_;
- _tmp2_ = g_strdup (desktop);
- _tmp3_ = _tmp2_;
- gee_abstract_map_set ((GeeAbstractMap*) self->priv->players_DB, _tmp3_, GINT_TO_POINTER (TRUE));
- _g_free0 (_tmp3_);
- }
-}
-
-
-static gchar* bool_to_string (gboolean self) {
- gchar* result = NULL;
- if (self) {
- gchar* _tmp0_;
- _tmp0_ = g_strdup ("true");
- result = _tmp0_;
- return result;
- } else {
- gchar* _tmp1_;
- _tmp1_ = g_strdup ("false");
- result = _tmp1_;
- return result;
- }
-}
-
-
-gboolean familiar_players_db_already_familiar (FamiliarPlayersDB* self, const gchar* desktop) {
- gboolean result = FALSE;
- GeeSet* _tmp0_ = NULL;
- GeeSet* _tmp1_;
- gboolean _tmp2_;
- gchar* _tmp3_ = NULL;
- gchar* _tmp4_;
- GeeSet* _tmp5_ = NULL;
- GeeSet* _tmp6_;
- gboolean _tmp7_;
- gboolean _tmp8_;
- g_return_val_if_fail (self != NULL, FALSE);
- g_return_val_if_fail (desktop != NULL, FALSE);
- _tmp0_ = gee_map_get_keys ((GeeMap*) self->priv->players_DB);
- _tmp1_ = _tmp0_;
- _tmp2_ = gee_collection_contains ((GeeCollection*) _tmp1_, desktop);
- _tmp3_ = bool_to_string (_tmp2_);
- _tmp4_ = _tmp3_;
- g_debug ("familiar-players-db.vala:154: playerDB->already_familiar - result %s", _tmp4_);
- _g_free0 (_tmp4_);
- _g_object_unref0 (_tmp1_);
- _tmp5_ = gee_map_get_keys ((GeeMap*) self->priv->players_DB);
- _tmp6_ = _tmp5_;
- _tmp7_ = gee_collection_contains ((GeeCollection*) _tmp6_, desktop);
- result = (_tmp8_ = _tmp7_, _g_object_unref0 (_tmp6_), _tmp8_);
- return result;
-}
-
-
-GeeSet* familiar_players_db_records (FamiliarPlayersDB* self) {
- GeeSet* result = NULL;
- GeeSet* _tmp0_ = NULL;
- g_return_val_if_fail (self != NULL, NULL);
- _tmp0_ = gee_map_get_keys ((GeeMap*) self->priv->players_DB);
- result = _tmp0_;
- return result;
-}
-
-
-gchar* familiar_players_db_fetch_icon_name (const gchar* desktop_path) {
- gchar* result = NULL;
- GKeyFile* _tmp0_ = NULL;
- GKeyFile* desktop_keyfile;
- gchar* _tmp1_ = NULL;
- gchar* _tmp2_;
- GError * _inner_error_ = NULL;
- g_return_val_if_fail (desktop_path != NULL, NULL);
- _tmp0_ = g_key_file_new ();
- desktop_keyfile = _tmp0_;
- g_key_file_load_from_file (desktop_keyfile, desktop_path, G_KEY_FILE_NONE, &_inner_error_);
- if (_inner_error_ != NULL) {
- if (_inner_error_->domain == G_FILE_ERROR) {
- goto __catch11_g_file_error;
- }
- if (_inner_error_->domain == G_KEY_FILE_ERROR) {
- goto __catch11_g_key_file_error;
- }
- _g_key_file_free0 (desktop_keyfile);
- g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return NULL;
- }
- goto __finally11;
- __catch11_g_file_error:
- {
- GError * _error_;
- _error_ = _inner_error_;
- _inner_error_ = NULL;
- g_warning ("familiar-players-db.vala:170: Error loading keyfile - FileError");
- result = NULL;
- _g_error_free0 (_error_);
- _g_key_file_free0 (desktop_keyfile);
- return result;
- }
- goto __finally11;
- __catch11_g_key_file_error:
- {
- GError * _error_;
- _error_ = _inner_error_;
- _inner_error_ = NULL;
- g_warning ("familiar-players-db.vala:174: Error loading keyfile - KeyFileError");
- result = NULL;
- _g_error_free0 (_error_);
- _g_key_file_free0 (desktop_keyfile);
- return result;
- }
- __finally11:
- if (_inner_error_ != NULL) {
- _g_key_file_free0 (desktop_keyfile);
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return NULL;
- }
- _tmp1_ = g_key_file_get_string (desktop_keyfile, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, &_inner_error_);
- _tmp2_ = _tmp1_;
- if (_inner_error_ != NULL) {
- if (_inner_error_->domain == G_KEY_FILE_ERROR) {
- goto __catch12_g_key_file_error;
- }
- _g_key_file_free0 (desktop_keyfile);
- g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return NULL;
- }
- result = _tmp2_;
- _g_key_file_free0 (desktop_keyfile);
- return result;
- goto __finally12;
- __catch12_g_key_file_error:
- {
- GError * _error_;
- _error_ = _inner_error_;
- _inner_error_ = NULL;
- g_warning ("familiar-players-db.vala:183: Error trying to fetch the icon name from" \
-" the keyfile");
- result = NULL;
- _g_error_free0 (_error_);
- _g_key_file_free0 (desktop_keyfile);
- return result;
- }
- __finally12:
- _g_key_file_free0 (desktop_keyfile);
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return NULL;
-}
-
-
-static void familiar_players_db_class_init (FamiliarPlayersDBClass * klass) {
- familiar_players_db_parent_class = g_type_class_peek_parent (klass);
- g_type_class_add_private (klass, sizeof (FamiliarPlayersDBPrivate));
- G_OBJECT_CLASS (klass)->finalize = familiar_players_db_finalize;
-}
-
-
-static void familiar_players_db_instance_init (FamiliarPlayersDB * self) {
- self->priv = FAMILIAR_PLAYERS_DB_GET_PRIVATE (self);
-}
-
-
-static void familiar_players_db_finalize (GObject* obj) {
- FamiliarPlayersDB * self;
- self = FAMILIAR_PLAYERS_DB (obj);
- _g_object_unref0 (self->priv->players_DB);
- _g_free0 (self->priv->file_name);
- _g_free0 (self->priv->dir_name);
- _g_key_file_free0 (self->priv->key_file);
- G_OBJECT_CLASS (familiar_players_db_parent_class)->finalize (obj);
-}
-
-
-GType familiar_players_db_get_type (void) {
- static volatile gsize familiar_players_db_type_id__volatile = 0;
- if (g_once_init_enter (&familiar_players_db_type_id__volatile)) {
- static const GTypeInfo g_define_type_info = { sizeof (FamiliarPlayersDBClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) familiar_players_db_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FamiliarPlayersDB), 0, (GInstanceInitFunc) familiar_players_db_instance_init, NULL };
- GType familiar_players_db_type_id;
- familiar_players_db_type_id = g_type_register_static (G_TYPE_OBJECT, "FamiliarPlayersDB", &g_define_type_info, 0);
- g_once_init_leave (&familiar_players_db_type_id__volatile, familiar_players_db_type_id);
- }
- return familiar_players_db_type_id__volatile;
-}
-
-
-static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
- if ((array != NULL) && (destroy_func != NULL)) {
- int i;
- for (i = 0; i < array_length; i = i + 1) {
- if (((gpointer*) array)[i] != NULL) {
- destroy_func (((gpointer*) array)[i]);
- }
- }
- }
-}
-
-
-static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
- _vala_array_destroy (array, array_length, destroy_func);
- g_free (array);
-}
-
-
-