aboutsummaryrefslogtreecommitdiff
path: root/src/title-menu-item.c
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2010-07-12 17:45:04 +0200
committerSebastien Bacher <seb128@ubuntu.com>2010-07-12 17:45:04 +0200
commitf6ffb190261dfdbbf55e90b63c1cd06f03037e35 (patch)
treef34ba1947d158c3c38de6556f4049c518dc58c43 /src/title-menu-item.c
parent964106d9c8c140d9c27a22aca8078dfdab57c5e9 (diff)
parentd8253fc0cfe667316e2e5f033bcbfba4c3044297 (diff)
downloadayatana-indicator-sound-f6ffb190261dfdbbf55e90b63c1cd06f03037e35.tar.gz
ayatana-indicator-sound-f6ffb190261dfdbbf55e90b63c1cd06f03037e35.tar.bz2
ayatana-indicator-sound-f6ffb190261dfdbbf55e90b63c1cd06f03037e35.zip
Import upstream version 0.3.6
Diffstat (limited to 'src/title-menu-item.c')
-rw-r--r--src/title-menu-item.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/src/title-menu-item.c b/src/title-menu-item.c
index 0bf7db1..20d0aa4 100644
--- a/src/title-menu-item.c
+++ b/src/title-menu-item.c
@@ -63,7 +63,6 @@ typedef struct _TitleMenuitemPrivate TitleMenuitemPrivate;
typedef struct _PlayerController PlayerController;
typedef struct _PlayerControllerClass PlayerControllerClass;
-#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _PlayerControllerPrivate PlayerControllerPrivate;
#define TYPE_MPRIS_CONTROLLER (mpris_controller_get_type ())
@@ -126,8 +125,9 @@ enum {
TITLE_MENUITEM_DUMMY_PROPERTY
};
GType player_controller_get_type (void);
-TitleMenuitem* title_menuitem_new (PlayerController* parent, const char* name);
-TitleMenuitem* title_menuitem_construct (GType object_type, PlayerController* parent, const char* name);
+const char* player_controller_get_name (PlayerController* self);
+TitleMenuitem* title_menuitem_new (PlayerController* parent);
+TitleMenuitem* title_menuitem_construct (GType object_type, PlayerController* parent);
PlayerController* player_item_get_owner (PlayerItem* self);
GType mpris_controller_get_type (void);
GType player_controller_state_get_type (void);
@@ -137,40 +137,26 @@ GeeHashSet* title_menuitem_attributes_format (void);
-TitleMenuitem* title_menuitem_construct (GType object_type, PlayerController* parent, const char* name) {
+TitleMenuitem* title_menuitem_construct (GType object_type, PlayerController* parent) {
TitleMenuitem * self;
g_return_val_if_fail (parent != NULL, NULL);
- g_return_val_if_fail (name != NULL, NULL);
self = (TitleMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_TITLE_MENUITEM_TYPE, "owner", parent, NULL);
- dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_TITLE_MENUITEM_TEXT_NAME, name);
+ dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_TITLE_MENUITEM_TEXT_NAME, player_controller_get_name (parent));
return self;
}
-TitleMenuitem* title_menuitem_new (PlayerController* parent, const char* name) {
- return title_menuitem_construct (TYPE_TITLE_MENUITEM, parent, name);
-}
-
-
-static char* bool_to_string (gboolean self) {
- char* result = NULL;
- if (self) {
- result = g_strdup ("true");
- return result;
- } else {
- result = g_strdup ("false");
- return result;
- }
+TitleMenuitem* title_menuitem_new (PlayerController* parent) {
+ return title_menuitem_construct (TYPE_TITLE_MENUITEM, parent);
}
static void title_menuitem_real_handle_event (DbusmenuMenuitem* base, const char* name, GValue* input_value, guint timestamp) {
TitleMenuitem * self;
- char* _tmp0_;
self = (TitleMenuitem*) base;
g_return_if_fail (name != NULL);
- g_debug ("title-menu-item.vala:34: handle_event with bool value %s", _tmp0_ = bool_to_string (g_value_get_boolean (input_value)));
- _g_free0 (_tmp0_);
+ g_debug ("title-menu-item.vala:34: handle_event for owner %s with owner state = " \
+"%i and title menu name %s", player_controller_get_name (player_item_get_owner ((PlayerItem*) self)), player_item_get_owner ((PlayerItem*) self)->current_state, dbusmenu_menuitem_property_get ((DbusmenuMenuitem*) self, DBUSMENU_TITLE_MENUITEM_TEXT_NAME));
if (player_item_get_owner ((PlayerItem*) self)->current_state == PLAYER_CONTROLLER_STATE_OFFLINE) {
player_controller_instantiate (player_item_get_owner ((PlayerItem*) self));
}