[Xfce4-commits] <xfce4-weather-plugin:master> Try to make the forecast scrolled window a bit nicer.
Harald Judt
noreply at xfce.org
Sun Jul 15 20:18:01 CEST 2012
Updating branch refs/heads/master
to 8ba1f2388d63cd5b2cebc576c82d77de46037f21 (commit)
from e5463a94f5451ec3c7225f8cb5d142da217b5bf0 (commit)
commit 8ba1f2388d63cd5b2cebc576c82d77de46037f21
Author: Harald Judt <h.judt at gmx.at>
Date: Sun Jul 15 19:59:21 2012 +0200
Try to make the forecast scrolled window a bit nicer.
Relying on the automatic gtk widget size management, I was terribly
unsuccessful producing a nice result. So in a new attempt, let's
try to do the problematic stuff manually:
* Use a fixed size of 150px for the forecast boxes.
That makes the table look a bit more homogenous.
* Use a fixed width for the scrolled window:
- 650 pixel for monitor width <= 720
- 700 pixel for anything bigger
* Stuff the scrolled window into an event box to make it look more
consistent with the scroll-less version.
Because of the fixed width, some labels in the forecast boxes can
now be cut off. If that's the case, we'll need to tweak/enlarge
the forecast box width, it can't be that much off. I hope the
current setting works for most translations, though.
panel-plugin/weather-summary.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/panel-plugin/weather-summary.c b/panel-plugin/weather-summary.c
index d4d73ab..1122f46 100644
--- a/panel-plugin/weather-summary.c
+++ b/panel-plugin/weather-summary.c
@@ -508,6 +508,8 @@ make_forecast (xfceweather_data *data)
label = gtk_label_new(value);
gtk_box_pack_start(GTK_BOX(forecast_box), label, TRUE, TRUE, 0);
g_free(value);
+
+ gtk_widget_set_size_request(GTK_WIDGET(forecast_box), 150, -1);
}
xml_time_free(fcdata);
}
@@ -524,7 +526,7 @@ make_forecast (xfceweather_data *data)
static GtkWidget *
create_forecast_tab (xfceweather_data *data, GtkWidget *window)
{
- GtkWidget *align, *hbox, *scrolled, *table;
+ GtkWidget *ebox, *align, *hbox, *scrolled, *table;
GdkWindow *win;
GdkScreen *screen;
GdkRectangle rect;
@@ -566,8 +568,14 @@ create_forecast_tab (xfceweather_data *data, GtkWidget *window)
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled), align);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_widget_set_size_request(GTK_WIDGET(scrolled), 550, height_max);
- return scrolled;
+ if (rect.width <= 720)
+ gtk_widget_set_size_request(GTK_WIDGET(scrolled), 650, height_max);
+ else
+ gtk_widget_set_size_request(GTK_WIDGET(scrolled), 700, height_max);
+ ebox = gtk_event_box_new();
+ gtk_event_box_set_visible_window(ebox, TRUE);
+ gtk_container_add(GTK_CONTAINER(ebox), GTK_WIDGET(scrolled));
+ return ebox;
}
}
More information about the Xfce4-commits
mailing list