[gnome-panel/gtk3] panel, clock: Synchronize calculate_minimum_height() code
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/gtk3] panel, clock: Synchronize calculate_minimum_height() code
- Date: Mon, 31 Jan 2011 23:45:28 +0000 (UTC)
commit 70b5d9e57451dff3a25b3fbcc8dec671cac469cb
Author: Vincent Untz <vuntz gnome org>
Date: Mon Jan 31 19:39:12 2011 +0100
panel, clock: Synchronize calculate_minimum_height() code
Also change the panel version to use the padding instead of the border.
We're interested in the padding here. I believe.
applets/clock/clock.c | 6 +++---
gnome-panel/panel-toplevel.c | 25 +++++++++++++------------
2 files changed, 16 insertions(+), 15 deletions(-)
---
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index 478921f..a509c97 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -388,12 +388,12 @@ static int
calculate_minimum_height (GtkWidget *widget,
PanelAppletOrient orientation)
{
+ GtkStateFlags state;
GtkStyleContext *style_context;
- GtkStateFlags state;
- GtkBorder padding;
+ const PangoFontDescription *font_desc;
PangoContext *pango_context;
PangoFontMetrics *metrics;
- const PangoFontDescription *font_desc;
+ GtkBorder padding;
int focus_width = 0;
int focus_pad = 0;
int ascent;
diff --git a/gnome-panel/panel-toplevel.c b/gnome-panel/panel-toplevel.c
index e48ca6c..57af4ac 100644
--- a/gnome-panel/panel-toplevel.c
+++ b/gnome-panel/panel-toplevel.c
@@ -2337,39 +2337,40 @@ static int
calculate_minimum_height (GtkWidget *widget,
PanelOrientation orientation)
{
- GtkStyleContext *style_context;
GtkStateFlags state;
- PangoContext *context;
+ GtkStyleContext *style_context;
+ const PangoFontDescription *font_desc;
+ PangoContext *pango_context;
PangoFontMetrics *metrics;
- GtkBorder border;
+ GtkBorder padding;
int focus_width = 0;
int focus_pad = 0;
int ascent;
int descent;
int thickness;
- style_context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
+ style_context = gtk_widget_get_style_context (widget);
+ font_desc = gtk_style_context_get_font (style_context, state);
- context = gtk_widget_get_pango_context (widget);
- metrics = pango_context_get_metrics (context,
- gtk_style_context_get_font (style_context, state),
- pango_context_get_language (context));
- gtk_style_context_get_border (style_context, state, &border);
-
+ pango_context = gtk_widget_get_pango_context (widget);
+ metrics = pango_context_get_metrics (pango_context,
+ font_desc,
+ pango_context_get_language (pango_context));
ascent = pango_font_metrics_get_ascent (metrics);
descent = pango_font_metrics_get_descent (metrics);
pango_font_metrics_unref (metrics);
+ gtk_style_context_get_padding (style_context, state, &padding);
gtk_widget_style_get (widget,
"focus-line-width", &focus_width,
"focus-padding", &focus_pad,
NULL);
thickness = orientation & PANEL_HORIZONTAL_MASK ?
- border.top + border.bottom :
- border.left + border.right;
+ padding.top + padding.bottom :
+ padding.left + padding.right;
return PANGO_PIXELS (ascent + descent) + 2 * (focus_width + focus_pad) + thickness;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]