summaryrefslogtreecommitdiff
path: root/src/themes/standard
diff options
context:
space:
mode:
Diffstat (limited to 'src/themes/standard')
-rw-r--r--src/themes/standard/theme.c109
1 files changed, 9 insertions, 100 deletions
diff --git a/src/themes/standard/theme.c b/src/themes/standard/theme.c
index d8c2015..dac94da 100644
--- a/src/themes/standard/theme.c
+++ b/src/themes/standard/theme.c
@@ -61,11 +61,7 @@ typedef struct {
GdkPoint* border_points;
size_t num_border_points;
-#if GTK_CHECK_VERSION(3, 0, 0)
cairo_region_t *window_region;
-#else
- GdkRegion* window_region;
-#endif
guchar urgency;
glong timeout;
@@ -120,11 +116,6 @@ void notification_tick(GtkWindow *nw, glong remaining);
#define BACKGROUND_OPACITY 0.92
#define BOTTOM_GRADIENT_HEIGHT 30
-#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
-
static void fill_background(GtkWidget* widget, WindowData* windata, cairo_t* cr)
{
GtkStyle* style;
@@ -531,35 +522,18 @@ paint_window (GtkWidget *widget,
}
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
static void destroy_windata(WindowData* windata)
{
if (windata->window_region != NULL)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_region_destroy(windata->window_region);
-#else
- gdk_region_destroy(windata->window_region);
-#endif
}
g_free(windata);
@@ -641,16 +615,9 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
GtkWidget* image;
GtkWidget* alignment;
AtkObject* atkobj;
-#if !GTK_CHECK_VERSION(3, 0, 0)
- GtkRcStyle* rcstyle;
-#endif
WindowData* windata;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkVisual *visual;
-#else
- GdkColormap* colormap;
-#endif
GdkScreen* screen;
windata = g_new0(WindowData, 1);
@@ -666,7 +633,6 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
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)
@@ -678,15 +644,6 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
windata->composited = TRUE;
}
}
-#else
- colormap = gdk_screen_get_rgba_colormap(screen);
-
- if (colormap != NULL && gdk_screen_is_composited(screen))
- {
- gtk_widget_set_colormap(win, colormap);
- 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);
@@ -699,22 +656,18 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
g_signal_connect(G_OBJECT(win), "configure_event", G_CALLBACK(configure_event_cb), 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);
gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 1);
-#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);
@@ -722,12 +675,12 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
gtk_box_pack_start(GTK_BOX(main_vbox), windata->bottom_spacer, FALSE, FALSE, 0);
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);
@@ -746,9 +699,7 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
gtk_misc_set_alignment(GTK_MISC(windata->summary_label), 0.0, 0.0);
#endif
gtk_label_set_line_wrap(GTK_LABEL(windata->summary_label), TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_label_set_line_wrap_mode (GTK_LABEL (windata->summary_label), PANGO_WRAP_WORD_CHAR);
-#endif
atkobj = gtk_widget_get_accessible(windata->summary_label);
atk_object_set_description(atkobj, "Notification summary text.");
@@ -767,13 +718,6 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
//gtk_widget_set_size_request(close_button, 20, 20);
g_signal_connect_swapped(G_OBJECT(close_button), "clicked", G_CALLBACK(gtk_widget_destroy), win);
-#if !GTK_CHECK_VERSION(3, 0, 0)
- rcstyle = gtk_rc_style_new();
- rcstyle->xthickness = rcstyle->ythickness = 0;
- gtk_widget_modify_style(close_button, rcstyle);
- g_object_unref(rcstyle);
-#endif
-
atkobj = gtk_widget_get_accessible(close_button);
atk_action_set_description(ATK_ACTION(atkobj), 0, "Closes the notification.");
atk_object_set_name(atkobj, "");
@@ -783,24 +727,20 @@ GtkWindow* 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);
gtk_widget_set_size_request(windata->iconbox, BODY_X_OFFSET, -1);
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 (windata->icon, GTK_ALIGN_CENTER);
gtk_widget_set_valign (windata->icon, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment(GTK_MISC(windata->icon), 0.5, 0.0);
-#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);
@@ -813,10 +753,8 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
gtk_misc_set_alignment(GTK_MISC(windata->body_label), 0.0, 0.0);
#endif
gtk_label_set_line_wrap(GTK_LABEL(windata->body_label), TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_label_set_line_wrap_mode (GTK_LABEL (windata->body_label), PANGO_WRAP_WORD_CHAR);
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);
atkobj = gtk_widget_get_accessible(windata->body_label);
@@ -826,7 +764,7 @@ GtkWindow* 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);
@@ -908,21 +846,13 @@ void set_notification_text(GtkWindow* nw, const char* summary, const char* body)
if (body != NULL && *body != '\0')
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size (windata->iconbox, NULL, &req);
-#else
- gtk_widget_size_request(windata->iconbox, &req);
-#endif
/* -1: border width for
* -6: spacing for hbox */
gtk_widget_set_size_request(windata->body_label, WIDTH - (1 * 2) - (10 * 2) - req.width - 6, -1);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size (windata->close_button, NULL, &req);
-#else
- gtk_widget_size_request(windata->close_button, &req);
-#endif
/* -1: main_vbox border width
* -10: vbox border width
* -6: spacing for hbox */
@@ -1011,25 +941,12 @@ paint_countdown (GtkWidget *pie,
}
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
on_countdown_draw (GtkWidget *widget, cairo_t *cr, WindowData *windata)
{
paint_countdown (widget, cr, windata);
return FALSE;
}
-#else
-on_countdown_expose_event (GtkWidget *widget, GdkEventExpose *event, WindowData *windata)
-{
- cairo_t *cr = gdk_cairo_create (event->window);
-
- paint_countdown (widget, cr, windata);
-
- cairo_destroy (cr);
-
- return FALSE;
-}
-#endif
static void action_clicked_cb(GtkWidget* w, GdkEventButton* event, ActionInvokedCb action_cb)
{
@@ -1068,18 +985,14 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A
gtk_widget_show(windata->pie_countdown);
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 (on_countdown_draw), windata);
-#else
- g_signal_connect (G_OBJECT (windata->pie_countdown), "expose_event", G_CALLBACK (on_countdown_expose_event), 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);
@@ -1094,12 +1007,8 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A
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);