summaryrefslogtreecommitdiff
path: root/typing-break
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-12-02 00:45:36 +0300
committermonsta <[email protected]>2016-12-02 00:50:14 +0300
commit0c27d18ab5efb721a2f02549767016c81fc6ce2c (patch)
tree76b7b89cface072e011a3757a833e9090bab44f2 /typing-break
parent1aa83d45ebf9599c6d4d3f47211c3961282e98f0 (diff)
downloadmate-control-center-0c27d18ab5efb721a2f02549767016c81fc6ce2c.tar.bz2
mate-control-center-0c27d18ab5efb721a2f02549767016c81fc6ce2c.tar.xz
move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option
and require libmatekbd, libmate-desktop, marco, m-s-d >= 1.17
Diffstat (limited to 'typing-break')
-rw-r--r--typing-break/drw-break-window.c78
-rw-r--r--typing-break/drw-utils.c70
2 files changed, 0 insertions, 148 deletions
diff --git a/typing-break/drw-break-window.c b/typing-break/drw-break-window.c
index 59a502ee..66db00f1 100644
--- a/typing-break/drw-break-window.c
+++ b/typing-break/drw-break-window.c
@@ -73,13 +73,8 @@ static gboolean postpone_sensitize_cb (DrwBreakWindow *window)
static gboolean clock_timeout_cb (DrwBreakWindow *window);
static void postpone_clicked_cb (GtkWidget *button,
GtkWidget *window);
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean label_draw_event_cb (GtkLabel *label,
cairo_t *cr,
-#else
-static gboolean label_expose_event_cb (GtkLabel *label,
- GdkEventExpose *event,
-#endif
gpointer user_data);
static void label_size_request_cb (GtkLabel *label,
GtkRequisition *requisition,
@@ -167,11 +162,7 @@ drw_break_window_init (DrwBreakWindow *window)
align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_widget_show (align);
-#if GTK_CHECK_VERSION (3, 0, 0)
outer_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- outer_vbox = gtk_vbox_new (FALSE, 0);
-#endif
gtk_widget_show (outer_vbox);
right_padding = gdk_screen_get_width (screen) - monitor.width - monitor.x;
@@ -191,11 +182,7 @@ drw_break_window_init (DrwBreakWindow *window)
gtk_box_pack_start (GTK_BOX (outer_vbox), align, TRUE, TRUE, 0);
if (allow_postpone) {
-#if GTK_CHECK_VERSION (3, 0, 0)
button_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- button_box = gtk_hbox_new (FALSE, 0);
-#endif
gtk_widget_show (button_box);
gtk_container_set_border_width (GTK_CONTAINER (button_box), 12);
@@ -228,30 +215,18 @@ drw_break_window_init (DrwBreakWindow *window)
gtk_box_pack_end (GTK_BOX (outer_vbox), button_box, FALSE, TRUE, 0);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- vbox = gtk_vbox_new (FALSE, 0);
-#endif
gtk_widget_show (vbox);
gtk_container_add (GTK_CONTAINER (align), vbox);
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- hbox = gtk_hbox_new (FALSE, 0);
-#endif
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, FALSE, 0);
priv->image = gtk_image_new_from_icon_name ("process-stop", GTK_ICON_SIZE_DIALOG);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (priv->image, GTK_ALIGN_END);
gtk_widget_set_valign (priv->image, GTK_ALIGN_CENTER);
-#else
- gtk_misc_set_alignment (GTK_MISC (priv->image), 1.0, 0.5);
-#endif
gtk_widget_show (priv->image);
gtk_box_pack_start (GTK_BOX (hbox), priv->image, TRUE, TRUE, 8);
@@ -259,13 +234,8 @@ drw_break_window_init (DrwBreakWindow *window)
gtk_widget_show (priv->break_label);
g_signal_connect (priv->break_label,
-#if GTK_CHECK_VERSION (3, 0, 0)
"draw",
G_CALLBACK (label_draw_event_cb),
-#else
- "expose_event",
- G_CALLBACK (label_expose_event_cb),
-#endif
NULL);
g_signal_connect_after (priv->break_label,
@@ -286,13 +256,8 @@ drw_break_window_init (DrwBreakWindow *window)
gtk_box_pack_start (GTK_BOX (vbox), priv->clock_label, TRUE, TRUE, 8);
g_signal_connect (priv->clock_label,
-#if GTK_CHECK_VERSION (3, 0, 0)
"draw",
G_CALLBACK (label_draw_event_cb),
-#else
- "expose_event",
- G_CALLBACK (label_expose_event_cb),
-#endif
NULL);
g_signal_connect_after (priv->clock_label,
@@ -610,7 +575,6 @@ get_layout_location (GtkLabel *label,
}
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean
label_draw_event_cb (GtkLabel *label,
cairo_t *cr,
@@ -636,48 +600,6 @@ label_draw_event_cb (GtkLabel *label,
return TRUE;
}
-#else
-static gboolean
-label_expose_event_cb (GtkLabel *label,
- GdkEventExpose *event,
- gpointer user_data)
-{
- gint x, y;
- GtkWidget *widget;
- GdkWindow *window;
- cairo_t *cr;
-
- get_layout_location (label, &x, &y);
-
- widget = GTK_WIDGET (label);
- window = gtk_widget_get_window (widget);
-
- cr = gdk_cairo_create (window);
-
- gdk_cairo_rectangle (cr, &event->area);
- cairo_clip (cr);
-
- cairo_set_source_rgb (cr, 0, 0, 0);
-
- cairo_move_to (cr, x + 1, y + 1);
- pango_cairo_layout_path (cr, gtk_label_get_layout (label));
- cairo_fill (cr);
-
- cairo_destroy (cr);
-
- gtk_paint_layout (gtk_widget_get_style (widget),
- window,
- gtk_widget_get_state (widget),
- FALSE,
- &event->area,
- widget,
- "label",
- x, y,
- gtk_label_get_layout (label));
-
- return TRUE;
-}
-#endif
static void
label_size_request_cb (GtkLabel *label,
diff --git a/typing-break/drw-utils.c b/typing-break/drw-utils.c
index 5c28db98..974f47ac 100644
--- a/typing-break/drw-utils.c
+++ b/typing-break/drw-utils.c
@@ -90,44 +90,15 @@ create_tile_pixbuf (GdkPixbuf *dest_pixbuf,
}
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
window_draw_event (GtkWidget *widget,
cairo_t *cr,
-#else
-window_expose_event (GtkWidget *widget,
- GdkEventExpose *event,
-#endif
gpointer data)
{
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *context;
- cairo_t *cr;
- cairo_surface_t *surface;
-#endif
int width;
int height;
gtk_window_get_size (GTK_WINDOW (widget), &width, &height);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- context = gdk_cairo_create (gtk_widget_get_window (widget));
-
- cairo_set_operator (context, CAIRO_OPERATOR_SOURCE);
-
- surface = cairo_surface_create_similar (cairo_get_target (context),
- CAIRO_CONTENT_COLOR_ALPHA,
- width,
- height);
-
- if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS) {
- goto done;
- }
-
- cr = cairo_create (surface);
- if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
- goto done;
- }
-#endif
cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0);
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
cairo_paint (cr);
@@ -137,18 +108,6 @@ window_expose_event (GtkWidget *widget,
cairo_set_source_rgba (cr, 0.2, 0.2, 0.2, 0.5);
cairo_fill (cr);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (cr);
-
- cairo_set_source_surface (context, surface, 0, 0);
- cairo_paint (context);
- done:
- if (surface != NULL) {
- cairo_surface_destroy (surface);
- }
- cairo_destroy (context);
-#endif
-
return FALSE;
}
@@ -168,21 +127,10 @@ set_pixmap_background (GtkWidget *window)
width = gdk_screen_get_width (screen);
height = gdk_screen_get_height (screen);
-#if GTK_CHECK_VERSION (3, 0, 0)
tmp_pixbuf = gdk_pixbuf_get_from_window (gdk_screen_get_root_window (screen),
0,
0,
width, height);
-#else
- tmp_pixbuf = gdk_pixbuf_get_from_drawable (NULL,
- gdk_screen_get_root_window (screen),
- gdk_screen_get_system_colormap (screen),
- 0,
- 0,
- 0,
- 0,
- width, height);
-#endif
pixbuf = gdk_pixbuf_new_from_file (IMAGEDIR "/ocean-stripes.png", NULL);
@@ -231,31 +179,13 @@ void
drw_setup_background (GtkWidget *window)
{
GdkScreen *screen;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GdkColormap *colormap;
-#endif
gboolean is_composited;
screen = gtk_widget_get_screen (window);
-#if GTK_CHECK_VERSION (3, 0, 0)
is_composited = gdk_screen_is_composited (screen);
-#else
- colormap = gdk_screen_get_rgba_colormap (screen);
-
- if (colormap != NULL && gdk_screen_is_composited (screen)) {
- gtk_widget_set_colormap (GTK_WIDGET (window), colormap);
- is_composited = TRUE;
- } else {
- is_composited = FALSE;
- }
-#endif
if (is_composited) {
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (window, "draw", G_CALLBACK (window_draw_event), window);
-#else
- g_signal_connect (window, "expose-event", G_CALLBACK (window_expose_event), window);
-#endif
} else {
set_pixmap_background (window);
}