[gucharmap] Use get_preferred_{width,height} on gtk3
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gucharmap] Use get_preferred_{width,height} on gtk3
- Date: Thu, 28 Oct 2010 22:54:52 +0000 (UTC)
commit 74a3b7b309b75e3141fb03860e22f588ef2da7a2
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Oct 29 00:53:07 2010 +0200
Use get_preferred_{width,height} on gtk3
Bug #633408.
gucharmap/gucharmap-chartable.c | 38 ++++++++++++++++++++++++++++++++++++--
1 files changed, 36 insertions(+), 2 deletions(-)
---
diff --git a/gucharmap/gucharmap-chartable.c b/gucharmap/gucharmap-chartable.c
index 17ad733..f1d3ffa 100644
--- a/gucharmap/gucharmap-chartable.c
+++ b/gucharmap/gucharmap-chartable.c
@@ -1779,6 +1779,36 @@ gucharmap_chartable_size_allocate (GtkWidget *widget,
update_scrollbar_adjustment (chartable);
}
+#if GTK_CHECK_VERSION (2, 91, 0)
+
+static void
+gucharmap_chartable_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ GucharmapChartable *chartable = GUCHARMAP_CHARTABLE (widget);
+ int font_size_px;
+
+ font_size_px = get_font_size_px (chartable);
+
+ *minimum = *natural = FACTOR_WIDTH * font_size_px;
+}
+
+static void
+gucharmap_chartable_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ GucharmapChartable *chartable = GUCHARMAP_CHARTABLE (widget);
+ int font_size_px;
+
+ font_size_px = get_font_size_px (chartable);
+
+ *minimum = *natural = FACTOR_HEIGHT * font_size_px;
+}
+
+#else
+
static void
gucharmap_chartable_size_request (GtkWidget *widget,
GtkRequisition *requisition)
@@ -1792,6 +1822,8 @@ gucharmap_chartable_size_request (GtkWidget *widget,
requisition->height = FACTOR_HEIGHT * font_size_px;
}
+#endif /* GTK 3.0 */
+
static void
gucharmap_chartable_style_set (GtkWidget *widget,
GtkStyle *previous_style)
@@ -2301,9 +2333,12 @@ gucharmap_chartable_class_init (GucharmapChartableClass *klass)
widget_class->drag_data_received = gucharmap_chartable_drag_data_received;
widget_class->button_press_event = gucharmap_chartable_button_press;
widget_class->button_release_event = gucharmap_chartable_button_release;
-#if GTK_CHECK_VERSION (2, 90, 8)
+#if GTK_CHECK_VERSION (2, 91, 0)
+ widget_class->get_preferred_width = gucharmap_chartable_get_preferred_width;
+ widget_class->get_preferred_height = gucharmap_chartable_get_preferred_height;
widget_class->draw = gucharmap_chartable_draw;
#else
+ widget_class->size_request = gucharmap_chartable_size_request;
widget_class->expose_event = gucharmap_chartable_expose_event;
#endif
widget_class->focus_in_event = gucharmap_chartable_focus_in_event;
@@ -2312,7 +2347,6 @@ gucharmap_chartable_class_init (GucharmapChartableClass *klass)
widget_class->key_release_event = gucharmap_chartable_key_release_event;
widget_class->motion_notify_event = gucharmap_chartable_motion_notify;
widget_class->size_allocate = gucharmap_chartable_size_allocate;
- widget_class->size_request = gucharmap_chartable_size_request;
widget_class->style_set = gucharmap_chartable_style_set;
#ifdef ENABLE_ACCESSIBLE
widget_class->get_accessible = gucharmap_chartable_get_accessible;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]