diff options
Diffstat (limited to 'eel')
-rw-r--r-- | eel/Makefile.am | 3 | ||||
-rw-r--r-- | eel/eel-background.c | 2 | ||||
-rw-r--r-- | eel/eel-background.h | 4 | ||||
-rw-r--r-- | eel/eel-canvas.c | 4 | ||||
-rw-r--r-- | eel/eel-debug-drawing.c | 48 | ||||
-rw-r--r-- | eel/eel-debug-drawing.h | 3 | ||||
-rw-r--r-- | eel/eel-gdk-extensions.c | 2 | ||||
-rw-r--r-- | eel/eel-gdk-pixbuf-extensions.c | 16 | ||||
-rw-r--r-- | eel/eel-gdk-pixbuf-extensions.h | 5 | ||||
-rw-r--r-- | eel/eel-gtk-container.c | 8 | ||||
-rw-r--r-- | eel/eel-gtk-container.h | 4 | ||||
-rw-r--r-- | eel/eel-labeled-image.c | 63 | ||||
-rw-r--r-- | eel/eel-mate-extensions.c | 19 | ||||
-rw-r--r-- | eel/eel-wrap-table.c | 48 |
14 files changed, 217 insertions, 12 deletions
diff --git a/eel/Makefile.am b/eel/Makefile.am index ffa906ee..7919b80f 100644 --- a/eel/Makefile.am +++ b/eel/Makefile.am @@ -2,7 +2,7 @@ NULL= noinst_LTLIBRARIES=libeel-2.la -INCLUDES = \ +AM_CPPFLAGS = \ -DG_LOG_DOMAIN=\"Eel\" \ -I$(top_builddir) \ -I$(top_srcdir) \ @@ -90,6 +90,7 @@ libeel_2_la_SOURCES = \ eel-wrap-table.c \ eel-xml-extensions.c \ eel-lib-self-check-functions.h \ + $(eel_headers) \ $(NULL) nodist_libeel_2_la_SOURCES = \ diff --git a/eel/eel-background.c b/eel/eel-background.c index d8be8225..dc1dc1f5 100644 --- a/eel/eel-background.c +++ b/eel/eel-background.c @@ -40,7 +40,7 @@ #include <math.h> #include <stdio.h> #define MATE_DESKTOP_USE_UNSTABLE_API -#include <libmateui/mate-bg.h> +#include <libmate-desktop/mate-bg.h> #include <libcaja-private/caja-global-preferences.h> #if !GTK_CHECK_VERSION(3, 0, 0) diff --git a/eel/eel-background.h b/eel/eel-background.h index 74d370e7..9303835e 100644 --- a/eel/eel-background.h +++ b/eel/eel-background.h @@ -48,7 +48,7 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #define MATE_DESKTOP_USE_UNSTABLE_API -#include <libmateui/mate-bg.h> +#include <libmate-desktop/mate-bg.h> typedef struct EelBackground EelBackground; typedef struct EelBackgroundClass EelBackgroundClass; @@ -96,7 +96,7 @@ gboolean eel_background_is_set (EelBackground /* Helper function for widgets using EelBackground */ void eel_background_draw (GtkWidget *widget, #if GTK_CHECK_VERSION (3, 0, 0) - cairo_t *cr) + cairo_t *cr); #else GdkEventExpose *event); #endif diff --git a/eel/eel-canvas.c b/eel/eel-canvas.c index 24f84e24..8341958a 100644 --- a/eel/eel-canvas.c +++ b/eel/eel-canvas.c @@ -3913,7 +3913,11 @@ eel_canvas_item_accessible_is_item_in_window (EelCanvasItem *item, int window_width, window_height; gdk_window_get_geometry (gtk_widget_get_window (widget), NULL, NULL, +#if GTK_CHECK_VERSION (3, 0, 0) + &window_width, &window_height); +#else &window_width, &window_height, NULL); +#endif /* * Check whether rectangles intersect */ diff --git a/eel/eel-debug-drawing.c b/eel/eel-debug-drawing.c index 63706829..b334f66f 100644 --- a/eel/eel-debug-drawing.c +++ b/eel/eel-debug-drawing.c @@ -117,8 +117,34 @@ debug_pixbuf_viewer_size_request (GtkWidget *widget, GtkRequisition *requisition requisition->height = MAX (2, dimensions.height); } +#if GTK_CHECK_VERSION (3, 0, 0) +static void +debug_pixbuf_viewer_get_preferred_width (GtkWidget *widget, + gint *minimum_width, + gint *natural_width) +{ + GtkRequisition req; + debug_pixbuf_viewer_size_request (widget, &req); + *minimum_width = *natural_width = req.width; +} + +static void +debug_pixbuf_viewer_get_preferred_height (GtkWidget *widget, + gint *minimum_height, + gint *natural_height) +{ + GtkRequisition req; + debug_pixbuf_viewer_size_request (widget, &req); + *minimum_height = *natural_height = req.height; +} +#endif + static int +#if GTK_CHECK_VERSION (3, 0, 0) +debug_pixbuf_viewer_draw (GtkWidget *widget, cairo_t *cr) +#else debug_pixbuf_viewer_expose_event (GtkWidget *widget, GdkEventExpose *event) +#endif { DebugPixbufViewer *viewer; EelIRect clipped_dirty_area; @@ -127,8 +153,12 @@ debug_pixbuf_viewer_expose_event (GtkWidget *widget, GdkEventExpose *event) GtkAllocation allocation; g_assert (DEBUG_IS_PIXBUF_VIEWER (widget)); +#if GTK_CHECK_VERSION (3, 0, 0) + g_assert (cr != NULL); +#else g_assert (event != NULL); g_assert (event->window == gtk_widget_get_window (widget)); +#endif g_assert (gtk_widget_get_realized (widget)); viewer = DEBUG_PIXBUF_VIEWER (widget); @@ -145,9 +175,15 @@ debug_pixbuf_viewer_expose_event (GtkWidget *widget, GdkEventExpose *event) bounds.y1 = bounds.y0 + gdk_pixbuf_get_height (viewer->pixbuf); /* Clip the dirty area to the screen; bail if no work to do */ +#if GTK_CHECK_VERSION (3, 0, 0) + clipped_dirty_area = eel_gdk_window_clip_dirty_area_to_screen (gtk_widget_get_window (widget), + dirty_area); +#else dirty_area = eel_gdk_rectangle_to_eel_irect (event->area); clipped_dirty_area = eel_gdk_window_clip_dirty_area_to_screen (event->window, dirty_area); +#endif + if (!eel_irect_is_empty (&clipped_dirty_area)) { EelIRect clipped_bounds; @@ -160,7 +196,11 @@ debug_pixbuf_viewer_expose_event (GtkWidget *widget, GdkEventExpose *event) g_assert (clipped_bounds.y0 >= bounds.y0); eel_gdk_pixbuf_draw_to_drawable (viewer->pixbuf, +#if GTK_CHECK_VERSION (3, 0, 0) + cr, +#else event->window, +#endif clipped_bounds.x0 - bounds.x0, clipped_bounds.y0 - bounds.y0, clipped_bounds); @@ -182,8 +222,14 @@ debug_pixbuf_viewer_class_init (DebugPixbufViewerClass *pixbuf_viewer_class) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (pixbuf_viewer_class); object_class->finalize = debug_pixbuf_viewer_finalize; +#if GTK_CHECK_VERSION (3, 0, 0) + widget_class->get_preferred_width = debug_pixbuf_viewer_get_preferred_width; + widget_class->get_preferred_height = debug_pixbuf_viewer_get_preferred_height; + widget_class->draw = debug_pixbuf_viewer_draw; +#else widget_class->size_request = debug_pixbuf_viewer_size_request; widget_class->expose_event = debug_pixbuf_viewer_expose_event; +#endif } static void @@ -207,6 +253,7 @@ debug_pixbuf_viewer_set_pixbuf (DebugPixbufViewer *viewer, GdkPixbuf *pixbuf) * * Draw a rectangle and cross. Useful for debugging exposure events. */ +#if !GTK_CHECK_VERSION (3, 0, 0) void eel_debug_draw_rectangle_and_cross (GdkDrawable *drawable, EelIRect rectangle, @@ -252,6 +299,7 @@ eel_debug_draw_rectangle_and_cross (GdkDrawable *drawable, cairo_destroy (cr); } +#endif /** * eel_debug_show_pixbuf_in_external_viewer: diff --git a/eel/eel-debug-drawing.h b/eel/eel-debug-drawing.h index 8620ca6b..f7d29ef9 100644 --- a/eel/eel-debug-drawing.h +++ b/eel/eel-debug-drawing.h @@ -25,13 +25,16 @@ #ifndef EEL_DEBUG_DRAWING_H #define EEL_DEBUG_DRAWING_H +#include <gtk/gtk.h> #include <eel/eel-gdk-pixbuf-extensions.h> /* Draw a rectangle and cross on the given window */ +#if !GTK_CHECK_VERSION (3, 0, 0) void eel_debug_draw_rectangle_and_cross (GdkDrawable *drawable, EelIRect rectangle, guint32 color, gboolean draw_cross); +#endif /* Show the given pixbuf in an external out of process viewer */ void eel_debug_show_pixbuf_in_external_viewer (const GdkPixbuf *pixbuf, diff --git a/eel/eel-gdk-extensions.c b/eel/eel-gdk-extensions.c index ed694277..3d68d9a5 100644 --- a/eel/eel-gdk-extensions.c +++ b/eel/eel-gdk-extensions.c @@ -504,7 +504,7 @@ eel_gdk_draw_layout_with_drop_shadow (GdkDrawable *drawable, pango_cairo_show_layout (cr, layout); #if GTK_CHECK_VERSION(3,0,0) - cairo_restore + cairo_restore (cr); #else cairo_destroy (cr); #endif diff --git a/eel/eel-gdk-pixbuf-extensions.c b/eel/eel-gdk-pixbuf-extensions.c index c913cb10..6870e932 100644 --- a/eel/eel-gdk-pixbuf-extensions.c +++ b/eel/eel-gdk-pixbuf-extensions.c @@ -622,10 +622,14 @@ eel_gdk_pixbuf_unref_if_not_null (GdkPixbuf *pixbuf_or_null) void eel_gdk_pixbuf_draw_to_drawable (const GdkPixbuf *pixbuf, +#if GTK_CHECK_VERSION (3, 0, 0) + cairo_t *cr, +#else GdkDrawable *drawable, +#endif int source_x, int source_y, - EelIRect destination_area) + EelIRect destination_area) { EelDimensions dimensions; EelIRect target; @@ -634,10 +638,16 @@ eel_gdk_pixbuf_draw_to_drawable (const GdkPixbuf *pixbuf, int target_height; int source_width; int source_height; - cairo_t *cr; +#if !GTK_CHECK_VERSION (3, 0, 0) + cairo_t *cr; +#endif g_return_if_fail (eel_gdk_pixbuf_is_valid (pixbuf)); +#if GTK_CHECK_VERSION (3, 0, 0) + g_return_if_fail (cr != NULL); +#else g_return_if_fail (drawable != NULL); +#endif g_return_if_fail (!eel_irect_is_empty (&destination_area)); dimensions = eel_gdk_pixbuf_get_dimensions (pixbuf); @@ -673,7 +683,9 @@ eel_gdk_pixbuf_draw_to_drawable (const GdkPixbuf *pixbuf, target.x1 = target.x0 + MIN (target_width, source_width); target.y1 = target.y0 + MIN (target_height, source_height); +#if !GTK_CHECK_VERSION (3, 0, 0) cr = gdk_cairo_create (drawable); +#endif gdk_cairo_set_source_pixbuf (cr, (GdkPixbuf *) pixbuf, source.x0 - target.x0, source.y0 - target.y0); cairo_rectangle (cr, target.x0, target.y0, diff --git a/eel/eel-gdk-pixbuf-extensions.h b/eel/eel-gdk-pixbuf-extensions.h index 382cd6cd..7d31defe 100644 --- a/eel/eel-gdk-pixbuf-extensions.h +++ b/eel/eel-gdk-pixbuf-extensions.h @@ -30,6 +30,7 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #include <gdk/gdk.h> #include <gio/gio.h> +#include <gtk/gtk.h> #define EEL_OPACITY_FULLY_TRANSPARENT 0 #define EEL_OPACITY_FULLY_OPAQUE 255 @@ -92,7 +93,11 @@ void eel_gdk_pixbuf_unref_if_not_null (GdkPixbuf /* Copy a pixbuf to an area of a GdkDrawable */ void eel_gdk_pixbuf_draw_to_drawable (const GdkPixbuf *pixbuf, +#if GTK_CHECK_VERSION (3, 0, 0) + cairo_t *cr, +#else GdkDrawable *drawable, +#endif int source_x, int source_y, EelIRect destination_area); diff --git a/eel/eel-gtk-container.c b/eel/eel-gtk-container.c index cb841fd5..9a1df176 100644 --- a/eel/eel-gtk-container.c +++ b/eel/eel-gtk-container.c @@ -43,7 +43,11 @@ void eel_gtk_container_child_expose_event (GtkContainer *container, GtkWidget *child, +#if GTK_CHECK_VERSION (3, 0, 0) + cairo_t *cr) +#else GdkEventExpose *event) +#endif { g_return_if_fail (GTK_IS_CONTAINER (container)); @@ -54,7 +58,11 @@ eel_gtk_container_child_expose_event (GtkContainer *container, g_return_if_fail (GTK_IS_WIDGET (child)); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_container_propagate_draw (container, child, cr); +#else gtk_container_propagate_expose (container, child, event); +#endif } /** diff --git a/eel/eel-gtk-container.h b/eel/eel-gtk-container.h index f5ca876d..c11ca3e2 100644 --- a/eel/eel-gtk-container.h +++ b/eel/eel-gtk-container.h @@ -31,7 +31,11 @@ void eel_gtk_container_child_expose_event (GtkContainer *container, GtkWidget *child, +#if GTK_CHECK_VERSION (3, 0, 0) + cairo_t *cr); +#else GdkEventExpose *event); +#endif void eel_gtk_container_child_map (GtkContainer *container, GtkWidget *child); void eel_gtk_container_child_unmap (GtkContainer *container, diff --git a/eel/eel-labeled-image.c b/eel/eel-labeled-image.c index 12dad9c1..7eff21a9 100644 --- a/eel/eel-labeled-image.c +++ b/eel/eel-labeled-image.c @@ -320,6 +320,28 @@ eel_labeled_image_size_request (GtkWidget *widget, 2 * labeled_image->details->y_padding; } +#if GTK_CHECK_VERSION (3, 0, 0) +static void +eel_labeled_image_get_preferred_width (GtkWidget *widget, + gint *minimum_width, + gint *natural_width) +{ + GtkRequisition req; + eel_labeled_image_size_request (widget, &req); + *minimum_width = *natural_width = req.width; +} + +static void +eel_labeled_image_get_preferred_height (GtkWidget *widget, + gint *minimum_height, + gint *natural_height) +{ + GtkRequisition req; + eel_labeled_image_size_request (widget, &req); + *minimum_height = *natural_height = req.height; +} +#endif + static void eel_labeled_image_size_allocate (GtkWidget *widget, GtkAllocation *allocation) @@ -347,8 +369,13 @@ eel_labeled_image_size_allocate (GtkWidget *widget, } static int +#if GTK_CHECK_VERSION (3, 0, 0) +eel_labeled_image_draw (GtkWidget *widget, + cairo_t *cr) +#else eel_labeled_image_expose_event (GtkWidget *widget, GdkEventExpose *event) +#endif { EelLabeledImage *labeled_image; EelIRect label_bounds; @@ -357,7 +384,9 @@ eel_labeled_image_expose_event (GtkWidget *widget, g_assert (EEL_IS_LABELED_IMAGE (widget)); g_assert (gtk_widget_get_realized (widget)); +#if !GTK_CHECK_VERSION (3, 0, 0) g_assert (event != NULL); +#endif labeled_image = EEL_LABELED_IMAGE (widget); @@ -369,10 +398,16 @@ eel_labeled_image_expose_event (GtkWidget *widget, label_bounds = eel_labeled_image_get_label_bounds (EEL_LABELED_IMAGE (widget)); gtk_paint_flat_box (style, +#if GTK_CHECK_VERSION (3, 0, 0) + cr, +#else window, +#endif gtk_widget_get_state (widget), GTK_SHADOW_NONE, +#if !GTK_CHECK_VERSION (3, 0, 0) &event->area, +#endif widget, "eel-labeled-image", label_bounds.x0, label_bounds.y0, @@ -384,22 +419,38 @@ eel_labeled_image_expose_event (GtkWidget *widget, { eel_gtk_container_child_expose_event (GTK_CONTAINER (widget), labeled_image->details->label, +#if GTK_CHECK_VERSION (3, 0, 0) + cr); +#else event); +#endif } if (labeled_image_show_image (labeled_image)) { eel_gtk_container_child_expose_event (GTK_CONTAINER (widget), labeled_image->details->image, +#if GTK_CHECK_VERSION (3, 0, 0) + cr); +#else event); +#endif } if (gtk_widget_has_focus (widget)) { label_bounds = eel_labeled_image_get_image_bounds (EEL_LABELED_IMAGE (widget)); - gtk_paint_focus (style, window, + gtk_paint_focus (style, +#if GTK_CHECK_VERSION (3, 0, 0) + cr, +#else + window, +#endif GTK_STATE_NORMAL, - &event->area, widget, +#if !GTK_CHECK_VERSION (3, 0, 0) + &event->area, +#endif + widget, "eel-focusable-labeled-image", label_bounds.x0, label_bounds.y0, label_bounds.x1 - label_bounds.x0, @@ -528,9 +579,15 @@ eel_labeled_image_class_init (EelLabeledImageClass *labeled_image_class) #endif /* GtkWidgetClass */ - widget_class->size_request = eel_labeled_image_size_request; widget_class->size_allocate = eel_labeled_image_size_allocate; +#if GTK_CHECK_VERSION (3, 0, 0) + widget_class->get_preferred_width = eel_labeled_image_get_preferred_width; + widget_class->get_preferred_height = eel_labeled_image_get_preferred_height; + widget_class->draw = eel_labeled_image_draw; +#else + widget_class->size_request = eel_labeled_image_size_request; widget_class->expose_event = eel_labeled_image_expose_event; +#endif widget_class->map = eel_labeled_image_map; widget_class->unmap = eel_labeled_image_unmap; widget_class->get_accessible = eel_labeled_image_get_accessible; diff --git a/eel/eel-mate-extensions.c b/eel/eel-mate-extensions.c index 2af5a941..f1974397 100644 --- a/eel/eel-mate-extensions.c +++ b/eel/eel-mate-extensions.c @@ -31,7 +31,7 @@ #include "eel-mate-extensions.h" #include <gtk/gtk.h> -#include <libmate/mate-desktop-utils.h> +#include <libmate-desktop/mate-desktop-utils.h> /* Return a command string containing the path to a terminal on this system. */ @@ -194,7 +194,24 @@ eel_mate_open_terminal_on_screen (const char *command, g_message ("Could not start a terminal"); return; } +#if GTK_CHECK_VERSION (3, 0, 0) + GdkAppLaunchContext *launch_context; + GAppInfo *app_info = NULL; + app_info = g_app_info_create_from_commandline (command_line, + NULL, + G_APP_INFO_CREATE_NONE, + NULL); + if (app_info != NULL) + { + launch_context = gdk_app_launch_context_new (); + gdk_app_launch_context_set_screen (launch_context, screen); + g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (launch_context), NULL); + g_object_unref (launch_context); + g_object_unref (app_info); + } +#else gdk_spawn_command_line_on_screen (screen, command_line, NULL); +#endif g_free (command_line); } 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; |