[Xfce4-commits] <xfce4-mpc-plugin:master> Better handling of set_size callback.
Landry Breuil
noreply at xfce.org
Sun Feb 12 20:30:05 CET 2012
Updating branch refs/heads/master
to 36a771794466f8447479a72f5d0e80e371a5158a (commit)
from b1a3b0d88461ae0a5b51f011fc98cbf564ddb83f (commit)
commit 36a771794466f8447479a72f5d0e80e371a5158a
Author: Landry Breuil <landry at xfce.org>
Date: Sun Feb 12 16:30:02 2012 +0100
Better handling of set_size callback.
- remove ugly button_set_sized_image now that image is assigned
upon button creation.
- directly set button size in both directions, with help from nick.
this commit fixes mpc plugin display on vertical panels, or after
a panel resize - icons look much better now!
panel-plugin/xfce4-mpc-plugin.c | 21 ++++-----------------
1 files changed, 4 insertions(+), 17 deletions(-)
diff --git a/panel-plugin/xfce4-mpc-plugin.c b/panel-plugin/xfce4-mpc-plugin.c
index 2583596..9bff8c2 100644
--- a/panel-plugin/xfce4-mpc-plugin.c
+++ b/panel-plugin/xfce4-mpc-plugin.c
@@ -44,14 +44,6 @@ mpc_free (XfcePanelPlugin * plugin, t_mpc * mpc)
}
static void
-button_set_sized_image(GtkWidget *button, gchar *icon, gint size)
-{
- GtkWidget *image;
- image = gtk_image_new_from_pixbuf(xfce_panel_pixbuf_from_source(icon, NULL, size));
- gtk_button_set_image(GTK_BUTTON(button), image);
-}
-
-static void
mpc_set_orientation (XfcePanelPlugin * plugin, GtkOrientation orientation, t_mpc * mpc)
{
DBG ("!");
@@ -65,15 +57,10 @@ mpc_set_size (XfcePanelPlugin * plugin, int size, t_mpc * mpc)
DBG ("size=%d",size);
gtk_container_set_border_width (GTK_CONTAINER (mpc->frame), (size > 26 ? 2 : 0));
- if (xfce_panel_plugin_get_orientation (plugin) == GTK_ORIENTATION_HORIZONTAL)
- gtk_widget_set_size_request (GTK_WIDGET (mpc->frame), -1, size);
- else
- gtk_widget_set_size_request (GTK_WIDGET (mpc->frame), size, -1);
-
- button_set_sized_image(mpc->prev, "gtk-media-previous-ltr", size - 3);
- button_set_sized_image(mpc->next, "gtk-media-next-ltr", size - 3);
- button_set_sized_image(mpc->toggle, "gtk-media-pause", size - 3);
- button_set_sized_image(mpc->stop, "gtk-media-stop", size - 3);
+ gtk_widget_set_size_request (GTK_WIDGET (mpc->next), size, size);
+ gtk_widget_set_size_request (GTK_WIDGET (mpc->prev), size, size);
+ gtk_widget_set_size_request (GTK_WIDGET (mpc->stop), size, size);
+ gtk_widget_set_size_request (GTK_WIDGET (mpc->toggle), size, size);
return TRUE;
}
More information about the Xfce4-commits
mailing list