diff options
Diffstat (limited to 'eel/eel-wrap-table.c')
-rw-r--r-- | eel/eel-wrap-table.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/eel/eel-wrap-table.c b/eel/eel-wrap-table.c index 42253acd..26e06ef8 100644 --- a/eel/eel-wrap-table.c +++ b/eel/eel-wrap-table.c @@ -196,6 +196,28 @@ eel_wrap_table_size_request (GtkWidget *widget, requisition->height = content_dimensions.height + gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2; } +#if GTK_CHECK_VERSION (3, 0, 0) +static void +eel_wrap_table_get_preferred_width (GtkWidget *widget, + gint *minimum_width, + gint *natural_width) +{ + GtkRequisition req; + eel_wrap_table_size_request (widget, &req); + *minimum_width = *natural_width = req.width; +} + +static void +eel_wrap_table_get_preferred_height (GtkWidget *widget, + gint *minimum_height, + gint *natural_height) +{ + GtkRequisition req; + eel_wrap_table_size_request (widget, &req); + *minimum_height = *natural_height = req.height; +} +#endif + static void eel_wrap_table_size_allocate (GtkWidget *widget, GtkAllocation *allocation) @@ -213,24 +235,37 @@ eel_wrap_table_size_allocate (GtkWidget *widget, } static int +#if GTK_CHECK_VERSION (3, 0, 0) +eel_wrap_table_draw (GtkWidget *widget, + cairo_t *cr) +#else eel_wrap_table_expose_event (GtkWidget *widget, GdkEventExpose *event) +#endif { EelWrapTable *wrap_table; GList *iterator; g_assert (EEL_IS_WRAP_TABLE (widget)); g_assert (gtk_widget_get_realized (widget)); +#if !GTK_CHECK_VERSION (3, 0, 0) g_assert (event != NULL); +#endif wrap_table = EEL_WRAP_TABLE (widget); for (iterator = wrap_table->details->children; iterator; iterator = iterator->next) { g_assert (GTK_IS_WIDGET (iterator->data)); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_container_propagate_draw (GTK_CONTAINER (widget), + GTK_WIDGET (iterator->data), + cr); +#else gtk_container_propagate_expose (GTK_CONTAINER (widget), GTK_WIDGET (iterator->data), event); +#endif } return FALSE; @@ -411,9 +446,15 @@ eel_wrap_table_class_init (EelWrapTableClass *wrap_table_class) gobject_class->get_property = eel_wrap_table_get_property; /* GtkWidgetClass */ - widget_class->size_request = eel_wrap_table_size_request; widget_class->size_allocate = eel_wrap_table_size_allocate; +#if GTK_CHECK_VERSION (3, 0, 0) + widget_class->get_preferred_width = eel_wrap_table_get_preferred_width; + widget_class->get_preferred_height = eel_wrap_table_get_preferred_height; + widget_class->draw = eel_wrap_table_draw; +#else + widget_class->size_request = eel_wrap_table_size_request; widget_class->expose_event = eel_wrap_table_expose_event; +#endif widget_class->map = eel_wrap_table_map; widget_class->unmap = eel_wrap_table_unmap; widget_class->realize = eel_wrap_table_realize; @@ -755,8 +796,13 @@ wrap_table_child_focus_in (GtkWidget *widget, gtk_widget_translate_coordinates (widget, container, 0, 0, &x, &y); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_adjustment_set_value (hadj, MIN (x, gtk_adjustment_get_upper(hadj) - gtk_adjustment_get_page_size(hadj))); + gtk_adjustment_set_value (vadj, MIN (y, gtk_adjustment_get_upper(vadj) - gtk_adjustment_get_page_size(vadj))); +#else gtk_adjustment_set_value (hadj, MIN (x, hadj->upper - hadj->page_size)); gtk_adjustment_set_value (vadj, MIN (y, vadj->upper - vadj->page_size)); +#endif } return FALSE; |