summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-05-19 14:10:54 +0300
committermonsta <[email protected]>2016-05-19 14:10:54 +0300
commite9a16f9dd6e56080643557470dea5778400ba306 (patch)
tree972b77f511e337c44952baa888d8080ed9dd0e65
parentddc3c12d06e80f64eb8b8248920aa7bca2d52753 (diff)
downloadmate-notification-daemon-e9a16f9dd6e56080643557470dea5778400ba306.tar.bz2
mate-notification-daemon-e9a16f9dd6e56080643557470dea5778400ba306.tar.xz
require GTK+ >= 3.14, drop GTK+2 code and --with-gtk build option
-rw-r--r--configure.ac35
-rw-r--r--src/daemon/daemon.c150
-rw-r--r--src/daemon/stack.c8
-rw-r--r--src/themes/coco/coco-theme.c132
-rw-r--r--src/themes/nodoka/nodoka-theme.c151
-rw-r--r--src/themes/slider/theme.c317
-rw-r--r--src/themes/standard/theme.c109
7 files changed, 38 insertions, 864 deletions
diff --git a/configure.ac b/configure.ac
index 15f6921..3764045 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,31 +84,10 @@ dnl ---------------------------------------------------------------------------
dnl Requirements for the themes
dnl ---------------------------------------------------------------------------
-AC_MSG_CHECKING([which gtk+ version to compile against])
-AC_ARG_WITH([gtk],
- [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against (default: 2.0)])],
- [case "$with_gtk" in
- 2.0|3.0) ;;
- *) AC_MSG_ERROR([invalid gtk version specified]) ;;
- esac],
- [with_gtk=2.0])
-AC_MSG_RESULT([$with_gtk])
-
-case "$with_gtk" in
- 2.0) GTK_API_VERSION=2.0
- GTK_REQUIRED=2.24.0
- LIBWNCK_API_VERSION=1.0
- LIBCANBERRA_API_VERSION=
- ;;
- 3.0) GTK_API_VERSION=3.0
- GTK_REQUIRED=3.0.0
- LIBWNCK_API_VERSION=3.0
- LIBCANBERRA_API_VERSION=3
- ;;
-esac
+GTK_REQUIRED=3.14.0
PKG_CHECK_MODULES(THEME,
- gtk+-$GTK_API_VERSION >= $GTK_REQUIRED
+ gtk+-3.0 >= $GTK_REQUIRED
)
AC_SUBST(THEME_CFLAGS)
AC_SUBST(THEME_LIBS)
@@ -121,14 +100,14 @@ REQ_DBUS_VERSION=0.78
REQ_LIBCANBERRA_GTK_VERSION=0.4
PKG_CHECK_MODULES(GMODULE,gmodule-2.0,[GMODULE_ADD="gmodule-2.0"],[GMODULE_ADD=""])
pkg_modules="
- gtk+-$GTK_API_VERSION >= $GTK_REQUIRED, \
+ gtk+-3.0 >= $GTK_REQUIRED, \
glib-2.0 >= $REQ_GLIB_VERSION, \
gio-2.0 >= $REQ_GLIB_VERSION, \
$GMODULE_ADD \
dbus-1 >= $REQ_DBUS_VERSION, \
dbus-glib-1 >= $REQ_DBUS_VERSION, \
- libcanberra-gtk$LIBCANBERRA_API_VERSION >= $REQ_LIBCANBERRA_GTK_VERSION, \
- libwnck-$LIBWNCK_API_VERSION \
+ libcanberra-gtk3 >= $REQ_LIBCANBERRA_GTK_VERSION, \
+ libwnck-3.0 \
x11 \
"
PKG_CHECK_MODULES(NOTIFICATION_DAEMON, $pkg_modules)
@@ -138,12 +117,12 @@ AC_SUBST(NOTIFICATION_DAEMON_LIBS)
dnl ---------------------------------------------------------------------------
dnl Requirements for the setup tool
dnl ---------------------------------------------------------------------------
-PKG_CHECK_MODULES(NOTIFICATION_CAPPLET, glib-2.0 >= $REQ_GLIB_VERSION gio-2.0 >= $REQ_GLIB_VERSION gtk+-$GTK_API_VERSION >= $GTK_REQUIRED libnotify dbus-1 dbus-glib-1)
+PKG_CHECK_MODULES(NOTIFICATION_CAPPLET, glib-2.0 >= $REQ_GLIB_VERSION gio-2.0 >= $REQ_GLIB_VERSION gtk+-3.0 >= $GTK_REQUIRED libnotify dbus-1 dbus-glib-1)
AC_SUBST(NOTIFICATION_CAPPLET_CFLAGS)
AC_SUBST(NOTIFICATION_CAPPLET_LIBS)
gdk_modules="
- gdk-$GTK_API_VERSION >= $GTK_REQUIRED, \
+ gdk-3.0 >= $GTK_REQUIRED, \
gdk-pixbuf-2.0 >= 2.22.0 \
"
PKG_CHECK_MODULES(GDK, $gdk_modules, have_gdk=yes,
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index 8d941f2..ca357cb 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -106,12 +106,7 @@ struct _NotifyDaemonPrivate {
gboolean url_clicked_lock;
NotifyStackLocation stack_location;
-#if GTK_CHECK_VERSION (3, 8, 0)
NotifyScreen* screen;
-#else
- NotifyScreen** screens;
- int n_screens;
-#endif
};
typedef struct {
@@ -183,12 +178,7 @@ static void remove_exit_timeout(NotifyDaemon* daemon)
static void create_stack_for_monitor(NotifyDaemon* daemon, GdkScreen* screen, int monitor_num)
{
-#if GTK_CHECK_VERSION (3, 8, 0)
NotifyScreen* nscreen = daemon->priv->screen;
-#else
- int screen_num = gdk_screen_get_number(screen);
- NotifyScreen* nscreen = daemon->priv->screens[screen_num];
-#endif
nscreen->stacks[monitor_num] = notify_stack_new(daemon, screen, monitor_num, daemon->priv->stack_location);
}
@@ -196,18 +186,10 @@ static void create_stack_for_monitor(NotifyDaemon* daemon, GdkScreen* screen, in
static void on_screen_monitors_changed(GdkScreen* screen, NotifyDaemon* daemon)
{
NotifyScreen* nscreen;
-#if !GTK_CHECK_VERSION (3, 8, 0)
- int screen_num;
-#endif
int n_monitors;
int i;
-#if GTK_CHECK_VERSION (3, 8, 0)
nscreen = daemon->priv->screen;
-#else
- screen_num = gdk_screen_get_number(screen);
- nscreen = daemon->priv->screens[screen_num];
-#endif
n_monitors = gdk_screen_get_n_monitors(screen);
@@ -259,17 +241,9 @@ static void on_screen_monitors_changed(GdkScreen* screen, NotifyDaemon* daemon)
static void create_stacks_for_screen(NotifyDaemon* daemon, GdkScreen *screen)
{
NotifyScreen* nscreen;
-#if !GTK_CHECK_VERSION (3, 8, 0)
- int screen_num;
-#endif
int i;
-#if GTK_CHECK_VERSION (3, 8, 0)
nscreen = daemon->priv->screen;
-#else
- screen_num = gdk_screen_get_number(screen);
- nscreen = daemon->priv->screens[screen_num];
-#endif
nscreen->n_stacks = gdk_screen_get_n_monitors(screen);
@@ -298,7 +272,6 @@ static GdkFilterReturn screen_xevent_filter(GdkXEvent* xevent, GdkEvent* event,
return GDK_FILTER_CONTINUE;
}
-#if GTK_CHECK_VERSION (3, 8, 0)
static void create_screen(NotifyDaemon* daemon)
{
GdkDisplay *display;
@@ -322,39 +295,6 @@ static void create_screen(NotifyDaemon* daemon)
create_stacks_for_screen(daemon, screen);
}
-#else
-static void create_screens(NotifyDaemon* daemon)
-{
- GdkDisplay* display;
- int i;
-
- g_assert(daemon->priv->screens == NULL);
-
- display = gdk_display_get_default();
- daemon->priv->n_screens = gdk_display_get_n_screens(display);
-
- daemon->priv->screens = g_new0(NotifyScreen *, daemon->priv->n_screens);
-
- for (i = 0; i < daemon->priv->n_screens; i++)
- {
- GdkScreen* screen;
- GdkWindow* gdkwindow;
-
- screen = gdk_display_get_screen(display, i);
- g_signal_connect(screen, "monitors-changed", G_CALLBACK(on_screen_monitors_changed), daemon);
-
- daemon->priv->screens[i] = g_new0(NotifyScreen, 1);
-
- daemon->priv->screens[i]->workarea_atom = XInternAtom(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "_NET_WORKAREA", True);
-
- gdkwindow = gdk_screen_get_root_window(screen);
- gdk_window_add_filter(gdkwindow, (GdkFilterFunc) screen_xevent_filter, daemon->priv->screens[i]);
- gdk_window_set_events(gdkwindow, gdk_window_get_events(gdkwindow) | GDK_PROPERTY_CHANGE_MASK);
-
- create_stacks_for_screen(daemon, gdk_display_get_screen(display, i));
- }
-}
-#endif
static void on_popup_location_changed(GSettings *settings, gchar *key, NotifyDaemon* daemon)
{
@@ -378,7 +318,6 @@ static void on_popup_location_changed(GSettings *settings, gchar *key, NotifyDae
daemon->priv->stack_location = stack_location;
g_free(slocation);
-#if GTK_CHECK_VERSION (3, 8, 0)
NotifyScreen *nscreen;
nscreen = daemon->priv->screen;
@@ -388,19 +327,6 @@ static void on_popup_location_changed(GSettings *settings, gchar *key, NotifyDae
stack = nscreen->stacks[i];
notify_stack_set_location(stack, stack_location);
}
-#else
- for (i = 0; i < daemon->priv->n_screens; i++)
- {
- int j;
-
- for (j = 0; j < daemon->priv->screens[i]->n_stacks; j++)
- {
- NotifyStack* stack;
- stack = daemon->priv->screens[i]->stacks[j];
- notify_stack_set_location(stack, stack_location);
- }
- }
-#endif
}
static void notify_daemon_init(NotifyDaemon* daemon)
@@ -422,23 +348,15 @@ static void notify_daemon_init(NotifyDaemon* daemon)
daemon->priv->stack_location = get_stack_location_from_string(location);
g_free(location);
-#if GTK_CHECK_VERSION (3, 8, 0)
daemon->priv->screen = NULL;
create_screen(daemon);
-#else
- daemon->priv->n_screens = 0;
- daemon->priv->screens = NULL;
-
- create_screens(daemon);
-#endif
daemon->priv->idle_reposition_notify_ids = g_hash_table_new(NULL, NULL);
daemon->priv->monitored_window_hash = g_hash_table_new(NULL, NULL);
daemon->priv->notification_hash = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, (GDestroyNotify) _notify_timeout_destroy);
}
-#if GTK_CHECK_VERSION (3, 8, 0)
static void destroy_screen(NotifyDaemon* daemon)
{
GdkDisplay *display;
@@ -465,39 +383,6 @@ static void destroy_screen(NotifyDaemon* daemon)
g_free(daemon->priv->screen);
daemon->priv->screen = NULL;
}
-#else
-static void destroy_screens(NotifyDaemon* daemon)
-{
- GdkDisplay* display;
- int i;
- int j;
-
- display = gdk_display_get_default();
-
- for (i = 0; i < daemon->priv->n_screens; i++)
- {
- GdkScreen* screen;
- GdkWindow* gdkwindow;
-
- screen = gdk_display_get_screen(display, i);
- g_signal_handlers_disconnect_by_func(screen, G_CALLBACK(on_screen_monitors_changed), daemon);
-
- gdkwindow = gdk_screen_get_root_window(screen);
- gdk_window_remove_filter(gdkwindow, (GdkFilterFunc) screen_xevent_filter, daemon->priv->screens[i]);
-
- for (j = 0; j < daemon->priv->screens[i]->n_stacks; j++)
- {
- notify_stack_destroy(daemon->priv->screens[i]->stacks[j]);
- daemon->priv->screens[i]->stacks[j] = NULL;
- }
-
- g_free(daemon->priv->screens[i]->stacks);
- }
-
- g_free(daemon->priv->screens);
- daemon->priv->screens = NULL;
-}
-#endif
static void notify_daemon_finalize(GObject* object)
{
@@ -516,11 +401,7 @@ static void notify_daemon_finalize(GObject* object)
g_hash_table_destroy(daemon->priv->idle_reposition_notify_ids);
g_hash_table_destroy(daemon->priv->notification_hash);
-#if GTK_CHECK_VERSION (3, 8, 0)
destroy_screen(daemon);
-#else
- destroy_screens(daemon);
-#endif
g_free(daemon->priv);
@@ -1101,11 +982,7 @@ static GdkPixbuf* _notify_daemon_pixbuf_from_path(const char* path)
pixbuf = gtk_icon_theme_load_icon (theme, path, icon_size, GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
-#if GTK_CHECK_VERSION (3, 8, 0)
g_object_unref (icon_info);
-#else
- gtk_icon_info_free (icon_info);
-#endif
}
if (pixbuf == NULL)
@@ -1592,14 +1469,9 @@ gboolean notify_daemon_notify_handler(NotifyDaemon* daemon, const char* app_name
else
{
int monitor_num;
-#if !GTK_CHECK_VERSION (3, 8, 0)
- int screen_num;
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDisplay *display;
GdkDeviceManager *device_manager;
GdkDevice *pointer;
-#endif
GdkScreen* screen;
gint x, y;
@@ -1610,49 +1482,27 @@ gboolean notify_daemon_notify_handler(NotifyDaemon* daemon, const char* app_name
* number the user has set in gsettings. */
if (g_settings_get_boolean(daemon->gsettings, GSETTINGS_KEY_USE_ACTIVE))
{
-#if GTK_CHECK_VERSION (3, 0, 0)
display = gdk_display_get_default ();
device_manager = gdk_display_get_device_manager (display);
pointer = gdk_device_manager_get_client_pointer (device_manager);
gdk_device_get_position (pointer, &screen, &x, &y);
-#else
- gdk_display_get_pointer (gdk_display_get_default (), &screen, &x, &y, NULL);
-#endif
-#if !GTK_CHECK_VERSION (3, 8, 0)
- screen_num = gdk_screen_get_number (screen);
-#endif
monitor_num = gdk_screen_get_monitor_at_point (screen, x, y);
}
else
{
screen = gdk_display_get_default_screen(gdk_display_get_default());
-#if !GTK_CHECK_VERSION (3, 8, 0)
- screen_num = gdk_screen_get_number(screen);
-#endif
monitor_num = g_settings_get_int(daemon->gsettings, GSETTINGS_KEY_MONITOR_NUMBER);
}
-#if GTK_CHECK_VERSION (3, 8, 0)
if (monitor_num >= priv->screen->n_stacks)
-#else
- if (monitor_num >= priv->screens[screen_num]->n_stacks)
-#endif
{
/* screw it - dump it on the last one we'll get
a monitors-changed signal soon enough*/
-#if GTK_CHECK_VERSION (3, 8, 0)
monitor_num = priv->screen->n_stacks - 1;
-#else
- monitor_num = priv->screens[screen_num]->n_stacks - 1;
-#endif
}
-#if GTK_CHECK_VERSION (3, 8, 0)
notify_stack_add_window (priv->screen->stacks[monitor_num], nw, new_notification);
-#else
- notify_stack_add_window (priv->screens[screen_num]->stacks[monitor_num], nw, new_notification);
-#endif
}
if (id == 0)
diff --git a/src/daemon/stack.c b/src/daemon/stack.c
index a60f2b2..0fd8775 100644
--- a/src/daemon/stack.c
+++ b/src/daemon/stack.c
@@ -301,11 +301,7 @@ notify_stack_shift_notifications (NotifyStack *stack,
GtkRequisition req;
if (nw == NULL || nw2 != nw) {
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size (GTK_WIDGET (nw2), NULL, &req);
-#else
- gtk_widget_size_request (GTK_WIDGET (nw2), &req);
-#endif
translate_coordinates (stack->location,
&workarea,
@@ -366,11 +362,7 @@ void notify_stack_add_window(NotifyStack* stack, GtkWindow* nw, gboolean new_not
GtkRequisition req;
gint x, y;
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_get_preferred_size(GTK_WIDGET(nw), NULL, &req);
-#else
- gtk_widget_size_request(GTK_WIDGET(nw), &req);
-#endif
notify_stack_shift_notifications(stack, nw, NULL, req.width, req.height + NOTIFY_STACK_SPACING, &x, &y);
theme_move_notification(nw, x, y);
diff --git a/src/themes/coco/coco-theme.c b/src/themes/coco/coco-theme.c
index 5200348..1c97599 100644
--- a/src/themes/coco/coco-theme.c
+++ b/src/themes/coco/coco-theme.c
@@ -102,11 +102,6 @@ void notification_tick(GtkWindow *nw, glong remaining);
#define BACKGROUND_OPACITY 0.90
#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 */
@@ -180,7 +175,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)
@@ -213,62 +207,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,
@@ -310,35 +248,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
@@ -356,16 +277,9 @@ configure_event_cb(GtkWidget *nw,
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;
@@ -395,9 +309,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;
}
@@ -466,11 +377,7 @@ create_notification(UrlClickedCb url_clicked)
GtkWidget *padding;
AtkObject *atkobj;
WindowData *windata;
-#if GTK_CHECK_VERSION(3, 0, 0)
GdkVisual *visual;
-#else
- GdkColormap *colormap;
-#endif
GdkScreen *screen;
windata = g_new0(WindowData, 1);
@@ -484,7 +391,6 @@ create_notification(UrlClickedCb url_clicked)
windata->rtl = gtk_widget_get_default_direction();
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)
@@ -493,16 +399,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);
@@ -516,17 +412,12 @@ 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);
-#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
g_signal_connect (G_OBJECT (win), "configure-event", G_CALLBACK (on_configure_event), windata);
@@ -537,13 +428,13 @@ create_notification(UrlClickedCb url_clicked)
gtk_box_pack_start(GTK_BOX(main_vbox), padding, FALSE, FALSE, 0);
g_object_set(G_OBJECT(padding), "top-padding", 8, "right-padding", 8, NULL);
- 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_container_add(GTK_CONTAINER(padding), windata->main_hbox);
gtk_container_set_border_width(GTK_CONTAINER(windata->main_hbox), 13);
/* The icon goes at the left */
- windata->iconbox = gtk_vbox_new(FALSE, 0);
+ windata->iconbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_show(windata->iconbox);
gtk_box_pack_start(GTK_BOX(windata->main_hbox), windata->iconbox,
FALSE, FALSE, 0);
@@ -558,7 +449,7 @@ create_notification(UrlClickedCb url_clicked)
gtk_box_pack_start(GTK_BOX(windata->main_hbox), padding, TRUE, TRUE, 0);
g_object_set(G_OBJECT(padding), "left-padding", 8, NULL);
- vbox = gtk_vbox_new(FALSE, 0);
+ vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_show(vbox);
gtk_container_add(GTK_CONTAINER(padding), vbox);
@@ -587,9 +478,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);
@@ -601,7 +490,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);
@@ -698,20 +587,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);
@@ -728,12 +612,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);
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);
diff --git a/src/themes/slider/theme.c b/src/themes/slider/theme.c
index 5c38126..37c08f1 100644
--- a/src/themes/slider/theme.c
+++ b/src/themes/slider/theme.c
@@ -95,11 +95,6 @@ gboolean get_always_stack(GtkWidget* nw);
#define MAX_ICON_SIZE IMAGE_SIZE
-#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 draw_round_rect(cairo_t* cr, gdouble aspect, gdouble x, gdouble y, gdouble corner_radius, gdouble width, gdouble height)
{
gdouble radius = corner_radius / aspect;
@@ -131,7 +126,6 @@ static void draw_round_rect(cairo_t* cr, gdouble aspect, gdouble x, gdouble y, g
cairo_arc(cr, x + radius, y + radius, radius, 180.0f * G_PI / 180.0f, 270.0f * G_PI / 180.0f);
}
-#if GTK_CHECK_VERSION(3, 0, 0)
static void
get_background_color (GtkStyleContext *context,
GtkStateFlags state,
@@ -149,26 +143,19 @@ get_background_color (GtkStyleContext *context,
*color = *c;
gdk_rgba_free (c);
}
-#endif
static void fill_background(GtkWidget* widget, WindowData* windata, cairo_t* cr)
{
GtkAllocation allocation;
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *context;
GdkRGBA color;
GdkRGBA fg_color;
GdkRGBA bg_color;
-#else
- GtkStyle *style;
- GdkColor color;
-#endif
double r, g, b;
gtk_widget_get_allocation(widget, &allocation);
draw_round_rect(cr, 1.0f, DEFAULT_X0 + 1, DEFAULT_Y0 + 1, DEFAULT_RADIUS, allocation.width - 2, allocation.height - 2);
-#if GTK_CHECK_VERSION(3, 0, 0)
context = gtk_widget_get_style_context(widget);
get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg_color);
@@ -194,31 +181,8 @@ static void fill_background(GtkWidget* widget, WindowData* windata, cairo_t* cr)
cairo_set_source_rgba(cr, r, g, b, BACKGROUND_ALPHA / 2);
cairo_set_line_width(cr, 1);
cairo_stroke(cr);
-
-#else
- style = gtk_widget_get_style (widget);
-
- color = style->bg[GTK_STATE_NORMAL];
- r = (float) color.red / 65535.0;
- g = (float) color.green / 65535.0;
- b = (float) color.blue / 65535.0;
- cairo_set_source_rgba(cr, r, g, b, BACKGROUND_ALPHA);
- cairo_fill_preserve(cr);
-
- /* Should we show urgency somehow? Probably doesn't
- * have any meaningful value to the user... */
-
- color = style->text_aa[GTK_STATE_NORMAL];
- r = (float) color.red / 65535.0;
- g = (float) color.green / 65535.0;
- b = (float) color.blue / 65535.0;
- cairo_set_source_rgba(cr, r, g, b, BACKGROUND_ALPHA / 2);
- cairo_set_line_width(cr, 1);
- cairo_stroke(cr);
-#endif
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
update_shape_region (cairo_surface_t *surface,
WindowData *windata)
@@ -251,62 +215,7 @@ 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);
- draw_round_rect (cr, 1.0f, DEFAULT_X0, DEFAULT_Y0, DEFAULT_RADIUS, windata->width, windata->height);
- 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,
cairo_t *cr,
WindowData *windata)
@@ -346,11 +255,7 @@ static void paint_window (GtkWidget *widget,
cairo_save (cr);
cairo_set_source_surface(cr, surface, 0, 0);
cairo_paint(cr);
-#if GTK_CHECK_VERSION (3, 0, 0)
update_shape_region (surface, windata);
-#else
- update_shape_mask (windata);
-#endif
cairo_restore (cr);
cairo_surface_destroy(surface);
@@ -361,7 +266,6 @@ static gboolean on_window_map(GtkWidget* widget, GdkEvent* event, WindowData* wi
return FALSE;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean
on_draw (GtkWidget *widget,
cairo_t *cr,
@@ -371,21 +275,6 @@ on_draw (GtkWidget *widget,
return FALSE;
}
-#else
-static gboolean
-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)
{
@@ -419,45 +308,6 @@ static void on_window_realize(GtkWidget* widget, WindowData* windata)
/* Nothing */
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
-static void color_reverse(const GdkColor* a, GdkColor* b)
-{
- gdouble red;
- gdouble green;
- gdouble blue;
- gdouble h;
- gdouble s;
- gdouble v;
-
- red = (gdouble) a->red / 65535.0;
- green = (gdouble) a->green / 65535.0;
- blue = (gdouble) a->blue / 65535.0;
-
- gtk_rgb_to_hsv(red, green, blue, &h, &s, &v);
-
- /* pivot brightness around the center */
- v = 0.5 + (0.5 - v);
-
- if (v > 1.0)
- {
- v = 1.0;
- }
- else if (v < 0.0)
- {
- v = 0.0;
- }
-
- /* reduce saturation by 50% */
- s *= 0.5;
-
- gtk_hsv_to_rgb(h, s, v, &red, &green, &blue);
-
- b->red = red * 65535.0;
- b->green = green * 65535.0;
- b->blue = blue * 65535.0;
-}
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
static GtkStateFlags state_flags_from_type (GtkStateType state)
{
GtkStateFlags flags;
@@ -521,45 +371,7 @@ static void override_style(GtkWidget* widget)
state++;
}
}
-#else
-static void override_style(GtkWidget* widget, GtkStyle* previous_style)
-{
- GtkStateType state;
- GtkStyle* style;
- GdkColor fg;
- GdkColor bg;
-
- style = gtk_style_copy(gtk_widget_get_style (widget));
-
- if (previous_style == NULL || (previous_style != NULL && (previous_style->bg[GTK_STATE_NORMAL].red != style->bg[GTK_STATE_NORMAL].red || previous_style->bg[GTK_STATE_NORMAL].green != style->bg[GTK_STATE_NORMAL].green || previous_style->bg[GTK_STATE_NORMAL].blue != style->bg[GTK_STATE_NORMAL].blue)))
- {
- state = (GtkStateType) 0;
-
- while (state < (GtkStateType) G_N_ELEMENTS(style->bg))
- {
- color_reverse(&style->bg[state], &bg);
- gtk_widget_modify_bg(widget, state, &bg);
- state++;
- }
- }
-
- if (previous_style == NULL || (previous_style != NULL && (previous_style->fg[GTK_STATE_NORMAL].red != style->fg[GTK_STATE_NORMAL].red || previous_style->fg[GTK_STATE_NORMAL].green != style->fg[GTK_STATE_NORMAL].green || previous_style->fg[GTK_STATE_NORMAL].blue != style->fg[GTK_STATE_NORMAL].blue)))
- {
- state = (GtkStateType) 0;
-
- while (state < (GtkStateType) G_N_ELEMENTS(style->fg))
- {
- color_reverse(&style->fg[state], &fg);
- gtk_widget_modify_fg(widget, state, &fg);
- state++;
- }
- }
-
- g_object_unref(style);
-}
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
static void on_style_updated(GtkWidget* widget, WindowData* windata)
{
g_signal_handlers_block_by_func(G_OBJECT(widget), on_style_updated, windata);
@@ -569,17 +381,6 @@ static void on_style_updated(GtkWidget* widget, WindowData* windata)
g_signal_handlers_unblock_by_func(G_OBJECT(widget), on_style_updated, windata);
}
-#else
-static void on_style_set(GtkWidget* widget, GtkStyle* previous_style, WindowData* windata)
-{
- g_signal_handlers_block_by_func(G_OBJECT(widget), on_style_set, windata);
- override_style(widget, previous_style);
-
- gtk_widget_queue_draw(widget);
-
- g_signal_handlers_unblock_by_func(G_OBJECT(widget), on_style_set, windata);
-}
-#endif
static void on_composited_changed(GtkWidget* window, WindowData* windata)
{
@@ -597,15 +398,8 @@ 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);
@@ -615,17 +409,9 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
win = gtk_window_new(GTK_WINDOW_POPUP);
gtk_window_set_resizable(GTK_WINDOW(win), FALSE);
gtk_widget_set_app_paintable(win, TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect(G_OBJECT(win), "style-updated", G_CALLBACK(on_style_updated), windata);
-#else
- g_signal_connect(G_OBJECT(win), "style-set", G_CALLBACK(on_style_set), windata);
-#endif
g_signal_connect(G_OBJECT(win), "map-event", G_CALLBACK(on_window_map), windata);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect(G_OBJECT(win), "draw", G_CALLBACK(on_draw), windata);
-#else
- g_signal_connect(G_OBJECT(win), "expose-event", G_CALLBACK(on_expose_event), windata);
-#endif
g_signal_connect(G_OBJECT(win), "realize", G_CALLBACK(on_window_realize), windata);
windata->win = win;
@@ -634,7 +420,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)
{
@@ -645,18 +430,6 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
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
g_signal_connect(win, "composited-changed", G_CALLBACK(on_composited_changed), windata);
@@ -669,15 +442,12 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
g_signal_connect(G_OBJECT(win), "configure-event", G_CALLBACK(on_configure_event), windata);
- main_vbox = gtk_vbox_new(FALSE, 0);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_signal_connect(G_OBJECT(main_vbox), "style-set", G_CALLBACK(on_style_set), windata);
-#endif
+ 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), 12);
- 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);
@@ -692,7 +462,7 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
gtk_widget_show(windata->icon);
gtk_container_add(GTK_CONTAINER(windata->iconbox), windata->icon);
- 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);
@@ -703,9 +473,6 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
gtk_box_pack_start(GTK_BOX(windata->main_hbox), alignment, FALSE, FALSE, 0);
close_button = gtk_button_new();
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_signal_connect(G_OBJECT(close_button), "style-set", G_CALLBACK(on_style_set), windata);
-#endif
gtk_widget_show(close_button);
windata->close_button = close_button;
gtk_container_add(GTK_CONTAINER(alignment), close_button);
@@ -713,13 +480,6 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
gtk_container_set_border_width(GTK_CONTAINER(close_button), 0);
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, "");
@@ -731,9 +491,6 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
/* center vbox */
windata->summary_label = gtk_label_new(NULL);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_signal_connect(G_OBJECT(windata->summary_label), "style-set", G_CALLBACK(on_style_set), windata);
-#endif
gtk_widget_show(windata->summary_label);
gtk_box_pack_start(GTK_BOX(vbox), windata->summary_label, TRUE, TRUE, 0);
#if GTK_CHECK_VERSION (3, 16, 0)
@@ -743,26 +500,21 @@ 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.");
- windata->content_hbox = gtk_hbox_new(FALSE, 6);
+ windata->content_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_show(windata->content_hbox);
gtk_box_pack_start(GTK_BOX(vbox), windata->content_hbox, FALSE, FALSE, 0);
- 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);
windata->body_label = gtk_label_new(NULL);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_signal_connect(G_OBJECT(windata->body_label), "style-set", G_CALLBACK(on_style_set), windata);
-#endif
gtk_widget_show(windata->body_label);
gtk_box_pack_start(GTK_BOX(vbox), windata->body_label, TRUE, TRUE, 0);
#if GTK_CHECK_VERSION (3, 16, 0)
@@ -772,10 +524,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_swapped(G_OBJECT(windata->body_label), "activate-link", G_CALLBACK(windata->url_clicked), win);
atkobj = gtk_widget_get_accessible(windata->body_label);
@@ -785,7 +535,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_widget_show(windata->actions_box);
gtk_container_add(GTK_CONTAINER(alignment), windata->actions_box);
@@ -868,11 +618,7 @@ void set_notification_text(GtkWindow* nw, const char* summary, const char* body)
update_content_hbox_visibility(windata);
-#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 */
@@ -965,56 +711,31 @@ void set_notification_arrow(GtkWidget* nw, gboolean visible, int x, int y)
g_assert(windata != NULL);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean on_countdown_draw(GtkWidget* pie, cairo_t* cr, WindowData* windata)
-#else
-static gboolean on_countdown_expose(GtkWidget* pie, GdkEventExpose* event, WindowData* windata)
-#endif
{
GtkAllocation allocation;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext* style;
GdkRGBA color;
GdkRGBA fg_color;
-#else
- GtkStyle* style;
- GdkColor color;
- cairo_t* cr;
-#endif
cairo_t* context;
cairo_surface_t* surface;
double r, g, b;
context = gdk_cairo_create(GDK_WINDOW(gtk_widget_get_window(windata->pie_countdown)));
-#if GTK_CHECK_VERSION(3, 0, 0)
style = gtk_widget_get_style_context(windata->win);
-#else
- style = gtk_widget_get_style(windata->win);
-#endif
cairo_set_operator(context, CAIRO_OPERATOR_SOURCE);
gtk_widget_get_allocation(pie, &allocation);
surface = cairo_surface_create_similar(cairo_get_target(context), CAIRO_CONTENT_COLOR_ALPHA, allocation.width, allocation.height);
-#if GTK_CHECK_VERSION(3, 0, 0)
cairo_set_source_surface (cr, surface, 0, 0);
-#else
- cr = cairo_create(surface);
-#endif
cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_style_context_get_color (style, GTK_STATE_FLAG_NORMAL, &color);
get_background_color (style, GTK_STATE_FLAG_NORMAL, &fg_color);
r = color.red;
g = color.green;
b = color.blue;
-#else
- color = style->bg[GTK_STATE_NORMAL];
- r = (float) color.red / 65535.0;
- g = (float) color.green / 65535.0;
- b = (float) color.blue / 65535.0;
-#endif
cairo_set_source_rgba(cr, r, g, b, BACKGROUND_ALPHA);
cairo_paint(cr);
@@ -1022,11 +743,7 @@ static gboolean on_countdown_expose(GtkWidget* pie, GdkEventExpose* event, Windo
{
gdouble pct = (gdouble) windata->remaining / (gdouble) windata->timeout;
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba(cr, &fg_color);
-#else
- gdk_cairo_set_source_color(cr, &style->fg[GTK_STATE_NORMAL]);
-#endif
cairo_move_to(cr, PIE_RADIUS, PIE_RADIUS);
cairo_arc_negative(cr, PIE_RADIUS, PIE_RADIUS, PIE_RADIUS, -G_PI_2, -(pct * G_PI * 2) - G_PI_2);
@@ -1074,30 +791,20 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A
gtk_box_pack_end(GTK_BOX(windata->actions_box), alignment, FALSE, TRUE, 0);
windata->pie_countdown = gtk_drawing_area_new();
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_signal_connect(G_OBJECT(windata->pie_countdown), "style-set", G_CALLBACK(on_style_set), windata);
-#endif
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), windata);
-#endif
}
button = gtk_button_new();
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_signal_connect(G_OBJECT(button), "style-set", G_CALLBACK(on_style_set), windata);
-#endif
gtk_widget_show(button);
gtk_box_pack_start(GTK_BOX(windata->actions_box), button, FALSE, FALSE, 0);
gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
gtk_container_set_border_width(GTK_CONTAINER(button), 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);
@@ -1110,23 +817,13 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A
if (pixbuf != NULL)
{
GtkWidget* image = gtk_image_new_from_pixbuf(pixbuf);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_signal_connect(G_OBJECT(image), "style-set", G_CALLBACK(on_style_set), windata);
-#endif
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);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_signal_connect(G_OBJECT(label), "style-set", G_CALLBACK(on_style_set), windata);
-#endif
gtk_widget_show(label);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
#if GTK_CHECK_VERSION (3, 16, 0)
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);