[Xfce4-commits] <xfce4-mpc-plugin:master> Finally ditch the eventbox, not needed.

Landry Breuil noreply at xfce.org
Sun Feb 12 20:30:08 CET 2012


Updating branch refs/heads/master
         to efa3bc8d04d5ebe3f8a4beac5d47a41b6bc698a0 (commit)
       from 9fbbf72aacc98c34f47a35f1cc83053dfea19554 (commit)

commit efa3bc8d04d5ebe3f8a4beac5d47a41b6bc698a0
Author: Landry Breuil <landry at xfce.org>
Date:   Sun Feb 12 17:25:07 2012 +0100

    Finally ditch the eventbox, not needed.
    
    instead, directly connect enter_notify_event and scroll_event to
    panel buttons. Using set_visible_window(FALSE) was nice, but the
    events were not received anymore by the ebox. I've tried
    set_above_child(TRUE) too, but in that case the buttons weren't
    receiving events... so let's just ditch the eventbox!

 panel-plugin/xfce4-mpc-plugin.c |   11 +++--------
 panel-plugin/xfce4-mpc-plugin.h |    2 +-
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/panel-plugin/xfce4-mpc-plugin.c b/panel-plugin/xfce4-mpc-plugin.c
index c064226..98fe178 100644
--- a/panel-plugin/xfce4-mpc-plugin.c
+++ b/panel-plugin/xfce4-mpc-plugin.c
@@ -675,6 +675,8 @@ new_button_with_cbk(XfcePanelPlugin * plugin, GtkWidget *parent, gchar* icon, gp
    gtk_container_add(GTK_CONTAINER(button), image);
    xfce_panel_plugin_add_action_widget (plugin, button);
    g_signal_connect (G_OBJECT(button), "button_press_event", G_CALLBACK(cb), data);
+   g_signal_connect (G_OBJECT(button), "enter_notify_event", G_CALLBACK(enter_cb), data);
+   g_signal_connect (G_OBJECT(button), "scroll_event", G_CALLBACK(scroll_cb), data);
    gtk_box_pack_start (GTK_BOX(parent), button, TRUE, TRUE, 0);
    return button;
 }
@@ -709,16 +711,9 @@ mpc_create (XfcePanelPlugin * plugin)
    gtk_frame_set_shadow_type (GTK_FRAME (mpc->frame), GTK_SHADOW_IN);
    gtk_widget_show (mpc->frame);
 
-   mpc->ebox = gtk_event_box_new();
-   gtk_event_box_set_visible_window(GTK_EVENT_BOX(mpc->ebox), FALSE);
-   g_signal_connect (G_OBJECT(mpc->ebox), "enter_notify_event", G_CALLBACK(enter_cb), mpc);
-   g_signal_connect (G_OBJECT(mpc->ebox), "scroll_event", G_CALLBACK(scroll_cb), mpc);
-   gtk_widget_show (mpc->ebox);
-
    mpc->box = xfce_hvbox_new(xfce_panel_plugin_get_orientation(plugin), FALSE, 0);
 
-   gtk_container_add (GTK_CONTAINER(mpc->ebox), mpc->box);
-   gtk_container_add (GTK_CONTAINER(mpc->frame), mpc->ebox);
+   gtk_container_add (GTK_CONTAINER(mpc->frame), mpc->box);
 
    mpc->prev = new_button_with_cbk(plugin, mpc->box, "media-skip-backward", G_CALLBACK(prev), mpc);
    mpc->stop = new_button_with_cbk(plugin, mpc->box, "media-playback-stop", G_CALLBACK(stop), mpc);
diff --git a/panel-plugin/xfce4-mpc-plugin.h b/panel-plugin/xfce4-mpc-plugin.h
index 48430b3..be34b00 100644
--- a/panel-plugin/xfce4-mpc-plugin.h
+++ b/panel-plugin/xfce4-mpc-plugin.h
@@ -38,7 +38,7 @@ typedef struct {
 
 typedef struct {
    XfcePanelPlugin *plugin;
-   GtkWidget *frame,*ebox,*box,*prev,*stop,*toggle,*next,*random,*repeat,*appl,*about;
+   GtkWidget *frame,*box,*prev,*stop,*toggle,*next,*random,*repeat,*appl,*about;
    GtkWidget *playlist;
    gboolean show_frame;
    /* mpd handle */


More information about the Xfce4-commits mailing list