aboutsummaryrefslogtreecommitdiff
path: root/src/transport-widget.c
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-09-15 17:39:15 +0100
committerConor Curran <conor.curran@canonical.com>2010-09-15 17:39:15 +0100
commit1d0f58a776b0b10dd4603d0e4b060352b9d8ba8c (patch)
treec6565723b20e811e6470c790610aab8ccc408e08 /src/transport-widget.c
parent16e74443cc9f2806f4ef0a0d142f93d921f4aa27 (diff)
downloadayatana-indicator-sound-1d0f58a776b0b10dd4603d0e4b060352b9d8ba8c.tar.gz
ayatana-indicator-sound-1d0f58a776b0b10dd4603d0e4b060352b9d8ba8c.tar.bz2
ayatana-indicator-sound-1d0f58a776b0b10dd4603d0e4b060352b9d8ba8c.zip
on menu close buttons are now reset
Diffstat (limited to 'src/transport-widget.c')
-rw-r--r--src/transport-widget.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/src/transport-widget.c b/src/transport-widget.c
index 2dfcbef..329797c 100644
--- a/src/transport-widget.c
+++ b/src/transport-widget.c
@@ -54,10 +54,15 @@ static gboolean transport_widget_button_press_event (GtkWidget *menuitem,
GdkEventButton *event);
static gboolean transport_widget_button_release_event (GtkWidget *menuitem,
GdkEventButton *event);
-static void transport_widget_property_update(DbusmenuMenuitem* item,
+static void transport_widget_property_update( DbusmenuMenuitem* item,
gchar * property,
GValue * value,
- gpointer userdata);
+ gpointer userdata );
+static void transport_widget_menu_hidden ( GtkWidget *menu,
+ TransportWidget *transport);
+static void transport_widget_notify ( TransportWidget *item,
+ GParamSpec *pspec,
+ gpointer user_data );
G_DEFINE_TYPE (TransportWidget, transport_widget, GTK_TYPE_MENU_ITEM);
@@ -100,6 +105,11 @@ transport_widget_init (TransportWidget *self)
gtk_container_add (GTK_CONTAINER (self), priv->hbox);
gtk_widget_show_all (priv->hbox);
+
+ g_signal_connect (G_OBJECT(self),
+ "notify",
+ G_CALLBACK (transport_widget_notify),
+ NULL);
}
static void
@@ -129,6 +139,37 @@ static void transport_widget_set_twin_item(TransportWidget* self,
G_CALLBACK(transport_widget_property_update), self);
}
+static void
+transport_widget_notify (TransportWidget *item,
+ GParamSpec *pspec,
+ gpointer user_data)
+{
+
+ if (g_strcmp0 (pspec->name, "parent"))
+ {
+ GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (item));
+
+ if (parent)
+ {
+ g_signal_connect (parent, "hide",
+ G_CALLBACK (transport_widget_menu_hidden),
+ item);
+ }
+ }
+}
+
+static void
+transport_widget_menu_hidden ( GtkWidget *menu,
+ TransportWidget *transport)
+{
+ g_debug("Transport Widget's menu hidden method called");
+ g_return_val_if_fail(IS_TRANSPORT_WIDGET(transport), FALSE);
+ TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE(TRANSPORT_WIDGET(transport));
+ play_button_react_to_button_release(priv->play_button, TRANSPORT_NADA);
+
+}
+
+
/* keyevents */
static gboolean
transport_widget_button_press_event (GtkWidget *menuitem,