[gnome-panel/gtk3] showdesktop: Port gtk_widget_get_style to GtkStyleContext
- From: Germán Poó Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/gtk3] showdesktop: Port gtk_widget_get_style to GtkStyleContext
- Date: Sun, 30 Jan 2011 02:21:33 +0000 (UTC)
commit d27ef4de9ba872e5afc5e60430c7a16549158f61
Author: Germán Póo-Caamaño <gpoo gnome org>
Date: Sat Jan 29 18:21:14 2011 -0800
showdesktop: Port gtk_widget_get_style to GtkStyleContext
Signed-off-by: Germán Póo-Caamaño <gpoo gnome org>
applets/wncklet/showdesktop.c | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/applets/wncklet/showdesktop.c b/applets/wncklet/showdesktop.c
index a4709a9..c8e21da 100644
--- a/applets/wncklet/showdesktop.c
+++ b/applets/wncklet/showdesktop.c
@@ -135,7 +135,6 @@ button_size_allocated (GtkWidget *button,
static void
update_icon (ShowDesktopData *sdd)
{
- GtkStyle *style;
int width, height;
GdkPixbuf *icon;
GdkPixbuf *scaled;
@@ -144,27 +143,31 @@ update_icon (ShowDesktopData *sdd)
int focus_width = 0;
int focus_pad = 0;
int thickness = 0;
+ GtkStyleContext *context;
+ GtkStateFlags state;
+ GtkBorder padding;
if (!sdd->icon_theme)
return;
- gtk_widget_style_get (sdd->button,
- "focus-line-width", &focus_width,
- "focus-padding", &focus_pad,
- NULL);
-
- style = gtk_widget_get_style (sdd->button);
+ state = gtk_widget_get_state_flags (sdd->button);
+ context = gtk_widget_get_style_context (sdd->button);
+ gtk_style_context_get_padding (context, state, &padding);
+ gtk_style_context_get_style (context,
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ NULL);
switch (sdd->orient) {
case GTK_ORIENTATION_HORIZONTAL:
- thickness = style->ythickness;
+ thickness = padding.top + padding.bottom;
break;
case GTK_ORIENTATION_VERTICAL:
- thickness = style->xthickness;
+ thickness = padding.left + padding.right;
break;
}
- icon_size = sdd->size - 2 * (focus_width + focus_pad + thickness);
+ icon_size = sdd->size - 2 * (focus_width + focus_pad) + thickness;
if (icon_size < 22)
icon_size = 16;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]