aboutsummaryrefslogtreecommitdiff
path: root/src/player-controller.c
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2010-09-08 12:24:23 +0200
committerSebastien Bacher <seb128@ubuntu.com>2010-09-08 12:24:23 +0200
commitb347212eb1cb41fb9739a9873b0ff8eb8abb4b77 (patch)
tree3c9cb3c86b5668c2c03155c60a041f6cc85d28ba /src/player-controller.c
parent80e5ad4f83a8b1218133761de11d433a7854041e (diff)
downloadayatana-indicator-sound-b347212eb1cb41fb9739a9873b0ff8eb8abb4b77.tar.gz
ayatana-indicator-sound-b347212eb1cb41fb9739a9873b0ff8eb8abb4b77.tar.bz2
ayatana-indicator-sound-b347212eb1cb41fb9739a9873b0ff8eb8abb4b77.zip
Import upstream version 0.4.2
Diffstat (limited to 'src/player-controller.c')
-rw-r--r--src/player-controller.c64
1 files changed, 36 insertions, 28 deletions
diff --git a/src/player-controller.c b/src/player-controller.c
index 28bb28c..51eafe8 100644
--- a/src/player-controller.c
+++ b/src/player-controller.c
@@ -1,4 +1,4 @@
-/* player-controller.c generated by valac 0.9.7, the Vala compiler
+/* player-controller.c generated by valac 0.9.8, the Vala compiler
* generated from player-controller.vala, do not modify */
/*
@@ -54,15 +54,15 @@ typedef struct _PlayerControllerPrivate PlayerControllerPrivate;
typedef struct _PlayerItem PlayerItem;
typedef struct _PlayerItemClass PlayerItemClass;
-#define TYPE_MPRIS_BRIDGE (mpris_bridge_get_type ())
-#define MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_BRIDGE, MprisBridge))
-#define MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_BRIDGE, MprisBridgeClass))
-#define IS_MPRIS_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_BRIDGE))
-#define IS_MPRIS_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_BRIDGE))
-#define MPRIS_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_BRIDGE, MprisBridgeClass))
+#define TYPE_MPRIS2_CONTROLLER (mpris2_controller_get_type ())
+#define MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2Controller))
+#define MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass))
+#define IS_MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS2_CONTROLLER))
+#define IS_MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS2_CONTROLLER))
+#define MPRIS2_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass))
-typedef struct _MprisBridge MprisBridge;
-typedef struct _MprisBridgeClass MprisBridgeClass;
+typedef struct _Mpris2Controller Mpris2Controller;
+typedef struct _Mpris2ControllerClass Mpris2ControllerClass;
#define PLAYER_CONTROLLER_TYPE_WIDGET_ORDER (player_controller_widget_order_get_type ())
@@ -106,7 +106,7 @@ struct _PlayerController {
PlayerControllerPrivate * priv;
gint current_state;
GeeArrayList* custom_items;
- MprisBridge* mpris_bridge;
+ Mpris2Controller* mpris_bridge;
};
struct _PlayerControllerClass {
@@ -140,7 +140,7 @@ static gpointer player_controller_parent_class = NULL;
GType player_controller_get_type (void) G_GNUC_CONST;
GType player_item_get_type (void) G_GNUC_CONST;
-GType mpris_bridge_get_type (void) G_GNUC_CONST;
+GType mpris2_controller_get_type (void) G_GNUC_CONST;
#define PLAYER_CONTROLLER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_PLAYER_CONTROLLER, PlayerControllerPrivate))
enum {
PLAYER_CONTROLLER_DUMMY_PROPERTY,
@@ -164,8 +164,8 @@ const char* player_controller_get_name (PlayerController* self);
void player_controller_activate (PlayerController* self);
void player_controller_instantiate (PlayerController* self);
GAppInfo* player_controller_get_app_info (PlayerController* self);
-MprisBridge* mpris_bridge_new (PlayerController* ctrl);
-MprisBridge* mpris_bridge_construct (GType object_type, PlayerController* ctrl);
+Mpris2Controller* mpris2_controller_new (PlayerController* ctrl);
+Mpris2Controller* mpris2_controller_construct (GType object_type, PlayerController* ctrl);
void player_controller_determine_state (PlayerController* self);
void player_controller_vanish (PlayerController* self);
void player_controller_hibernate (PlayerController* self);
@@ -185,7 +185,7 @@ TransportMenuitem* transport_menuitem_new (PlayerController* parent);
TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerController* parent);
GType transport_menuitem_get_type (void) G_GNUC_CONST;
gint player_controller_get_menu_offset (PlayerController* self);
-gboolean mpris_bridge_connected (MprisBridge* self);
+gboolean mpris2_controller_connected (Mpris2Controller* self);
void player_controller_set_app_info (PlayerController* self, GAppInfo* value);
static void player_controller_finalize (GObject* obj);
static void player_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
@@ -263,7 +263,7 @@ PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* cli
void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state) {
g_return_if_fail (self != NULL);
- g_debug ("player-controller.vala:66: update_state - player controller %s : new s" \
+ g_debug ("player-controller.vala:69: update_state - player controller %s : new s" \
"tate %i", self->priv->_name, (gint) new_state);
self->current_state = (gint) new_state;
player_controller_update_layout (self);
@@ -279,27 +279,27 @@ void player_controller_activate (PlayerController* self) {
void player_controller_instantiate (PlayerController* self) {
GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
- g_debug ("player-controller.vala:84: instantiate in player controller for %s", self->priv->_name);
+ g_debug ("player-controller.vala:87: instantiate in player controller for %s", self->priv->_name);
{
g_app_info_launch (self->priv->_app_info, NULL, NULL, &_inner_error_);
if (_inner_error_ != NULL) {
- goto __catch0_g_error;
+ goto __catch4_g_error;
}
player_controller_update_state (self, PLAYER_CONTROLLER_STATE_INSTANTIATING);
}
- goto __finally0;
- __catch0_g_error:
+ goto __finally4;
+ __catch4_g_error:
{
GError * _error_;
_error_ = _inner_error_;
_inner_error_ = NULL;
{
- g_warning ("player-controller.vala:90: Failed to launch app %s with error message:" \
+ g_warning ("player-controller.vala:93: Failed to launch app %s with error message:" \
" %s", self->priv->_name, _error_->message);
_g_error_free0 (_error_);
}
}
- __finally0:
+ __finally4:
if (_inner_error_ != NULL) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
@@ -309,14 +309,14 @@ void player_controller_instantiate (PlayerController* self) {
static void player_controller_establish_mpris_connection (PlayerController* self) {
- MprisBridge* _tmp0_;
+ Mpris2Controller* _tmp0_;
g_return_if_fail (self != NULL);
if (self->current_state != PLAYER_CONTROLLER_STATE_READY) {
- g_debug ("player-controller.vala:97: establish_mpris_connection - Not ready to c" \
-"onnect");
+ g_debug ("player-controller.vala:100: establish_mpris_connection - Not ready to " \
+"connect");
return;
}
- self->mpris_bridge = (_tmp0_ = mpris_bridge_new (self), _g_object_unref0 (self->mpris_bridge), _tmp0_);
+ self->mpris_bridge = (_tmp0_ = mpris2_controller_new (self), _g_object_unref0 (self->mpris_bridge), _tmp0_);
player_controller_determine_state (self);
}
@@ -414,6 +414,14 @@ static void player_controller_construct_widgets (PlayerController* self) {
}
+static glong string_get_length (const char* self) {
+ glong result;
+ g_return_val_if_fail (self != NULL, 0L);
+ result = g_utf8_strlen (self, (gssize) (-1));
+ return result;
+}
+
+
static char* string_slice (const char* self, glong start, glong end) {
char* result = NULL;
glong string_length;
@@ -421,7 +429,7 @@ static char* string_slice (const char* self, glong start, glong end) {
gboolean _tmp1_ = FALSE;
const char* start_string;
g_return_val_if_fail (self != NULL, NULL);
- string_length = g_utf8_strlen (self, -1);
+ string_length = string_get_length (self);
if (start < 0) {
start = string_length + start;
}
@@ -459,7 +467,7 @@ static char* player_controller_format_client_name (const char* client_name) {
formatted = (_tmp2_ = g_strconcat (_tmp0_ = g_utf8_strup (client_name, (gssize) 1), _tmp1_ = string_slice (client_name, (glong) 1, g_utf8_strlen (client_name, -1)), NULL), _g_free0 (formatted), _tmp2_);
_g_free0 (_tmp1_);
_g_free0 (_tmp0_);
- g_debug ("player-controller.vala:160: PlayerController->format_client_name - : %" \
+ g_debug ("player-controller.vala:163: PlayerController->format_client_name - : %" \
"s", formatted);
}
result = formatted;
@@ -469,7 +477,7 @@ static char* player_controller_format_client_name (const char* client_name) {
void player_controller_determine_state (PlayerController* self) {
g_return_if_fail (self != NULL);
- if (mpris_bridge_connected (self->mpris_bridge) == TRUE) {
+ if (mpris2_controller_connected (self->mpris_bridge) == TRUE) {
player_controller_update_state (self, PLAYER_CONTROLLER_STATE_CONNECTED);
} else {
player_controller_update_state (self, PLAYER_CONTROLLER_STATE_DISCONNECTED);