aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-07-21 11:56:15 +0200
committerConor Curran <conor.curran@canonical.com>2010-07-21 11:56:15 +0200
commit928fbf4bab7659ec523ae16adc052ca42fece589 (patch)
tree34a9e9c6db117485fdca246eab88b14e69ab4bc6 /src
parent48f11cbfef431334442fbb3bf3c2e06b7da76d29 (diff)
downloadayatana-indicator-sound-928fbf4bab7659ec523ae16adc052ca42fece589.tar.gz
ayatana-indicator-sound-928fbf4bab7659ec523ae16adc052ca42fece589.tar.bz2
ayatana-indicator-sound-928fbf4bab7659ec523ae16adc052ca42fece589.zip
scrub bar working
Diffstat (limited to 'src')
-rw-r--r--src/common-defs.h1
-rw-r--r--src/mpris-controller.vala1
-rw-r--r--src/player-item.vala4
-rw-r--r--src/scrub-menu-item.vala4
-rw-r--r--src/scrub-widget.c39
5 files changed, 30 insertions, 19 deletions
diff --git a/src/common-defs.h b/src/common-defs.h
index 76e9558..208c8cb 100644
--- a/src/common-defs.h
+++ b/src/common-defs.h
@@ -41,4 +41,5 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#define DBUSMENU_SCRUB_MENUITEM_TYPE "x-canonical-sound-menu-player-scrub-menu-item"
#define DBUSMENU_SCRUB_MENUITEM_DURATION "x-canonical-sound-menu-player-scrub-time"
#define DBUSMENU_SCRUB_MENUITEM_POSITION "x-canonical-sound-menu-player-scrub-position"
+#define DBUSMENU_SCRUB_MENUITEM_PLAY_STATE "x-canonical-sound-menu-player-scrub-play-state"
diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala
index 8e43131..9586b3d 100644
--- a/src/mpris-controller.vala
+++ b/src/mpris-controller.vala
@@ -117,6 +117,7 @@ public class MprisController : GLib.Object
v.set_int(play_state);
ht.insert("state", v);
this.owner.custom_items[PlayerController.widget_order.TRANSPORT].update(ht, TransportMenuitem.attributes_format());
+ this.owner.custom_items[PlayerController.widget_order.SCRUB].update(ht, ScrubMenuitem.attributes_format());
}
private void onTrackChange(dynamic DBus.Object mpris_client, HashTable<string,Value?> ht)
diff --git a/src/player-item.vala b/src/player-item.vala
index 4bdb60d..2952f71 100644
--- a/src/player-item.vala
+++ b/src/player-item.vala
@@ -89,10 +89,10 @@ public class PlayerItem : Dbusmenu.Menuitem
if(data == null){
return false;
}
- if(data.size() < attributes.size){
+ /*if(data.size() < attributes.size){
warning("update hash was too small for the target");
return false;
- }
+ }*/
return true;
}
diff --git a/src/scrub-menu-item.vala b/src/scrub-menu-item.vala
index cfd6312..29fa903 100644
--- a/src/scrub-menu-item.vala
+++ b/src/scrub-menu-item.vala
@@ -37,14 +37,14 @@ public class ScrubMenuitem : PlayerItem
public void update_position(int32 new_position)
{
this.property_set_int(MENUITEM_POSITION, new_position);
- }
-
+ }
public static HashSet<string> attributes_format()
{
HashSet<string> attrs = new HashSet<string>();
attrs.add(MENUITEM_DURATION);
attrs.add(MENUITEM_POSITION);
+ attrs.add(MENUITEM_PLAY_STATE);
return attrs;
}
} \ No newline at end of file
diff --git a/src/scrub-widget.c b/src/scrub-widget.c
index 4a63701..925acb3 100644
--- a/src/scrub-widget.c
+++ b/src/scrub-widget.c
@@ -77,7 +77,6 @@ scrub_widget_class_init (ScrubWidgetClass *klass)
gobject_class->finalize = scrub_widget_finalize;
}
-
static void
scrub_widget_init (ScrubWidget *self)
{
@@ -88,7 +87,7 @@ scrub_widget_init (ScrubWidget *self)
priv->time_line = ido_timeline_new(0);
ido_scale_menu_item_set_style (IDO_SCALE_MENU_ITEM(priv->ido_scrub_bar), IDO_SCALE_MENU_ITEM_STYLE_LABEL);
- //ido_timeline_set_fps(priv->time_line, .00000001);
+ //ido_timeline_set_fps(priv->time_line, 0.000001f);
g_object_set(priv->ido_scrub_bar, "reverse-scroll-events", TRUE, NULL);
// register slider changes listening on the range
@@ -125,22 +124,33 @@ scrub_widget_property_update(DbusmenuMenuitem* item, gchar* property,
if(g_ascii_strcasecmp(DBUSMENU_SCRUB_MENUITEM_DURATION, property) == 0){
g_debug("scrub-widget::update length = %i", g_value_get_int(value));
ido_scale_menu_item_set_secondary_label(IDO_SCALE_MENU_ITEM(priv->ido_scrub_bar),
- scrub_widget_format_time(g_value_get_int(value)));
- ido_timeline_set_duration(priv->time_line, g_value_get_int(value));
- ido_timeline_start(priv->time_line);
+ scrub_widget_format_time(g_value_get_int(value)));
+ ido_timeline_set_duration(priv->time_line, g_value_get_int(value) * 1000);
g_debug("timeline is running: %i", (gint)ido_timeline_is_running(priv->time_line));
g_debug("timeline duration = %i", ido_timeline_get_duration(priv->time_line));
- //ido_timeline_set_fps(priv->time_line, 0.5);
+ scrub_widget_set_ido_position(mitem,
+ dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_POSITION)/1000,
+ dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_DURATION));
}
else if(g_ascii_strcasecmp(DBUSMENU_SCRUB_MENUITEM_POSITION, property) == 0){
g_debug("scrub-widget::update position = %i", g_value_get_int(value));
ido_scale_menu_item_set_primary_label(IDO_SCALE_MENU_ITEM(priv->ido_scrub_bar),
scrub_widget_format_time(g_value_get_int(value)/1000));
- }
- scrub_widget_set_ido_position(mitem,
- dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_POSITION)/1000,
- dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_DURATION));
-
+ scrub_widget_set_ido_position(mitem,
+ dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_POSITION)/1000,
+ dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_DURATION));
+
+ }
+ else if(g_ascii_strcasecmp(DBUSMENU_SCRUB_MENUITEM_PLAY_STATE, property) == 0){
+ if(g_value_get_int(value) == 0){
+ g_debug("START TIMELINE");
+ ido_timeline_start(priv->time_line);
+ }
+ else{
+ g_debug("PAUSE TIMELINE");
+ ido_timeline_pause(priv->time_line);
+ }
+ }
}
static void
@@ -153,8 +163,7 @@ scrub_widget_set_twin_item(ScrubWidget* self,
g_signal_connect(G_OBJECT(twin_item), "property-changed",
G_CALLBACK(scrub_widget_property_update), self);
- gchar* left_text = scrub_widget_format_time(dbusmenu_menuitem_property_get_int(priv->twin_item,
- DBUSMENU_SCRUB_MENUITEM_POSITION)/1000);
+ gchar* left_text = scrub_widget_format_time(dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_POSITION)/1000);
gchar* right_text = scrub_widget_format_time(dbusmenu_menuitem_property_get_int(priv->twin_item,
DBUSMENU_SCRUB_MENUITEM_DURATION));
scrub_widget_set_ido_position(self,
@@ -259,10 +268,10 @@ scrub_widget_timeline_finished_cb(IdoTimeline *timeline,
gpointer user_data)
{
g_debug("Timeline Finished!");
- g_return_if_fail (IS_SCRUB_WIDGET (user_data));
+ /*g_return_if_fail (IS_SCRUB_WIDGET (user_data));
ScrubWidget* mitem = SCRUB_WIDGET(user_data);
ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(mitem);
- ido_timeline_rewind(priv->time_line);
+ ido_timeline_rewind(priv->time_line);*/
}
/**