aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-07-28 17:14:36 -0400
committerKen VanDine <ken.vandine@canonical.com>2011-07-28 17:14:36 -0400
commit81057468f44bb02e8cda510dc6bec30fe2ba987e (patch)
tree531a09a1c34005ec845f49dfa82004d9d25ae377
parent754649716f175cabcbc6175a5f0a8cd248edff83 (diff)
parentbce814c8b5db523e514de2bf1be4e33b7c3cf2de (diff)
downloadayatana-indicator-sound-81057468f44bb02e8cda510dc6bec30fe2ba987e.tar.gz
ayatana-indicator-sound-81057468f44bb02e8cda510dc6bec30fe2ba987e.tar.bz2
ayatana-indicator-sound-81057468f44bb02e8cda510dc6bec30fe2ba987e.zip
* New upstream release.
- menu resizes on reopen (LP: #809275) - pulse indication of SoundMenu play button not strong enough (LP: #742251)
-rwxr-xr-xconfigure28
-rw-r--r--configure.ac4
-rw-r--r--debian/changelog9
-rw-r--r--src/Makefile.am2
-rw-r--r--src/Makefile.in12
-rw-r--r--src/indicator-sound.c54
-rw-r--r--src/metadata-widget.c24
-rw-r--r--src/mute-menu-item.c5
-rw-r--r--src/mute-widget.c141
-rw-r--r--src/mute-widget.h67
-rw-r--r--src/transport-widget.c158
11 files changed, 386 insertions, 118 deletions
diff --git a/configure b/configure
index 12aa807..20091a4 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for indicator-sound 0.7.3.
+# Generated by GNU Autoconf 2.68 for indicator-sound 0.7.4.
#
# Report bugs to <conor.curran@canonical.com>.
#
@@ -630,8 +630,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='indicator-sound'
PACKAGE_TARNAME='indicator-sound'
-PACKAGE_VERSION='0.7.3'
-PACKAGE_STRING='indicator-sound 0.7.3'
+PACKAGE_VERSION='0.7.4'
+PACKAGE_STRING='indicator-sound 0.7.4'
PACKAGE_BUGREPORT='conor.curran@canonical.com'
PACKAGE_URL=''
@@ -1437,7 +1437,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures indicator-sound 0.7.3 to adapt to many kinds of systems.
+\`configure' configures indicator-sound 0.7.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1507,7 +1507,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of indicator-sound 0.7.3:";;
+ short | recursive ) echo "Configuration of indicator-sound 0.7.4:";;
esac
cat <<\_ACEOF
@@ -1644,7 +1644,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-indicator-sound configure 0.7.3
+indicator-sound configure 0.7.4
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2013,7 +2013,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by indicator-sound $as_me 0.7.3, which was
+It was created by indicator-sound $as_me 0.7.4, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -2833,7 +2833,7 @@ fi
# Define the identity of the package.
PACKAGE=indicator-sound
- VERSION=0.7.3
+ VERSION=0.7.4
cat >>confdefs.h <<_ACEOF
@@ -13903,13 +13903,13 @@ if test "x$with_localinstall" = "xyes"; then :
else
if test "x$with_gtk" = "x2"; then :
- INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator`
- INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir indicator`
+ INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator-0.4`
+ INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir indicator-0.4`
else
- INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator3`
- INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir indicator3`
+ INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator3-0.4`
+ INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir indicator3-0.4`
fi
fi
@@ -15456,7 +15456,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by indicator-sound $as_me 0.7.3, which was
+This file was extended by indicator-sound $as_me 0.7.4, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -15522,7 +15522,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-indicator-sound config.status 0.7.3
+indicator-sound config.status 0.7.4
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 184de39..47d8350 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,10 @@
-AC_INIT(indicator-sound, 0.7.3, conor.curran@canonical.com)
+AC_INIT(indicator-sound, 0.7.4, conor.curran@canonical.com)
AC_PREREQ(2.53)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(indicator-sound, 0.7.3)
+AM_INIT_AUTOMAKE(indicator-sound, 0.7.4)
AM_MAINTAINER_MODE
diff --git a/debian/changelog b/debian/changelog
index 20eaa75..da1b8ac 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+indicator-sound (0.7.4-0ubuntu1) UNRELEASED; urgency=low
+
+ * New upstream release.
+ - menu resizes on reopen (LP: #809275)
+ - pulse indication of SoundMenu play button not strong
+ enough (LP: #742251)
+
+ -- Ken VanDine <ken.vandine@canonical.com> Thu, 28 Jul 2011 17:12:15 -0400
+
indicator-sound (0.7.3-0ubuntu1) oneiric; urgency=low
* New upstream release.
diff --git a/src/Makefile.am b/src/Makefile.am
index e35f871..60c7249 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,6 +18,8 @@ libsoundmenu_la_SOURCES = \
transport-widget.h \
metadata-widget.c \
metadata-widget.h \
+ mute-widget.c \
+ mute-widget.h \
volume-widget.c \
volume-widget.h \
voip-input-widget.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index 4617dd3..bfd79c6 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -77,6 +77,7 @@ am_libsoundmenu_la_OBJECTS = libsoundmenu_la-indicator-sound.lo \
libsoundmenu_la-sound-state-manager.lo \
libsoundmenu_la-transport-widget.lo \
libsoundmenu_la-metadata-widget.lo \
+ libsoundmenu_la-mute-widget.lo \
libsoundmenu_la-volume-widget.lo \
libsoundmenu_la-voip-input-widget.lo \
libsoundmenu_la-gen-sound-service.xml.lo
@@ -331,6 +332,8 @@ libsoundmenu_la_SOURCES = \
transport-widget.h \
metadata-widget.c \
metadata-widget.h \
+ mute-widget.c \
+ mute-widget.h \
volume-widget.c \
volume-widget.h \
voip-input-widget.c \
@@ -583,6 +586,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsoundmenu_la-gen-sound-service.xml.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsoundmenu_la-indicator-sound.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsoundmenu_la-metadata-widget.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsoundmenu_la-mute-widget.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsoundmenu_la-sound-state-manager.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsoundmenu_la-sound-state.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsoundmenu_la-transport-widget.Plo@am__quote@
@@ -653,6 +657,14 @@ libsoundmenu_la-metadata-widget.lo: metadata-widget.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsoundmenu_la_CFLAGS) $(CFLAGS) -c -o libsoundmenu_la-metadata-widget.lo `test -f 'metadata-widget.c' || echo '$(srcdir)/'`metadata-widget.c
+libsoundmenu_la-mute-widget.lo: mute-widget.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsoundmenu_la_CFLAGS) $(CFLAGS) -MT libsoundmenu_la-mute-widget.lo -MD -MP -MF $(DEPDIR)/libsoundmenu_la-mute-widget.Tpo -c -o libsoundmenu_la-mute-widget.lo `test -f 'mute-widget.c' || echo '$(srcdir)/'`mute-widget.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsoundmenu_la-mute-widget.Tpo $(DEPDIR)/libsoundmenu_la-mute-widget.Plo
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mute-widget.c' object='libsoundmenu_la-mute-widget.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsoundmenu_la_CFLAGS) $(CFLAGS) -c -o libsoundmenu_la-mute-widget.lo `test -f 'mute-widget.c' || echo '$(srcdir)/'`mute-widget.c
+
libsoundmenu_la-volume-widget.lo: volume-widget.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsoundmenu_la_CFLAGS) $(CFLAGS) -MT libsoundmenu_la-volume-widget.lo -MD -MP -MF $(DEPDIR)/libsoundmenu_la-volume-widget.Tpo -c -o libsoundmenu_la-volume-widget.lo `test -f 'volume-widget.c' || echo '$(srcdir)/'`volume-widget.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsoundmenu_la-volume-widget.Tpo $(DEPDIR)/libsoundmenu_la-volume-widget.Plo
diff --git a/src/indicator-sound.c b/src/indicator-sound.c
index 76bf710..7c72900 100644
--- a/src/indicator-sound.c
+++ b/src/indicator-sound.c
@@ -39,6 +39,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "voip-input-widget.h"
#include "dbus-shared-names.h"
#include "sound-state-manager.h"
+#include "mute-widget.h"
#include "gen-sound-service.xml.h"
#include "common-defs.h"
@@ -49,6 +50,7 @@ struct _IndicatorSoundPrivate
{
GtkWidget* volume_widget;
GtkWidget* voip_widget;
+ MuteWidget *mute_widget;
GList* transport_widgets_list;
GDBusProxy *dbus_proxy;
SoundStateManager* state_manager;
@@ -75,6 +77,9 @@ static const gchar * get_accessible_desc (IndicatorObject * io);
static void indicator_sound_scroll (IndicatorObject * io,
IndicatorObjectEntry * entry, gint delta,
IndicatorScrollDirection direction);
+static void indicator_sound_middle_click (IndicatorObject * io,
+ IndicatorObjectEntry * entry,
+ guint time, gpointer data);
//key/moust event handlers
static gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data);
@@ -97,6 +102,10 @@ static gboolean new_metadata_widget (DbusmenuMenuitem * newitem,
DbusmenuMenuitem * parent,
DbusmenuClient * client,
gpointer user_data);
+static gboolean new_mute_widget (DbusmenuMenuitem * newitem,
+ DbusmenuMenuitem * parent,
+ DbusmenuClient * client,
+ gpointer user_data);
// DBUS communication
static GDBusNodeInfo *node_info = NULL;
@@ -125,6 +134,7 @@ indicator_sound_class_init (IndicatorSoundClass *klass)
io_class->get_menu = get_menu;
io_class->get_accessible_desc = get_accessible_desc;
io_class->entry_scrolled = indicator_sound_scroll;
+ io_class->secondary_activate = indicator_sound_middle_click;
}
static void
@@ -137,6 +147,7 @@ indicator_sound_init (IndicatorSound *self)
IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self);
priv->volume_widget = NULL;
priv->voip_widget = NULL;
+ priv->mute_widget = NULL;
priv->dbus_proxy = NULL;
GList* t_list = NULL;
priv->transport_widgets_list = t_list;
@@ -207,6 +218,9 @@ get_menu (IndicatorObject * io)
dbusmenu_client_add_type_handler (DBUSMENU_CLIENT(client),
DBUSMENU_METADATA_MENUITEM_TYPE,
new_metadata_widget);
+ dbusmenu_client_add_type_handler (DBUSMENU_CLIENT(client),
+ DBUSMENU_MUTE_MENUITEM_TYPE,
+ new_mute_widget);
// Note: Not ideal but all key handling needs to be managed here and then
// delegated to the appropriate widget.
g_signal_connect (menu, "key-press-event", G_CALLBACK(key_press_cb), io);
@@ -459,6 +473,36 @@ new_voip_slider_widget (DbusmenuMenuitem * newitem,
return TRUE;
}
+static gboolean
+new_mute_widget(DbusmenuMenuitem * newitem,
+ DbusmenuMenuitem * parent,
+ DbusmenuClient * client,
+ gpointer user_data)
+{
+ IndicatorObject *io = NULL;
+
+ g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE);
+ g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE);
+
+ io = g_object_get_data (G_OBJECT (client), "indicator");
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io));
+
+ if (priv->mute_widget != NULL){
+ g_object_unref (priv->mute_widget);
+ priv->mute_widget = NULL;
+ }
+
+ priv->mute_widget = mute_widget_new(newitem);
+ GtkMenuItem *item = mute_widget_get_menu_item (priv->mute_widget);
+
+ dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client),
+ newitem,
+ item,
+ parent);
+
+ return TRUE;
+}
+
/*******************************************************************/
//UI callbacks
/******************************************************************/
@@ -677,6 +721,16 @@ indicator_sound_scroll (IndicatorObject * io, IndicatorObjectEntry * entry,
sound_state_manager_show_notification (priv->state_manager, value);
}
+static void
+indicator_sound_middle_click (IndicatorObject * io, IndicatorObjectEntry * entry,
+ guint time, gpointer data)
+{
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io));
+ g_return_if_fail (priv);
+
+ mute_widget_toggle(priv->mute_widget);
+}
+
void
update_accessible_desc (IndicatorObject * io)
{
diff --git a/src/metadata-widget.c b/src/metadata-widget.c
index d34f1fc..ee9957f 100644
--- a/src/metadata-widget.c
+++ b/src/metadata-widget.c
@@ -77,7 +77,12 @@ static void metadata_widget_selection_received_event_callback( GtkWidget
guint time,
gpointer user_data);
+
+
#if GTK_CHECK_VERSION(3, 0, 0)
+static void metadata_widget_get_preferred_width (GtkWidget* self,
+ gint* minimum_width,
+ gint* natural_width);
static gboolean metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *image,
cairo_t* cr,
gpointer user_data);
@@ -106,7 +111,9 @@ metadata_widget_class_init (MetadataWidgetClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
widget_class->button_release_event = metadata_widget_button_release_event;
-
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ widget_class->get_preferred_width = metadata_widget_get_preferred_width;
+ #endif
g_type_class_add_private (klass, sizeof (MetadataWidgetPrivate));
gobject_class->dispose = metadata_widget_dispose;
@@ -163,6 +170,7 @@ metadata_widget_init (MetadataWidget *self)
gtk_misc_set_alignment(GTK_MISC(artist), (gfloat)0, (gfloat)0);
gtk_misc_set_padding (GTK_MISC(artist), (gfloat)10, (gfloat)0);
gtk_widget_set_size_request (artist, 140, 15);
+
gtk_label_set_ellipsize(GTK_LABEL(artist), PANGO_ELLIPSIZE_MIDDLE);
metadata_widget_style_labels(self, GTK_LABEL(artist));
priv->artist_label = artist;
@@ -172,6 +180,7 @@ metadata_widget_init (MetadataWidget *self)
piece = gtk_label_new("");
gtk_misc_set_alignment(GTK_MISC(piece), (gfloat)0, (gfloat)0);
gtk_misc_set_padding (GTK_MISC(piece), (gfloat)10, (gfloat)-5);
+
gtk_widget_set_size_request (piece, 140, 15);
gtk_label_set_ellipsize(GTK_LABEL(piece), PANGO_ELLIPSIZE_MIDDLE);
metadata_widget_style_labels(self, GTK_LABEL(piece));
@@ -183,6 +192,7 @@ metadata_widget_init (MetadataWidget *self)
gtk_misc_set_alignment(GTK_MISC(container), (gfloat)0, (gfloat)0);
gtk_misc_set_padding (GTK_MISC(container), (gfloat)10, (gfloat)0);
gtk_widget_set_size_request (container, 140, 15);
+
gtk_label_set_ellipsize(GTK_LABEL(container), PANGO_ELLIPSIZE_MIDDLE);
metadata_widget_style_labels(self, GTK_LABEL(container));
priv->container_label = container;
@@ -215,6 +225,7 @@ metadata_widget_init (MetadataWidget *self)
gtk_widget_show_all (priv->meta_data_h_box);
gtk_widget_set_no_show_all (priv->meta_data_h_box, TRUE);
+
gtk_widget_hide (priv->meta_data_h_box);
}
@@ -235,12 +246,19 @@ metadata_widget_finalize (GObject *object)
G_OBJECT_CLASS (metadata_widget_parent_class)->finalize (object);
}
+
+#if GTK_CHECK_VERSION(3, 0, 0)
+static void
+metadata_widget_get_preferred_width (GtkWidget* self,
+ gint* minimum_width,
+ gint* natural_width)
+{
+ *minimum_width = *natural_width = 200;
+}
/**
* We override the expose method to enable primitive drawing of the
* empty album art image and rounded rectangles on the album art.
*/
-
-#if GTK_CHECK_VERSION(3, 0, 0)
static gboolean
metadata_image_expose_gtk_3 (GtkWidget *metadata,
cairo_t* cr,
diff --git a/src/mute-menu-item.c b/src/mute-menu-item.c
index 2876be3..0e6a46f 100644
--- a/src/mute-menu-item.c
+++ b/src/mute-menu-item.c
@@ -63,6 +63,11 @@ mute_menu_item_init (MuteMenuItem *self)
MuteMenuItemPrivate* priv = MUTE_MENU_ITEM_GET_PRIVATE(self);
priv->button = NULL;
priv->button = dbusmenu_menuitem_new();
+
+ dbusmenu_menuitem_property_set(priv->button,
+ DBUSMENU_MENUITEM_PROP_TYPE,
+ DBUSMENU_MUTE_MENUITEM_TYPE);
+
dbusmenu_menuitem_property_set_bool (priv->button,
DBUSMENU_MENUITEM_PROP_VISIBLE,
TRUE);
diff --git a/src/mute-widget.c b/src/mute-widget.c
new file mode 100644
index 0000000..97c87ff
--- /dev/null
+++ b/src/mute-widget.c
@@ -0,0 +1,141 @@
+/*
+Copyright 2011 Canonical Ltd.
+
+Authors:
+ Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+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 <glib/gi18n.h>
+#include <glib.h>
+#include "mute-widget.h"
+#include "common-defs.h"
+#include "indicator-sound.h"
+
+typedef struct _MuteWidgetPrivate MuteWidgetPrivate;
+
+struct _MuteWidgetPrivate
+{
+ DbusmenuMenuitem *item;
+ GtkMenuItem *gitem;
+};
+
+#define MUTE_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MUTE_WIDGET_TYPE, MuteWidgetPrivate))
+
+/* Prototypes */
+static void mute_widget_class_init (MuteWidgetClass *klass);
+static void mute_widget_init (MuteWidget *self);
+static void mute_widget_dispose (GObject *object);
+static void mute_widget_finalize (GObject *object);
+
+G_DEFINE_TYPE (MuteWidget, mute_widget, G_TYPE_OBJECT);
+
+static void
+mute_widget_class_init (MuteWidgetClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->dispose = mute_widget_dispose;
+ gobject_class->finalize = mute_widget_finalize;
+ g_type_class_add_private (klass, sizeof (MuteWidgetPrivate));
+}
+
+static void
+mute_widget_init (MuteWidget *self)
+{
+ MuteWidgetPrivate *priv = MUTE_WIDGET_GET_PRIVATE(self);
+ priv->item = NULL;
+ priv->gitem = GTK_MENU_ITEM(gtk_menu_item_new ());
+}
+
+static void
+mute_widget_dispose (GObject *object)
+{
+ G_OBJECT_CLASS (mute_widget_parent_class)->dispose (object);
+}
+
+static void
+mute_widget_finalize (GObject *object)
+{
+ MuteWidget *self = MUTE_WIDGET (object);
+ MuteWidgetPrivate *priv = MUTE_WIDGET_GET_PRIVATE(self);
+
+ g_object_unref (priv->item);
+ g_object_unref (G_OBJECT (priv->gitem));
+ G_OBJECT_CLASS (mute_widget_parent_class)->finalize (object);
+}
+
+GtkMenuItem *
+mute_widget_get_menu_item(MuteWidget *self)
+{
+ MuteWidgetPrivate *priv = MUTE_WIDGET_GET_PRIVATE(self);
+ return priv->gitem;
+}
+
+MuteStatus
+mute_widget_get_status (MuteWidget *self)
+{
+ g_return_val_if_fail(self, MUTE_STATUS_UNAVAILABLE);
+ MuteStatus status = MUTE_STATUS_UNAVAILABLE;
+ MuteWidgetPrivate *priv = MUTE_WIDGET_GET_PRIVATE(self);
+
+ GVariant *vstatus = dbusmenu_menuitem_property_get_variant(priv->item,
+ DBUSMENU_MUTE_MENUITEM_VALUE);
+
+ if (g_variant_is_of_type (vstatus, G_VARIANT_TYPE_BOOLEAN))
+ {
+ if (g_variant_get_boolean (vstatus))
+ status = MUTE_STATUS_MUTED;
+ else
+ status = MUTE_STATUS_UNMUTED;
+ }
+
+ return status;
+}
+
+void mute_widget_toggle (MuteWidget *self)
+{
+ g_return_if_fail (self);
+ MuteWidgetPrivate *priv = MUTE_WIDGET_GET_PRIVATE(self);
+ gtk_menu_item_activate (priv->gitem);
+}
+
+/**
+ * mute_widget_new:
+ * @returns: a new #MuteWidget.
+ **/
+MuteWidget *
+mute_widget_new (DbusmenuMenuitem *item)
+{
+ MuteWidget* widget = g_object_new(MUTE_WIDGET_TYPE, NULL);
+ MuteWidgetPrivate* priv = MUTE_WIDGET_GET_PRIVATE(widget);
+ priv->item = g_object_ref(item);
+
+ GVariant *label = dbusmenu_menuitem_property_get_variant(priv->item,
+ DBUSMENU_MENUITEM_PROP_LABEL);
+
+ if (g_variant_is_of_type(label, G_VARIANT_TYPE_STRING))
+ gtk_menu_item_set_label(priv->gitem, g_variant_get_string(label, NULL));
+
+ if (label)
+ {
+ g_debug("Added a new Mute Widget %s", g_variant_print(label, FALSE));
+ g_variant_unref(label);
+ }
+
+ return widget;
+}
diff --git a/src/mute-widget.h b/src/mute-widget.h
new file mode 100644
index 0000000..95130a1
--- /dev/null
+++ b/src/mute-widget.h
@@ -0,0 +1,67 @@
+/*
+Copyright 2011 Canonical Ltd.
+
+Authors:
+ Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+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_WIDGET_H__
+#define __MUTE_WIDGET_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#if GTK_CHECK_VERSION(3, 0, 0)
+#include <libdbusmenu-gtk3/menuitem.h>
+#else
+#include <libdbusmenu-gtk/menuitem.h>
+#endif
+#include <libindicator/indicator-object.h>
+
+G_BEGIN_DECLS
+
+#define MUTE_WIDGET_TYPE (mute_widget_get_type ())
+#define MUTE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MUTE_WIDGET_TYPE, MuteWidget))
+#define MUTE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MUTE_WIDGET_TYPE, MuteWidgetClass))
+#define IS_MUTE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MUTE_WIDGET_TYPE))
+#define IS_MUTE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MUTE_WIDGET_TYPE))
+#define MUTE_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MUTE_WIDGET_TYPE, MuteWidgetClass))
+
+typedef struct _MuteWidget MuteWidget;
+typedef struct _MuteWidgetClass MuteWidgetClass;
+
+struct _MuteWidgetClass {
+ GObjectClass parent_class;
+};
+
+struct _MuteWidget {
+ GObject parent;
+};
+
+typedef enum {
+ MUTE_STATUS_UNAVAILABLE,
+ MUTE_STATUS_MUTED,
+ MUTE_STATUS_UNMUTED
+} MuteStatus;
+
+GType mute_widget_get_type (void) G_GNUC_CONST;
+MuteWidget* mute_widget_new (DbusmenuMenuitem *item);
+MuteStatus mute_widget_get_status (MuteWidget *self);
+void mute_widget_toggle (MuteWidget *self);
+GtkMenuItem *mute_widget_get_menu_item (MuteWidget *self);
+
+G_END_DECLS
+
+#endif
+
diff --git a/src/transport-widget.c b/src/transport-widget.c
index 11e0f91..898472e 100644
--- a/src/transport-widget.c
+++ b/src/transport-widget.c
@@ -85,11 +85,12 @@ struct _TransportWidgetPrivate
gboolean has_focus;
gint hold_timer;
gint skip_frequency;
- gint launching_timer;
- gdouble launching_transparency;
- gboolean fade_out;
};
+static GList *transport_widget_list = NULL;
+static GtkStyleContext *spinner_style_context = NULL;
+static GtkWidgetPath *spinner_widget_path = NULL;
+
// TODO refactor the UI handlers, consolidate functionality between key press /release
// and button press / release.
#define TRANSPORT_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRANSPORT_WIDGET_TYPE, TransportWidgetPrivate))
@@ -141,7 +142,6 @@ static TransportAction transport_widget_collision_detection (gint x, gint y);
static void transport_widget_start_timing (TransportWidget* widget);
static gboolean transport_widget_trigger_seek (gpointer userdata);
static gboolean transport_widget_seek (gpointer userdata);
-static gboolean transport_widget_fade_playbutton (gpointer userdata);
/// Init functions //////////////////////////////////////////////////////////
@@ -170,7 +170,25 @@ transport_widget_class_init (TransportWidgetClass *klass)
static void
transport_widget_init (TransportWidget *self)
{
- TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(self);
+ TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(self);
+
+ if (transport_widget_list == NULL){
+ /* append the object to the static linked list. */
+ transport_widget_list = g_list_append (transport_widget_list, self);
+
+ /* create widget path */
+ spinner_widget_path = gtk_widget_path_new();
+
+ gtk_widget_path_iter_set_name (spinner_widget_path, -1 , "IndicatorSoundSpinner");
+ gtk_widget_path_append_type (spinner_widget_path, GTK_TYPE_SPINNER);
+
+ /* create style context and append path */
+ spinner_style_context = gtk_style_context_new();
+
+ gtk_style_context_set_path (spinner_style_context, spinner_widget_path);
+ gtk_style_context_add_class (spinner_style_context, GTK_STYLE_CLASS_SPINNER);
+ }
+
priv->current_command = TRANSPORT_ACTION_NO_ACTION;
priv->current_state = TRANSPORT_STATE_PAUSED;
priv->key_event = TRANSPORT_ACTION_NO_ACTION;
@@ -178,9 +196,6 @@ transport_widget_init (TransportWidget *self)
priv->has_focus = FALSE;
priv->hold_timer = 0;
priv->skip_frequency = 0;
- priv->launching_timer = 0;
- priv->launching_transparency = 1.0f;
- priv->fade_out = TRUE;
priv->command_coordinates = g_hash_table_new_full(g_direct_hash,
g_direct_equal,
NULL,
@@ -233,12 +248,28 @@ transport_widget_init (TransportWidget *self)
static void
transport_widget_dispose (GObject *object)
{
+ transport_widget_list = g_list_remove (transport_widget_list, object);
+
+ if (transport_widget_list == NULL){
+ if (spinner_widget_path != NULL){
+ gtk_widget_path_free (spinner_widget_path);
+ spinner_widget_path = NULL;
+ }
+
+ if (spinner_style_context != NULL){
+ g_object_unref (spinner_style_context);
+ spinner_style_context = NULL;
+ }
+ }
+
G_OBJECT_CLASS (transport_widget_parent_class)->dispose (object);
}
static void
transport_widget_finalize (GObject *object)
{
+
+
G_OBJECT_CLASS (transport_widget_parent_class)->finalize (object);
}
@@ -249,7 +280,7 @@ transport_widget_expose (GtkWidget *button, GdkEventExpose *event)
cairo_t *cr;
cr = gdk_cairo_create (gtk_widget_get_window (button));
- //g_debug("In the playbutton's expose method, x = %i, y=%i and width: %i and height: %i'");
+ g_debug("In the playbutton's expose method, x = %i, y=%i and width: %i and height: %i'");
cairo_rectangle (cr,
event->area.x, event->area.y,
event->area.width, event->area.height);
@@ -275,7 +306,6 @@ transport_widget_toggle_play_pause(TransportWidget* button,
{
TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(button);
priv->current_state = update;
- //g_debug("TransportWidget::toggle play state : %i", priv->current_state);
gtk_widget_queue_draw (GTK_WIDGET(button));
}
@@ -306,6 +336,8 @@ static gboolean
transport_widget_motion_notify_event (GtkWidget *menuitem,
GdkEventMotion *event)
{
+ //g_debug("transport_widget_motion_notify_event()");
+
g_return_val_if_fail ( IS_TRANSPORT_WIDGET(menuitem), FALSE );
TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) );
TransportAction result = transport_widget_determine_motion_event ( TRANSPORT_WIDGET(menuitem),
@@ -327,6 +359,8 @@ static gboolean
transport_widget_leave_notify_event (GtkWidget *menuitem,
GdkEventCrossing *event)
{
+ //g_debug("transport_widget_leave_notify_event()");
+
g_return_val_if_fail ( IS_TRANSPORT_WIDGET(menuitem), FALSE );
TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) );
@@ -341,6 +375,8 @@ static gboolean
transport_widget_button_press_event (GtkWidget *menuitem,
GdkEventButton *event)
{
+ //g_debug("transport_widget_button_press_event()");
+
g_return_val_if_fail ( IS_TRANSPORT_WIDGET(menuitem), FALSE );
TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) );
TransportAction result = transport_widget_determine_button_event ( TRANSPORT_WIDGET(menuitem),
@@ -1228,7 +1264,9 @@ draw (GtkWidget* button, cairo_t *cr)
g_return_val_if_fail(IS_TRANSPORT_WIDGET(button), FALSE);
g_return_val_if_fail(cr != NULL, FALSE);
TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(button);
-
+
+ //g_debug("transport-widget draw()");
+
cairo_surface_t* surf = NULL;
cairo_t* cr_surf = NULL;
@@ -1755,60 +1793,8 @@ draw (GtkWidget* button, cairo_t *cr)
}
else if(priv->current_state == TRANSPORT_STATE_LAUNCHING)
{
-/*
- g_debug ("launching in draw");
-*/
- _setup (&cr_surf, &surf, PLAY_WIDTH+6, PLAY_HEIGHT+6);
- _mask_play (cr_surf,
- PLAY_PADDING,
- PLAY_PADDING,
- PLAY_WIDTH - (2*PLAY_PADDING),
- PLAY_HEIGHT - (2*PLAY_PADDING));
-
- double BUTTON_SHADOW_LAUNCHING[] = {color_button[3].r,
- color_button[3].g,
- color_button[3].b,
- priv->launching_transparency};
- double BUTTON_LAUNCHING_END[] = {color_button[0].r,
- color_button[0].g,
- color_button[0].b,
- priv->launching_transparency};
- double BUTTON_LAUNCHING_START[] = {color_button[1].r,
- color_button[1].g,
- color_button[1].b,
- priv->launching_transparency};
- _fill (cr_surf,
- PLAY_PADDING,
- PLAY_PADDING,
- PLAY_WIDTH - (2*PLAY_PADDING),
- PLAY_HEIGHT - (2*PLAY_PADDING),
- BUTTON_SHADOW_LAUNCHING,
- BUTTON_SHADOW_LAUNCHING,
- FALSE);
- _surface_blur (surf, 3);
- _finalize_repaint (cr, &cr_surf, &surf, PAUSE_X-0.5f, PAUSE_Y + 0.5f, 3);
-
- // draw play-button
- _setup (&cr_surf, &surf, PLAY_WIDTH, PLAY_HEIGHT);
- cairo_set_line_width (cr, 10.5);
- cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
- cairo_set_line_join(cr, CAIRO_LINE_JOIN_ROUND);
- _mask_play (cr_surf,
- PLAY_PADDING,
- PLAY_PADDING,
- PLAY_WIDTH - (2*PLAY_PADDING),
- PLAY_HEIGHT - (2*PLAY_PADDING));
- _fill (cr_surf,
- PLAY_PADDING,
- PLAY_PADDING,
- PLAY_WIDTH - (2*PLAY_PADDING),
- PLAY_HEIGHT - (2*PLAY_PADDING),
- BUTTON_LAUNCHING_START,
- BUTTON_LAUNCHING_END,
- FALSE);
- _finalize (cr, &cr_surf, &surf, PAUSE_X-0.5f, PAUSE_Y);
+ gtk_render_activity (spinner_style_context, cr, 106, 6 , 30, 30);
}
-
return FALSE;
}
@@ -1827,30 +1813,6 @@ transport_widget_set_twin_item(TransportWidget* self,
(TransportState)initial_state);
}
-static gboolean
-transport_widget_fade_playbutton (gpointer userdata)
-{
- TransportWidget* bar = (TransportWidget*)userdata;
- g_return_val_if_fail(IS_TRANSPORT_WIDGET(bar), FALSE);
-/*
- g_debug ("fade in /out timeout");
-*/
- TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(bar);
- if (priv->launching_transparency == 1.0f){
- priv->fade_out = TRUE;
- }
- else if (priv->launching_transparency <= 0.3F){
- priv->fade_out = FALSE;
- }
- if (priv->fade_out == TRUE){
- priv->launching_transparency -= 0.05f;
- }
- else{
- priv->launching_transparency += 0.05f;
- }
- gtk_widget_queue_draw (GTK_WIDGET(bar));
- return TRUE;
-}
/**
* transport_widget_update_state()
* Callback for updates from the other side of dbus
@@ -1867,21 +1829,19 @@ transport_widget_property_update(DbusmenuMenuitem* item, gchar* property,
if(g_ascii_strcasecmp(DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE, property) == 0)
{
TransportState new_state = (TransportState)g_variant_get_int32(value);
- //g_debug("transport_widget_update_state - with value %i", update_value);
+ //g_debug("transport_widget_update_state - with value %i", new_state);
if (new_state == TRANSPORT_STATE_LAUNCHING){
+ gtk_style_context_notify_state_change (spinner_style_context,
+ gtk_widget_get_window ( GTK_WIDGET(userdata)),
+ NULL,
+ GTK_STATE_FLAG_ACTIVE,
+ TRUE);
+ gtk_style_context_set_state (spinner_style_context, GTK_STATE_FLAG_ACTIVE);
+
priv->current_state = TRANSPORT_STATE_LAUNCHING;
- priv->launching_timer = g_timeout_add (100,
- transport_widget_fade_playbutton,
- bar);
- //g_debug("TransportWidget::toggle play state : %i", priv->current_state);
+ g_debug("TransportWidget::toggle play state : %i", priv->current_state);
}
else{
- if (priv->launching_timer != 0){
- g_source_remove (priv->launching_timer);
- priv->launching_timer = 0;
- priv->fade_out = TRUE;
- priv->launching_transparency = 1.0f;
- }
transport_widget_toggle_play_pause(bar, new_state);
}
}