[Goodies-commits] r4618 - xfce4-dict/trunk/panel-plugin

Enrico Troeger enrico at xfce.org
Fri Apr 18 18:06:53 CEST 2008


Author: enrico
Date: 2008-04-18 16:06:53 +0000 (Fri, 18 Apr 2008)
New Revision: 4618

Modified:
   xfce4-dict/trunk/panel-plugin/xfce4-dict-plugin.c
Log:
Fix minor panel button sizing issues (make it a little wider on horizontal panel, a little flatter on vertical panels).


Modified: xfce4-dict/trunk/panel-plugin/xfce4-dict-plugin.c
===================================================================
--- xfce4-dict/trunk/panel-plugin/xfce4-dict-plugin.c	2008-04-18 16:06:50 UTC (rev 4617)
+++ xfce4-dict/trunk/panel-plugin/xfce4-dict-plugin.c	2008-04-18 16:06:53 UTC (rev 4618)
@@ -56,7 +56,7 @@
 static GdkPixbuf *dict_plugin_load_and_scale(const guint8 *data, gint dstw, gint dsth)
 {
 	GdkPixbuf *pb, *pb_scaled;
-	int pb_w, pb_h;
+	gint pb_w, pb_h;
 
 	pb = gdk_pixbuf_new_from_inline(-1, data, FALSE, NULL);
 	pb_w = gdk_pixbuf_get_width(pb);
@@ -72,17 +72,18 @@
 	pb_scaled = gdk_pixbuf_scale_simple(pb, dstw, dsth, GDK_INTERP_HYPER);
 	g_object_unref(G_OBJECT(pb));
 
-	return (pb_scaled);
+	return pb_scaled;
 }
 
 
 static gboolean dict_plugin_panel_set_size(XfcePanelPlugin *plugin, gint wsize, DictPanelData *dpd)
 {
 	gint width;
+	gint height = wsize;
 	gint size = wsize - 2 - (2 * MAX(dpd->panel_button->style->xthickness,
 									 dpd->panel_button->style->ythickness));
 
-	/*g_object_unref(G_OBJECT(dd->icon));*/
+	g_object_unref(G_OBJECT(dpd->dd->icon));
 	dpd->dd->icon = dict_plugin_load_and_scale(dict_gui_get_icon_data(), size, -1);
 
 	gtk_image_set_from_pixbuf(GTK_IMAGE(dpd->panel_button_image), dpd->dd->icon);
@@ -96,8 +97,11 @@
 	else
 		width = size;
 
-	gtk_widget_set_size_request(GTK_WIDGET(plugin), width, size);
+	if (xfce_panel_plugin_get_orientation(plugin) == GTK_ORIENTATION_VERTICAL)
+		height -= 4; /* reduce some of the height because it creates too much space otherwise */
 
+	gtk_widget_set_size_request(dpd->panel_button, wsize, height);
+
 	return TRUE;
 }
 




More information about the Goodies-commits mailing list