[gtk+/resolution-independence: 12/24] port toolbar related items to RI
- From: Davyd Madeley <davyd src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+/resolution-independence: 12/24] port toolbar related items to RI
- Date: Sat, 2 May 2009 02:18:02 -0400 (EDT)
commit 26ae47559050d6212930f2d94e510bff7d373540
Author: David Zeuthen <davidz redhat com>
Date: Wed Aug 13 14:57:56 2008 -0400
port toolbar related items to RI
min/max for GtkCheckButton
min/max for GtkToolbar
min/max for GtkToolButton
fixed gtkcheckbutton.c
fixed gtktoolbar.c
fixed gtktoolbutton.c
---
gtk/gtkcheckbutton.c | 28 ++++++++++++----------------
gtk/gtkseparatortoolitem.c | 16 ++++++++--------
gtk/gtktoolbar.c | 42 ++++++++++++++++++------------------------
gtk/gtktoolbar.h | 2 +-
gtk/gtktoolbutton.c | 34 +++++++++++++++++-----------------
5 files changed, 56 insertions(+), 66 deletions(-)
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 92d82f2..3a28181 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -32,8 +32,8 @@
#include "gtkalias.h"
-#define INDICATOR_SIZE 13
-#define INDICATOR_SPACING 2
+#define INDICATOR_SIZE GTK_SIZE_ONE_TWELFTH_EM(13)
+#define INDICATOR_SPACING GTK_SIZE_ONE_TWELFTH_EM(2)
static void gtk_check_button_size_request (GtkWidget *widget,
@@ -65,21 +65,17 @@ gtk_check_button_class_init (GtkCheckButtonClass *class)
class->draw_indicator = gtk_real_check_button_draw_indicator;
gtk_widget_class_install_style_property (widget_class,
- g_param_spec_int ("indicator-size",
- P_("Indicator Size"),
- P_("Size of check or radio indicator"),
- 0,
- G_MAXINT,
- INDICATOR_SIZE,
- GTK_PARAM_READABLE));
+ gtk_param_spec_size ("indicator-size",
+ P_("Indicator Size"),
+ P_("Size of check or radio indicator"),
+ 0, G_MAXINT, INDICATOR_SIZE,
+ GTK_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
- g_param_spec_int ("indicator-spacing",
- P_("Indicator Spacing"),
- P_("Spacing around check or radio indicator"),
- 0,
- G_MAXINT,
- INDICATOR_SPACING,
- GTK_PARAM_READABLE));
+ gtk_param_spec_size ("indicator-spacing",
+ P_("Indicator Spacing"),
+ P_("Spacing around check or radio indicator"),
+ 0, G_MAXINT, INDICATOR_SPACING,
+ GTK_PARAM_READABLE));
}
static void
diff --git a/gtk/gtkseparatortoolitem.c b/gtk/gtkseparatortoolitem.c
index 4aa4b15..b037d68 100644
--- a/gtk/gtkseparatortoolitem.c
+++ b/gtk/gtkseparatortoolitem.c
@@ -49,7 +49,7 @@ static gboolean gtk_separator_tool_item_expose (GtkWidget
GdkEventExpose *event);
static void gtk_separator_tool_item_add (GtkContainer *container,
GtkWidget *child);
-static gint get_space_size (GtkToolItem *tool_item);
+static GtkSize get_space_size (GtkToolItem *tool_item);
@@ -62,17 +62,17 @@ struct _GtkSeparatorToolItemPrivate
G_DEFINE_TYPE (GtkSeparatorToolItem, gtk_separator_tool_item, GTK_TYPE_TOOL_ITEM)
-static gint
+static GtkSize
get_space_size (GtkToolItem *tool_item)
{
- gint space_size = _gtk_toolbar_get_default_space_size();
+ GtkSize space_size = _gtk_toolbar_get_default_space_size();
GtkWidget *parent = GTK_WIDGET (tool_item)->parent;
if (GTK_IS_TOOLBAR (parent))
{
- gtk_widget_style_get (parent,
- "space-size", &space_size,
- NULL);
+ gtk_widget_style_get_unit (parent,
+ "space-size", &space_size,
+ NULL);
}
return space_size;
@@ -183,12 +183,12 @@ gtk_separator_tool_item_size_request (GtkWidget *widget,
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
- requisition->width = get_space_size (item);
+ requisition->width = gtk_widget_size_to_pixel (widget, get_space_size (item));
requisition->height = 1;
}
else
{
- requisition->height = get_space_size (item);
+ requisition->height = gtk_widget_size_to_pixel (widget, get_space_size (item));
requisition->width = 1;
}
}
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 6b1f053..dd5c253 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -63,7 +63,7 @@ typedef struct _ToolbarContent ToolbarContent;
#define DEFAULT_IPADDING 0
-#define DEFAULT_SPACE_SIZE 12
+#define DEFAULT_SPACE_SIZE GTK_SIZE_ONE_TWELFTH_EM(12)
#define DEFAULT_SPACE_STYLE GTK_TOOLBAR_SPACE_LINE
#define SPACE_LINE_DIVISION 10.0
#define SPACE_LINE_START 2.0
@@ -577,31 +577,25 @@ gtk_toolbar_class_init (GtkToolbarClass *klass)
/* style properties */
gtk_widget_class_install_style_property (widget_class,
- g_param_spec_int ("space-size",
- P_("Spacer size"),
- P_("Size of spacers"),
- 0,
- G_MAXINT,
- DEFAULT_SPACE_SIZE,
- GTK_PARAM_READABLE));
+ gtk_param_spec_size ("space-size",
+ P_("Spacer size"),
+ P_("Size of spacers"),
+ 0, G_MAXINT, DEFAULT_SPACE_SIZE,
+ GTK_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
- g_param_spec_int ("internal-padding",
- P_("Internal padding"),
- P_("Amount of border space between the toolbar shadow and the buttons"),
- 0,
- G_MAXINT,
- DEFAULT_IPADDING,
- GTK_PARAM_READABLE));
+ gtk_param_spec_size ("internal-padding",
+ P_("Internal padding"),
+ P_("Amount of border space between the toolbar shadow and the buttons"),
+ 0, G_MAXINT, DEFAULT_IPADDING,
+ GTK_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
- g_param_spec_int ("max-child-expand",
- P_("Maximum child expand"),
- P_("Maximum amount of space an expandable item will be given"),
- 0,
- G_MAXINT,
- G_MAXINT,
- GTK_PARAM_READABLE));
+ gtk_param_spec_size ("max-child-expand",
+ P_("Maximum child expand"),
+ P_("Maximum amount of space an expandable item will be given"),
+ 0, G_MAXINT, GTK_SIZE_MAXPIXEL,
+ GTK_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
g_param_spec_enum ("space-style",
@@ -4752,7 +4746,7 @@ toolbar_content_hide_all (ToolbarContent *content)
static gint
get_space_size (GtkToolbar *toolbar)
{
- gint space_size = DEFAULT_SPACE_SIZE;
+ gint space_size = gtk_widget_size_to_pixel (toolbar, DEFAULT_SPACE_SIZE);
if (toolbar)
{
@@ -4863,7 +4857,7 @@ gtk_toolbar_check_new_api (GtkToolbar *toolbar)
/* GTK+ internal methods */
-gint
+GtkSize
_gtk_toolbar_get_default_space_size (void)
{
return DEFAULT_SPACE_SIZE;
diff --git a/gtk/gtktoolbar.h b/gtk/gtktoolbar.h
index 333b328..3698ea1 100644
--- a/gtk/gtktoolbar.h
+++ b/gtk/gtktoolbar.h
@@ -180,7 +180,7 @@ void _gtk_toolbar_paint_space_line (GtkWidget *widget
GtkToolbar *toolbar,
const GdkRectangle *area,
const GtkAllocation *allocation);
-gint _gtk_toolbar_get_default_space_size (void);
+GtkSize _gtk_toolbar_get_default_space_size (void);
diff --git a/gtk/gtktoolbutton.c b/gtk/gtktoolbutton.c
index 89231ea..4bc11a8 100644
--- a/gtk/gtktoolbutton.c
+++ b/gtk/gtktoolbutton.c
@@ -257,13 +257,11 @@ gtk_tool_button_class_init (GtkToolButtonClass *klass)
* Since: 2.10
*/
gtk_widget_class_install_style_property (widget_class,
- g_param_spec_int ("icon-spacing",
- P_("Icon spacing"),
- P_("Spacing in pixels between the icon and label"),
- 0,
- G_MAXINT,
- 0,
- GTK_PARAM_READWRITE));
+ gtk_param_spec_size ("icon-spacing",
+ P_("Icon spacing"),
+ P_("Spacing in pixels between the icon and label"),
+ 0, G_MAXINT, 0,
+ GTK_PARAM_READWRITE));
/**
* GtkToolButton::clicked:
@@ -317,13 +315,13 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
gboolean need_icon = FALSE;
GtkIconSize icon_size;
GtkWidget *box = NULL;
- guint icon_spacing;
+ GtkSize icon_spacing;
button->priv->contents_invalid = FALSE;
- gtk_widget_style_get (GTK_WIDGET (tool_item),
- "icon-spacing", &icon_spacing,
- NULL);
+ gtk_widget_style_get_unit (GTK_WIDGET (tool_item),
+ "icon-spacing", &icon_spacing,
+ NULL);
if (button->priv->icon_widget && button->priv->icon_widget->parent)
{
@@ -612,8 +610,10 @@ clone_image_menu_size (GtkImage *image, GtkSettings *settings)
gint width, height;
if (settings &&
- gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU,
- &width, &height))
+ gtk_icon_size_lookup_for_settings_for_monitor (settings,
+ gtk_widget_get_monitor_num (GTK_WIDGET (image)),
+ GTK_ICON_SIZE_MENU,
+ &width, &height))
{
GdkPixbuf *src_pixbuf, *dest_pixbuf;
GtkWidget *cloned_image;
@@ -717,14 +717,14 @@ static void
gtk_tool_button_update_icon_spacing (GtkToolButton *button)
{
GtkWidget *box;
- guint spacing;
+ GtkSize spacing;
box = GTK_BIN (button->priv->button)->child;
if (GTK_IS_BOX (box))
{
- gtk_widget_style_get (GTK_WIDGET (button),
- "icon-spacing", &spacing,
- NULL);
+ gtk_widget_style_get_unit (GTK_WIDGET (button),
+ "icon-spacing", &spacing,
+ NULL);
gtk_box_set_spacing (GTK_BOX (box), spacing);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]