summaryrefslogtreecommitdiff
path: root/applets/clock/clock-map.c
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-11-21 21:14:26 +0300
committermonsta <[email protected]>2016-11-21 21:14:26 +0300
commitd0ddaedffa7d417a699cafce73c1e418515c4a28 (patch)
tree645b7a86e32b21113e1ce14f563bfb8d8900fa53 /applets/clock/clock-map.c
parent7dfeb78328039cf92a9f45d64c9b3662d967a1fe (diff)
downloadmate-panel-d0ddaedffa7d417a699cafce73c1e418515c4a28.tar.bz2
mate-panel-d0ddaedffa7d417a699cafce73c1e418515c4a28.tar.xz
move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option
and require libmate-desktop >= 1.17 WARNING: use GTK+3 build of libmateweather for this build. that lib is not migrated to GTK+3 only as we will possibly use libgweather instead of it.
Diffstat (limited to 'applets/clock/clock-map.c')
-rw-r--r--applets/clock/clock-map.c80
1 files changed, 0 insertions, 80 deletions
diff --git a/applets/clock/clock-map.c b/applets/clock/clock-map.c
index 704835ea..a8e0c2b0 100644
--- a/applets/clock/clock-map.c
+++ b/applets/clock/clock-map.c
@@ -58,7 +58,6 @@ typedef struct {
static void clock_map_finalize (GObject *);
static void clock_map_size_allocate (GtkWidget *this,
GtkAllocation *allocation);
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean clock_map_draw (GtkWidget *this,
cairo_t *cr);
static void clock_map_get_preferred_width (GtkWidget *widget,
@@ -67,12 +66,6 @@ static void clock_map_get_preferred_width (GtkWidget *widget,
static void clock_map_get_preferred_height (GtkWidget *widget,
gint *minimum_height,
gint *natural_height);
-#else
-static gboolean clock_map_expose (GtkWidget *this,
- GdkEventExpose *expose);
-static void clock_map_size_request (GtkWidget *this,
- GtkRequisition *requisition);
-#endif
static void clock_map_place_locations (ClockMap *this);
static void clock_map_render_shadow (ClockMap *this);
static void clock_map_display (ClockMap *this);
@@ -100,14 +93,9 @@ clock_map_class_init (ClockMapClass *this_class)
/* GtkWidget signals */
widget_class->size_allocate = clock_map_size_allocate;
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->draw = clock_map_draw;
widget_class->get_preferred_width = clock_map_get_preferred_width;
widget_class->get_preferred_height = clock_map_get_preferred_height;
-#else
- widget_class->expose_event = clock_map_expose;
- widget_class->size_request = clock_map_size_request;
-#endif
g_type_class_add_private (this_class, sizeof (ClockMapPrivate));
@@ -234,98 +222,38 @@ clock_map_refresh (ClockMap *this)
}
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
clock_map_draw (GtkWidget *this, cairo_t *cr)
-#else
-clock_map_expose (GtkWidget *this, GdkEventExpose *event)
-#endif
{
ClockMapPrivate *priv = PRIVATE (this);
-#if GTK_CHECK_VERSION (3, 0, 0)
int width, height;
GtkStyleContext *context;
GdkRGBA color;
context = gtk_widget_get_style_context (this);
gtk_style_context_get_color (context, GTK_STATE_FLAG_ACTIVE, &color);
-#else
- GtkStyle *style;
- GdkWindow *window;
- GtkAllocation allocation;
- GdkRectangle region;
- cairo_t *cr;
-
- style = gtk_widget_get_style (this);
-#endif
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
- window = gtk_widget_get_window (this);
- gtk_widget_get_allocation (this, &allocation);
-#endif
if (!priv->shadow_map_pixbuf) {
g_warning ("Needed to refresh the map in expose event.");
clock_map_refresh (CLOCK_MAP (this));
}
-#if GTK_CHECK_VERSION (3, 0, 0)
width = gdk_pixbuf_get_width (priv->shadow_map_pixbuf);
height = gdk_pixbuf_get_height (priv->shadow_map_pixbuf);
gdk_cairo_set_source_pixbuf (cr, priv->shadow_map_pixbuf, 0, 0);
cairo_rectangle (cr, 0, 0, width, height);
cairo_paint (cr);
-#else
- cr = gdk_cairo_create (window);
-
- region.x = allocation.x;
- region.y = allocation.y;
- region.width = gdk_pixbuf_get_width (priv->shadow_map_pixbuf);
- region.height = gdk_pixbuf_get_height (priv->shadow_map_pixbuf);
-
- gdk_rectangle_intersect (&region, &(event->area), &region);
- gdk_draw_pixbuf (window,
- style->black_gc,
- priv->shadow_map_pixbuf,
- region.x - allocation.x,
- region.y - allocation.y,
- region.x,
- region.y,
- region.width,
- region.height,
- GDK_RGB_DITHER_NORMAL,
- 0, 0);
-#endif
/* draw a simple outline */
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_rectangle (cr, 0.5, 0.5, width - 1, height - 1);
gdk_cairo_set_source_rgba (cr, &color);
-#else
- cairo_rectangle (
- cr,
- allocation.x + 0.5, allocation.y + 0.5,
- gdk_pixbuf_get_width (priv->shadow_map_pixbuf) - 1,
- gdk_pixbuf_get_height (priv->shadow_map_pixbuf) - 1);
-
- cairo_set_source_rgb (
- cr,
- style->mid [GTK_STATE_ACTIVE].red / 65535.0,
- style->mid [GTK_STATE_ACTIVE].green / 65535.0,
- style->mid [GTK_STATE_ACTIVE].blue / 65535.0);
-#endif
cairo_set_line_width (cr, 1.0);
cairo_stroke (cr);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (cr);
-#endif
-
return FALSE;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
clock_map_get_preferred_width (GtkWidget *this,
gint *minimum_width,
@@ -341,14 +269,6 @@ clock_map_get_preferred_height (GtkWidget *this,
{
*minimum_height = *natural_height = 125;
}
-#else
-static void
-clock_map_size_request (GtkWidget *this, GtkRequisition *requisition)
-{
- requisition->width = 250;
- requisition->height = 125;
-}
-#endif
static void
clock_map_size_allocate (GtkWidget *this, GtkAllocation *allocation)