diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-06-15 00:32:27 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-06-15 00:32:27 +0100 |
commit | ca99bae318b2768e721c2fa0834e8d12c196b245 (patch) | |
tree | a94a0f13e29c8b1a5f3ac967577632c001f3690d | |
parent | b8519dc8b908adf85f88299c743106c9c3627b64 (diff) | |
download | ayatana-indicator-sound-ca99bae318b2768e721c2fa0834e8d12c196b245.tar.gz ayatana-indicator-sound-ca99bae318b2768e721c2fa0834e8d12c196b245.tar.bz2 ayatana-indicator-sound-ca99bae318b2768e721c2fa0834e8d12c196b245.zip |
key events are not going to be easy
-rw-r--r-- | src/transport-menu-item.vala | 2 | ||||
-rw-r--r-- | src/transport-widget.c | 91 |
2 files changed, 65 insertions, 28 deletions
diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala index 0ecc9b1..7687a92 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -15,7 +15,5 @@ public class TransportMenuitem : Dbusmenu.Menuitem public override void handle_event(string name, GLib.Value input_value, uint timestamp) { - this.property_set(DBUSMENU_TRANSPORT_MENUITEM_STATE, "1"); - debug("TransportItem -> handle event caught!"); } }
\ No newline at end of file diff --git a/src/transport-widget.c b/src/transport-widget.c index cd73a17..7e26c68 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -58,14 +58,21 @@ static void transport_widget_init (TransportWidget *self); static void transport_widget_dispose (GObject *object); static void transport_widget_finalize (GObject *object); -/* UI and dbus callbacks */ -static gboolean transport_widget_button_press_event (GtkWidget *menuitem, - GdkEventButton *event); +/* UI and dbusmenu callbacks */ +static gboolean transport_widget_button_press_event (GtkWidget *menuitem, + GdkEventButton *event); static gboolean transport_widget_button_release_event (GtkWidget *menuitem, - GdkEventButton *event); -static gboolean transport_widget_play_button_trigger (GtkWidget *widget, - GdkEventButton *event, - gpointer user_data); + GdkEventButton *event); +static gboolean transport_widget_play_button_press_event (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data); +static gboolean transport_widget_previous_button_press_event (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data); +static gboolean transport_widget_next_button_press_event (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data); + static void transport_widget_update_state(DbusmenuMenuitem* item, gchar * property, GValue * value, @@ -138,27 +145,26 @@ transport_widget_init (TransportWidget *self) priv->next_button = gtk_button_new_with_label(">>"); priv->play_button = gtk_button_new_with_label(">"); - gtk_box_pack_start (GTK_BOX (hbox), priv->previous_button, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), priv->play_button, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), priv->next_button, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), priv->previous_button, FALSE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (hbox), priv->play_button, FALSE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (hbox), priv->next_button, FALSE, TRUE, 0); + + g_signal_connect(GTK_OBJECT(priv->play_button), "button-press-event", G_CALLBACK(transport_widget_play_button_press_event), priv->play_button); + g_signal_connect(GTK_OBJECT(priv->previous_button), "button-press-event", G_CALLBACK(transport_widget_previous_button_press_event), NULL); + g_signal_connect(GTK_OBJECT(priv->next_button), "button-press-event", G_CALLBACK(transport_widget_next_button_press_event), NULL); - g_signal_connect(priv->play_button, "button-press-event", G_CALLBACK(transport_widget_play_button_trigger), NULL); - priv->hbox = hbox; + priv->hbox = hbox; g_signal_connect(G_OBJECT(twin_item), "property-changed", G_CALLBACK(transport_widget_update_state), self); - gtk_widget_show_all (priv->hbox); - gtk_container_add (GTK_CONTAINER (self), hbox); + gtk_container_add (GTK_CONTAINER (self), priv->hbox); + gtk_widget_show_all (priv->hbox); } static void transport_widget_dispose (GObject *object) { - //if(IS_TRANSPORT_BAR(object) == TRUE){ - // TransportWidgetPrivate * priv = TRANSPORT_BAR_GET_PRIVATE(TRANSPORT_BAR(object)); - // g_object_unref(priv->previous_button); - //} G_OBJECT_CLASS (transport_widget_parent_class)->dispose (object); } @@ -171,10 +177,25 @@ transport_widget_finalize (GObject *object) /* keyevents */ static gboolean transport_widget_button_press_event (GtkWidget *menuitem, - GdkEventButton *event) + GdkEventButton *event) { g_debug("TransportWidget::menu_press_event"); - return FALSE; + //TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE(TRANSPORT_WIDGET(menuitem)); + //gtk_button_pressed(GTK_BUTTON(priv->play_button)); + //gtk_button_pressed(GTK_BUTTON(priv->previous_button)); + //gtk_button_pressed(GTK_BUTTON(priv->next_button)); + + //if (event->type == GDK_BUTTON_PRESS) { + //GdkEventButton *bevent = (GdkEventButton *) event; + //gtk_button_pressed(bevent->button); +//gtk_menu_popup (GTK_MENU (menuitem), NULL, NULL, NULL, NULL, +// bevent->button, bevent->time); + /* Tell calling code that we have handled this event; the buck + * stops here. */ + //return TRUE; + //} + + return TRUE; } static gboolean @@ -182,17 +203,35 @@ transport_widget_button_release_event (GtkWidget *menuitem, GdkEventButton *event) { g_debug("TransportWidget::menu_release_event"); - return FALSE; + return TRUE; } /* Individual keyevents on the buttons */ static gboolean -transport_widget_play_button_trigger(GtkWidget* widget, - GdkEventButton *event, - gpointer user_data) +transport_widget_play_button_press_event( GtkWidget* widget, + GdkEventButton *event, + gpointer user_data) +{ + g_debug("!!!!! TransportWidget::PLAY button_press_event"); + return TRUE; +} + +static gboolean +transport_widget_previous_button_press_event( GtkWidget* widget, + GdkEventButton *event, + gpointer user_data) +{ + g_debug("!!!!! TransportWidget::PREVIOUS button_press_event"); + return TRUE; +} + +static gboolean +transport_widget_next_button_press_event( GtkWidget* widget, + GdkEventButton *event, + gpointer user_data) { - g_debug("TransportWidget::PLAY button_press_event"); - return FALSE; + g_debug("!!!!! TransportWidget::NEXT button_press_event"); + return TRUE; } /** |