From 1b9837ab2ddfac074149d020e700e9272579b211 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 21 Jun 2010 11:36:58 +0100 Subject: lots of changes --- src/Makefile.am | 5 ++++- src/common-defs.h | 6 +++--- src/metadata-menu-item.vala | 28 +++++++++++++++++++++------- src/metadata-widget.c | 8 ++++---- src/mpris-controller.vala | 13 ++++++------- src/player-controller.vala | 21 ++++++--------------- src/sound-service.c | 4 ++-- src/transport-menu-item.vala | 15 ++++----------- src/transport-widget.c | 20 +++++++++++++++++++- 9 files changed, 69 insertions(+), 51 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 5a42dc6..e556eed 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -56,17 +56,20 @@ music_bridge_VALASOURCES = \ metadata-menu-item.vala \ player-controller.vala \ mpris-controller-v2.vala \ - mpris-controller.vala + mpris-controller.vala \ + player-item.vala music_bridge_VALAFLAGS = \ --ccode \ -H music-player-bridge.h -d . \ --library music-bridge \ --vapidir=./ \ + --vapidir=$(topsrcdir)/vapi \ --thread \ --pkg gee-1.0 \ --pkg Indicate-0.2 \ --pkg Dbusmenu-Glib-0.2 \ + --pkg music-bridge \ --pkg dbus-glib-1 $(MAINTAINER_VALAFLAGS) diff --git a/src/common-defs.h b/src/common-defs.h index 014d864..d35c672 100644 --- a/src/common-defs.h +++ b/src/common-defs.h @@ -31,6 +31,6 @@ with this program. If not, see . #define DBUSMENU_METADATA_MENUITEM_TYPE "x-canonical-metadata-menu-item" #define DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST "x-canonical-metadata-text-artist" -#define DBUSMENU_METADATA_MENUITEM_TEXT_PIECE "x-canonical-metadata-text-piece" -#define DBUSMENU_METADATA_MENUITEM_TEXT_CONTAINER "x-canonical-metadata-text-container" -#define DBUSMENU_METADATA_MENUITEM_IMAGE_PATH "x-canonical-metadata-image" +#define DBUSMENU_METADATA_MENUITEM_TEXT_TITLE "x-canonical-metadata-text-title" +#define DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM "x-canonical-metadata-text-album" +#define DBUSMENU_METADATA_MENUITEM_IMAGE_PATH "x-canonical-metadata-image" diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 82926b1..28e034a 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -1,21 +1,23 @@ using Dbusmenu; using Gee; +using CommonDefs; -public class MetadataMenuitem : Dbusmenu.Menuitem +public class MetadataMenuitem : PlayerItem { /* Not ideal duplicate definition of const - see common-defs/h */ - const string DBUSMENU_METADATA_MENUITEM_TYPE = "x-canonical-metadata-menu-item"; - const string DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST = "x-canonical-metadata-text-artist"; - const string DBUSMENU_METADATA_MENUITEM_TEXT_PIECE = "x-canonical-metadata-text-piece"; - const string DBUSMENU_METADATA_MENUITEM_TEXT_CONTAINER = "x-canonical-metadata-text-container"; - const string DBUSMENU_METADATA_MENUITEM_IMAGE_PATH = "x-canonical-metadata-image"; + //const string DBUSMENU_METADATA_MENUITEM_TYPE = "x-canonical-metadata-menu-item"; + //const string DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST = "x-canonical-metadata-text-artist"; + //const string DBUSMENU_METADATA_MENUITEM_TEXT_TITLE = "x-canonical-metadata-text-title"; + //const string DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM = "x-canonical-metadata-text-album"; + //const string DBUSMENU_METADATA_MENUITEM_IMAGE_PATH = "x-canonical-metadata-image"; public MetadataMenuitem() { this.property_set(MENUITEM_PROP_TYPE, DBUSMENU_METADATA_MENUITEM_TYPE); + } - public void update(HashMap data) + public override void update(HashMap data) { this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST, data.get("artist").strip()); this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_PIECE, data.get("title").strip()); @@ -37,4 +39,16 @@ public class MetadataMenuitem : Dbusmenu.Menuitem { debug("MetadataItem -> handle event caught!"); } + + public static HashMap attributes() + { + HashMap result = new HashMap(); + result.set(DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST, typeof(string)); + result.set("x-canonical-metadata-text-title", typeof(string)); + result.set("x-canonical-metadata-text-album", typeof(string)); + result.set("x-canonical-metadata-text-image", typeof(string)); + + return result; + } + } \ No newline at end of file diff --git a/src/metadata-widget.c b/src/metadata-widget.c index c4d3b50..b2ca255 100644 --- a/src/metadata-widget.c +++ b/src/metadata-widget.c @@ -106,13 +106,13 @@ metadata_widget_init (MetadataWidget *self) // piece GtkWidget* piece; - piece = gtk_label_new(dbusmenu_menuitem_property_get(twin_item, DBUSMENU_METADATA_MENUITEM_TEXT_PIECE)); + piece = gtk_label_new(dbusmenu_menuitem_property_get(twin_item, DBUSMENU_METADATA_MENUITEM_TEXT_TITLE)); priv->piece_label = piece; // container GtkWidget* container; - container = gtk_label_new(dbusmenu_menuitem_property_get(twin_item, DBUSMENU_METADATA_MENUITEM_TEXT_CONTAINER)); + container = gtk_label_new(dbusmenu_menuitem_property_get(twin_item, DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM)); priv->container_label = container; // Pack in the right order @@ -171,10 +171,10 @@ metadata_widget_property_update(DbusmenuMenuitem* item, gchar* property, if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST, property) == 0){ gtk_label_set_text(GTK_LABEL(priv->artist_label), g_value_get_string(value)); } - else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_TEXT_PIECE, property) == 0){ + else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_TEXT_TITLE, property) == 0){ gtk_label_set_text(GTK_LABEL(priv->piece_label), g_value_get_string(value)); } - else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_TEXT_CONTAINER, property) == 0){ + else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM, property) == 0){ gtk_label_set_text(GTK_LABEL(priv->container_label), g_value_get_string(value)); } else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_IMAGE_PATH, property) == 0){ diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index 7e65594..cd1d2db 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -76,13 +76,12 @@ public class MprisController : GLib.Object private void onStatusChange(dynamic DBus.Object mpris_client, status st) { debug("onStatusChange - signal received"); - //ValueArray a = new ValueArray(4); - //Value v = new Value(typeof(int32)); - //v.set_int(st.playback); - //a.append(v); - //debug("onStatusChange - play %i", a.get_nth(0).get_int()); - //int playback = (ValueArray)st.get_nth(0).get_int(); - //int shuffle = ar.get_nth(1).get_int(); + status* status = &st; + unowned ValueArray ar = (ValueArray)status; + + int playback = ar.get_nth(0).get_int(); + debug("onStatusChange - play %i", ar.get_nth(0).get_int()); + //int repeat = ar.get_nth(2).get_int(); //int endless = ar.get_nth(3).get_int(); } diff --git a/src/player-controller.vala b/src/player-controller.vala index aa72cac..22a200e 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -29,7 +29,7 @@ public class PlayerController : GLib.Object private Dbusmenu.Menuitem root_menu; private string name; private bool is_active; - private ArrayList custom_items; + private ArrayList custom_items; private MprisController mpris_adaptor; public PlayerController(Dbusmenu.Menuitem root, string client_name, bool active) @@ -37,7 +37,7 @@ public class PlayerController : GLib.Object this.root_menu = root; this.name = format_client_name(client_name.strip()); this.is_active = active; - this.custom_items = new ArrayList(); + this.custom_items = new ArrayList(); self_construct(); // Temporary scenario to handle both v1 and v2 of MPRIS. @@ -48,11 +48,7 @@ public class PlayerController : GLib.Object this.mpris_adaptor = new MprisController(this.name, this); } - // TODO subclass dbusmenuMenuitem to something like a playermenuitem - // and use this type to collectively - // control widgets. - TransportMenuitem t = (TransportMenuitem)this.custom_items[TRANSPORT]; - t.set_adaptor(this.mpris_adaptor); + this.custom_items[TRANSPORT].set_adaptor(this.mpris_adaptor); } public void vanish() @@ -65,15 +61,10 @@ public class PlayerController : GLib.Object private bool self_construct() { // Separator item - Dbusmenu.Menuitem separator_item = new Dbusmenu.Menuitem(); - separator_item.property_set(MENUITEM_PROP_TYPE, CLIENT_TYPES_SEPARATOR); - this.custom_items.add(separator_item); + this.custom_items.add(PlayerItem.new_separator_item()); // Title item - Dbusmenu.Menuitem title_item = new Dbusmenu.Menuitem(); - title_item.property_set(MENUITEM_PROP_LABEL, this.name); - title_item.property_set(MENUITEM_PROP_ICON_NAME, "applications-multimedia"); - this.custom_items.add(title_item); + this.custom_items.add(PlayerItem.new_title_item(this.name)); // Metadata item MetadataMenuitem metadata_item = new MetadataMenuitem(); @@ -84,7 +75,7 @@ public class PlayerController : GLib.Object this.custom_items.add(transport_item); int offset = 2; - foreach(Dbusmenu.Menuitem item in this.custom_items){ + foreach(PlayerItem item in this.custom_items){ root_menu.child_add_position(item, offset + this.custom_items.index_of(item)); } return true; diff --git a/src/sound-service.c b/src/sound-service.c index bcdac07..ea04e4b 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -45,8 +45,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; } diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala index 2e1ed0b..7dc1c7f 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -21,31 +21,24 @@ with this program. If not, see . using Dbusmenu; using Gee; -public class TransportMenuitem : Dbusmenu.Menuitem +public class TransportMenuitem : PlayerItem { /* Not ideal duplicate definition of const - see common-defs/h */ const string DBUSMENU_TRANSPORT_MENUITEM_TYPE = "x-canonical-transport-bar"; const string DBUSMENU_TRANSPORT_MENUITEM_STATE = "x-canonical-transport-state"; - private MprisController mpris_adaptor; public TransportMenuitem() { this.property_set(MENUITEM_PROP_TYPE, DBUSMENU_TRANSPORT_MENUITEM_TYPE); - // Hardcode the set up state until we can get the struct vala bug fixed this.property_set_bool(DBUSMENU_TRANSPORT_MENUITEM_STATE, false); debug("transport on the vala side"); } - public void set_adaptor(MprisController adaptor) + public override void update(HashMap data) { - this.mpris_adaptor = adaptor; + debug("TransportMenuitem::update()"); } - - /** - Callback method for the handle_event - * TRUE => Playing - * FALSE => Paused - **/ + public override void handle_event(string name, GLib.Value input_value, uint timestamp) { debug("handle_event with bool value %s", input_value.get_boolean().to_string()); diff --git a/src/transport-widget.c b/src/transport-widget.c index c53513d..10b96df 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -61,7 +61,9 @@ static gboolean transport_widget_button_press_event (GtkWidget *men GdkEventButton *event); static gboolean transport_widget_button_release_event (GtkWidget *menuitem, GdkEventButton *event); - +static void transport_widget_play_clicked (GtkWidget* button, + TransportWidget* self); + static void transport_widget_property_update(DbusmenuMenuitem* item, gchar * property, GValue * value, @@ -78,7 +80,9 @@ transport_widget_class_init (TransportWidgetClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + GtkMenuItemClass *menu_item_class = GTK_MENU_ITEM_CLASS(klass); + menu_item_class->hide_on_activate = FALSE; widget_class->button_press_event = transport_widget_button_press_event; widget_class->button_release_event = transport_widget_button_release_event; @@ -143,6 +147,8 @@ transport_widget_init (TransportWidget *self) g_signal_connect(G_OBJECT(twin_item), "property-changed", G_CALLBACK(transport_widget_property_update), self); + g_signal_connect(priv->play_button, "clicked", G_CALLBACK(transport_widget_play_clicked), self); + gtk_container_add (GTK_CONTAINER (self), priv->hbox); gtk_widget_show_all (priv->hbox); @@ -166,8 +172,10 @@ transport_widget_button_press_event (GtkWidget *menuitem, GdkEventButton *event) { g_debug("TransportWidget::menu_press_event"); + TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE(TRANSPORT_WIDGET(menuitem)); + gtk_widget_event (priv->hbox, (GdkEvent*)event); gboolean state = g_ascii_strcasecmp(gtk_button_get_label(GTK_BUTTON(priv->play_button)), ">") == 0; gtk_button_set_label(GTK_BUTTON(priv->play_button), transport_widget_toggle_play_label(gtk_button_get_label(GTK_BUTTON(priv->play_button)))); @@ -181,11 +189,21 @@ transport_widget_button_press_event (GtkWidget *menuitem, return TRUE; } +static void +transport_widget_play_clicked(GtkWidget* button, + TransportWidget* self) +{ + g_debug("Transport_widget_play_clicked"); +} + static gboolean transport_widget_button_release_event (GtkWidget *menuitem, GdkEventButton *event) { g_debug("TransportWidget::menu_release_event"); + TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE(TRANSPORT_WIDGET(menuitem)); + gtk_widget_event (priv->hbox, (GdkEvent*)event); + return TRUE; } -- cgit v1.2.3 From 869af4c3707c109b725b05bba70da2d8816051c4 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 21 Jun 2010 11:50:47 +0100 Subject: moved the vapi file --- src/Makefile.am | 2 +- vapi/music-bridge.vapi | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 vapi/music-bridge.vapi diff --git a/src/Makefile.am b/src/Makefile.am index e556eed..a1a1deb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -64,7 +64,7 @@ music_bridge_VALAFLAGS = \ -H music-player-bridge.h -d . \ --library music-bridge \ --vapidir=./ \ - --vapidir=$(topsrcdir)/vapi \ + --vapidir=../vapi/ \ --thread \ --pkg gee-1.0 \ --pkg Indicate-0.2 \ diff --git a/vapi/music-bridge.vapi b/vapi/music-bridge.vapi new file mode 100644 index 0000000..65d40ec --- /dev/null +++ b/vapi/music-bridge.vapi @@ -0,0 +1,4 @@ +/* music-bridge.vapi generated by valac, do not modify. */ +[CCode (cheader_filename = "common-defs.h")] +namespace CommonDefs{ +} \ No newline at end of file -- cgit v1.2.3 From 4f84a27c35c47d5833547a4727016514ef98f2b0 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 21 Jun 2010 11:54:28 +0100 Subject: player item src --- src/player-item.vala | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/player-item.vala diff --git a/src/player-item.vala b/src/player-item.vala new file mode 100644 index 0000000..a0ea25a --- /dev/null +++ b/src/player-item.vala @@ -0,0 +1,65 @@ +/* +This service primarily controls PulseAudio and is driven by the sound indicator menu on the panel. +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran + +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 . +*/ + +using Dbusmenu; +using Gee; + +public class PlayerItem : Dbusmenu.Menuitem +{ + public MprisController mpris_adaptor; + + public PlayerItem() + { + } + + public virtual void update(HashMap data) + { + debug("PlayerItem::update()"); + foreach(var key in this.attributes().keys){ + this.attributes.get(key); + } + } + + public void set_adaptor(MprisController adaptor) + { + this.mpris_adaptor = adaptor; + } + + // Bespoke constructors for player items + // Title item + public static PlayerItem new_title_item(dynamic string name) + { + PlayerItem item = new PlayerItem(); + item.property_set(MENUITEM_PROP_LABEL, name); + item.property_set(MENUITEM_PROP_ICON_NAME, "applications-multimedia"); + return item; + } + + // Separator item + public static PlayerItem new_separator_item() + { + PlayerItem separator = new PlayerItem(); + separator.property_set(MENUITEM_PROP_TYPE, CLIENT_TYPES_SEPARATOR); + return separator; + } + + +} + -- cgit v1.2.3 From 2357b40b5530215fc018302eaa288241b436d025 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 21 Jun 2010 12:21:43 +0100 Subject: changed name of local vapi for common defs --- src/metadata-menu-item.vala | 23 ++++++++--------------- src/player-item.vala | 6 +++--- vapi/common-defs.vapi | 9 +++++++++ vapi/music-bridge.vapi | 4 ---- 4 files changed, 20 insertions(+), 22 deletions(-) create mode 100644 vapi/common-defs.vapi delete mode 100644 vapi/music-bridge.vapi diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 28e034a..02ae1c9 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -4,25 +4,18 @@ using CommonDefs; public class MetadataMenuitem : PlayerItem { - /* Not ideal duplicate definition of const - see common-defs/h */ - //const string DBUSMENU_METADATA_MENUITEM_TYPE = "x-canonical-metadata-menu-item"; - //const string DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST = "x-canonical-metadata-text-artist"; - //const string DBUSMENU_METADATA_MENUITEM_TEXT_TITLE = "x-canonical-metadata-text-title"; - //const string DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM = "x-canonical-metadata-text-album"; - //const string DBUSMENU_METADATA_MENUITEM_IMAGE_PATH = "x-canonical-metadata-image"; - public MetadataMenuitem() { - this.property_set(MENUITEM_PROP_TYPE, DBUSMENU_METADATA_MENUITEM_TYPE); + this.property_set(MENUITEM_PROP_TYPE, CommonDefs.DBUSMENU_METADATA_MENUITEM_TYPE); } public override void update(HashMap data) { - this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST, data.get("artist").strip()); - this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_PIECE, data.get("title").strip()); - this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_CONTAINER, data.get("album").strip()); - this.property_set(DBUSMENU_METADATA_MENUITEM_IMAGE_PATH, sanitize_image_path(data.get("arturl"))); + this.property_set(CommonDefs.DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST, data.get("artist").strip()); + this.property_set(CommonDefs.DBUSMENU_METADATA_MENUITEM_TEXT_TITLE, data.get("title").strip()); + this.property_set(CommonDefs.DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM, data.get("album").strip()); + this.property_set(CommonDefs.DBUSMENU_METADATA_MENUITEM_IMAGE_PATH, sanitize_image_path(data.get("arturl"))); } public static string sanitize_image_path(string path) @@ -44,9 +37,9 @@ public class MetadataMenuitem : PlayerItem { HashMap result = new HashMap(); result.set(DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST, typeof(string)); - result.set("x-canonical-metadata-text-title", typeof(string)); - result.set("x-canonical-metadata-text-album", typeof(string)); - result.set("x-canonical-metadata-text-image", typeof(string)); + result.set(DBUSMENU_METADATA_MENUITEM_TEXT_TITLE, typeof(string)); + result.set(DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM, typeof(string)); + result.set(DBUSMENU_METADATA_MENUITEM_IMAGE_PATH, typeof(string)); return result; } diff --git a/src/player-item.vala b/src/player-item.vala index a0ea25a..aa35b33 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -32,9 +32,9 @@ public class PlayerItem : Dbusmenu.Menuitem public virtual void update(HashMap data) { debug("PlayerItem::update()"); - foreach(var key in this.attributes().keys){ - this.attributes.get(key); - } + //foreach(var key in this.attributes().keys){ + // this.attributes.get(key); + //} } public void set_adaptor(MprisController adaptor) diff --git a/vapi/common-defs.vapi b/vapi/common-defs.vapi new file mode 100644 index 0000000..8f374d0 --- /dev/null +++ b/vapi/common-defs.vapi @@ -0,0 +1,9 @@ +/* music-bridge.vapi generated by valac, do not modify. */ +[CCode (cheader_filename = "common-defs.h")] +namespace CommonDefs{ + public const string DBUSMENU_METADATA_MENUITEM_TYPE; + public const string DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST; + public const string DBUSMENU_METADATA_MENUITEM_TEXT_TITLE; + public const string DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM; + public const string DBUSMENU_METADATA_MENUITEM_IMAGE_PATH; +} \ No newline at end of file diff --git a/vapi/music-bridge.vapi b/vapi/music-bridge.vapi deleted file mode 100644 index 65d40ec..0000000 --- a/vapi/music-bridge.vapi +++ /dev/null @@ -1,4 +0,0 @@ -/* music-bridge.vapi generated by valac, do not modify. */ -[CCode (cheader_filename = "common-defs.h")] -namespace CommonDefs{ -} \ No newline at end of file -- cgit v1.2.3 From 87445b8921774ec705b4bb62429a5f69be941737 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 21 Jun 2010 12:25:46 +0100 Subject: more refactoring of vapis --- src/Makefile.am | 2 +- src/metadata-menu-item.vala | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index a1a1deb..a2a54e8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -69,7 +69,7 @@ music_bridge_VALAFLAGS = \ --pkg gee-1.0 \ --pkg Indicate-0.2 \ --pkg Dbusmenu-Glib-0.2 \ - --pkg music-bridge \ + --pkg common-defs \ --pkg dbus-glib-1 $(MAINTAINER_VALAFLAGS) diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 02ae1c9..2b865f7 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -6,16 +6,16 @@ public class MetadataMenuitem : PlayerItem { public MetadataMenuitem() { - this.property_set(MENUITEM_PROP_TYPE, CommonDefs.DBUSMENU_METADATA_MENUITEM_TYPE); + this.property_set(MENUITEM_PROP_TYPE, DBUSMENU_METADATA_MENUITEM_TYPE); } public override void update(HashMap data) { - this.property_set(CommonDefs.DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST, data.get("artist").strip()); - this.property_set(CommonDefs.DBUSMENU_METADATA_MENUITEM_TEXT_TITLE, data.get("title").strip()); - this.property_set(CommonDefs.DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM, data.get("album").strip()); - this.property_set(CommonDefs.DBUSMENU_METADATA_MENUITEM_IMAGE_PATH, sanitize_image_path(data.get("arturl"))); + this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST, data.get("artist").strip()); + this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_TITLE, data.get("title").strip()); + this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM, data.get("album").strip()); + this.property_set(DBUSMENU_METADATA_MENUITEM_IMAGE_PATH, sanitize_image_path(data.get("arturl"))); } public static string sanitize_image_path(string path) -- cgit v1.2.3 From 7be2c7248a0b29ea74e8e36db405d5974995a57b Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 21 Jun 2010 16:25:16 +0100 Subject: going for generic property updates --- src/common-defs.h | 2 +- src/metadata-menu-item.vala | 48 ++++++++++++++++++++++++--------------------- src/metadata-widget.c | 6 +++--- src/mpris-controller.vala | 13 +----------- src/player-controller.vala | 2 +- src/player-item.vala | 16 +++++++-------- vapi/common-defs.vapi | 12 ++++++------ 7 files changed, 46 insertions(+), 53 deletions(-) diff --git a/src/common-defs.h b/src/common-defs.h index d35c672..1e53e07 100644 --- a/src/common-defs.h +++ b/src/common-defs.h @@ -33,4 +33,4 @@ with this program. If not, see . #define DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST "x-canonical-metadata-text-artist" #define DBUSMENU_METADATA_MENUITEM_TEXT_TITLE "x-canonical-metadata-text-title" #define DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM "x-canonical-metadata-text-album" -#define DBUSMENU_METADATA_MENUITEM_IMAGE_PATH "x-canonical-metadata-image" +#define DBUSMENU_METADATA_MENUITEM_ARTURL "x-canonical-metadata-image" diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 2b865f7..5464074 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -1,22 +1,21 @@ using Dbusmenu; using Gee; -using CommonDefs; +using DbusmenuMetadata; public class MetadataMenuitem : PlayerItem { public MetadataMenuitem() { - this.property_set(MENUITEM_PROP_TYPE, DBUSMENU_METADATA_MENUITEM_TYPE); - + this.property_set(MENUITEM_PROP_TYPE, MENUITEM_TYPE); } - public override void update(HashMap data) - { - this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST, data.get("artist").strip()); - this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_TITLE, data.get("title").strip()); - this.property_set(DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM, data.get("album").strip()); - this.property_set(DBUSMENU_METADATA_MENUITEM_IMAGE_PATH, sanitize_image_path(data.get("arturl"))); - } + //public override void update(HashMap data) + //{ + // this.property_set(MENUITEM_TEXT_ARTIST, data.get("artist").strip()); + // this.property_set(MENUITEM_TEXT_TITLE, data.get("title").strip()); + // this.property_set(MENUITEM_TEXT_ALBUM, data.get("album").strip()); + // this.property_set(MENUITEM_IMAGE_PATH, sanitize_image_path(data.get("arturl"))); + //} public static string sanitize_image_path(string path) { @@ -27,21 +26,26 @@ public class MetadataMenuitem : PlayerItem debug("Sanitize image path - result = %s", result); return result; } - - public override void handle_event(string name, GLib.Value input_value, uint timestamp) + + public static HashMap attributes_format() { - debug("MetadataItem -> handle event caught!"); - } + HashMap results = new HashMap(); + results.set(MENUITEM_TEXT_TITLE, typeof(string)); + results.set(MENUITEM_TEXT_ARTIST, typeof(string)); + results.set(MENUITEM_TEXT_ALBUM, typeof(string)); + results.set(MENUITEM_TEXT_ARTURL, typeof(string)); + return results; + } + - public static HashMap attributes() + public static HashMap format_updates(HashMap data) { - HashMap result = new HashMap(); - result.set(DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST, typeof(string)); - result.set(DBUSMENU_METADATA_MENUITEM_TEXT_TITLE, typeof(string)); - result.set(DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM, typeof(string)); - result.set(DBUSMENU_METADATA_MENUITEM_IMAGE_PATH, typeof(string)); + HashMap results = new HashMap(); - return result; + results.set(MENUITEM_TEXT_TITLE, (string)data.lookup("title").strip()); + results.set(MENUITEM_TEXT_ARTIST, (string)data.lookup("artist").strip()); + results.set(MENUITEM_TEXT_ALBUM, (string)data.lookup("album").strip(), typeof(string)); + results.set(MENUITEM_TEXT_ARTURL, sanitize_image_path((string)data.lookup("arturl").strip()), typeof(string)); + return results; } - } \ No newline at end of file diff --git a/src/metadata-widget.c b/src/metadata-widget.c index b2ca255..66e8cac 100644 --- a/src/metadata-widget.c +++ b/src/metadata-widget.c @@ -93,7 +93,7 @@ metadata_widget_init (MetadataWidget *self) // image priv->album_art = gtk_image_new(); - priv->image_path = g_strdup(dbusmenu_menuitem_property_get(twin_item, DBUSMENU_METADATA_MENUITEM_IMAGE_PATH)); + priv->image_path = g_strdup(dbusmenu_menuitem_property_get(twin_item, DBUSMENU_METADATA_MENUITEM_ARTURL)); update_album_art(self); gtk_box_pack_start (GTK_BOX (priv->hbox), priv->album_art, FALSE, FALSE, 0); GtkWidget* vbox = gtk_vbox_new(TRUE, 0); @@ -177,7 +177,7 @@ metadata_widget_property_update(DbusmenuMenuitem* item, gchar* property, else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM, property) == 0){ gtk_label_set_text(GTK_LABEL(priv->container_label), g_value_get_string(value)); } - else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_IMAGE_PATH, property) == 0){ + else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ARTURL, property) == 0){ if(priv->image_path != NULL){ g_free(priv->image_path); } @@ -194,7 +194,7 @@ static void update_album_art(MetadataWidget* self){ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self); GdkPixbuf* pixbuf; pixbuf = gdk_pixbuf_new_from_file(priv->image_path, NULL); - pixbuf = gdk_pixbuf_scale_simple(pixbuf,60, 60,GDK_INTERP_BILINEAR); + pixbuf = gdk_pixbuf_scale_simple(pixbuf,60, 60, GDK_INTERP_BILINEAR); g_debug("attempting to set the image with path %s", priv->image_path); gtk_image_set_from_pixbuf(GTK_IMAGE(priv->album_art), pixbuf); g_object_unref(pixbuf); diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index cd1d2db..98473ad 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -54,7 +54,7 @@ public class MprisController : GLib.Object private void onTrackChange(dynamic DBus.Object mpris_client, HashTable ht) { - this.controller.update_playing_info(format_metadata(ht)); + this.controller.update_playing_info(MetadataMenuitem.format_updates(ht)); } /** @@ -85,16 +85,5 @@ public class MprisController : GLib.Object //int repeat = ar.get_nth(2).get_int(); //int endless = ar.get_nth(3).get_int(); } - - private static HashMap format_metadata(HashTable data) - { - HashMap results = new HashMap(); - debug("format_metadata - title = %s", (string)data.lookup("title")); - results.set("title", (string)data.lookup("title")); - results.set("artist", (string)data.lookup("artist")); - results.set("album", (string)data.lookup("album")); - results.set("arturl", (string)data.lookup("arturl")); - return results; - } } diff --git a/src/player-controller.vala b/src/player-controller.vala index 22a200e..ef1e130 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -84,7 +84,7 @@ public class PlayerController : GLib.Object public void update_playing_info(HashMap data) { debug("PlayerController - update_playing_info"); - MetadataMenuitem item = (MetadataMenuitem)this.custom_items[METADATA]; + MetadataMenuitem item = this.custom_items[METADATA] as MetadataMenuitem; item.update(data); } diff --git a/src/player-item.vala b/src/player-item.vala index aa35b33..10dedc2 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -26,15 +26,17 @@ public class PlayerItem : Dbusmenu.Menuitem public MprisController mpris_adaptor; public PlayerItem() - { + { } - public virtual void update(HashMap data) + public void update(HashMap data, Type type) { debug("PlayerItem::update()"); - //foreach(var key in this.attributes().keys){ - // this.attributes.get(key); - //} + HashMap attributes = type.attributes_format(); + foreach(var property in data){ + //property.value as attributes.get(property.key) + //this.property_set(property.key, ); + } } public void set_adaptor(MprisController adaptor) @@ -58,8 +60,6 @@ public class PlayerItem : Dbusmenu.Menuitem PlayerItem separator = new PlayerItem(); separator.property_set(MENUITEM_PROP_TYPE, CLIENT_TYPES_SEPARATOR); return separator; - } - - + } } diff --git a/vapi/common-defs.vapi b/vapi/common-defs.vapi index 8f374d0..ce77929 100644 --- a/vapi/common-defs.vapi +++ b/vapi/common-defs.vapi @@ -1,9 +1,9 @@ /* music-bridge.vapi generated by valac, do not modify. */ [CCode (cheader_filename = "common-defs.h")] -namespace CommonDefs{ - public const string DBUSMENU_METADATA_MENUITEM_TYPE; - public const string DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST; - public const string DBUSMENU_METADATA_MENUITEM_TEXT_TITLE; - public const string DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM; - public const string DBUSMENU_METADATA_MENUITEM_IMAGE_PATH; +namespace DbusmenuMetadata{ + public const string MENUITEM_TYPE; + public const string MENUITEM_TEXT_ARTIST; + public const string MENUITEM_TEXT_TITLE; + public const string MENUITEM_TEXT_ALBUM; + public const string MENUITEM_ARTURL; } \ No newline at end of file -- cgit v1.2.3 From 6e001f4e0606bce9d3eb070df97d44a7b10081c5 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 21 Jun 2010 19:36:21 +0100 Subject: wip --- src/common-defs.h | 2 +- src/metadata-menu-item.vala | 13 +------------ src/mpris-controller.vala | 13 +++++++------ src/player-controller.vala | 17 ++++++++--------- src/player-item.vala | 32 +++++++++++++++++++++++++++++--- src/transport-menu-item.vala | 8 ++++---- 6 files changed, 50 insertions(+), 35 deletions(-) diff --git a/src/common-defs.h b/src/common-defs.h index 1e53e07..c12d9c1 100644 --- a/src/common-defs.h +++ b/src/common-defs.h @@ -33,4 +33,4 @@ with this program. If not, see . #define DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST "x-canonical-metadata-text-artist" #define DBUSMENU_METADATA_MENUITEM_TEXT_TITLE "x-canonical-metadata-text-title" #define DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM "x-canonical-metadata-text-album" -#define DBUSMENU_METADATA_MENUITEM_ARTURL "x-canonical-metadata-image" +#define DBUSMENU_METADATA_MENUITEM_ARTURL "x-canonical-metadata-arturl" diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 5464074..8d626ca 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -33,19 +33,8 @@ public class MetadataMenuitem : PlayerItem results.set(MENUITEM_TEXT_TITLE, typeof(string)); results.set(MENUITEM_TEXT_ARTIST, typeof(string)); results.set(MENUITEM_TEXT_ALBUM, typeof(string)); - results.set(MENUITEM_TEXT_ARTURL, typeof(string)); + results.set(MENUITEM_ARTURL, typeof(string)); return results; } - - public static HashMap format_updates(HashMap data) - { - HashMap results = new HashMap(); - - results.set(MENUITEM_TEXT_TITLE, (string)data.lookup("title").strip()); - results.set(MENUITEM_TEXT_ARTIST, (string)data.lookup("artist").strip()); - results.set(MENUITEM_TEXT_ALBUM, (string)data.lookup("album").strip(), typeof(string)); - results.set(MENUITEM_TEXT_ARTURL, sanitize_image_path((string)data.lookup("arturl").strip()), typeof(string)); - return results; - } } \ No newline at end of file diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index 98473ad..c71662a 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -44,17 +44,18 @@ public class MprisController : GLib.Object this.mpris_player = this.connection.get_object ("org.mpris.".concat(name.down()) , "/Player", mpris_interface); this.mpris_player.TrackChange += onTrackChange; this.mpris_player.StatusChange += onStatusChange; - this.controller.update_playing_info(get_track_data()); + //this.controller.update_playing_info(get_track_data()); } - public HashMap get_track_data() - { - return format_metadata(this.mpris_player.GetMetadata()); - } + //public HashMap get_track_data() + //{ + //return format_metadata(this.mpris_player.GetMetadata()); + //} private void onTrackChange(dynamic DBus.Object mpris_client, HashTable ht) { - this.controller.update_playing_info(MetadataMenuitem.format_updates(ht)); + this.controller.custom_items[this.controller.METADATA].update(ht, + MetadataMenuitem.attributes_format()); } /** diff --git a/src/player-controller.vala b/src/player-controller.vala index ef1e130..862bb29 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -23,13 +23,13 @@ using Gee; public class PlayerController : GLib.Object { - private const int METADATA = 2; + public const int METADATA = 2; private const int TRANSPORT = 3; private Dbusmenu.Menuitem root_menu; private string name; private bool is_active; - private ArrayList custom_items; + public ArrayList custom_items; private MprisController mpris_adaptor; public PlayerController(Dbusmenu.Menuitem root, string client_name, bool active) @@ -47,7 +47,6 @@ public class PlayerController : GLib.Object else{ this.mpris_adaptor = new MprisController(this.name, this); } - this.custom_items[TRANSPORT].set_adaptor(this.mpris_adaptor); } @@ -81,12 +80,12 @@ public class PlayerController : GLib.Object return true; } - public void update_playing_info(HashMap data) - { - debug("PlayerController - update_playing_info"); - MetadataMenuitem item = this.custom_items[METADATA] as MetadataMenuitem; - item.update(data); - } + //public void update_playing_info(HashMap data) + //{ + // debug("PlayerController - update_playing_info"); + // MetadataMenuitem item = this.custom_items[METADATA] as MetadataMenuitem; + // item.update(data, MetadataMenuitem.attributes_format()); + //} private static string format_client_name(string client_name) { diff --git a/src/player-item.vala b/src/player-item.vala index 10dedc2..ee09074 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -29,11 +29,26 @@ public class PlayerItem : Dbusmenu.Menuitem { } - public void update(HashMap data, Type type) + public void update(HashTable data, HashMap attributes) { debug("PlayerItem::update()"); - HashMap attributes = type.attributes_format(); - foreach(var property in data){ + foreach(var property in attributes){ + //debug("property value = %s", attributes.get(property.key).name()); + GLib.Object obj = GLib.Object.new(attributes.get(property.key)); + debug("bang line"); + Type t = obj.get_type(); + if(t.is_a(typeof(string)) == true){ + debug("obj is a string !!! we can tell -halla fucking lula!"); + } + //string[] input_keys = property.key.split("-"); + //string search_key = input_keys[input_keys.length-1 : input_keys.length][0]; + //debug("key parsed from properties is %s", search_key); + //debug("and the bloody type should be %s", property.value.name()); + //var input_value = data.lookup(search_key) as property.value.name(); + //foreach(var s in input_keys){ + // debug("string = %s", s); + //} + //string[] st = input_keys[input_keys.length-1 : input_keys.length]; //property.value as attributes.get(property.key) //this.property_set(property.key, ); } @@ -44,6 +59,17 @@ public class PlayerItem : Dbusmenu.Menuitem this.mpris_adaptor = adaptor; } + public static HashMap format_updates(HashTable ht) + { + HashMap results = new HashMap(); + //HashMap attrs = attributes_format(); + //results.set(MENUITEM_TEXT_TITLE, (string)data.lookup("title").strip()); + //results.set(MENUITEM_TEXT_ARTIST, (string)data.lookup("artist").strip()); + //results.set(MENUITEM_TEXT_ALBUM, (string)data.lookup("album").strip(), typeof(string)); + //results.set(MENUITEM_TEXT_ARTURL, sanitize_image_path((string)data.lookup("arturl").strip()), typeof(string)); + return results; + } + // Bespoke constructors for player items // Title item public static PlayerItem new_title_item(dynamic string name) diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala index 7dc1c7f..bfa81d3 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -34,10 +34,10 @@ public class TransportMenuitem : PlayerItem debug("transport on the vala side"); } - public override void update(HashMap data) - { - debug("TransportMenuitem::update()"); - } + //public override void update(HashMap data) + //{ + // debug("TransportMenuitem::update()"); + //} public override void handle_event(string name, GLib.Value input_value, uint timestamp) { -- cgit v1.2.3 From 39e811f976a80011703e7b0c04b891a1f1abdd68 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 21 Jun 2010 20:54:28 +0100 Subject: finally --- src/metadata-menu-item.vala | 32 ++++++-------------------- src/player-item.vala | 54 ++++++++++++++++++++------------------------ src/transport-menu-item.vala | 13 +++-------- vapi/common-defs.vapi | 6 +++++ 4 files changed, 40 insertions(+), 65 deletions(-) diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 8d626ca..08b1b85 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -9,32 +9,14 @@ public class MetadataMenuitem : PlayerItem this.property_set(MENUITEM_PROP_TYPE, MENUITEM_TYPE); } - //public override void update(HashMap data) - //{ - // this.property_set(MENUITEM_TEXT_ARTIST, data.get("artist").strip()); - // this.property_set(MENUITEM_TEXT_TITLE, data.get("title").strip()); - // this.property_set(MENUITEM_TEXT_ALBUM, data.get("album").strip()); - // this.property_set(MENUITEM_IMAGE_PATH, sanitize_image_path(data.get("arturl"))); - //} - - public static string sanitize_image_path(string path) - { - string result = path.strip(); - if(result.has_prefix("file:///")){ - result = result.slice(7, result.len()); - } - debug("Sanitize image path - result = %s", result); - return result; - } - - public static HashMap attributes_format() + public static HashSet attributes_format() { - HashMap results = new HashMap(); - results.set(MENUITEM_TEXT_TITLE, typeof(string)); - results.set(MENUITEM_TEXT_ARTIST, typeof(string)); - results.set(MENUITEM_TEXT_ALBUM, typeof(string)); - results.set(MENUITEM_ARTURL, typeof(string)); - return results; + HashSet attrs = new HashSet(); + attrs.add(MENUITEM_TEXT_TITLE); + attrs.add(MENUITEM_TEXT_ARTIST); + attrs.add(MENUITEM_TEXT_ALBUM); + attrs.add(MENUITEM_ARTURL); + return attrs; } } \ No newline at end of file diff --git a/src/player-item.vala b/src/player-item.vala index ee09074..7bf1063 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -28,49 +28,43 @@ public class PlayerItem : Dbusmenu.Menuitem public PlayerItem() { } - - public void update(HashTable data, HashMap attributes) + + public void update(HashTable data, HashSet attributes) { debug("PlayerItem::update()"); - foreach(var property in attributes){ - //debug("property value = %s", attributes.get(property.key).name()); - GLib.Object obj = GLib.Object.new(attributes.get(property.key)); - debug("bang line"); - Type t = obj.get_type(); - if(t.is_a(typeof(string)) == true){ - debug("obj is a string !!! we can tell -halla fucking lula!"); + foreach(string property in attributes){ + string[] input_keys = property.split("-"); + string search_key = input_keys[input_keys.length-1 : input_keys.length][0]; + if (data.lookup(search_key).holds (typeof (string))){ + this.property_set(property, this.sanitize_string(data.lookup(search_key) as string)); + } + else if (data.lookup(search_key).holds (typeof (int))){ + // Circumvent weird vala bug + int* v = (int*)data.lookup(search_key); + int r = *v; + this.property_set_int(property, r); } - //string[] input_keys = property.key.split("-"); - //string search_key = input_keys[input_keys.length-1 : input_keys.length][0]; - //debug("key parsed from properties is %s", search_key); - //debug("and the bloody type should be %s", property.value.name()); - //var input_value = data.lookup(search_key) as property.value.name(); - //foreach(var s in input_keys){ - // debug("string = %s", s); - //} - //string[] st = input_keys[input_keys.length-1 : input_keys.length]; - //property.value as attributes.get(property.key) - //this.property_set(property.key, ); } - } + } public void set_adaptor(MprisController adaptor) { this.mpris_adaptor = adaptor; } - public static HashMap format_updates(HashTable ht) + + public static string sanitize_string(string st) { - HashMap results = new HashMap(); - //HashMap attrs = attributes_format(); - //results.set(MENUITEM_TEXT_TITLE, (string)data.lookup("title").strip()); - //results.set(MENUITEM_TEXT_ARTIST, (string)data.lookup("artist").strip()); - //results.set(MENUITEM_TEXT_ALBUM, (string)data.lookup("album").strip(), typeof(string)); - //results.set(MENUITEM_TEXT_ARTURL, sanitize_image_path((string)data.lookup("arturl").strip()), typeof(string)); - return results; + string result = st.strip(); + if(result.has_prefix("file:///")){ + result = result.slice(7, result.len()); + } + debug("Sanitize string - result = %s", result); + return result; } + - // Bespoke constructors for player items + //----- Custom constructors for player items ----------------// // Title item public static PlayerItem new_title_item(dynamic string name) { diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala index bfa81d3..3c49e1c 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -20,25 +20,18 @@ with this program. If not, see . using Dbusmenu; using Gee; +using DbusmenuTransport; public class TransportMenuitem : PlayerItem { - /* Not ideal duplicate definition of const - see common-defs/h */ - const string DBUSMENU_TRANSPORT_MENUITEM_TYPE = "x-canonical-transport-bar"; - const string DBUSMENU_TRANSPORT_MENUITEM_STATE = "x-canonical-transport-state"; public TransportMenuitem() { - this.property_set(MENUITEM_PROP_TYPE, DBUSMENU_TRANSPORT_MENUITEM_TYPE); - this.property_set_bool(DBUSMENU_TRANSPORT_MENUITEM_STATE, false); + this.property_set(MENUITEM_PROP_TYPE, MENUITEM_TYPE); + this.property_set_bool(MENUITEM_STATE, false); debug("transport on the vala side"); } - //public override void update(HashMap data) - //{ - // debug("TransportMenuitem::update()"); - //} - public override void handle_event(string name, GLib.Value input_value, uint timestamp) { debug("handle_event with bool value %s", input_value.get_boolean().to_string()); diff --git a/vapi/common-defs.vapi b/vapi/common-defs.vapi index ce77929..67dc1f3 100644 --- a/vapi/common-defs.vapi +++ b/vapi/common-defs.vapi @@ -6,4 +6,10 @@ namespace DbusmenuMetadata{ public const string MENUITEM_TEXT_TITLE; public const string MENUITEM_TEXT_ALBUM; public const string MENUITEM_ARTURL; +} + +[CCode (cheader_filename = "common-defs.h")] +namespace DbusmenuTransport{ + public const string MENUITEM_TYPE; + public const string MENUITEM_STATE; } \ No newline at end of file -- cgit v1.2.3 From 3c42ee89d903f2bd1a239f2e3e8c236bfe2ef2ba Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 21 Jun 2010 23:28:31 +0100 Subject: trying for support --- src/mpris-controller.vala | 22 +++++++++------------- src/player-item.vala | 5 +++++ src/transport-menu-item.vala | 7 +++++++ src/transport-widget.c | 2 +- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index c71662a..62077d1 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -20,7 +20,6 @@ with this program. If not, see . using Gee; - public class MprisController : GLib.Object { private DBus.Connection connection; @@ -33,7 +32,6 @@ public class MprisController : GLib.Object public int32 endless; } - public MprisController(string name, PlayerController controller, string mpris_interface="org.freedesktop.MediaPlayer"){ try { this.connection = DBus.Bus.get (DBus.BusType.SESSION); @@ -44,18 +42,13 @@ public class MprisController : GLib.Object this.mpris_player = this.connection.get_object ("org.mpris.".concat(name.down()) , "/Player", mpris_interface); this.mpris_player.TrackChange += onTrackChange; this.mpris_player.StatusChange += onStatusChange; - //this.controller.update_playing_info(get_track_data()); } - //public HashMap get_track_data() - //{ - //return format_metadata(this.mpris_player.GetMetadata()); - //} private void onTrackChange(dynamic DBus.Object mpris_client, HashTable ht) { this.controller.custom_items[this.controller.METADATA].update(ht, - MetadataMenuitem.attributes_format()); + MetadataMenuitem.attributes_format()); } /** @@ -80,11 +73,14 @@ public class MprisController : GLib.Object status* status = &st; unowned ValueArray ar = (ValueArray)status; - int playback = ar.get_nth(0).get_int(); - debug("onStatusChange - play %i", ar.get_nth(0).get_int()); - - //int repeat = ar.get_nth(2).get_int(); - //int endless = ar.get_nth(3).get_int(); + bool play_state = (ar.get_nth(0).get_int() == 1); + debug("onStatusChange - play state %s", play_state.to_string()); + HashTable ht = new HashTable(str_hash, str_equal); + Value v = Value(typeof(bool)); + v.set_boolean(play_state); + ht.insert("state", play_state); + this.controller.custom_items[this.controller.TRANSPORT].update(ht, + TransportMenuitem.attributes_format()); } } diff --git a/src/player-item.vala b/src/player-item.vala index 7bf1063..fe1eeab 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -44,6 +44,11 @@ public class PlayerItem : Dbusmenu.Menuitem int r = *v; this.property_set_int(property, r); } + else if(data.lookup(search_key).holds (typeof (bool))){ + bool* b = (bool*)data.lookup(search_key); + bool input = *b; + this.property_set_bool(property, input); + } } } diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala index 3c49e1c..aae07cc 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -36,5 +36,12 @@ public class TransportMenuitem : PlayerItem { debug("handle_event with bool value %s", input_value.get_boolean().to_string()); this.mpris_adaptor.toggle_playback(input_value.get_boolean()); + } + + public static HashSet attributes_format() + { + HashSet attrs = new HashSet(); + attrs.add(MENUITEM_STATE); + return attrs; } } \ No newline at end of file diff --git a/src/transport-widget.c b/src/transport-widget.c index 10b96df..e1baa68 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -222,7 +222,7 @@ transport_widget_property_update(DbusmenuMenuitem* item, gchar* property, TransportWidget* bar = (TransportWidget*)userdata; TransportWidgetPrivate *priv = TRANSPORT_WIDGET_GET_PRIVATE(bar); - gtk_button_set_label(GTK_BUTTON(priv->play_button), g_strdup(transport_widget_toggle_play_label(property))); + gtk_button_set_label(GTK_BUTTON(priv->play_button), transport_widget_toggle_play_label(property)); } // will be needed for image swapping -- cgit v1.2.3 From 770b3266e2e7a92efb220f990d10ee0e36577b0f Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 22 Jun 2010 11:31:31 +0100 Subject: automatic updates at start up now working properly - still vala oddities to solve but functionality has not been hampered --- src/common-defs.h | 2 +- src/mpris-controller.vala | 27 ++++++++++++++++++--------- src/player-item.vala | 2 ++ src/sound-service.c | 4 ++-- src/transport-menu-item.vala | 8 ++++++-- src/transport-widget.c | 23 +++++++++-------------- vapi/common-defs.vapi | 2 +- 7 files changed, 39 insertions(+), 29 deletions(-) diff --git a/src/common-defs.h b/src/common-defs.h index c12d9c1..5fbf743 100644 --- a/src/common-defs.h +++ b/src/common-defs.h @@ -27,7 +27,7 @@ with this program. If not, see . /* DBUS Custom Items */ #define DBUSMENU_SLIDER_MENUITEM_TYPE "x-canonical-ido-slider-item" #define DBUSMENU_TRANSPORT_MENUITEM_TYPE "x-canonical-transport-bar" -#define DBUSMENU_TRANSPORT_MENUITEM_STATE "x-canonical-transport-state" +#define DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE "x-canonical-transport-state" #define DBUSMENU_METADATA_MENUITEM_TYPE "x-canonical-metadata-menu-item" #define DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST "x-canonical-metadata-text-artist" diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index 62077d1..4515c00 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -41,12 +41,21 @@ public class MprisController : GLib.Object this.controller = controller; this.mpris_player = this.connection.get_object ("org.mpris.".concat(name.down()) , "/Player", mpris_interface); this.mpris_player.TrackChange += onTrackChange; - this.mpris_player.StatusChange += onStatusChange; + this.mpris_player.StatusChange += onStatusChange; + + status st = this.mpris_player.GetStatus(); + int play_state = st.playback; + debug("GetStatusChange - play state %i", play_state); + (this.controller.custom_items[this.controller.TRANSPORT] as TransportMenuitem).change_play_state(play_state); + this.controller.custom_items[this.controller.METADATA].update(this.mpris_player.GetMetadata(), + MetadataMenuitem.attributes_format()); + } private void onTrackChange(dynamic DBus.Object mpris_client, HashTable ht) { + debug("onTrackChange"); this.controller.custom_items[this.controller.METADATA].update(ht, MetadataMenuitem.attributes_format()); } @@ -73,14 +82,14 @@ public class MprisController : GLib.Object status* status = &st; unowned ValueArray ar = (ValueArray)status; - bool play_state = (ar.get_nth(0).get_int() == 1); - debug("onStatusChange - play state %s", play_state.to_string()); - HashTable ht = new HashTable(str_hash, str_equal); - Value v = Value(typeof(bool)); - v.set_boolean(play_state); - ht.insert("state", play_state); - this.controller.custom_items[this.controller.TRANSPORT].update(ht, - TransportMenuitem.attributes_format()); + int play_state = ar.get_nth(0).get_int(); + debug("onStatusChange - play state %i", play_state); + //HashTable ht = new HashTable(str_hash, str_equal); + //int* type = &play_state; + //Value v = Value(typeof(int*)); + //v.set_pointer(type); + //ht.insert("state", v); + (this.controller.custom_items[this.controller.TRANSPORT] as TransportMenuitem).change_play_state(play_state); } } diff --git a/src/player-item.vala b/src/player-item.vala index fe1eeab..3cac208 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -35,7 +35,9 @@ public class PlayerItem : Dbusmenu.Menuitem foreach(string property in attributes){ string[] input_keys = property.split("-"); string search_key = input_keys[input_keys.length-1 : input_keys.length][0]; + debug("search key = %s", search_key); if (data.lookup(search_key).holds (typeof (string))){ + debug("track data change player item update"); this.property_set(property, this.sanitize_string(data.lookup(search_key) as string)); } else if (data.lookup(search_key).holds (typeof (int))){ diff --git a/src/sound-service.c b/src/sound-service.c index ea04e4b..bcdac07 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -45,8 +45,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; } diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala index aae07cc..c8733c0 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -28,10 +28,14 @@ public class TransportMenuitem : PlayerItem public TransportMenuitem() { this.property_set(MENUITEM_PROP_TYPE, MENUITEM_TYPE); - this.property_set_bool(MENUITEM_STATE, false); debug("transport on the vala side"); } + public void change_play_state(int state) + { + this.property_set_int(MENUITEM_PLAY_STATE, state); + } + public override void handle_event(string name, GLib.Value input_value, uint timestamp) { debug("handle_event with bool value %s", input_value.get_boolean().to_string()); @@ -41,7 +45,7 @@ public class TransportMenuitem : PlayerItem public static HashSet attributes_format() { HashSet attrs = new HashSet(); - attrs.add(MENUITEM_STATE); + attrs.add(MENUITEM_PLAY_STATE); return attrs; } } \ No newline at end of file diff --git a/src/transport-widget.c b/src/transport-widget.c index e1baa68..9077c41 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -69,7 +69,7 @@ static void transport_widget_property_update(DbusmenuMenuitem* item, GValue * value, gpointer userdata); // utility methods -static gchar* transport_widget_toggle_play_label(const gchar* state); +static gchar* transport_widget_toggle_play_label(gint state); G_DEFINE_TYPE (TransportWidget, transport_widget, GTK_TYPE_MENU_ITEM); @@ -134,13 +134,8 @@ transport_widget_init (TransportWidget *self) GtkWidget *hbox; hbox = gtk_hbox_new(TRUE, 2); - - gchar* label = ">"; - if(dbusmenu_menuitem_property_get_bool(twin_item, DBUSMENU_TRANSPORT_MENUITEM_STATE) == TRUE){ - label = "||"; - } - - priv->play_button = gtk_button_new_with_label(g_strdup(label)); + gchar* symbol = transport_widget_toggle_play_label(dbusmenu_menuitem_property_get_int(twin_item, DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE)); + priv->play_button = gtk_button_new_with_label(symbol); gtk_box_pack_start (GTK_BOX (hbox), priv->play_button, FALSE, TRUE, 0); priv->hbox = hbox; @@ -178,7 +173,7 @@ transport_widget_button_press_event (GtkWidget *menuitem, gtk_widget_event (priv->hbox, (GdkEvent*)event); gboolean state = g_ascii_strcasecmp(gtk_button_get_label(GTK_BUTTON(priv->play_button)), ">") == 0; - gtk_button_set_label(GTK_BUTTON(priv->play_button), transport_widget_toggle_play_label(gtk_button_get_label(GTK_BUTTON(priv->play_button)))); + gtk_button_set_label(GTK_BUTTON(priv->play_button), transport_widget_toggle_play_label((gint)state)); GValue value = {0}; g_value_init(&value, G_TYPE_BOOLEAN); g_debug("TransportWidget::menu_press_event - going to send value %i", state); @@ -216,20 +211,20 @@ transport_widget_property_update(DbusmenuMenuitem* item, gchar* property, GValue* value, gpointer userdata) { g_debug("transport_widget_update_state - with property %s", property); - gchar* input = g_strdup(g_value_get_string(value)); - g_debug("transport_widget_update_state - with value %s", input); + int update_value = g_value_get_int(value); + g_debug("transport_widget_update_state - with value %i", update_value); TransportWidget* bar = (TransportWidget*)userdata; TransportWidgetPrivate *priv = TRANSPORT_WIDGET_GET_PRIVATE(bar); - gtk_button_set_label(GTK_BUTTON(priv->play_button), transport_widget_toggle_play_label(property)); + gtk_button_set_label(GTK_BUTTON(priv->play_button), transport_widget_toggle_play_label(update_value)); } // will be needed for image swapping -static gchar* transport_widget_toggle_play_label(const gchar* state) +static gchar* transport_widget_toggle_play_label(int play_state) { gchar* label = ">"; - if(g_strcmp0(state, ">") == 0){ + if(play_state == 1){ label = "||"; } return label; diff --git a/vapi/common-defs.vapi b/vapi/common-defs.vapi index 67dc1f3..48f8a8f 100644 --- a/vapi/common-defs.vapi +++ b/vapi/common-defs.vapi @@ -11,5 +11,5 @@ namespace DbusmenuMetadata{ [CCode (cheader_filename = "common-defs.h")] namespace DbusmenuTransport{ public const string MENUITEM_TYPE; - public const string MENUITEM_STATE; + public const string MENUITEM_PLAY_STATE; } \ No newline at end of file -- cgit v1.2.3 From 38e16eeeff6ec6f54662cc4da194e2ad1e024241 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 22 Jun 2010 12:43:24 +0100 Subject: silly vala errors rectified --- src/common-defs.h | 2 +- src/metadata-menu-item.vala | 19 +++++++++++++++++++ src/mpris-controller.vala | 14 ++++++-------- src/player-item.vala | 23 ++++++++++------------- src/transport-menu-item.vala | 1 - vapi/common-defs.vapi | 20 +++++++++++++++++++- 6 files changed, 55 insertions(+), 24 deletions(-) diff --git a/src/common-defs.h b/src/common-defs.h index 5fbf743..dca21cc 100644 --- a/src/common-defs.h +++ b/src/common-defs.h @@ -27,7 +27,7 @@ with this program. If not, see . /* DBUS Custom Items */ #define DBUSMENU_SLIDER_MENUITEM_TYPE "x-canonical-ido-slider-item" #define DBUSMENU_TRANSPORT_MENUITEM_TYPE "x-canonical-transport-bar" -#define DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE "x-canonical-transport-state" +#define DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE "x-canonical-transport-play-state" #define DBUSMENU_METADATA_MENUITEM_TYPE "x-canonical-metadata-menu-item" #define DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST "x-canonical-metadata-text-artist" diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 08b1b85..f62cd46 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -1,3 +1,22 @@ +/* +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran + +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 . +*/ + using Dbusmenu; using Gee; using DbusmenuMetadata; diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index 4515c00..64a46e6 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -80,16 +80,14 @@ public class MprisController : GLib.Object { debug("onStatusChange - signal received"); status* status = &st; - unowned ValueArray ar = (ValueArray)status; - + unowned ValueArray ar = (ValueArray)status; int play_state = ar.get_nth(0).get_int(); debug("onStatusChange - play state %i", play_state); - //HashTable ht = new HashTable(str_hash, str_equal); - //int* type = &play_state; - //Value v = Value(typeof(int*)); - //v.set_pointer(type); - //ht.insert("state", v); - (this.controller.custom_items[this.controller.TRANSPORT] as TransportMenuitem).change_play_state(play_state); + HashTable ht = new HashTable(str_hash, str_equal); + Value v = Value(typeof(int)); + v.set_int(play_state); + ht.insert("state", v); + this.controller.custom_items[this.controller.TRANSPORT].update(ht, TransportMenuitem.attributes_format()); } } diff --git a/src/player-item.vala b/src/player-item.vala index 3cac208..09b0e6b 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -1,5 +1,4 @@ /* -This service primarily controls PulseAudio and is driven by the sound indicator menu on the panel. Copyright 2010 Canonical Ltd. Authors: @@ -36,20 +35,18 @@ public class PlayerItem : Dbusmenu.Menuitem string[] input_keys = property.split("-"); string search_key = input_keys[input_keys.length-1 : input_keys.length][0]; debug("search key = %s", search_key); - if (data.lookup(search_key).holds (typeof (string))){ - debug("track data change player item update"); - this.property_set(property, this.sanitize_string(data.lookup(search_key) as string)); + + Value v = data.lookup(search_key); + + if (v.holds (typeof (string))){ + this.property_set(property, this.sanitize_string(v.get_string())); } - else if (data.lookup(search_key).holds (typeof (int))){ - // Circumvent weird vala bug - int* v = (int*)data.lookup(search_key); - int r = *v; - this.property_set_int(property, r); + else if (v.holds (typeof (int))){ + debug("with value : %i", v.get_int()); + this.property_set_int(property, v.get_int()); } - else if(data.lookup(search_key).holds (typeof (bool))){ - bool* b = (bool*)data.lookup(search_key); - bool input = *b; - this.property_set_bool(property, input); + else if(v.holds (typeof (bool))){ + this.property_set_bool(property, v.get_boolean()); } } } diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala index c8733c0..39a0cab 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -1,5 +1,4 @@ /* -This service primarily controls PulseAudio and is driven by the sound indicator menu on the panel. Copyright 2010 Canonical Ltd. Authors: diff --git a/vapi/common-defs.vapi b/vapi/common-defs.vapi index 48f8a8f..222fb67 100644 --- a/vapi/common-defs.vapi +++ b/vapi/common-defs.vapi @@ -1,4 +1,22 @@ -/* music-bridge.vapi generated by valac, do not modify. */ +/* +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran + +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 . +*/ + [CCode (cheader_filename = "common-defs.h")] namespace DbusmenuMetadata{ public const string MENUITEM_TYPE; -- cgit v1.2.3 From b77c81f85bc219790f5a079e9b888b6ae3627739 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 22 Jun 2010 14:54:03 +0100 Subject: merge requests point of interest --- src/mpris-controller.vala | 1 + src/transport-widget.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index 64a46e6..a6d27be 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -89,5 +89,6 @@ public class MprisController : GLib.Object ht.insert("state", v); this.controller.custom_items[this.controller.TRANSPORT].update(ht, TransportMenuitem.attributes_format()); } + } diff --git a/src/transport-widget.c b/src/transport-widget.c index 9077c41..bc9df53 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -136,6 +136,7 @@ transport_widget_init (TransportWidget *self) hbox = gtk_hbox_new(TRUE, 2); gchar* symbol = transport_widget_toggle_play_label(dbusmenu_menuitem_property_get_int(twin_item, DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE)); priv->play_button = gtk_button_new_with_label(symbol); + //g_free(symbol); gtk_box_pack_start (GTK_BOX (hbox), priv->play_button, FALSE, TRUE, 0); priv->hbox = hbox; @@ -167,6 +168,9 @@ transport_widget_button_press_event (GtkWidget *menuitem, GdkEventButton *event) { g_debug("TransportWidget::menu_press_event"); + if(IS_TRANSPORT_WIDGET(menuitem) == FALSE){ + return FALSE; + } TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE(TRANSPORT_WIDGET(menuitem)); @@ -196,6 +200,10 @@ transport_widget_button_release_event (GtkWidget *menuitem, GdkEventButton *event) { g_debug("TransportWidget::menu_release_event"); + if(IS_TRANSPORT_WIDGET(menuitem) == FALSE){ + return FALSE; + } + TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE(TRANSPORT_WIDGET(menuitem)); gtk_widget_event (priv->hbox, (GdkEvent*)event); @@ -208,7 +216,7 @@ transport_widget_button_release_event (GtkWidget *menuitem, **/ static void transport_widget_property_update(DbusmenuMenuitem* item, gchar* property, - GValue* value, gpointer userdata) + GValue* value, gpointer userdata) { g_debug("transport_widget_update_state - with property %s", property); int update_value = g_value_get_int(value); -- cgit v1.2.3