aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am2
-rw-r--r--src/common-defs.h3
-rw-r--r--src/mute-menu-item.c114
-rw-r--r--src/mute-menu-item.h55
-rw-r--r--src/sound-service.c4
5 files changed, 176 insertions, 2 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 32b6928..f880662 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -95,6 +95,8 @@ indicator_sound_service_SOURCES = \
sound-service-dbus.c \
slider-menu-item.h \
slider-menu-item.c \
+ mute-menu-item.h \
+ mute-menu-item.c \
gen-sound-service.xml.h \
gen-sound-service.xml.c \
$(music_bridge_VALASOURCES:.vala=.c)
diff --git a/src/common-defs.h b/src/common-defs.h
index 8ec69e8..c7d497a 100644
--- a/src/common-defs.h
+++ b/src/common-defs.h
@@ -30,6 +30,9 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#define DBUSMENU_VOLUME_MENUITEM_TYPE "x-canonical-ido-volume-type"
#define DBUSMENU_VOLUME_MENUITEM_LEVEL "x-canonical-ido-volume-level"
+#define DBUSMENU_MUTE_MENUITEM_TYPE "x-canonical-sound-menu-mute-type"
+#define DBUSMENU_MUTE_MENUITEM_VALUE "x-canonical-sound-menu-mute-value"
+
#define DBUSMENU_TRANSPORT_MENUITEM_TYPE "x-canonical-sound-menu-player-transport-type"
#define DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE "x-canonical-sound-menu-player-transport-state"
diff --git a/src/mute-menu-item.c b/src/mute-menu-item.c
new file mode 100644
index 0000000..bdb14a6
--- /dev/null
+++ b/src/mute-menu-item.c
@@ -0,0 +1,114 @@
+/*
+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/>.
+*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "common-defs.h"
+#include <glib/gi18n.h>
+#include "mute-menu-item.h"
+#include "common-defs.h"
+
+
+typedef struct _MuteMenuItemPrivate MuteMenuItemPrivate;
+
+struct _MuteMenuItemPrivate {
+ gboolean mute_all;
+};
+
+#define MUTE_MENU_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MUTE_MENU_ITEM_TYPE, MuteMenuItemPrivate))
+
+/* Prototypes */
+static void mute_menu_item_class_init (MuteMenuItemClass *klass);
+static void mute_menu_item_init (MuteMenuItem *self);
+static void mute_menu_item_dispose (GObject *object);
+static void mute_menu_item_finalize (GObject *object);
+static void handle_event (DbusmenuMenuitem * mi, const gchar * name,
+ GVariant * value, guint timestamp);
+
+G_DEFINE_TYPE (MuteMenuItem, mute_menu_item, DBUSMENU_TYPE_MENUITEM);
+
+static void mute_menu_item_class_init (MuteMenuItemClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (MuteMenuItemPrivate));
+
+ object_class->dispose = mute_menu_item_dispose;
+ object_class->finalize = mute_menu_item_finalize;
+
+ DbusmenuMenuitemClass * mclass = DBUSMENU_MENUITEM_CLASS(klass);
+ mclass->handle_event = handle_event;
+ return;
+}
+
+static void mute_menu_item_init (MuteMenuItem *self)
+{
+ g_debug("Building new Mute Menu Item");
+ return;
+}
+
+static void mute_menu_item_dispose (GObject *object)
+{
+ G_OBJECT_CLASS (mute_menu_item_parent_class)->dispose (object);
+ return;
+}
+
+static void
+mute_menu_item_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (mute_menu_item_parent_class)->finalize (object);
+}
+
+
+static void
+handle_event (DbusmenuMenuitem * mi,
+ const gchar * name,
+ GVariant * value,
+ guint timestamp)
+{
+ /*g_debug ( "handle-event in the mute at the backend, input is of type %s",
+ g_variant_get_type_string(value));*/
+
+ GVariant* input = NULL;
+ input = value;
+ g_variant_ref (input);
+
+ // Please note: Subject to change in future DBusmenu revisions
+ if (g_variant_is_of_type(value, G_VARIANT_TYPE_VARIANT) == TRUE) {
+ input = g_variant_get_variant(value);
+ }
+
+ gboolean mute_input = g_variant_get_boolean(input);
+ g_variant_unref (input);
+}
+
+MuteMenuItem* mute_menu_item_new(gboolean sinks_available, gdouble start_volume)
+{
+ MuteMenuItem *self = g_object_new(MUTE_MENU_ITEM_TYPE, NULL);
+ dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_MUTE_MENUITEM_TYPE);
+
+ //dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_ENABLED, sinks_available);
+ //dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, sinks_available);
+ return self;
+}
+
+
+
+
diff --git a/src/mute-menu-item.h b/src/mute-menu-item.h
new file mode 100644
index 0000000..36f5e69
--- /dev/null
+++ b/src/mute-menu-item.h
@@ -0,0 +1,55 @@
+/*
+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/>.
+*/
+
+#ifndef __MUTE_MENU_ITEM_H__
+#define __MUTE_MENU_ITEM_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <libdbusmenu-glib/menuitem.h>
+
+G_BEGIN_DECLS
+
+#define MUTE_MENU_ITEM_TYPE (mute_menu_item_get_type ())
+#define MUTE_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MUTE_MENU_ITEM_TYPE, MuteMenuItem))
+#define MUTE_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MUTE_MENU_ITEM_TYPE, MuteMenuItemClass))
+#define IS_MUTE_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MUTE_MENU_ITEM_TYPE))
+#define IS_MUTE_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MUTE_MENU_ITEM_TYPE))
+#define MUTE_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MUTE_MENU_ITEM_TYPE, MuteMenuItemClass))
+
+typedef struct _MuteMenuItem MuteMenuItem;
+typedef struct _MuteMenuItemClass MuteMenuItemClass;
+
+struct _MuteMenuItemClass {
+ DbusmenuMenuitemClass parent_class;
+};
+
+struct _MuteMenuItem {
+ DbusmenuMenuitem parent;
+};
+
+GType mute_menu_item_get_type (void);
+
+MuteMenuItem* mute_menu_item_new();
+
+G_END_DECLS
+
+#endif
+
diff --git a/src/sound-service.c b/src/sound-service.c
index 98f1881..defcb94 100644
--- a/src/sound-service.c
+++ b/src/sound-service.c
@@ -40,8 +40,8 @@ service_shutdown (IndicatorService *service, gpointer user_data)
{
if (mainloop != NULL) {
g_debug("Service shutdown !");
- close_pulse_activites();
- g_main_loop_quit(mainloop);
+ //close_pulse_activites();
+ //g_main_loop_quit(mainloop);
}
return;
}