Index: nautilus-ideviceinfo-0.1.0/configure.ac =================================================================== --- nautilus-ideviceinfo-0.1.0.orig/configure.ac 2011-09-09 00:42:58.000000000 +0200 +++ nautilus-ideviceinfo-0.1.0/configure.ac 2011-09-11 00:21:02.000000000 +0200 @@ -18,15 +18,16 @@ GLIB2_REQS=2.14.1 LIBPLIST_REQS=0.15 GTK2_REQS=2.16 -NAUTILUS_REQS=2.21.2 +NAUTILUS_REQS=3.0.0 LIBGPOD_REQS=0.7.90 LIBXML_REQS=2.6.30 +GTK3_REQS=3.0.0 # Checks for libraries. PKG_CHECK_MODULES(WIDGET, libimobiledevice-1.0 >= $LIBIMOBILE_REQS glib-2.0 >= $GLIB2_REQS libplist >= $LIBPLIST_REQS - gtk+-2.0 >= $GTK2_REQS) + gtk+-3.0 >= $GTK3_REQS) PKG_CHECK_MODULES(libnautilusextension, libnautilus-extension >= $NAUTILUS_REQS) PKG_CHECK_MODULES(libgpod, libgpod-1.0 >= $LIBGPOD_REQS, enable_libgpod=yes, enable_libgpod=no) PKG_CHECK_MODULES(libxml, libxml-2.0 >= $LIBXML_REQS) Index: nautilus-ideviceinfo-0.1.0/src/rb-segmented-bar.c =================================================================== --- nautilus-ideviceinfo-0.1.0.orig/src/rb-segmented-bar.c 2011-09-09 00:42:58.000000000 +0200 +++ nautilus-ideviceinfo-0.1.0/src/rb-segmented-bar.c 2011-09-09 00:47:06.000000000 +0200 @@ -135,9 +135,40 @@ priv->segment_box_size = 12; priv->segment_box_spacing = 6; priv->value_formatter = rb_segmented_bar_default_value_formatter; +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_has_window (GTK_WIDGET (bar), FALSE); +#else GTK_WIDGET_SET_FLAGS (GTK_WIDGET (bar), GTK_NO_WINDOW); +#endif } +#if GTK_CHECK_VERSION(3,0,0) +static void +rb_segmented_bar_get_preferred_width (GtkWidget *widget, + gint *minimal_width, + gint *natural_width) +{ + GtkRequisition requisition; + + rb_segmented_bar_size_request (widget, &requisition); + + *minimal_width = *natural_width = requisition.width; +} + +static void +rb_segmented_bar_get_preferred_height (GtkWidget *widget, + gint *minimal_height, + gint *natural_height) +{ + GtkRequisition requisition; + + rb_segmented_bar_size_request (widget, &requisition); + + *minimal_height = *natural_height = requisition.height; +} +#else +#endif + static void rb_segmented_bar_class_init (RBSegmentedBarClass *klass) { @@ -148,8 +179,14 @@ object_class->get_property = rb_segmented_bar_get_property; object_class->set_property = rb_segmented_bar_set_property; +#if GTK_CHECK_VERSION(3,0,0) + widget_class->draw = rb_segmented_bar_expose; + widget_class->get_preferred_width = rb_segmented_bar_get_preferred_width; + widget_class->get_preferred_height = rb_segmented_bar_get_preferred_height; +#else widget_class->expose_event = rb_segmented_bar_expose; widget_class->size_request = rb_segmented_bar_size_request; +#endif widget_class->size_allocate = rb_segmented_bar_size_allocate; /** @@ -398,16 +435,31 @@ } else { real_height = priv->bar_height; } +#if GTK_CHECK_VERSION(2,18,0) + gtk_widget_set_allocation(widget, allocation); +#else widget->allocation = *allocation; +#endif if (priv->show_labels) { compute_layout_size (RB_SEGMENTED_BAR (widget)); +#if GTK_CHECK_VERSION(2,18,0) + allocation->height = MAX (priv->bar_height + priv->bar_label_spacing + priv->layout_height, +#else widget->allocation.height = MAX (priv->bar_height + priv->bar_label_spacing + priv->layout_height, +#endif real_height); } else { +#if GTK_CHECK_VERSION(2,18,0) + allocation->height = real_height; + } + allocation->width = priv->layout_width + 2*(priv->h_padding); + GTK_WIDGET_CLASS(rb_segmented_bar_parent_class)->size_allocate(widget, allocation); +#else widget->allocation.height = real_height; } widget->allocation.width = priv->layout_width + 2*(priv->h_padding); GTK_WIDGET_CLASS(rb_segmented_bar_parent_class)->size_allocate(widget, allocation); +#endif } @@ -657,7 +709,7 @@ if (priv->segments == NULL) { return; } - gdk_color = >K_WIDGET (bar)->style->fg[GTK_WIDGET_STATE (GTK_WIDGET (bar))]; + gdk_color = >k_widget_get_style(GTK_WIDGET (bar))->fg[gtk_widget_get_state (GTK_WIDGET (bar))]; text_color.red = gdk_color->red / 65535.0; text_color.green = gdk_color->green / 65535.0; text_color.blue = gdk_color->blue / 65535.0; @@ -746,31 +798,46 @@ RBSegmentedBarPrivate *priv; cairo_t *context; cairo_pattern_t *bar_pattern; +#if GTK_CHECK_VERSION(2,18,0) + GtkAllocation allocation; + gtk_widget_set_allocation(widget, &allocation); +#endif g_return_val_if_fail (RB_IS_SEGMENTED_BAR (widget), FALSE); - if (GTK_WIDGET_DRAWABLE (widget) == FALSE) { + if (gtk_widget_is_drawable(widget) == FALSE) { return FALSE; } bar = RB_SEGMENTED_BAR (widget); priv = RB_SEGMENTED_BAR_GET_PRIVATE (bar); - context = gdk_cairo_create (GDK_DRAWABLE (widget->window)); + context = gdk_cairo_create (gtk_widget_get_window(widget)); if (priv->reflect) { cairo_push_group (context); } cairo_set_operator (context, CAIRO_OPERATOR_OVER); +#if GTK_CHECK_VERSION(2,18,0) + cairo_translate (context, allocation.x + priv->h_padding, + allocation.y); + cairo_rectangle (context, 0, 0, + allocation.width - priv->h_padding, +#else cairo_translate (context, widget->allocation.x + priv->h_padding, widget->allocation.y); cairo_rectangle (context, 0, 0, widget->allocation.width - priv->h_padding, +#endif MAX (2*priv->bar_height, priv->bar_height + priv->bar_label_spacing + priv->layout_height)); cairo_clip (context); bar_pattern = rb_segmented_bar_render (bar, +#if GTK_CHECK_VERSION(2,18,0) + allocation.width - 2*priv->h_padding, +#else widget->allocation.width - 2*priv->h_padding, +#endif priv->bar_height); cairo_save (context); @@ -785,7 +852,11 @@ cairo_save (context); cairo_rectangle (context, 0, priv->bar_height, +#if GTK_CHECK_VERSION(2,18,0) + allocation.width - priv->h_padding, +#else widget->allocation.width - priv->h_padding, +#endif priv->bar_height); cairo_clip (context); cairo_matrix_init_scale (&matrix, 1, -1); @@ -812,11 +883,20 @@ if (priv->show_labels) { if (priv->reflect) { cairo_translate (context, +#if GTK_CHECK_VERSION(2,18,0) + allocation.x + (allocation.width - priv->layout_width)/2, + allocation.y + priv->bar_height + priv->bar_label_spacing); +#else widget->allocation.x + (widget->allocation.width - priv->layout_width)/2, widget->allocation.y + priv->bar_height + priv->bar_label_spacing); +#endif } else { cairo_translate (context, +#if GTK_CHECK_VERSION(2,18,0) + -priv->h_padding + (allocation.width - priv->layout_width)/2, +#else -priv->h_padding + (widget->allocation.width - priv->layout_width)/2, +#endif priv->bar_height + priv->bar_label_spacing); } rb_segmented_bar_render_labels (bar, context);