diff options
Diffstat (limited to 'src/scrub-menu-item.c')
-rw-r--r-- | src/scrub-menu-item.c | 206 |
1 files changed, 0 insertions, 206 deletions
diff --git a/src/scrub-menu-item.c b/src/scrub-menu-item.c deleted file mode 100644 index 18a8129..0000000 --- a/src/scrub-menu-item.c +++ /dev/null @@ -1,206 +0,0 @@ -/* scrub-menu-item.c generated by valac 0.9.8, the Vala compiler - * generated from scrub-menu-item.vala, do not modify */ - -/* -Copyright 2010 Canonical Ltd. - -Authors: - Conor Curran <conor.curran@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 -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 <http://www.gnu.org/licenses/>. -*/ - -#include <glib.h> -#include <glib-object.h> -#include <libdbusmenu-glib/client.h> -#include <libdbusmenu-glib/menuitem-proxy.h> -#include <libdbusmenu-glib/menuitem.h> -#include <libdbusmenu-glib/server.h> -#include <common-defs.h> -#include <gee.h> -#include <stdlib.h> -#include <string.h> -#include <float.h> -#include <math.h> - - -#define TYPE_PLAYER_ITEM (player_item_get_type ()) -#define PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_ITEM, PlayerItem)) -#define PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_ITEM, PlayerItemClass)) -#define IS_PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_ITEM)) -#define IS_PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_ITEM)) -#define PLAYER_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_ITEM, PlayerItemClass)) - -typedef struct _PlayerItem PlayerItem; -typedef struct _PlayerItemClass PlayerItemClass; -typedef struct _PlayerItemPrivate PlayerItemPrivate; - -#define TYPE_SCRUB_MENUITEM (scrub_menuitem_get_type ()) -#define SCRUB_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SCRUB_MENUITEM, ScrubMenuitem)) -#define SCRUB_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SCRUB_MENUITEM, ScrubMenuitemClass)) -#define IS_SCRUB_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SCRUB_MENUITEM)) -#define IS_SCRUB_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SCRUB_MENUITEM)) -#define SCRUB_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SCRUB_MENUITEM, ScrubMenuitemClass)) - -typedef struct _ScrubMenuitem ScrubMenuitem; -typedef struct _ScrubMenuitemClass ScrubMenuitemClass; -typedef struct _ScrubMenuitemPrivate ScrubMenuitemPrivate; - -#define TYPE_PLAYER_CONTROLLER (player_controller_get_type ()) -#define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController)) -#define PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) -#define IS_PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_CONTROLLER)) -#define IS_PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_CONTROLLER)) -#define PLAYER_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) - -typedef struct _PlayerController PlayerController; -typedef struct _PlayerControllerClass PlayerControllerClass; -#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -typedef struct _PlayerControllerPrivate PlayerControllerPrivate; - -#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 _Mpris2Controller Mpris2Controller; -typedef struct _Mpris2ControllerClass Mpris2ControllerClass; - -struct _PlayerItem { - DbusmenuMenuitem parent_instance; - PlayerItemPrivate * priv; -}; - -struct _PlayerItemClass { - DbusmenuMenuitemClass parent_class; -}; - -struct _ScrubMenuitem { - PlayerItem parent_instance; - ScrubMenuitemPrivate * priv; -}; - -struct _ScrubMenuitemClass { - PlayerItemClass parent_class; -}; - -struct _PlayerController { - GObject parent_instance; - PlayerControllerPrivate * priv; - gint current_state; - GeeArrayList* custom_items; - Mpris2Controller* mpris_bridge; -}; - -struct _PlayerControllerClass { - GObjectClass parent_class; -}; - - -static gpointer scrub_menuitem_parent_class = NULL; - -GType player_item_get_type (void) G_GNUC_CONST; -GType scrub_menuitem_get_type (void) G_GNUC_CONST; -enum { - SCRUB_MENUITEM_DUMMY_PROPERTY -}; -GType player_controller_get_type (void) G_GNUC_CONST; -ScrubMenuitem* scrub_menuitem_new (PlayerController* parent); -ScrubMenuitem* scrub_menuitem_construct (GType object_type, PlayerController* parent); -void player_item_reset (PlayerItem* self, GeeHashSet* attrs); -GeeHashSet* scrub_menuitem_attributes_format (void); -static void scrub_menuitem_real_handle_event (DbusmenuMenuitem* base, const char* name, GValue* input_value, guint timestamp); -PlayerController* player_item_get_owner (PlayerItem* self); -const char* player_controller_get_name (PlayerController* self); -GType mpris2_controller_get_type (void) G_GNUC_CONST; -void mpris2_controller_set_track_position (Mpris2Controller* self, double position); -void scrub_menuitem_update_position (ScrubMenuitem* self, gint32 new_position); -void scrub_menuitem_update_playstate (ScrubMenuitem* self, gint state); - - - -ScrubMenuitem* scrub_menuitem_construct (GType object_type, PlayerController* parent) { - ScrubMenuitem * self; - GeeHashSet* _tmp0_; - g_return_val_if_fail (parent != NULL, NULL); - self = (ScrubMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_SCRUB_MENUITEM_TYPE, "owner", parent, NULL); - player_item_reset ((PlayerItem*) self, _tmp0_ = scrub_menuitem_attributes_format ()); - _g_object_unref0 (_tmp0_); - return self; -} - - -ScrubMenuitem* scrub_menuitem_new (PlayerController* parent) { - return scrub_menuitem_construct (TYPE_SCRUB_MENUITEM, parent); -} - - -static void scrub_menuitem_real_handle_event (DbusmenuMenuitem* base, const char* name, GValue* input_value, guint timestamp) { - ScrubMenuitem * self; - self = (ScrubMenuitem*) base; - g_return_if_fail (name != NULL); - g_debug ("scrub-menu-item.vala:34: handle_event for owner %s with value: %f", player_controller_get_name (player_item_get_owner ((PlayerItem*) self)), g_value_get_double (input_value)); - mpris2_controller_set_track_position (player_item_get_owner ((PlayerItem*) self)->mpris_bridge, g_value_get_double (input_value)); -} - - -void scrub_menuitem_update_position (ScrubMenuitem* self, gint32 new_position) { - g_return_if_fail (self != NULL); - dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, DBUSMENU_SCRUB_MENUITEM_POSITION, (gint) new_position); -} - - -void scrub_menuitem_update_playstate (ScrubMenuitem* self, gint state) { - g_return_if_fail (self != NULL); - dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, DBUSMENU_SCRUB_MENUITEM_PLAY_STATE, state); -} - - -GeeHashSet* scrub_menuitem_attributes_format (void) { - GeeHashSet* result = NULL; - GeeHashSet* attrs; - attrs = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); - gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_SCRUB_MENUITEM_DURATION); - gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_SCRUB_MENUITEM_POSITION); - gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_SCRUB_MENUITEM_PLAY_STATE); - result = attrs; - return result; -} - - -static void scrub_menuitem_class_init (ScrubMenuitemClass * klass) { - scrub_menuitem_parent_class = g_type_class_peek_parent (klass); - DBUSMENU_MENUITEM_CLASS (klass)->handle_event = scrub_menuitem_real_handle_event; -} - - -static void scrub_menuitem_instance_init (ScrubMenuitem * self) { -} - - -GType scrub_menuitem_get_type (void) { - static volatile gsize scrub_menuitem_type_id__volatile = 0; - if (g_once_init_enter (&scrub_menuitem_type_id__volatile)) { - static const GTypeInfo g_define_type_info = { sizeof (ScrubMenuitemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) scrub_menuitem_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ScrubMenuitem), 0, (GInstanceInitFunc) scrub_menuitem_instance_init, NULL }; - GType scrub_menuitem_type_id; - scrub_menuitem_type_id = g_type_register_static (TYPE_PLAYER_ITEM, "ScrubMenuitem", &g_define_type_info, 0); - g_once_init_leave (&scrub_menuitem_type_id__volatile, scrub_menuitem_type_id); - } - return scrub_menuitem_type_id__volatile; -} - - - - |