[Xfce4-commits] [panel-plugins/xfce4-places-plugin] 28/30: Fix initial image size, make plugin square by default
noreply at xfce.org
noreply at xfce.org
Mon Apr 22 12:08:19 CEST 2019
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository panel-plugins/xfce4-places-plugin.
commit f0e93082d0fd2cfb43c81fe95cd9a01acf482b68
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Sun Apr 21 14:32:41 2019 -0400
Fix initial image size, make plugin square by default
---
panel-plugin/button.c | 30 +++++++++++++++++-------------
panel-plugin/button.h | 1 -
2 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/panel-plugin/button.c b/panel-plugin/button.c
index 3f526e4..a0d3098 100644
--- a/panel-plugin/button.c
+++ b/panel-plugin/button.c
@@ -230,7 +230,6 @@ places_button_init(PlacesButton *self)
self->box = NULL;
self->label = NULL;
self->image = NULL;
- self->plugin_size = -1;
}
static void
@@ -337,11 +336,11 @@ places_button_resize_image(PlacesButton *self, gint new_size)
}
if (self->image == NULL) {
- self->image = g_object_ref(gtk_image_new_from_pixbuf(icon));
- gtk_box_pack_start(GTK_BOX(self->box), self->image, FALSE, FALSE, 0);
+ self->image = g_object_ref(gtk_image_new_from_pixbuf(icon));
+ gtk_box_pack_start(GTK_BOX(self->box), self->image, FALSE, FALSE, 0);
+ } else {
+ gtk_image_set_from_pixbuf(GTK_IMAGE(self->image), icon);
}
- else
- gtk_image_set_from_pixbuf(GTK_IMAGE(self->image), icon);
gtk_widget_set_halign (GTK_WIDGET (self->image), GTK_ALIGN_CENTER);
gtk_widget_set_valign (GTK_WIDGET (self->image), GTK_ALIGN_CENTER);
@@ -391,14 +390,18 @@ places_button_resize_label(PlacesButton *self,
if (vertical)
{
gtk_label_set_angle (GTK_LABEL (self->label), -90);
- gtk_widget_set_halign (GTK_WIDGET (self->image), GTK_ALIGN_CENTER);
- gtk_widget_set_valign (GTK_WIDGET (self->image), GTK_ALIGN_START);
+ if (self->image != NULL) {
+ gtk_widget_set_halign (GTK_WIDGET (self->image), GTK_ALIGN_CENTER);
+ gtk_widget_set_valign (GTK_WIDGET (self->image), GTK_ALIGN_START);
+ }
}
else
{
gtk_label_set_angle (GTK_LABEL (self->label), 0);
- gtk_widget_set_halign (GTK_WIDGET (self->image), GTK_ALIGN_START);
- gtk_widget_set_valign (GTK_WIDGET (self->image), GTK_ALIGN_CENTER);
+ if (self->image != NULL) {
+ gtk_widget_set_halign (GTK_WIDGET (self->image), GTK_ALIGN_START);
+ gtk_widget_set_valign (GTK_WIDGET (self->image), GTK_ALIGN_CENTER);
+ }
}
gtk_widget_show(self->label);
}
@@ -422,7 +425,6 @@ places_button_resize(PlacesButton *self)
return;
new_size = xfce_panel_plugin_get_size(self->plugin);
- self->plugin_size = new_size;
DBG("Panel size: %d", new_size);
show_image = self->pixbuf_factory != NULL;
@@ -441,6 +443,11 @@ places_button_resize(PlacesButton *self)
xfce_panel_plugin_set_small (self->plugin, !show_label);
+ if (show_image)
+ gtk_widget_set_size_request (GTK_WIDGET (self), new_size, new_size);
+ else
+ gtk_widget_set_size_request (GTK_WIDGET (self), -1, -1);
+
if (show_label) {
if (vertical) {
gtk_widget_set_halign (self->alignment, GTK_ALIGN_CENTER);
@@ -483,9 +490,6 @@ places_button_mode_changed(XfcePanelPlugin *plugin, XfcePanelPluginMode mode, Pl
static gboolean
places_button_size_changed(XfcePanelPlugin *plugin, gint size, PlacesButton *self)
{
- if (self->plugin_size == size)
- return TRUE;
-
DBG("size changed");
places_button_resize(self);
return TRUE;
diff --git a/panel-plugin/button.h b/panel-plugin/button.h
index 18c5744..f8ebd20 100644
--- a/panel-plugin/button.h
+++ b/panel-plugin/button.h
@@ -51,7 +51,6 @@ struct _PlacesButton
GtkWidget *label;
gchar *label_text;
places_button_image_pixbuf_factory *pixbuf_factory;
- gint plugin_size;
gulong screen_changed_id;
};
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list