aboutsummaryrefslogtreecommitdiff
path: root/src/metadata-menu-item.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/metadata-menu-item.c')
-rw-r--r--src/metadata-menu-item.c205
1 files changed, 205 insertions, 0 deletions
diff --git a/src/metadata-menu-item.c b/src/metadata-menu-item.c
new file mode 100644
index 0000000..f33e848
--- /dev/null
+++ b/src/metadata-menu-item.c
@@ -0,0 +1,205 @@
+/* metadata-menu-item.c generated by valac, the Vala compiler
+ * generated from metadata-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>
+
+
+#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_MPRIS_CONTROLLER (mpris_controller_get_type ())
+#define MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS_CONTROLLER, MprisController))
+#define MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS_CONTROLLER, MprisControllerClass))
+#define IS_MPRIS_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS_CONTROLLER))
+#define IS_MPRIS_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS_CONTROLLER))
+#define MPRIS_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS_CONTROLLER, MprisControllerClass))
+
+typedef struct _MprisController MprisController;
+typedef struct _MprisControllerClass MprisControllerClass;
+
+#define TYPE_METADATA_MENUITEM (metadata_menuitem_get_type ())
+#define METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitem))
+#define METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_METADATA_MENUITEM, MetadataMenuitemClass))
+#define IS_METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_METADATA_MENUITEM))
+#define IS_METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_METADATA_MENUITEM))
+#define METADATA_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitemClass))
+
+typedef struct _MetadataMenuitem MetadataMenuitem;
+typedef struct _MetadataMenuitemClass MetadataMenuitemClass;
+typedef struct _MetadataMenuitemPrivate MetadataMenuitemPrivate;
+#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+#define _g_free0(var) (var = (g_free (var), NULL))
+
+struct _PlayerItem {
+ DbusmenuMenuitem parent_instance;
+ PlayerItemPrivate * priv;
+ MprisController* mpris_adaptor;
+};
+
+struct _PlayerItemClass {
+ DbusmenuMenuitemClass parent_class;
+ void (*check_layout) (PlayerItem* self);
+};
+
+struct _MetadataMenuitem {
+ PlayerItem parent_instance;
+ MetadataMenuitemPrivate * priv;
+};
+
+struct _MetadataMenuitemClass {
+ PlayerItemClass parent_class;
+};
+
+
+static gpointer metadata_menuitem_parent_class = NULL;
+
+GType player_item_get_type (void);
+GType mpris_controller_get_type (void);
+GType metadata_menuitem_get_type (void);
+enum {
+ METADATA_MENUITEM_DUMMY_PROPERTY
+};
+PlayerItem* player_item_new (void);
+PlayerItem* player_item_construct (GType object_type);
+MetadataMenuitem* metadata_menuitem_new (void);
+MetadataMenuitem* metadata_menuitem_construct (GType object_type);
+GeeHashSet* metadata_menuitem_attributes_format (void);
+gboolean metadata_menuitem_populated (MetadataMenuitem* self);
+static void metadata_menuitem_real_check_layout (PlayerItem* base);
+static int _vala_strcmp0 (const char * str1, const char * str2);
+
+
+
+MetadataMenuitem* metadata_menuitem_construct (GType object_type) {
+ MetadataMenuitem * self;
+ self = (MetadataMenuitem*) player_item_construct (object_type);
+ dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_METADATA_MENUITEM_TYPE);
+ return self;
+}
+
+
+MetadataMenuitem* metadata_menuitem_new (void) {
+ return metadata_menuitem_construct (TYPE_METADATA_MENUITEM);
+}
+
+
+GeeHashSet* metadata_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_METADATA_MENUITEM_TEXT_TITLE);
+ gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_METADATA_MENUITEM_TEXT_ARTIST);
+ gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM);
+ gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_METADATA_MENUITEM_ARTURL);
+ result = attrs;
+ return result;
+}
+
+
+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;
+ }
+}
+
+
+static void metadata_menuitem_real_check_layout (PlayerItem* base) {
+ MetadataMenuitem * self;
+ char* _tmp0_;
+ self = (MetadataMenuitem*) base;
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_MENUITEM_PROP_VISIBLE, metadata_menuitem_populated (self));
+ g_debug ("metadata-menu-item.vala:43: check layout for the metadata = %s", _tmp0_ = bool_to_string (metadata_menuitem_populated (self)));
+ _g_free0 (_tmp0_);
+}
+
+
+gboolean metadata_menuitem_populated (MetadataMenuitem* self) {
+ gboolean result = FALSE;
+ gboolean _tmp0_ = FALSE;
+ g_return_val_if_fail (self != NULL, FALSE);
+ if (dbusmenu_menuitem_property_get ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_TEXT_TITLE) != NULL) {
+ _tmp0_ = _vala_strcmp0 (dbusmenu_menuitem_property_get ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_TEXT_TITLE), "") != 0;
+ } else {
+ _tmp0_ = FALSE;
+ }
+ result = _tmp0_;
+ return result;
+}
+
+
+static void metadata_menuitem_class_init (MetadataMenuitemClass * klass) {
+ metadata_menuitem_parent_class = g_type_class_peek_parent (klass);
+ PLAYER_ITEM_CLASS (klass)->check_layout = metadata_menuitem_real_check_layout;
+}
+
+
+static void metadata_menuitem_instance_init (MetadataMenuitem * self) {
+}
+
+
+GType metadata_menuitem_get_type (void) {
+ static volatile gsize metadata_menuitem_type_id__volatile = 0;
+ if (g_once_init_enter (&metadata_menuitem_type_id__volatile)) {
+ static const GTypeInfo g_define_type_info = { sizeof (MetadataMenuitemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) metadata_menuitem_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MetadataMenuitem), 0, (GInstanceInitFunc) metadata_menuitem_instance_init, NULL };
+ GType metadata_menuitem_type_id;
+ metadata_menuitem_type_id = g_type_register_static (TYPE_PLAYER_ITEM, "MetadataMenuitem", &g_define_type_info, 0);
+ g_once_init_leave (&metadata_menuitem_type_id__volatile, metadata_menuitem_type_id);
+ }
+ return metadata_menuitem_type_id__volatile;
+}
+
+
+static int _vala_strcmp0 (const char * str1, const char * str2) {
+ if (str1 == NULL) {
+ return -(str1 != str2);
+ }
+ if (str2 == NULL) {
+ return str1 != str2;
+ }
+ return strcmp (str1, str2);
+}
+
+
+
+