aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/metadata-widget.c84
-rw-r--r--src/transport-widget.c12
-rw-r--r--src/transport-widget.h9
3 files changed, 88 insertions, 17 deletions
diff --git a/src/metadata-widget.c b/src/metadata-widget.c
index fd36c01..52716ae 100644
--- a/src/metadata-widget.c
+++ b/src/metadata-widget.c
@@ -3,6 +3,7 @@ Copyright 2010 Canonical Ltd.
Authors:
Conor Curran <conor.curran@canonical.com>
+ Mirco Müller <mirco.mueller@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
@@ -26,7 +27,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "common-defs.h"
#include <gtk/gtk.h>
#include <glib.h>
-
+#include "transport-widget.h"
typedef struct _MetadataWidgetPrivate MetadataWidgetPrivate;
@@ -41,6 +42,7 @@ struct _MetadataWidgetPrivate
GtkWidget* piece_label;
GtkWidget* container_label;
DbusmenuMenuitem* twin_item;
+ gint artwork_offset;
};
#define METADATA_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), METADATA_WIDGET_TYPE, MetadataWidgetPrivate))
@@ -99,6 +101,7 @@ metadata_widget_init (MetadataWidget *self)
priv->album_art = gtk_image_new();
priv->image_path = g_string_new(dbusmenu_menuitem_property_get(priv->twin_item, DBUSMENU_METADATA_MENUITEM_ARTURL));
priv->old_image_path = g_string_new("");
+ priv->artwork_offset = 2;
//g_debug("Metadata::At startup and image path = %s", priv->image_path->str);
g_signal_connect(priv->album_art, "expose-event",
@@ -106,7 +109,11 @@ metadata_widget_init (MetadataWidget *self)
GTK_WIDGET(self));
gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60);
- gtk_box_pack_start (GTK_BOX (priv->hbox), priv->album_art, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->hbox),
+ priv->album_art,
+ FALSE,
+ FALSE,
+ priv->artwork_offset * 2);
priv->theme_change_occured = FALSE;
@@ -156,7 +163,7 @@ metadata_widget_init (MetadataWidget *self)
g_signal_connect(self, "style-set", G_CALLBACK(metadata_widget_set_style), GTK_WIDGET(self));
gtk_widget_set_size_request(GTK_WIDGET(self), 200, 65);
- gtk_container_add (GTK_CONTAINER (self), hbox);
+ gtk_container_add (GTK_CONTAINER (self), hbox);
}
static void
@@ -209,6 +216,56 @@ metadata_image_expose (GtkWidget *metadata, GdkEventExpose *event, gpointer user
return TRUE;
}
+
+static void
+draw_gradient (cairo_t* cr,
+ GtkAllocation alloc,
+ double* rgba_start,
+ double* rgba_end)
+{
+ cairo_pattern_t* pattern = NULL;
+ cairo_rectangle (cr,
+ alloc.x, alloc.y,
+ alloc.width, alloc.height);
+
+ cairo_clip(cr);
+
+ cairo_move_to (cr, alloc.x , alloc.y);
+ cairo_line_to(cr, alloc.x + alloc.width,
+ alloc.y);
+ cairo_line_to(cr, alloc.x + alloc.width,
+ alloc.y + alloc.height);
+ cairo_line_to(cr, alloc.x, alloc.y + alloc.height);
+ cairo_line_to(cr, alloc.x, alloc.y);
+
+ cairo_close_path (cr);
+
+ cairo_set_line_width (cr, 3.0);
+ CairoColorRGB darkened_top_color;
+
+ _color_shade (&rgba_end, 0.8, &color_button[2]);
+
+ pattern = cairo_pattern_create_linear (alloc.x,
+ alloc.y,
+ alloc.x,
+ alloc.y + alloc.height);
+ cairo_pattern_add_color_stop_rgba (pattern,
+ 0.0f,
+ rgba_start[0],
+ rgba_start[1],
+ rgba_start[2],
+ rgba_start[3]);
+ cairo_pattern_add_color_stop_rgba (pattern,
+ 1.0f,
+ rgba_end[0],
+ rgba_end[1],
+ rgba_end[2],
+ rgba_end[3]);
+ cairo_set_source (cr, pattern);
+ cairo_stroke (cr);
+ cairo_pattern_destroy (pattern);
+}
+
static void
draw_album_border(GtkWidget *metadata)
{
@@ -225,8 +282,23 @@ draw_album_border(GtkWidget *metadata)
alloc.height = alloc.height + (offset * 2);
alloc.x = alloc.x - offset;
alloc.y = alloc.y - offset;
-
- cairo_rectangle (cr,
+
+ double start_colour[] = { style->bg[0].red/65535.0,
+ style->bg[0].green/65535.0,
+ style->bg[0].blue/65535.0,
+ 1.0f };
+
+ double end_colour[] = { style->fg[0].red/65535.0,
+ style->fg[0].green/65535.0,
+ style->fg[0].blue/65535.0,
+ 1.0f};
+
+ draw_gradient(cr,
+ alloc,
+ start_colour,
+ end_colour);
+
+ /*cairo_rectangle (cr,
alloc.x, alloc.y,
alloc.width, alloc.height);
cairo_clip(cr);
@@ -249,7 +321,7 @@ draw_album_border(GtkWidget *metadata)
0.6);
cairo_set_line_width (cr, 2.0);
- cairo_stroke (cr);
+ cairo_stroke (cr);*/
}
static void
diff --git a/src/transport-widget.c b/src/transport-widget.c
index 1f023a9..ad044da 100644
--- a/src/transport-widget.c
+++ b/src/transport-widget.c
@@ -69,7 +69,6 @@ Uses code from ctk
#define INNER_COMPRESSED_START_SHADE 0.95
#define INNER_COMPRESSED_END_SHADE 1.05
-
typedef struct _TransportWidgetPrivate TransportWidgetPrivate;
struct _TransportWidgetPrivate
@@ -80,14 +79,6 @@ struct _TransportWidgetPrivate
DbusmenuMenuitem* twin_item;
};
-typedef struct
-{
- double r;
- double g;
- double b;
-} CairoColorRGB;
-
-
#define TRANSPORT_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRANSPORT_WIDGET_TYPE, TransportWidgetPrivate))
/* Gobject boiler plate */
@@ -117,7 +108,6 @@ static void transport_widget_menu_hidden ( GtkWidget *menu,
static void transport_widget_notify ( TransportWidget *item,
GParamSpec *pspec,
gpointer user_data );
-
static TransportWidgetEvent transport_widget_determine_button_event ( TransportWidget* button,
GdkEventButton* event);
static void transport_widget_react_to_button_release ( TransportWidget* button,
@@ -743,7 +733,7 @@ _color_hls_to_rgb (gdouble *h,
}
}
-static void
+void
_color_shade (const CairoColorRGB *a, float k, CairoColorRGB *b)
{
double red;
diff --git a/src/transport-widget.h b/src/transport-widget.h
index 337ccdf..6ccce05 100644
--- a/src/transport-widget.h
+++ b/src/transport-widget.h
@@ -55,6 +55,15 @@ struct _TransportWidget {
GtkMenuItem parent;
};
+typedef struct
+{
+ double r;
+ double g;
+ double b;
+} CairoColorRGB;
+
+
+void _color_shade (const CairoColorRGB *a, float k, CairoColorRGB *b);
GType transport_widget_get_type (void);
GtkWidget* transport_widget_new ( DbusmenuMenuitem *item );