aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-09-01 17:51:30 +0100
committerConor Curran <conor.curran@canonical.com>2010-09-01 17:51:30 +0100
commitbb73e65c4fd9f698050ff1d2ddb71fc35bac6803 (patch)
tree91441c76f5795be8640d760068a015efb844cd29
parent9ab9b175e1f77457157211f5f93c54e8ae87e3dc (diff)
downloadayatana-indicator-sound-bb73e65c4fd9f698050ff1d2ddb71fc35bac6803.tar.gz
ayatana-indicator-sound-bb73e65c4fd9f698050ff1d2ddb71fc35bac6803.tar.bz2
ayatana-indicator-sound-bb73e65c4fd9f698050ff1d2ddb71fc35bac6803.zip
last fm art work should load correctly now
-rw-r--r--src/common-defs.h2
-rw-r--r--src/fetch-file.vala22
-rw-r--r--src/metadata-widget.c14
-rw-r--r--src/player-item.vala9
-rw-r--r--src/sound-service.c4
5 files changed, 34 insertions, 17 deletions
diff --git a/src/common-defs.h b/src/common-defs.h
index faffcb2..2590692 100644
--- a/src/common-defs.h
+++ b/src/common-defs.h
@@ -25,7 +25,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#define SIGNAL_SINK_AVAILABLE_UPDATE "SinkAvailableUpdate"
#define DBUSMENU_PROPERTY_EMPTY -1
-#define DBUSMENU_PLAYERITEM_REMOTE_FILEPATH "/home/ronoc/Desktop/tempy"
+#define DBUSMENU_PLAYER_ITEM_REMOTE_FILEPATH "/home/ronoc/Desktop/tempy"
/* DBUS Custom Items */
#define DBUSMENU_VOLUME_MENUITEM_TYPE "x-canonical-ido-volume-type"
diff --git a/src/fetch-file.vala b/src/fetch-file.vala
index f172853..1811cc1 100644
--- a/src/fetch-file.vala
+++ b/src/fetch-file.vala
@@ -1,3 +1,24 @@
+/*
+ * Copyright (C) 2010 Canonical, Ltd.
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License
+ * version 3.0 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3.0 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Authors
+ * Gordon Allott <gord.allott@canonical.com>
+ * Conor Curran <conor.curran@canonical.com>
+ */
+
public class FetchFile : Object
{
/* public variables */
@@ -26,7 +47,6 @@ public class FetchFile : Object
public async void fetch_data ()
{
- //grab our data from our uri
try {
this.stream = new DataInputStream(this.file.read(null));
this.stream.set_byte_order (DataStreamByteOrder.LITTLE_ENDIAN);
diff --git a/src/metadata-widget.c b/src/metadata-widget.c
index 72acc8c..cfff098 100644
--- a/src/metadata-widget.c
+++ b/src/metadata-widget.c
@@ -105,7 +105,7 @@ metadata_widget_init (MetadataWidget *self)
priv->album_art = gtk_image_new();
priv->image_path = g_string_new(dbusmenu_menuitem_property_get(twin_item, DBUSMENU_METADATA_MENUITEM_ARTURL));
priv->old_image_path = g_string_new("");
- priv->remote_image_path = g_string_new(DBUSMENU_PLAYERITEM_REMOTE_FILEPATH);
+ priv->remote_image_path = g_string_new(DBUSMENU_PLAYER_ITEM_REMOTE_FILEPATH);
g_debug("Metadata::At startup and image path = %s", priv->image_path->str);
g_signal_connect(priv->album_art, "expose-event",
@@ -178,10 +178,6 @@ metadata_widget_finalize (GObject *object)
G_OBJECT_CLASS (metadata_widget_parent_class)->finalize (object);
}
-static void metadata_load_new_image(MetadataWidget* self)
-{
-}
-
/**
* We override the expose method to enable primitive drawing of the
* empty album art image (and soon rounded rectangles on the album art)
@@ -322,10 +318,12 @@ metadata_widget_property_update(DbusmenuMenuitem* item, gchar* property,
}
else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ARTURL, property) == 0){
g_string_erase(priv->image_path, 0, -1);
- //gchar* empty = "";
- g_string_erase(priv->old_image_path, 0, -1);
g_string_overwrite(priv->image_path, 0, g_value_get_string (value));
- //g_free(empty);
+ // Basically force expose the reload the image because we have an image update
+ // but we are using remote images i.e. the same file
+ if(g_string_equal(priv->image_path, priv->remote_image_path) == TRUE){
+ g_string_erase(priv->old_image_path, 0, -1);
+ }
}
}
diff --git a/src/player-item.vala b/src/player-item.vala
index 7de6840..1e16742 100644
--- a/src/player-item.vala
+++ b/src/player-item.vala
@@ -20,6 +20,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
using Dbusmenu;
using Gee;
using Gdk;
+using DbusmenuPlayer;
public class PlayerItem : Dbusmenu.Menuitem
{
@@ -128,18 +129,16 @@ public class PlayerItem : Dbusmenu.Menuitem
private void on_fetcher_completed(ByteArray update, string property)
{
- string temp_path = "/home/ronoc/Desktop/tempy";
- //"/tmp/indicator-sound-remote-image";
try{
PixbufLoader loader = new PixbufLoader ();
loader.write (update.data, update.len);
loader.close ();
Pixbuf icon = loader.get_pixbuf ();
- icon.save (temp_path, loader.get_format().get_name());
- this.property_set(property, temp_path);
+ icon.save (ITEM_REMOTE_FILEPATH, loader.get_format().get_name());
+ this.property_set(property, ITEM_REMOTE_FILEPATH);
}
catch(GLib.Error e){
- warning("Problem taking file from the interweb - error: %s",
+ warning("Problem fetching file from the interweb - error: %s",
e.message);
}
}
diff --git a/src/sound-service.c b/src/sound-service.c
index 42ce116..12f067e 100644
--- a/src/sound-service.c
+++ b/src/sound-service.c
@@ -41,8 +41,8 @@ service_shutdown (IndicatorService *service, gpointer user_data)
if (mainloop != NULL) {
g_debug("Service shutdown !");
// TODO: uncomment for release !!
- //close_pulse_activites();
- //g_main_loop_quit(mainloop);
+ close_pulse_activites();
+ g_main_loop_quit(mainloop);
}
return;
}