aboutsummaryrefslogtreecommitdiff
path: root/src/metadata-menu-item.c
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-09-28 15:17:30 -0400
committerKen VanDine <ken.vandine@canonical.com>2011-09-28 15:17:30 -0400
commite92bccafd8bc17ca37d48e78d497e1001dbaef80 (patch)
tree98e69ce3ea129c396840ef69a1feae40b01b5529 /src/metadata-menu-item.c
parent8b55a10546bbdee8fe0fa0088d751f885068ca94 (diff)
parentbf90e843f9ecc907ab917d3d3b540014137d6964 (diff)
downloadayatana-indicator-sound-e92bccafd8bc17ca37d48e78d497e1001dbaef80.tar.gz
ayatana-indicator-sound-e92bccafd8bc17ca37d48e78d497e1001dbaef80.tar.bz2
ayatana-indicator-sound-e92bccafd8bc17ca37d48e78d497e1001dbaef80.zip
releasing version 0.7.8-0ubuntu1
Diffstat (limited to 'src/metadata-menu-item.c')
-rw-r--r--src/metadata-menu-item.c608
1 files changed, 379 insertions, 229 deletions
diff --git a/src/metadata-menu-item.c b/src/metadata-menu-item.c
index 7e368e2..0e6f819 100644
--- a/src/metadata-menu-item.c
+++ b/src/metadata-menu-item.c
@@ -1,4 +1,4 @@
-/* metadata-menu-item.c generated by valac 0.12.1, the Vala compiler
+/* metadata-menu-item.c generated by valac 0.14.0, the Vala compiler
* generated from metadata-menu-item.vala, do not modify */
/*
@@ -165,9 +165,9 @@ void metadata_menuitem_fetch_art (MetadataMenuitem* self, const gchar* uri, cons
#define PLAYER_ITEM_EMPTY (-1)
FetchFile* fetch_file_new (const gchar* uri, const gchar* prop);
FetchFile* fetch_file_construct (GType object_type, const gchar* uri, const gchar* prop);
-static void _lambda0_ (MetadataMenuitem* self);
+static void __lambda0_ (MetadataMenuitem* self);
static void metadata_menuitem_on_fetcher_failed (MetadataMenuitem* self);
-static void __lambda0__fetch_file_failed (FetchFile* _sender, gpointer self);
+static void ___lambda0__fetch_file_failed (FetchFile* _sender, gpointer self);
static void metadata_menuitem_on_fetcher_completed (MetadataMenuitem* self, GByteArray* update, const gchar* property);
static void _metadata_menuitem_on_fetcher_completed_fetch_file_completed (FetchFile* _sender, GByteArray* data, const gchar* property, gpointer self);
void fetch_file_fetch_data (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
@@ -192,8 +192,10 @@ static void metadata_menuitem_finalize (GObject* obj);
MetadataMenuitem* metadata_menuitem_construct (GType object_type, PlayerController* parent) {
MetadataMenuitem * self = NULL;
+ PlayerController* _tmp0_;
g_return_val_if_fail (parent != NULL, NULL);
- self = (MetadataMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_METADATA_MENUITEM_TYPE, "owner", parent, NULL);
+ _tmp0_ = parent;
+ self = (MetadataMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_METADATA_MENUITEM_TYPE, "owner", _tmp0_, NULL);
return self;
}
@@ -207,18 +209,24 @@ static void metadata_menuitem_clean_album_art_temp_dir (void) {
const gchar* _tmp0_ = NULL;
gchar* _tmp1_ = NULL;
gchar* path;
- GFile* _tmp2_ = NULL;
+ const gchar* _tmp2_;
+ GFile* _tmp3_ = NULL;
GFile* album_art_dir;
- gboolean _tmp3_;
+ GFile* _tmp4_;
+ gboolean _tmp5_ = FALSE;
_tmp0_ = g_get_user_cache_dir ();
_tmp1_ = g_build_filename (_tmp0_, METADATA_MENUITEM_ALBUM_ART_DIR_SUFFIX, NULL);
path = _tmp1_;
- _tmp2_ = g_file_new_for_path (path);
- album_art_dir = _tmp2_;
- _tmp3_ = metadata_menuitem_delete_album_art_contents (album_art_dir);
- if (_tmp3_ == FALSE) {
+ _tmp2_ = path;
+ _tmp3_ = g_file_new_for_path (_tmp2_);
+ album_art_dir = _tmp3_;
+ _tmp4_ = album_art_dir;
+ _tmp5_ = metadata_menuitem_delete_album_art_contents (_tmp4_);
+ if (_tmp5_ == FALSE) {
+ const gchar* _tmp6_;
+ _tmp6_ = path;
g_warning ("metadata-menu-item.vala:58: could not remove the temp album art files " \
-"%s", path);
+"%s", _tmp6_);
}
_g_object_unref0 (album_art_dir);
_g_free0 (path);
@@ -230,12 +238,14 @@ static gchar* metadata_menuitem_create_album_art_temp_dir (void) {
const gchar* _tmp0_ = NULL;
gchar* _tmp1_ = NULL;
gchar* path;
- gint _tmp2_;
+ const gchar* _tmp2_;
+ gint _tmp3_ = 0;
_tmp0_ = g_get_user_cache_dir ();
_tmp1_ = g_build_filename (_tmp0_, METADATA_MENUITEM_ALBUM_ART_DIR_SUFFIX, NULL);
path = _tmp1_;
- _tmp2_ = g_mkdir (path, 0700);
- if (_tmp2_ == (-1)) {
+ _tmp2_ = path;
+ _tmp3_ = g_mkdir (_tmp2_, 0700);
+ if (_tmp3_ == (-1)) {
g_warning ("metadata-menu-item.vala:66: could not create a temp dir for remote alb" \
"um art, it must have been created already");
}
@@ -255,96 +265,126 @@ static const gchar* string_to_string (const gchar* self) {
static gboolean metadata_menuitem_delete_album_art_contents (GFile* dir) {
gboolean result = FALSE;
gboolean _result_;
- GFileEnumerator* _tmp0_ = NULL;
- GFileEnumerator* e;
GError * _inner_error_ = NULL;
g_return_val_if_fail (dir != NULL, FALSE);
_result_ = TRUE;
- _tmp0_ = g_file_enumerate_children (dir, G_FILE_ATTRIBUTE_STANDARD_NAME, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &_inner_error_);
- e = _tmp0_;
- if (_inner_error_ != NULL) {
- goto __catch2_g_error;
- }
- while (TRUE) {
- GFileInfo* _tmp1_ = NULL;
- GFileInfo* file;
- const gchar* _tmp2_ = NULL;
- const gchar* _tmp3_ = NULL;
- GFile* _tmp4_ = NULL;
- GFile* child;
- _tmp1_ = g_file_enumerator_next_file (e, NULL, &_inner_error_);
- file = _tmp1_;
+ {
+ GFile* _tmp0_;
+ GFileEnumerator* _tmp1_ = NULL;
+ GFileEnumerator* e;
+ _tmp0_ = dir;
+ _tmp1_ = g_file_enumerate_children (_tmp0_, G_FILE_ATTRIBUTE_STANDARD_NAME, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &_inner_error_);
+ e = _tmp1_;
if (_inner_error_ != NULL) {
- _g_object_unref0 (e);
goto __catch2_g_error;
}
- _tmp2_ = g_file_info_get_name (file);
- g_debug ("metadata-menu-item.vala:82: file name = %s", _tmp2_);
- if (file == NULL) {
- _g_object_unref0 (file);
- break;
- }
- _tmp3_ = g_file_info_get_name (file);
- _tmp4_ = g_file_get_child (dir, _tmp3_);
- child = _tmp4_;
- g_file_delete (child, NULL, &_inner_error_);
- if (_inner_error_ != NULL) {
- goto __catch3_g_error;
- }
- goto __finally3;
- __catch3_g_error:
- {
- GError * error_;
- gchar* _tmp5_ = NULL;
- gchar* _tmp6_;
- const gchar* _tmp7_ = NULL;
- const gchar* _tmp8_ = NULL;
- gchar* _tmp9_ = NULL;
- gchar* _tmp10_;
- error_ = _inner_error_;
- _inner_error_ = NULL;
- _tmp5_ = g_file_get_basename (child);
- _tmp6_ = _tmp5_;
- _tmp7_ = string_to_string (_tmp6_);
- _tmp8_ = string_to_string (error_->message);
- _tmp9_ = g_strconcat ("Unable to delete file '", _tmp7_, ": ", _tmp8_, NULL);
- _tmp10_ = _tmp9_;
- g_warning ("metadata-menu-item.vala:92: %s", _tmp10_);
- _g_free0 (_tmp10_);
- _g_free0 (_tmp6_);
- _result_ = FALSE;
- _g_error_free0 (error_);
- }
- __finally3:
- if (_inner_error_ != NULL) {
+ while (TRUE) {
+ GFileEnumerator* _tmp2_;
+ GFileInfo* _tmp3_ = NULL;
+ GFileInfo* file;
+ GFileInfo* _tmp4_;
+ const gchar* _tmp5_ = NULL;
+ GFileInfo* _tmp6_;
+ GFile* _tmp7_;
+ GFileInfo* _tmp8_;
+ const gchar* _tmp9_ = NULL;
+ GFile* _tmp10_ = NULL;
+ GFile* child;
+ _tmp2_ = e;
+ _tmp3_ = g_file_enumerator_next_file (_tmp2_, NULL, &_inner_error_);
+ file = _tmp3_;
+ if (_inner_error_ != NULL) {
+ _g_object_unref0 (e);
+ goto __catch2_g_error;
+ }
+ _tmp4_ = file;
+ _tmp5_ = g_file_info_get_name (_tmp4_);
+ g_debug ("metadata-menu-item.vala:82: file name = %s", _tmp5_);
+ _tmp6_ = file;
+ if (_tmp6_ == NULL) {
+ _g_object_unref0 (file);
+ break;
+ }
+ _tmp7_ = dir;
+ _tmp8_ = file;
+ _tmp9_ = g_file_info_get_name (_tmp8_);
+ _tmp10_ = g_file_get_child (_tmp7_, _tmp9_);
+ child = _tmp10_;
+ {
+ GFile* _tmp11_;
+ _tmp11_ = child;
+ g_file_delete (_tmp11_, NULL, &_inner_error_);
+ if (_inner_error_ != NULL) {
+ goto __catch3_g_error;
+ }
+ }
+ goto __finally3;
+ __catch3_g_error:
+ {
+ GError* error_ = NULL;
+ GFile* _tmp12_;
+ gchar* _tmp13_ = NULL;
+ gchar* _tmp14_;
+ const gchar* _tmp15_ = NULL;
+ GError* _tmp16_;
+ const gchar* _tmp17_;
+ const gchar* _tmp18_ = NULL;
+ gchar* _tmp19_ = NULL;
+ gchar* _tmp20_;
+ error_ = _inner_error_;
+ _inner_error_ = NULL;
+ _tmp12_ = child;
+ _tmp13_ = g_file_get_basename (_tmp12_);
+ _tmp14_ = _tmp13_;
+ _tmp15_ = string_to_string (_tmp14_);
+ _tmp16_ = error_;
+ _tmp17_ = _tmp16_->message;
+ _tmp18_ = string_to_string (_tmp17_);
+ _tmp19_ = g_strconcat ("Unable to delete file '", _tmp15_, ": ", _tmp18_, NULL);
+ _tmp20_ = _tmp19_;
+ g_warning ("metadata-menu-item.vala:92: %s", _tmp20_);
+ _g_free0 (_tmp20_);
+ _g_free0 (_tmp14_);
+ _result_ = FALSE;
+ _g_error_free0 (error_);
+ }
+ __finally3:
+ if (_inner_error_ != NULL) {
+ _g_object_unref0 (child);
+ _g_object_unref0 (file);
+ _g_object_unref0 (e);
+ goto __catch2_g_error;
+ }
_g_object_unref0 (child);
_g_object_unref0 (file);
- _g_object_unref0 (e);
- goto __catch2_g_error;
}
- _g_object_unref0 (child);
- _g_object_unref0 (file);
+ _g_object_unref0 (e);
}
- _g_object_unref0 (e);
goto __finally2;
__catch2_g_error:
{
- GError * _error_;
- gchar* _tmp11_ = NULL;
- gchar* _tmp12_;
- const gchar* _tmp13_ = NULL;
- gchar* _tmp14_ = NULL;
- gchar* _tmp15_;
+ GError* _error_ = NULL;
+ GFile* _tmp21_;
+ gchar* _tmp22_ = NULL;
+ gchar* _tmp23_;
+ const gchar* _tmp24_ = NULL;
+ gchar* _tmp25_ = NULL;
+ gchar* _tmp26_;
+ GError* _tmp27_;
+ const gchar* _tmp28_;
_error_ = _inner_error_;
_inner_error_ = NULL;
- _tmp11_ = g_file_get_basename (dir);
- _tmp12_ = _tmp11_;
- _tmp13_ = string_to_string (_tmp12_);
- _tmp14_ = g_strconcat ("Unable to read files from directory '", _tmp13_, "': %s", NULL);
- _tmp15_ = _tmp14_;
- g_warning (_tmp15_, _error_->message);
- _g_free0 (_tmp15_);
- _g_free0 (_tmp12_);
+ _tmp21_ = dir;
+ _tmp22_ = g_file_get_basename (_tmp21_);
+ _tmp23_ = _tmp22_;
+ _tmp24_ = string_to_string (_tmp23_);
+ _tmp25_ = g_strconcat ("Unable to read files from directory '", _tmp24_, "': %s", NULL);
+ _tmp26_ = _tmp25_;
+ _tmp27_ = _error_;
+ _tmp28_ = _tmp27_->message;
+ g_warning (_tmp26_, _tmp28_);
+ _g_free0 (_tmp26_);
+ _g_free0 (_tmp23_);
_result_ = FALSE;
_g_error_free0 (_error_);
}
@@ -363,22 +403,24 @@ static gchar* string_strip (const gchar* self) {
gchar* result = NULL;
gchar* _tmp0_ = NULL;
gchar* _result_;
+ const gchar* _tmp1_;
g_return_val_if_fail (self != NULL, NULL);
_tmp0_ = g_strdup (self);
_result_ = _tmp0_;
- g_strstrip (_result_);
+ _tmp1_ = _result_;
+ g_strstrip (_tmp1_);
result = _result_;
return result;
}
-static void _lambda0_ (MetadataMenuitem* self) {
+static void __lambda0_ (MetadataMenuitem* self) {
metadata_menuitem_on_fetcher_failed (self);
}
-static void __lambda0__fetch_file_failed (FetchFile* _sender, gpointer self) {
- _lambda0_ (self);
+static void ___lambda0__fetch_file_failed (FetchFile* _sender, gpointer self) {
+ __lambda0_ (self);
}
@@ -388,63 +430,90 @@ static void _metadata_menuitem_on_fetcher_completed_fetch_file_completed (FetchF
void metadata_menuitem_fetch_art (MetadataMenuitem* self, const gchar* uri, const gchar* prop) {
- GFile* _tmp0_ = NULL;
+ const gchar* _tmp0_;
+ GFile* _tmp1_ = NULL;
GFile* art_file;
- gboolean _tmp1_;
- FetchFile* _tmp10_ = NULL;
+ GFile* _tmp2_;
+ gboolean _tmp3_ = FALSE;
+ const gchar* _tmp19_;
+ const gchar* _tmp20_;
+ const gchar* _tmp21_;
+ const gchar* _tmp22_;
+ FetchFile* _tmp23_;
+ FetchFile* _tmp24_;
+ FetchFile* _tmp25_;
+ FetchFile* _tmp26_;
GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
g_return_if_fail (uri != NULL);
g_return_if_fail (prop != NULL);
- _tmp0_ = g_file_new_for_uri (uri);
- art_file = _tmp0_;
- _tmp1_ = g_file_is_native (art_file);
- if (_tmp1_ == TRUE) {
- gboolean _tmp2_;
+ _tmp0_ = uri;
+ _tmp1_ = g_file_new_for_uri (_tmp0_);
+ art_file = _tmp1_;
+ _tmp2_ = art_file;
+ _tmp3_ = g_file_is_native (_tmp2_);
+ if (_tmp3_ == TRUE) {
+ GFile* _tmp4_;
+ gboolean _tmp5_ = FALSE;
gchar* path = NULL;
- gchar* _tmp3_ = NULL;
- gchar* _tmp4_;
- gchar* _tmp5_ = NULL;
- gchar* _tmp6_;
- gchar* _tmp7_;
- gchar* _tmp8_ = NULL;
- gchar* _tmp9_;
- _tmp2_ = g_file_query_exists (art_file, NULL);
- if (_tmp2_ == FALSE) {
- dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, prop, PLAYER_ITEM_EMPTY);
+ _tmp4_ = art_file;
+ _tmp5_ = g_file_query_exists (_tmp4_, NULL);
+ if (_tmp5_ == FALSE) {
+ const gchar* _tmp6_;
+ _tmp6_ = prop;
+ dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, _tmp6_, PLAYER_ITEM_EMPTY);
_g_object_unref0 (art_file);
return;
}
- _tmp3_ = string_strip (uri);
- _tmp4_ = _tmp3_;
- _tmp5_ = g_filename_from_uri (_tmp4_, NULL, &_inner_error_);
- _tmp6_ = _tmp5_;
- _g_free0 (_tmp4_);
- _tmp7_ = _tmp6_;
- if (_inner_error_ != NULL) {
- if (_inner_error_->domain == G_CONVERT_ERROR) {
- goto __catch4_g_convert_error;
+ {
+ const gchar* _tmp7_;
+ gchar* _tmp8_ = NULL;
+ gchar* _tmp9_;
+ gchar* _tmp10_ = NULL;
+ gchar* _tmp11_;
+ gchar* _tmp12_;
+ const gchar* _tmp13_;
+ gchar* _tmp14_ = NULL;
+ gchar* _tmp15_;
+ const gchar* _tmp16_;
+ const gchar* _tmp17_;
+ _tmp7_ = uri;
+ _tmp8_ = string_strip (_tmp7_);
+ _tmp9_ = _tmp8_;
+ _tmp10_ = g_filename_from_uri (_tmp9_, NULL, &_inner_error_);
+ _tmp11_ = _tmp10_;
+ _g_free0 (_tmp9_);
+ _tmp12_ = _tmp11_;
+ if (_inner_error_ != NULL) {
+ if (_inner_error_->domain == G_CONVERT_ERROR) {
+ goto __catch4_g_convert_error;
+ }
+ _g_free0 (path);
+ _g_object_unref0 (art_file);
+ 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;
}
_g_free0 (path);
- _g_object_unref0 (art_file);
- 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;
+ path = _tmp12_;
+ _tmp13_ = uri;
+ _tmp14_ = string_strip (_tmp13_);
+ _tmp15_ = _tmp14_;
+ g_debug ("metadata-menu-item.vala:116: Populating the artwork field with %s", _tmp15_);
+ _g_free0 (_tmp15_);
+ _tmp16_ = prop;
+ _tmp17_ = path;
+ dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, _tmp16_, _tmp17_);
}
- _g_free0 (path);
- path = _tmp7_;
- _tmp8_ = string_strip (uri);
- _tmp9_ = _tmp8_;
- g_debug ("metadata-menu-item.vala:116: Populating the artwork field with %s", _tmp9_);
- _g_free0 (_tmp9_);
- dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, prop, path);
goto __finally4;
__catch4_g_convert_error:
{
- GError * e;
+ GError* e = NULL;
+ const gchar* _tmp18_;
e = _inner_error_;
_inner_error_ = NULL;
- g_warning ("metadata-menu-item.vala:120: Problem converting URI %s to file path", uri);
+ _tmp18_ = uri;
+ g_warning ("metadata-menu-item.vala:120: Problem converting URI %s to file path", _tmp18_);
_g_error_free0 (e);
}
__finally4:
@@ -459,17 +528,24 @@ void metadata_menuitem_fetch_art (MetadataMenuitem* self, const gchar* uri, cons
_g_object_unref0 (art_file);
return;
}
- g_debug ("metadata-menu-item.vala:126: fetch_art -remotely %s", metadata_menuitem_album_art_cache_dir);
- if (metadata_menuitem_album_art_cache_dir == NULL) {
+ _tmp19_ = metadata_menuitem_album_art_cache_dir;
+ g_debug ("metadata-menu-item.vala:126: fetch_art -remotely %s", _tmp19_);
+ _tmp20_ = metadata_menuitem_album_art_cache_dir;
+ if (_tmp20_ == NULL) {
_g_object_unref0 (art_file);
return;
}
- _tmp10_ = fetch_file_new (uri, prop);
+ _tmp21_ = uri;
+ _tmp22_ = prop;
+ _tmp23_ = fetch_file_new (_tmp21_, _tmp22_);
_g_object_unref0 (metadata_menuitem_fetcher);
- metadata_menuitem_fetcher = _tmp10_;
- g_signal_connect_object (metadata_menuitem_fetcher, "failed", (GCallback) __lambda0__fetch_file_failed, self, 0);
- g_signal_connect_object (metadata_menuitem_fetcher, "completed", (GCallback) _metadata_menuitem_on_fetcher_completed_fetch_file_completed, self, 0);
- fetch_file_fetch_data (metadata_menuitem_fetcher, NULL, NULL);
+ metadata_menuitem_fetcher = _tmp23_;
+ _tmp24_ = metadata_menuitem_fetcher;
+ g_signal_connect_object (_tmp24_, "failed", (GCallback) ___lambda0__fetch_file_failed, self, 0);
+ _tmp25_ = metadata_menuitem_fetcher;
+ g_signal_connect_object (_tmp25_, "completed", (GCallback) _metadata_menuitem_on_fetcher_completed_fetch_file_completed, self, 0);
+ _tmp26_ = metadata_menuitem_fetcher;
+ fetch_file_fetch_data (_tmp26_, NULL, NULL);
_g_object_unref0 (art_file);
}
@@ -487,70 +563,110 @@ static gpointer _g_object_ref0 (gpointer self) {
static void metadata_menuitem_on_fetcher_completed (MetadataMenuitem* self, GByteArray* update, const gchar* property) {
- GdkPixbufLoader* _tmp0_ = NULL;
- GdkPixbufLoader* loader;
- GdkPixbuf* _tmp1_ = NULL;
- GdkPixbuf* _tmp2_;
- GdkPixbuf* icon;
- gchar* _tmp3_ = NULL;
- gchar* path;
- gint _tmp4_;
- gint r;
GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
g_return_if_fail (update != NULL);
g_return_if_fail (property != NULL);
- _tmp0_ = gdk_pixbuf_loader_new ();
- loader = _tmp0_;
- gdk_pixbuf_loader_write (loader, update->data, (gsize) ((gint) update->len), &_inner_error_);
- if (_inner_error_ != NULL) {
- _g_object_unref0 (loader);
- goto __catch5_g_error;
- }
- gdk_pixbuf_loader_close (loader, &_inner_error_);
- if (_inner_error_ != NULL) {
- _g_object_unref0 (loader);
- goto __catch5_g_error;
- }
- _tmp1_ = gdk_pixbuf_loader_get_pixbuf (loader);
- _tmp2_ = _g_object_ref0 (_tmp1_);
- icon = _tmp2_;
- _tmp3_ = g_strconcat (metadata_menuitem_album_art_cache_dir, "/downloaded-coverart-XXXXXX", NULL);
- path = _tmp3_;
- _tmp4_ = g_mkstemp (path);
- r = _tmp4_;
- if (r != (-1)) {
- GdkPixbufFormat* _tmp5_ = NULL;
- const gchar* _tmp6_ = NULL;
- gchar* _tmp7_;
- _tmp5_ = gdk_pixbuf_loader_get_format (loader);
- _tmp6_ = gdk_pixbuf_format_get_name (_tmp5_);
- gdk_pixbuf_save (icon, path, _tmp6_, &_inner_error_, NULL);
+ {
+ GdkPixbufLoader* _tmp0_;
+ GdkPixbufLoader* loader;
+ GdkPixbufLoader* _tmp1_;
+ GByteArray* _tmp2_;
+ guint8* _tmp3_;
+ gint _tmp3__length1;
+ GdkPixbufLoader* _tmp4_;
+ GdkPixbufLoader* _tmp5_;
+ GdkPixbuf* _tmp6_ = NULL;
+ GdkPixbuf* _tmp7_;
+ GdkPixbuf* icon;
+ const gchar* _tmp8_;
+ gchar* _tmp9_ = NULL;
+ gchar* path;
+ const gchar* _tmp10_;
+ gint _tmp11_ = 0;
+ gint r;
+ gint _tmp12_;
+ _tmp0_ = gdk_pixbuf_loader_new ();
+ loader = _tmp0_;
+ _tmp1_ = loader;
+ _tmp2_ = update;
+ _tmp3_ = _tmp2_->data;
+ _tmp3__length1 = (gint) _tmp2_->len;
+ gdk_pixbuf_loader_write (_tmp1_, _tmp3_, (gsize) _tmp3__length1, &_inner_error_);
if (_inner_error_ != NULL) {
- _g_free0 (path);
- _g_object_unref0 (icon);
_g_object_unref0 (loader);
goto __catch5_g_error;
}
- dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, property, path);
- if (self->priv->previous_temp_album_art_path != NULL) {
- g_remove (self->priv->previous_temp_album_art_path);
+ _tmp4_ = loader;
+ gdk_pixbuf_loader_close (_tmp4_, &_inner_error_);
+ if (_inner_error_ != NULL) {
+ _g_object_unref0 (loader);
+ goto __catch5_g_error;
+ }
+ _tmp5_ = loader;
+ _tmp6_ = gdk_pixbuf_loader_get_pixbuf (_tmp5_);
+ _tmp7_ = _g_object_ref0 (_tmp6_);
+ icon = _tmp7_;
+ _tmp8_ = metadata_menuitem_album_art_cache_dir;
+ _tmp9_ = g_strconcat (_tmp8_, "/downloaded-coverart-XXXXXX", NULL);
+ path = _tmp9_;
+ _tmp10_ = path;
+ _tmp11_ = g_mkstemp (_tmp10_);
+ r = _tmp11_;
+ _tmp12_ = r;
+ if (_tmp12_ != (-1)) {
+ GdkPixbuf* _tmp13_;
+ const gchar* _tmp14_;
+ GdkPixbufLoader* _tmp15_;
+ GdkPixbufFormat* _tmp16_ = NULL;
+ const gchar* _tmp17_ = NULL;
+ const gchar* _tmp18_;
+ const gchar* _tmp19_;
+ const gchar* _tmp20_;
+ const gchar* _tmp22_;
+ gchar* _tmp23_;
+ _tmp13_ = icon;
+ _tmp14_ = path;
+ _tmp15_ = loader;
+ _tmp16_ = gdk_pixbuf_loader_get_format (_tmp15_);
+ _tmp17_ = gdk_pixbuf_format_get_name (_tmp16_);
+ gdk_pixbuf_save (_tmp13_, _tmp14_, _tmp17_, &_inner_error_, NULL);
+ if (_inner_error_ != NULL) {
+ _g_free0 (path);
+ _g_object_unref0 (icon);
+ _g_object_unref0 (loader);
+ goto __catch5_g_error;
+ }
+ _tmp18_ = property;
+ _tmp19_ = path;
+ dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, _tmp18_, _tmp19_);
+ _tmp20_ = self->priv->previous_temp_album_art_path;
+ if (_tmp20_ != NULL) {
+ const gchar* _tmp21_;
+ _tmp21_ = self->priv->previous_temp_album_art_path;
+ g_remove (_tmp21_);
+ }
+ _tmp22_ = path;
+ _tmp23_ = g_strdup (_tmp22_);
+ _g_free0 (self->priv->previous_temp_album_art_path);
+ self->priv->previous_temp_album_art_path = _tmp23_;
}
- _tmp7_ = g_strdup (path);
- _g_free0 (self->priv->previous_temp_album_art_path);
- self->priv->previous_temp_album_art_path = _tmp7_;
+ _g_free0 (path);
+ _g_object_unref0 (icon);
+ _g_object_unref0 (loader);
}
- _g_free0 (path);
- _g_object_unref0 (icon);
- _g_object_unref0 (loader);
goto __finally5;
__catch5_g_error:
{
- GError * e;
+ GError* e = NULL;
+ GError* _tmp24_;
+ const gchar* _tmp25_;
e = _inner_error_;
_inner_error_ = NULL;
+ _tmp24_ = e;
+ _tmp25_ = _tmp24_->message;
g_warning ("metadata-menu-item.vala:163: Problem creating file from bytearray fetc" \
-"hed from the interweb - error: %s", e->message);
+"hed from the interweb - error: %s", _tmp25_);
_g_error_free0 (e);
}
__finally5:
@@ -564,53 +680,75 @@ static void metadata_menuitem_on_fetcher_completed (MetadataMenuitem* self, GByt
static void metadata_menuitem_real_handle_event (DbusmenuMenuitem* base, const gchar* name, GVariant* input_value, guint timestamp) {
MetadataMenuitem * self;
- PlayerController* _tmp0_ = NULL;
+ PlayerController* _tmp0_;
+ PlayerController* _tmp1_;
+ gint _tmp2_;
self = (MetadataMenuitem*) base;
g_return_if_fail (name != NULL);
g_return_if_fail (input_value != NULL);
_tmp0_ = player_item_get_owner ((PlayerItem*) self);
- if (_tmp0_->current_state == PLAYER_CONTROLLER_STATE_OFFLINE) {
- PlayerController* _tmp1_ = NULL;
- _tmp1_ = player_item_get_owner ((PlayerItem*) self);
- player_controller_instantiate (_tmp1_);
+ _tmp1_ = _tmp0_;
+ _tmp2_ = _tmp1_->current_state;
+ if (_tmp2_ == ((gint) PLAYER_CONTROLLER_STATE_OFFLINE)) {
+ PlayerController* _tmp3_;
+ PlayerController* _tmp4_;
+ _tmp3_ = player_item_get_owner ((PlayerItem*) self);
+ _tmp4_ = _tmp3_;
+ player_controller_instantiate (_tmp4_);
} else {
- PlayerController* _tmp2_ = NULL;
- _tmp2_ = player_item_get_owner ((PlayerItem*) self);
- if (_tmp2_->current_state == PLAYER_CONTROLLER_STATE_CONNECTED) {
- PlayerController* _tmp3_ = NULL;
- _tmp3_ = player_item_get_owner ((PlayerItem*) self);
- mpris2_controller_expose (_tmp3_->mpris_bridge);
+ PlayerController* _tmp5_;
+ PlayerController* _tmp6_;
+ gint _tmp7_;
+ _tmp5_ = player_item_get_owner ((PlayerItem*) self);
+ _tmp6_ = _tmp5_;
+ _tmp7_ = _tmp6_->current_state;
+ if (_tmp7_ == ((gint) PLAYER_CONTROLLER_STATE_CONNECTED)) {
+ PlayerController* _tmp8_;
+ PlayerController* _tmp9_;
+ Mpris2Controller* _tmp10_;
+ _tmp8_ = player_item_get_owner ((PlayerItem*) self);
+ _tmp9_ = _tmp8_;
+ _tmp10_ = _tmp9_->mpris_bridge;
+ mpris2_controller_expose (_tmp10_);
}
}
}
void metadata_menuitem_alter_label (MetadataMenuitem* self, const gchar* new_title) {
+ const gchar* _tmp0_;
+ const gchar* _tmp1_;
g_return_if_fail (self != NULL);
g_return_if_fail (new_title != NULL);
- if (new_title == NULL) {
+ _tmp0_ = new_title;
+ if (_tmp0_ == NULL) {
return;
}
- dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME, new_title);
+ _tmp1_ = new_title;
+ dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME, _tmp1_);
}
void metadata_menuitem_toggle_active_triangle (MetadataMenuitem* self, gboolean update) {
+ gboolean _tmp0_;
g_return_if_fail (self != NULL);
g_debug ("metadata-menu-item.vala:189: toggle active triangle");
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING, update);
+ _tmp0_ = update;
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING, _tmp0_);
}
void metadata_menuitem_should_collapse (MetadataMenuitem* self, gboolean collapse) {
+ gboolean _tmp0_;
g_return_if_fail (self != NULL);
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_HIDE_TRACK_DETAILS, collapse);
+ _tmp0_ = collapse;
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_HIDE_TRACK_DETAILS, _tmp0_);
}
GeeHashSet* metadata_menuitem_attributes_format (void) {
GeeHashSet* result = NULL;
- GeeHashSet* _tmp0_ = NULL;
+ GeeHashSet* _tmp0_;
GeeHashSet* attrs;
_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
attrs = _tmp0_;
@@ -628,7 +766,7 @@ GeeHashSet* metadata_menuitem_attributes_format (void) {
GeeHashSet* metadata_menuitem_relevant_attributes_for_ui (void) {
GeeHashSet* result = NULL;
- GeeHashSet* _tmp0_ = NULL;
+ GeeHashSet* _tmp0_;
GeeHashSet* attrs;
_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
attrs = _tmp0_;
@@ -646,16 +784,22 @@ static GObject * metadata_menuitem_constructor (GType type, guint n_construct_pr
GObjectClass * parent_class;
MetadataMenuitem * self;
gchar* _tmp0_ = NULL;
- PlayerController* _tmp1_ = NULL;
- GAppInfo* _tmp2_ = NULL;
- const gchar* _tmp3_ = NULL;
- PlayerController* _tmp4_ = NULL;
- GAppInfo* _tmp5_ = NULL;
- const gchar* _tmp6_ = NULL;
- PlayerController* _tmp7_ = NULL;
- const gchar* _tmp8_ = NULL;
- GeeHashSet* _tmp9_ = NULL;
- GeeHashSet* _tmp10_;
+ PlayerController* _tmp1_;
+ PlayerController* _tmp2_;
+ GAppInfo* _tmp3_;
+ GAppInfo* _tmp4_;
+ const gchar* _tmp5_ = NULL;
+ PlayerController* _tmp6_;
+ PlayerController* _tmp7_;
+ GAppInfo* _tmp8_;
+ GAppInfo* _tmp9_;
+ const gchar* _tmp10_ = NULL;
+ PlayerController* _tmp11_;
+ PlayerController* _tmp12_;
+ const gchar* _tmp13_;
+ const gchar* _tmp14_;
+ GeeHashSet* _tmp15_ = NULL;
+ GeeHashSet* _tmp16_;
parent_class = G_OBJECT_CLASS (metadata_menuitem_parent_class);
obj = parent_class->constructor (type, n_construct_properties, construct_properties);
self = METADATA_MENUITEM (obj);
@@ -666,23 +810,29 @@ static GObject * metadata_menuitem_constructor (GType type, guint n_construct_pr
_g_free0 (metadata_menuitem_album_art_cache_dir);
metadata_menuitem_album_art_cache_dir = _tmp0_;
_tmp1_ = player_item_get_owner ((PlayerItem*) self);
- _tmp2_ = player_controller_get_app_info (_tmp1_);
- _tmp3_ = g_app_info_get_name (_tmp2_);
+ _tmp2_ = _tmp1_;
+ _tmp3_ = player_controller_get_app_info (_tmp2_);
+ _tmp4_ = _tmp3_;
+ _tmp5_ = g_app_info_get_name (_tmp4_);
g_debug ("metadata-menu-item.vala:42: JUST ABOUT TO ATTEMPT PLAYER NAME SETTING " \
-"%s", _tmp3_);
- _tmp4_ = player_item_get_owner ((PlayerItem*) self);
- _tmp5_ = player_controller_get_app_info (_tmp4_);
- _tmp6_ = g_app_info_get_name (_tmp5_);
- dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME, _tmp6_);
- _tmp7_ = player_item_get_owner ((PlayerItem*) self);
- _tmp8_ = player_controller_get_icon_name (_tmp7_);
- dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_ICON, _tmp8_);
+"%s", _tmp5_);
+ _tmp6_ = player_item_get_owner ((PlayerItem*) self);
+ _tmp7_ = _tmp6_;
+ _tmp8_ = player_controller_get_app_info (_tmp7_);
+ _tmp9_ = _tmp8_;
+ _tmp10_ = g_app_info_get_name (_tmp9_);
+ dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME, _tmp10_);
+ _tmp11_ = player_item_get_owner ((PlayerItem*) self);
+ _tmp12_ = _tmp11_;
+ _tmp13_ = player_controller_get_icon_name (_tmp12_);
+ _tmp14_ = _tmp13_;
+ dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_ICON, _tmp14_);
dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING, FALSE);
dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_HIDE_TRACK_DETAILS, TRUE);
- _tmp9_ = metadata_menuitem_relevant_attributes_for_ui ();
- _tmp10_ = _tmp9_;
- player_item_reset ((PlayerItem*) self, _tmp10_);
- _g_object_unref0 (_tmp10_);
+ _tmp15_ = metadata_menuitem_relevant_attributes_for_ui ();
+ _tmp16_ = _tmp15_;
+ player_item_reset ((PlayerItem*) self, _tmp16_);
+ _g_object_unref0 (_tmp16_);
return obj;
}