aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-01-28 09:43:28 -0500
committerKen VanDine <ken.vandine@canonical.com>2011-01-28 09:43:28 -0500
commitd668df547af9a4add8c18e3614d344b80e0bd6c8 (patch)
treecbfcc0032f6b7caae85844da22ee1b45fb1d7727 /src
parent5338c77428955cf6701b5fa9cad84e135f6522b2 (diff)
parent868c3e3d18c5de79c679c57ae468f52a504dffd7 (diff)
downloadayatana-indicator-sound-d668df547af9a4add8c18e3614d344b80e0bd6c8.tar.gz
ayatana-indicator-sound-d668df547af9a4add8c18e3614d344b80e0bd6c8.tar.bz2
ayatana-indicator-sound-d668df547af9a4add8c18e3614d344b80e0bd6c8.zip
releasing version 0.5.8-0ubuntu1
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in5
-rw-r--r--src/indicator-sound.c41
-rw-r--r--src/metadata-menu-item.c1
-rw-r--r--src/mpris2-controller.c1
-rw-r--r--src/music-player-bridge.c1
-rw-r--r--src/music-player-bridge.h1
-rw-r--r--src/player-controller.c1
-rw-r--r--src/player-item.c1
-rw-r--r--src/playlists-menu-item.c1
-rw-r--r--src/title-menu-item.c1
-rw-r--r--src/transport-menu-item.c1
-rw-r--r--src/transport-widget.c99
12 files changed, 72 insertions, 82 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index b470fcf..e23b0b1 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -39,7 +39,10 @@ libexec_PROGRAMS = indicator-sound-service$(EXEEXT)
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
diff --git a/src/indicator-sound.c b/src/indicator-sound.c
index 42560c8..f259dfd 100644
--- a/src/indicator-sound.c
+++ b/src/indicator-sound.c
@@ -77,19 +77,22 @@ static gboolean key_release_cb(GtkWidget* widget, GdkEventKey* event, gpointer d
//custom widget realisation methods
static gboolean new_volume_slider_widget (DbusmenuMenuitem * newitem,
DbusmenuMenuitem * parent,
- DbusmenuClient * client);
+ DbusmenuClient * client,
+ gpointer user_data);
static gboolean new_transport_widget (DbusmenuMenuitem * newitem,
DbusmenuMenuitem * parent,
- DbusmenuClient * client);
+ DbusmenuClient * client,
+ gpointer user_data);
static gboolean new_metadata_widget (DbusmenuMenuitem * newitem,
DbusmenuMenuitem * parent,
- DbusmenuClient * client);
+ DbusmenuClient * client,
+ gpointer user_data);
static gboolean new_title_widget (DbusmenuMenuitem * newitem,
DbusmenuMenuitem * parent,
- DbusmenuClient * client);
+ DbusmenuClient * client,
+ gpointer user_data);
// DBUS communication
-
static GDBusNodeInfo *node_info = NULL;
static GDBusInterfaceInfo *interface_info = NULL;
static void create_connection_to_service (GObject *source_object,
@@ -185,10 +188,18 @@ get_menu (IndicatorObject * io)
DbusmenuGtkClient *client = dbusmenu_gtkmenu_get_client(menu);
g_object_set_data (G_OBJECT (client), "indicator", io);
- dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_VOLUME_MENUITEM_TYPE, new_volume_slider_widget);
- dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_TRANSPORT_MENUITEM_TYPE, new_transport_widget);
- dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_METADATA_MENUITEM_TYPE, new_metadata_widget);
- dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_TITLE_MENUITEM_TYPE, new_title_widget);
+ dbusmenu_client_add_type_handler (DBUSMENU_CLIENT(client),
+ DBUSMENU_VOLUME_MENUITEM_TYPE,
+ new_volume_slider_widget);
+ dbusmenu_client_add_type_handler (DBUSMENU_CLIENT(client),
+ DBUSMENU_TRANSPORT_MENUITEM_TYPE,
+ new_transport_widget);
+ dbusmenu_client_add_type_handler (DBUSMENU_CLIENT(client),
+ DBUSMENU_METADATA_MENUITEM_TYPE,
+ new_metadata_widget);
+ dbusmenu_client_add_type_handler (DBUSMENU_CLIENT(client),
+ DBUSMENU_TITLE_MENUITEM_TYPE,
+ new_title_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);
@@ -286,7 +297,8 @@ static void create_connection_to_service (GObject *source_object,
static gboolean
new_transport_widget (DbusmenuMenuitem * newitem,
DbusmenuMenuitem * parent,
- DbusmenuClient * client)
+ DbusmenuClient * client,
+ gpointer user_data)
{
g_debug("indicator-sound: new_transport_bar() called ");
@@ -314,7 +326,8 @@ new_transport_widget (DbusmenuMenuitem * newitem,
static gboolean
new_metadata_widget (DbusmenuMenuitem * newitem,
DbusmenuMenuitem * parent,
- DbusmenuClient * client)
+ DbusmenuClient * client,
+ gpointer user_data)
{
g_debug("indicator-sound: new_metadata_widget");
@@ -335,7 +348,8 @@ new_metadata_widget (DbusmenuMenuitem * newitem,
static gboolean
new_title_widget(DbusmenuMenuitem * newitem,
DbusmenuMenuitem * parent,
- DbusmenuClient * client)
+ DbusmenuClient * client,
+ gpointer user_data)
{
g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE);
g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE);
@@ -358,7 +372,8 @@ new_title_widget(DbusmenuMenuitem * newitem,
static gboolean
new_volume_slider_widget(DbusmenuMenuitem * newitem,
DbusmenuMenuitem * parent,
- DbusmenuClient * client)
+ DbusmenuClient * client,
+ gpointer user_data)
{
g_debug("indicator-sound: new_volume_slider_widget");
diff --git a/src/metadata-menu-item.c b/src/metadata-menu-item.c
index 05d7e84..cda3934 100644
--- a/src/metadata-menu-item.c
+++ b/src/metadata-menu-item.c
@@ -23,6 +23,7 @@ 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/dbusmenu-glib.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
diff --git a/src/mpris2-controller.c b/src/mpris2-controller.c
index c953648..fa57af3 100644
--- a/src/mpris2-controller.c
+++ b/src/mpris2-controller.c
@@ -27,6 +27,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <string.h>
#include <gee.h>
#include <libdbusmenu-glib/client.h>
+#include <libdbusmenu-glib/dbusmenu-glib.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
diff --git a/src/music-player-bridge.c b/src/music-player-bridge.c
index 16f3dfa..6076732 100644
--- a/src/music-player-bridge.c
+++ b/src/music-player-bridge.c
@@ -23,6 +23,7 @@ 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/dbusmenu-glib.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
diff --git a/src/music-player-bridge.h b/src/music-player-bridge.h
index b156cfe..14575fe 100644
--- a/src/music-player-bridge.h
+++ b/src/music-player-bridge.h
@@ -9,6 +9,7 @@
#include <stdlib.h>
#include <string.h>
#include <libdbusmenu-glib/client.h>
+#include <libdbusmenu-glib/dbusmenu-glib.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
diff --git a/src/player-controller.c b/src/player-controller.c
index 2aa709f..c8f241d 100644
--- a/src/player-controller.c
+++ b/src/player-controller.c
@@ -25,6 +25,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib-object.h>
#include <gee.h>
#include <libdbusmenu-glib/client.h>
+#include <libdbusmenu-glib/dbusmenu-glib.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
diff --git a/src/player-item.c b/src/player-item.c
index fad8f9f..2408ec7 100644
--- a/src/player-item.c
+++ b/src/player-item.c
@@ -23,6 +23,7 @@ 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/dbusmenu-glib.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
diff --git a/src/playlists-menu-item.c b/src/playlists-menu-item.c
index 5a32860..13004ed 100644
--- a/src/playlists-menu-item.c
+++ b/src/playlists-menu-item.c
@@ -23,6 +23,7 @@ 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/dbusmenu-glib.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
diff --git a/src/title-menu-item.c b/src/title-menu-item.c
index 8696ff4..a92af90 100644
--- a/src/title-menu-item.c
+++ b/src/title-menu-item.c
@@ -23,6 +23,7 @@ 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/dbusmenu-glib.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
diff --git a/src/transport-menu-item.c b/src/transport-menu-item.c
index 9bc1eea..92d435b 100644
--- a/src/transport-menu-item.c
+++ b/src/transport-menu-item.c
@@ -23,6 +23,7 @@ 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/dbusmenu-glib.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
diff --git a/src/transport-widget.c b/src/transport-widget.c
index 6ddd4bc..7c96684 100644
--- a/src/transport-widget.c
+++ b/src/transport-widget.c
@@ -129,10 +129,10 @@ static void transport_widget_toggle_play_pause ( TransportWidget* button,
TransportWidgetState update);
static void transport_widget_select (GtkItem* menu, gpointer Userdata);
static void transport_widget_deselect (GtkItem* menu, gpointer Userdata);
+static TransportWidgetEvent transport_widget_collision_detection (gint x, gint y);
/// Init functions //////////////////////////////////////////////////////////
-
static void
transport_widget_class_init (TransportWidgetClass *klass)
{
@@ -301,30 +301,23 @@ transport_widget_leave_notify_event (GtkWidget *menuitem,
TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) );
priv->motion_event = TRANSPORT_NADA;
- cairo_t *cr;
- cr = gdk_cairo_create (menuitem->window);
- draw ( menuitem, cr );
- cairo_destroy ( cr );
-
+ priv->current_command = TRANSPORT_NADA;
+ gtk_widget_queue_draw (GTK_WIDGET(menuitem));
+
return TRUE;
}
-/* keyevents */
static gboolean
transport_widget_button_press_event (GtkWidget *menuitem,
- GdkEventButton *event)
+ GdkEventButton *event)
{
g_return_val_if_fail ( IS_TRANSPORT_WIDGET(menuitem), FALSE );
TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) );
TransportWidgetEvent result = transport_widget_determine_button_event ( TRANSPORT_WIDGET(menuitem),
event);
-
if(result != TRANSPORT_NADA){
priv->current_command = result;
- cairo_t *cr;
- cr = gdk_cairo_create (menuitem->window);
- draw ( menuitem, cr );
- cairo_destroy ( cr );
+ gtk_widget_queue_draw (GTK_WIDGET(menuitem));
}
return TRUE;
}
@@ -333,14 +326,12 @@ static gboolean
transport_widget_button_release_event (GtkWidget *menuitem,
GdkEventButton *event)
{
- //g_debug("TransportWidget::menu_release_event");
g_return_val_if_fail(IS_TRANSPORT_WIDGET(menuitem), FALSE);
TransportWidget* transport = TRANSPORT_WIDGET(menuitem);
TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport );
TransportWidgetEvent result = transport_widget_determine_button_event ( transport,
event );
- if(result != TRANSPORT_NADA){
- //g_debug("TransportWidget::menu_press_event - going to send value %i", (int)result);
+ if (result != TRANSPORT_NADA && priv->current_command == result){
GVariant* new_transport_state = g_variant_new_int32 ((int)result);
dbusmenu_menuitem_handle_event ( priv->twin_item,
"Transport state change",
@@ -376,17 +367,8 @@ transport_widget_react_to_key_press_event ( TransportWidget* transport,
TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport );
priv->current_command = transport_event;
priv->key_event = transport_event;
-/* printf("transport_widget_react_to_key_press_event: before drawing\n");*/
gtk_widget_realize ( GTK_WIDGET(transport) );
-
- printf ( "transport widget - react to key press event -> is the window null: %i",
- gtk_widget_get_window (GTK_WIDGET (transport) ) == NULL );
- cairo_t *cr;
-
- printf("transport_widget_react_to_key_press_event: before drawing\n");
- cr = gdk_cairo_create ( GTK_WIDGET(transport)->window );
- draw ( GTK_WIDGET(transport), cr );
- cairo_destroy (cr);
+ gtk_widget_queue_draw (GTK_WIDGET(transport) );
}
}
@@ -396,7 +378,6 @@ transport_widget_react_to_key_release_event ( TransportWidget* transport,
{
if(transport_event != TRANSPORT_NADA){
TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport );
- //g_debug("TransportWidget::menu_press_event - going to send value %i", (int)result);
GVariant* new_transport_event = g_variant_new_int32((int)transport_event);
dbusmenu_menuitem_handle_event ( priv->twin_item,
"Transport state change",
@@ -412,53 +393,41 @@ transport_widget_focus_update ( TransportWidget* transport, gboolean focus )
{
TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport );
priv->has_focus = focus;
- g_debug("new focus update = %i", focus);
}
static TransportWidgetEvent
transport_widget_determine_button_event( TransportWidget* button,
GdkEventButton* event )
{
- //g_debug("event x coordinate = %f", event->x);
- //g_debug("event y coordinate = %f", event->y);
- TransportWidgetEvent button_event = TRANSPORT_NADA;
- // For now very simple rectangular collision detection
- if(event->x > 67 && event->x < 112
- && event->y > 12 && event->y < 40){
- button_event = TRANSPORT_PREVIOUS;
- }
- else if(event->x > 111 && event->x < 153
- && event->y > 5 && event->y < 47){
- button_event = TRANSPORT_PLAY_PAUSE;
- }
- else if(event->x > 152 && event->x < 197
- && event->y > 12 && event->y < 40){
- button_event = TRANSPORT_NEXT;
- }
- return button_event;
+ return transport_widget_collision_detection (event->x, event->y);
}
static TransportWidgetEvent
transport_widget_determine_motion_event( TransportWidget* button,
GdkEventMotion* event )
{
-/* g_debug("event x coordinate = %f", event->x);*/
-/* g_debug("event y coordinate = %f", event->y);*/
- TransportWidgetEvent motion_event = TRANSPORT_NADA;
- // For now very simple rectangular collision detection
- if(event->x > 67 && event->x < 112
- && event->y > 12 && event->y < 40){
- motion_event = TRANSPORT_PREVIOUS;
+ return transport_widget_collision_detection (event->x, event->y);
+}
+
+static TransportWidgetEvent
+transport_widget_collision_detection ( gint x,
+ gint y )
+{
+ TransportWidgetEvent event = TRANSPORT_NADA;
+
+ if (x > 67 && x < 112
+ && y > 12 && y < 40){
+ event = TRANSPORT_PREVIOUS;
}
- else if(event->x > 111 && event->x < 153
- && event->y > 5 && event->y < 47){
- motion_event = TRANSPORT_PLAY_PAUSE;
+ else if (x > 111 && x < 153
+ && y > 5 && y < 47){
+ event = TRANSPORT_PLAY_PAUSE;
}
- else if(event->x > 152 && event->x < 197
- && event->y > 12 && event->y < 40){
- motion_event = TRANSPORT_NEXT;
- }
- return motion_event;
+ else if (x > 152 && x < 197
+ && y > 12 && y < 40){
+ event = TRANSPORT_NEXT;
+ }
+ return event;
}
static void
@@ -467,17 +436,11 @@ transport_widget_react_to_button_release ( TransportWidget* button,
{
g_return_if_fail(IS_TRANSPORT_WIDGET(button));
TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(button);
- if(priv->current_command != TRANSPORT_NADA &&
- command != TRANSPORT_NADA){
- priv->current_command = command;
- }
- cairo_t *cr;
- cr = gdk_cairo_create ( GTK_WIDGET(button)->window );
priv->current_command = TRANSPORT_NADA;
priv->key_event = TRANSPORT_NADA;
- draw ( GTK_WIDGET(button), cr );
- cairo_destroy (cr);
+
+ gtk_widget_queue_draw (GTK_WIDGET(button));
}
/// internal helper functions //////////////////////////////////////////////////