summaryrefslogtreecommitdiff
path: root/src/themes/nodoka/nodoka-theme.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/themes/nodoka/nodoka-theme.c')
-rw-r--r--src/themes/nodoka/nodoka-theme.c151
1 files changed, 9 insertions, 142 deletions
diff --git a/src/themes/nodoka/nodoka-theme.c b/src/themes/nodoka/nodoka-theme.c
index a045d90..59aac14 100644
--- a/src/themes/nodoka/nodoka-theme.c
+++ b/src/themes/nodoka/nodoka-theme.c
@@ -118,11 +118,6 @@ void notification_tick(GtkWindow *nw, glong remaining);
#define BACKGROUND_OPACITY 0.92
#define GRADIENT_CENTER 0.7
-#if GTK_CHECK_VERSION (3, 2, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#endif
-
/* Support Nodoka Functions */
/* Handle clicking on link */
@@ -400,17 +395,10 @@ draw_stripe(GtkWidget *widget, WindowData *windata, cairo_t *cr)
cairo_rectangle (cr, 0, 0, STRIPE_WIDTH, windata->height);
cairo_clip (cr);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdouble color_mult = 1.0;
GdkRGBA top_color;
GdkRGBA center_color;
GdkRGBA bottom_color;
-#else
- gdouble color_mult = 65535.0;
- GdkColor top_color;
- GdkColor center_color;
- GdkColor bottom_color;
-#endif
float alpha;
if (windata->composited)
@@ -522,7 +510,6 @@ draw_pie(GtkWidget *pie, WindowData *windata, cairo_t *cr)
cairo_fill (cr);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
update_shape_region (cairo_surface_t *surface,
WindowData *windata)
@@ -555,62 +542,6 @@ update_shape_region (cairo_surface_t *surface,
windata->last_width = windata->width;
windata->last_height = windata->height;
}
-#else
-static void
-update_shape_mask (WindowData* windata)
-{
- cairo_t *cr;
- GdkBitmap* mask;
-
- if (windata->width == windata->last_width && windata->height == windata->last_height)
- {
- return;
- }
-
- if (windata->width == 0 || windata->height == 0)
- {
- GtkAllocation allocation;
-
- gtk_widget_get_allocation (windata->win, &allocation);
-
- windata->width = MAX (allocation.width, 1);
- windata->height = MAX (allocation.height, 1);
- }
-
- if (windata->composited)
- {
- gtk_widget_shape_combine_mask (windata->win, NULL, 0, 0);
- return;
- }
-
- windata->last_width = windata->width;
- windata->last_height = windata->height;
-
- mask = (GdkBitmap*) gdk_pixmap_new (NULL, windata->width, windata->height, 1);
-
- if (mask == NULL)
- {
- return;
- }
- cr = gdk_cairo_create (mask);
-
- if (cairo_status (cr) == CAIRO_STATUS_SUCCESS)
- {
- cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
- cairo_paint (cr);
-
- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- cairo_set_source_rgb (cr, 1.0f, 1.0f, 1.0f);
- nodoka_rounded_rectangle (cr, 0, 0, windata->width , windata->height, 6);
- cairo_fill (cr);
-
- gtk_widget_shape_combine_mask (windata->win, mask, 0, 0);
- }
-
- cairo_destroy (cr);
- g_object_unref (mask);
-}
-#endif
static void
paint_window (GtkWidget *widget,
@@ -669,35 +600,18 @@ paint_window (GtkWidget *widget,
cairo_paint (cr);
cairo_restore (cr);
-#if GTK_CHECK_VERSION (3, 0, 0)
update_shape_region (surface, windata);
-#else
- update_shape_mask (windata);
-#endif
cairo_surface_destroy (surface);
}
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
on_draw (GtkWidget *widget, cairo_t *cr, WindowData *windata)
{
paint_window (widget, cr, windata);
return FALSE;
}
-#else
-on_expose_event (GtkWidget *widget, GdkEventExpose *event, WindowData *windata)
-{
- cairo_t *cr = gdk_cairo_create (event->window);
-
- paint_window (widget, cr, windata);
-
- cairo_destroy (cr);
-
- return FALSE;
-}
-#endif
/* Event handlers */
static gboolean
@@ -723,16 +637,9 @@ static void on_composited_changed (GtkWidget* window, WindowData* windata)
static gboolean
countdown_expose_cb(GtkWidget *pie,
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_t *cr,
-#else
- GdkEventExpose *event,
-#endif
WindowData *windata)
{
-#if !GTK_CHECK_VERSION(3, 0, 0)
- cairo_t *cr = gdk_cairo_create (event->window);
-#endif
cairo_t *cr2;
cairo_surface_t *surface;
GtkAllocation alloc;
@@ -761,9 +668,6 @@ countdown_expose_cb(GtkWidget *pie,
cairo_restore (cr);
cairo_surface_destroy (surface);
-#if !GTK_CHECK_VERSION(3, 0, 0)
- cairo_destroy (cr);
-#endif
return TRUE;
}
@@ -818,11 +722,7 @@ create_notification(UrlClickedCb url_clicked)
GtkWidget *alignment;
AtkObject *atkobj;
WindowData *windata;
-#if GTK_CHECK_VERSION(3, 0, 0)
GdkVisual *visual;
-#else
- GdkColormap *colormap;
-#endif
GdkScreen *screen;
windata = g_new0(WindowData, 1);
@@ -835,7 +735,6 @@ create_notification(UrlClickedCb url_clicked)
windata->composited = FALSE;
screen = gtk_window_get_screen(GTK_WINDOW(win));
-#if GTK_CHECK_VERSION(3, 0, 0)
visual = gdk_screen_get_rgba_visual(screen);
if (visual != NULL)
@@ -844,16 +743,6 @@ create_notification(UrlClickedCb url_clicked)
if (gdk_screen_is_composited(screen))
windata->composited = TRUE;
}
-#else
- colormap = gdk_screen_get_rgba_colormap(screen);
-
- if (colormap != NULL)
- {
- gtk_widget_set_colormap(win, colormap);
- if (gdk_screen_is_composited(screen))
- windata->composited = TRUE;
- }
-#endif
gtk_window_set_title(GTK_WINDOW(win), "Notification");
gtk_window_set_type_hint(GTK_WINDOW(win), GDK_WINDOW_TYPE_HINT_NOTIFICATION);
@@ -870,25 +759,18 @@ create_notification(UrlClickedCb url_clicked)
g_signal_connect (G_OBJECT (win), "composited-changed", G_CALLBACK (on_composited_changed), windata);
- main_vbox = gtk_vbox_new(FALSE, 0);
+ main_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_show(main_vbox);
gtk_container_add(GTK_CONTAINER(win), main_vbox);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 1);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (G_OBJECT (main_vbox), "draw", G_CALLBACK (on_draw), windata);
-#else
- g_signal_connect (G_OBJECT (main_vbox), "expose_event", G_CALLBACK (on_expose_event), windata);
-#endif
windata->top_spacer = gtk_image_new();
gtk_box_pack_start(GTK_BOX(main_vbox), windata->top_spacer,
FALSE, FALSE, 0);
gtk_widget_set_size_request(windata->top_spacer, -1, DEFAULT_ARROW_HEIGHT);
- windata->main_hbox = gtk_hbox_new(FALSE, 0);
+ windata->main_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show(windata->main_hbox);
gtk_box_pack_start(GTK_BOX(main_vbox), windata->main_hbox,
FALSE, FALSE, 0);
@@ -899,12 +781,12 @@ create_notification(UrlClickedCb url_clicked)
gtk_widget_set_size_request(windata->bottom_spacer, -1,
DEFAULT_ARROW_HEIGHT);
- vbox = gtk_vbox_new(FALSE, 6);
+ vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
gtk_widget_show(vbox);
gtk_box_pack_start(GTK_BOX(windata->main_hbox), vbox, TRUE, TRUE, 0);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);
- hbox = gtk_hbox_new(FALSE, 6);
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_show(hbox);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
@@ -948,10 +830,10 @@ create_notification(UrlClickedCb url_clicked)
gtk_widget_show(image);
gtk_container_add(GTK_CONTAINER(close_button), image);
- windata->content_hbox = gtk_hbox_new(FALSE, 6);
+ windata->content_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start(GTK_BOX(vbox), windata->content_hbox, FALSE, FALSE, 0);
- windata->iconbox = gtk_hbox_new(FALSE, 0);
+ windata->iconbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show(windata->iconbox);
gtk_box_pack_start(GTK_BOX(windata->content_hbox), windata->iconbox,
FALSE, FALSE, 0);
@@ -960,14 +842,10 @@ create_notification(UrlClickedCb url_clicked)
windata->icon = gtk_image_new();
gtk_box_pack_start(GTK_BOX(windata->iconbox), windata->icon,
TRUE, TRUE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (image, GTK_ALIGN_CENTER);
-#else
- gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.5);
-#endif
- vbox = gtk_vbox_new(FALSE, 6);
+ vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
gtk_widget_show(vbox);
gtk_box_pack_start(GTK_BOX(windata->content_hbox), vbox, TRUE, TRUE, 0);
@@ -981,9 +859,7 @@ create_notification(UrlClickedCb url_clicked)
#endif
gtk_label_set_line_wrap(GTK_LABEL(windata->body_label), TRUE);
gtk_label_set_line_wrap_mode (GTK_LABEL (windata->body_label), PANGO_WRAP_WORD_CHAR);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_label_set_max_width_chars (GTK_LABEL (windata->body_label), 50);
-#endif
g_signal_connect(G_OBJECT(windata->body_label), "activate-link",
G_CALLBACK(activate_link), windata);
@@ -995,7 +871,7 @@ create_notification(UrlClickedCb url_clicked)
gtk_widget_show(alignment);
gtk_box_pack_start(GTK_BOX(vbox), alignment, FALSE, TRUE, 0);
- windata->actions_box = gtk_hbox_new(FALSE, 6);
+ windata->actions_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_add(GTK_CONTAINER(alignment), windata->actions_box);
return GTK_WINDOW(win);
@@ -1104,20 +980,15 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key,
gtk_container_add(GTK_CONTAINER(alignment), windata->pie_countdown);
gtk_widget_set_size_request(windata->pie_countdown,
PIE_WIDTH, PIE_HEIGHT);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect(G_OBJECT(windata->pie_countdown), "draw",
G_CALLBACK(countdown_expose_cb), windata);
-#else
- g_signal_connect(G_OBJECT(windata->pie_countdown), "expose_event",
- G_CALLBACK(countdown_expose_cb), windata);
-#endif
}
button = gtk_button_new();
gtk_widget_show(button);
gtk_box_pack_start(GTK_BOX(windata->actions_box), button, FALSE, FALSE, 0);
- hbox = gtk_hbox_new(FALSE, 6);
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_show(hbox);
gtk_container_add(GTK_CONTAINER(button), hbox);
@@ -1134,12 +1005,8 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key,
GtkWidget *image = gtk_image_new_from_pixbuf(pixbuf);
gtk_widget_show(image);
gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (image, GTK_ALIGN_CENTER);
-#else
- gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.5);
-#endif
}
label = gtk_label_new(NULL);