aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common-defs.h1
-rw-r--r--src/metadata-menu-item.vala15
-rw-r--r--src/metadata-widget.c66
-rw-r--r--src/player-controller.vala10
4 files changed, 75 insertions, 17 deletions
diff --git a/src/common-defs.h b/src/common-defs.h
index b6799e8..b1b001e 100644
--- a/src/common-defs.h
+++ b/src/common-defs.h
@@ -75,6 +75,7 @@ typedef enum {
#define DBUSMENU_METADATA_MENUITEM_PLAYER_NAME "x-canonical-sound-menu-player-metadata-player-name"
#define DBUSMENU_METADATA_MENUITEM_PLAYER_ICON "x-canonical-sound-menu-player-metadata-player-icon"
#define DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING "x-canonical-sound-menu-player-metadata-player-running"
+#define DBUSMENU_METADATA_MENUITEM_HIDE_TRACK_DETAILS "x-canonical-sound-menu-player-metadata-hide-track-details"
#define DBUSMENU_SCRUB_MENUITEM_TYPE "x-canonical-sound-menu-player-scrub-type"
#define DBUSMENU_SCRUB_MENUITEM_DURATION "x-canonical-sound-menu-player-scrub-mpris:length"
diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala
index 1d50d38..5d32314 100644
--- a/src/metadata-menu-item.vala
+++ b/src/metadata-menu-item.vala
@@ -182,6 +182,21 @@ public class MetadataMenuitem : PlayerItem
this.property_set_bool (MENUITEM_PLAYER_RUNNING, update);
}
+ public void collapse()
+ {
+ this.property_set_bool (MENUITEM_HIDE_TRACK_DETAILS, true);
+ }
+
+ public void expand()
+ {
+ this.property_set_bool (MENUITEM_HIDE_TRACK_DETAILS, false);
+ }
+
+ public void populated()
+ {
+ //this.property_get (MENUITEM_TITLE
+ }
+
public static HashSet<string> attributes_format()
{
HashSet<string> attrs = new HashSet<string>();
diff --git a/src/metadata-widget.c b/src/metadata-widget.c
index 5937eb8..135aab0 100644
--- a/src/metadata-widget.c
+++ b/src/metadata-widget.c
@@ -35,14 +35,15 @@ typedef struct _MetadataWidgetPrivate MetadataWidgetPrivate;
struct _MetadataWidgetPrivate
{
gboolean theme_change_occured;
- GtkWidget* hbox;
+ GtkWidget* meta_data_h_box;
+ GtkWidget* meta_data_v_box;
GtkWidget* album_art;
GString* image_path;
GString* old_image_path;
GtkWidget* artist_label;
GtkWidget* piece_label;
GtkWidget* container_label;
- GtkWidget* player_label;
+ GtkWidget* player_label;
DbusmenuMenuitem* twin_item;
};
@@ -94,14 +95,19 @@ metadata_widget_class_init (MetadataWidgetClass *klass)
gobject_class->finalize = metadata_widget_finalize;
}
+
+
static void
metadata_widget_init (MetadataWidget *self)
{
MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self);
GtkWidget *hbox;
+ GtkWidget *outer_v_box;
+ outer_v_box = gtk_vbox_new (FALSE, 0);
hbox = gtk_hbox_new(FALSE, 0);
- priv->hbox = hbox;
+
+ priv->meta_data_h_box = hbox;
// image
priv->album_art = gtk_image_new();
@@ -112,7 +118,7 @@ metadata_widget_init (MetadataWidget *self)
G_CALLBACK(metadata_image_expose),
GTK_WIDGET(self));
- gtk_box_pack_start (GTK_BOX (priv->hbox),
+ gtk_box_pack_start (GTK_BOX (priv->meta_data_h_box),
priv->album_art,
FALSE,
FALSE,
@@ -154,15 +160,34 @@ metadata_widget_init (MetadataWidget *self)
gtk_box_pack_start (GTK_BOX (vbox), priv->artist_label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), priv->container_label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (priv->hbox), vbox, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->meta_data_h_box), vbox, FALSE, FALSE, 0);
g_signal_connect(self, "style-set",
G_CALLBACK(metadata_widget_set_style), GTK_WIDGET(self));
g_signal_connect (self, "selection-received",
G_CALLBACK(metadata_widget_selection_received_event_callback),
GTK_WIDGET(self));
- gtk_widget_set_size_request(GTK_WIDGET(self), 200, 75);
- gtk_container_add (GTK_CONTAINER (self), hbox);
+
+ // player label
+ GtkWidget* player_label;
+ player_label = gtk_label_new("TEST LABEL");
+ gtk_misc_set_alignment(GTK_MISC(player_label), (gfloat)0, (gfloat)0);
+ gtk_misc_set_padding (GTK_MISC(player_label), (gfloat)0, (gfloat)0);
+ gtk_widget_set_size_request (player_label, 140, 20);
+ priv->player_label = player_label;
+
+ gtk_box_pack_start (GTK_BOX(outer_v_box), priv->player_label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(outer_v_box), priv->meta_data_h_box, FALSE, FALSE, 0);
+
+ gtk_container_add (GTK_CONTAINER (self), outer_v_box);
+ gtk_widget_set_size_request(GTK_WIDGET(self), 200, 20);
+ gtk_widget_hide (priv->meta_data_h_box);
+ gtk_widget_hide (priv->artist_label);
+ gtk_widget_hide (priv->piece_label);
+ gtk_widget_hide (priv->container_label);
+ gtk_widget_hide (priv->album_art);
+ gtk_widget_hide (priv->meta_data_v_box);
+
}
static void
@@ -370,10 +395,6 @@ metadata_widget_selection_received_event_callback ( GtkWidget *widget,
gpointer user_data )
{
- //g_return_val_if_fail(IS_METADATA_WIDGET(user_data), FALSE);
- //MetadataWidget* widget = METADATA_WIDGET(user_data);
- //MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(widget);
- g_debug("metadata_widget_selection_request_event_callback");
draw_album_border(widget, TRUE);
}
@@ -435,7 +456,28 @@ metadata_widget_property_update(DbusmenuMenuitem* item, gchar* property,
//g_debug("the image update is a download so redraw");
gtk_widget_queue_draw(GTK_WIDGET(mitem));
}
- }
+ }
+ else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_HIDE_TRACK_DETAILS, property) == 0){
+
+ g_debug ("MetadataWidget::Prop update for DBUSMENU_METADATA_MENUITEM_HIDE_TRACK_DETAILS. Value = %i",
+ dbusmenu_menuitem_property_get_bool (priv->twin_item, DBUSMENU_METADATA_MENUITEM_HIDE_TRACK_DETAILS));
+
+ if (dbusmenu_menuitem_property_get_bool (priv->twin_item,
+ DBUSMENU_METADATA_MENUITEM_HIDE_TRACK_DETAILS) == TRUE){
+ gtk_widget_hide (priv->meta_data_h_box);
+ gtk_widget_hide (priv->artist_label);
+ gtk_widget_hide (priv->piece_label);
+ gtk_widget_hide (priv->container_label);
+ gtk_widget_hide (priv->album_art);
+ gtk_widget_hide (priv->meta_data_v_box);
+ gtk_widget_set_size_request(GTK_WIDGET(mitem), 200, 20);
+
+ }
+ else{
+ gtk_widget_show (priv->meta_data_h_box);
+ gtk_widget_set_size_request(GTK_WIDGET(mitem), 200, 85);
+ }
+ }
}
static void
diff --git a/src/player-controller.vala b/src/player-controller.vala
index a7c1424..3722fff 100644
--- a/src/player-controller.vala
+++ b/src/player-controller.vala
@@ -144,19 +144,19 @@ public class PlayerController : GLib.Object
public void update_layout()
{
PlaylistsMenuitem playlists_menuitem = this.custom_items[widget_order.PLAYLISTS] as PlaylistsMenuitem;
+ MetadataMenuitem metadata_menuitem = this.custom_items[widget_order.METADATA] as MetadataMenuitem;
if(this.current_state != state.CONNECTED){
// TODO
- // For now just set the visibility to true so that I can figure out what todo here.
- this.custom_items[widget_order.METADATA].property_set_bool (MENUITEM_PROP_VISIBLE,
- true);
+ metadata_menuitem.collapse ();
playlists_menuitem.root_item.property_set_bool (MENUITEM_PROP_VISIBLE,
false );
this.custom_items[widget_order.TRANSPORT].property_set_bool (MENUITEM_PROP_VISIBLE,
this.app_info.get_id() == "banshee.desktop");
return;
}
- this.custom_items[widget_order.METADATA].property_set_bool (MENUITEM_PROP_VISIBLE,
- this.custom_items[widget_order.METADATA].populated(MetadataMenuitem.attributes_format()));
+ metadata_menuitem.expand ();
+ /*this.custom_items[widget_order.METADATA].property_set_bool (MENUITEM_PROP_VISIBLE,
+ this.custom_items[widget_order.METADATA].populated(MetadataMenuitem.attributes_format()));*/
if (this.app_info.get_id() == "banshee.desktop"){
TransportMenuitem transport = this.custom_items[widget_order.TRANSPORT] as TransportMenuitem;
transport.handle_cached_action();