diff options
author | monsta <[email protected]> | 2018-01-28 20:16:44 +0300 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-01-30 09:09:33 +0100 |
commit | bc42c561e29041c168b806a5618580066aa8a222 (patch) | |
tree | d5889961598cb89dc7231b4fbbdc0266c01bc1c0 /src | |
parent | 4a4687f22d854e5d4736830f513c577439e42151 (diff) | |
download | mate-notification-daemon-bc42c561e29041c168b806a5618580066aa8a222.tar.bz2 mate-notification-daemon-bc42c561e29041c168b806a5618580066aa8a222.tar.xz |
require GTK+ 3.22 and GLib 2.50
and drop additional checks for min/max GLib versions, it's not needed
Diffstat (limited to 'src')
-rw-r--r-- | src/capplet/mate-notification-properties.c | 4 | ||||
-rw-r--r-- | src/daemon/daemon.c | 60 | ||||
-rw-r--r-- | src/daemon/stack.c | 24 | ||||
-rw-r--r-- | src/daemon/stack.h | 4 | ||||
-rw-r--r-- | src/themes/coco/coco-theme.c | 12 | ||||
-rw-r--r-- | src/themes/nodoka/nodoka-theme.c | 12 | ||||
-rw-r--r-- | src/themes/slider/theme.c | 12 | ||||
-rw-r--r-- | src/themes/standard/theme.c | 30 |
8 files changed, 1 insertions, 157 deletions
diff --git a/src/capplet/mate-notification-properties.c b/src/capplet/mate-notification-properties.c index 22229d3..2f5b103 100644 --- a/src/capplet/mate-notification-properties.c +++ b/src/capplet/mate-notification-properties.c @@ -213,11 +213,7 @@ static void notification_properties_dialog_setup_monitors(NotificationAppletDial screen = gdk_display_get_default_screen(display); g_assert(screen != NULL); -#if GTK_CHECK_VERSION (3, 22, 0) num_monitors = gdk_display_get_n_monitors(display); -#else - num_monitors = gdk_screen_get_n_monitors(screen); -#endif g_assert(num_monitors >= 1); store = gtk_list_store_new(N_COLUMNS_MONITOR, G_TYPE_INT); diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 16c1f5e..a4dcd8c 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c @@ -176,7 +176,6 @@ static void remove_exit_timeout(NotifyDaemon* daemon) daemon->priv->exit_timeout_source = 0; } -#if GTK_CHECK_VERSION(3, 22, 0) static int _gtk_get_monitor_num (GdkMonitor *monitor) { @@ -195,36 +194,23 @@ _gtk_get_monitor_num (GdkMonitor *monitor) } static void create_stack_for_monitor(NotifyDaemon* daemon, GdkScreen* screen, GdkMonitor *monitor_num) -#else -static void create_stack_for_monitor(NotifyDaemon* daemon, GdkScreen* screen, int monitor_num) -#endif { NotifyScreen* nscreen = daemon->priv->screen; -#if GTK_CHECK_VERSION(3, 22, 0) nscreen->stacks[_gtk_get_monitor_num(monitor_num)] = notify_stack_new(daemon, screen, monitor_num, daemon->priv->stack_location); -#else - nscreen->stacks[monitor_num] = notify_stack_new(daemon, screen, monitor_num, daemon->priv->stack_location); -#endif } static void on_screen_monitors_changed(GdkScreen* screen, NotifyDaemon* daemon) { -#if GTK_CHECK_VERSION (3, 22, 0) GdkDisplay *display; -#endif NotifyScreen* nscreen; int n_monitors; int i; nscreen = daemon->priv->screen; -#if GTK_CHECK_VERSION (3, 22, 0) display = gdk_screen_get_display (screen); n_monitors = gdk_display_get_n_monitors(display); -#else - n_monitors = gdk_screen_get_n_monitors(screen); -#endif if (n_monitors > nscreen->n_stacks) { @@ -234,11 +220,7 @@ static void on_screen_monitors_changed(GdkScreen* screen, NotifyDaemon* daemon) /* add more stacks */ for (i = nscreen->n_stacks; i < n_monitors; i++) { -#if GTK_CHECK_VERSION (3, 22, 0) create_stack_for_monitor(daemon, screen, gdk_display_get_monitor (display, i)); -#else - create_stack_for_monitor(daemon, screen, i); -#endif } nscreen->n_stacks = n_monitors; @@ -277,30 +259,20 @@ static void on_screen_monitors_changed(GdkScreen* screen, NotifyDaemon* daemon) static void create_stacks_for_screen(NotifyDaemon* daemon, GdkScreen *screen) { -#if GTK_CHECK_VERSION (3, 22, 0) GdkDisplay *display; -#endif NotifyScreen* nscreen; int i; nscreen = daemon->priv->screen; -#if GTK_CHECK_VERSION (3, 22, 0) display = gdk_screen_get_display (screen); nscreen->n_stacks = gdk_display_get_n_monitors(display); -#else - nscreen->n_stacks = gdk_screen_get_n_monitors(screen); -#endif nscreen->stacks = g_renew(NotifyStack*, nscreen->stacks, nscreen->n_stacks); for (i = 0; i < nscreen->n_stacks; i++) { -#if GTK_CHECK_VERSION (3, 22, 0) create_stack_for_monitor(daemon, screen, gdk_display_get_monitor (display, i)); -#else - create_stack_for_monitor(daemon, screen, i); -#endif } } @@ -1536,17 +1508,9 @@ gboolean notify_daemon_notify_handler(NotifyDaemon* daemon, const char* app_name } else { -#if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor *monitor_id; -#else - int monitor_num; -#endif GdkDisplay *display; -#if GTK_CHECK_VERSION (3, 20, 0) GdkSeat *seat; -#else - GdkDeviceManager *device_manager; -#endif GdkDevice *pointer; GdkScreen* screen; gint x, y; @@ -1559,33 +1523,19 @@ gboolean notify_daemon_notify_handler(NotifyDaemon* daemon, const char* app_name if (g_settings_get_boolean(daemon->gsettings, GSETTINGS_KEY_USE_ACTIVE)) { display = gdk_display_get_default (); -#if GTK_CHECK_VERSION (3, 20, 0) seat = gdk_display_get_default_seat (display); pointer = gdk_seat_get_pointer (seat); -#else - device_manager = gdk_display_get_device_manager (display); - pointer = gdk_device_manager_get_client_pointer (device_manager); -#endif gdk_device_get_position (pointer, &screen, &x, &y); -#if GTK_CHECK_VERSION (3, 22, 0) monitor_id = gdk_display_get_monitor_at_point (gdk_screen_get_display (screen), x, y); -#else - monitor_num = gdk_screen_get_monitor_at_point (screen, x, y); -#endif } else { screen = gdk_display_get_default_screen(gdk_display_get_default()); -#if GTK_CHECK_VERSION (3, 22, 0) monitor_id = gdk_display_get_monitor (gdk_display_get_default(), g_settings_get_int(daemon->gsettings, GSETTINGS_KEY_MONITOR_NUMBER)); -#else - monitor_num = g_settings_get_int(daemon->gsettings, GSETTINGS_KEY_MONITOR_NUMBER); -#endif } -#if GTK_CHECK_VERSION (3, 22, 0) if (_gtk_get_monitor_num (monitor_id) >= priv->screen->n_stacks) { /* screw it - dump it on the last one we'll get @@ -1594,16 +1544,6 @@ gboolean notify_daemon_notify_handler(NotifyDaemon* daemon, const char* app_name } notify_stack_add_window (priv->screen->stacks[_gtk_get_monitor_num (monitor_id)], nw, new_notification); -#else - if (monitor_num >= priv->screen->n_stacks) - { - /* screw it - dump it on the last one we'll get - a monitors-changed signal soon enough*/ - monitor_num = priv->screen->n_stacks - 1; - } - - notify_stack_add_window (priv->screen->stacks[monitor_num], nw, new_notification); -#endif } if (id == 0) diff --git a/src/daemon/stack.c b/src/daemon/stack.c index 25514f7..d1a02db 100644 --- a/src/daemon/stack.c +++ b/src/daemon/stack.c @@ -36,11 +36,7 @@ struct _NotifyStack { NotifyDaemon* daemon; GdkScreen* screen; -#if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor *monitor; -#else - guint monitor; -#endif NotifyStackLocation location; GList* windows; guint update_id; @@ -193,7 +189,6 @@ translate_coordinates (NotifyStackLocation stack_location, } } -#if GTK_CHECK_VERSION(3, 22, 0) static int _gtk_get_monitor_num (GdkMonitor *monitor) { @@ -210,31 +205,20 @@ _gtk_get_monitor_num (GdkMonitor *monitor) return -1; } -#endif NotifyStack * notify_stack_new (NotifyDaemon *daemon, GdkScreen *screen, -#if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor *monitor, -#else - guint monitor, -#endif NotifyStackLocation location) { NotifyStack *stack; -#if GTK_CHECK_VERSION (3, 22, 0) GdkDisplay *display; display = gdk_screen_get_display (screen); -#endif g_assert (daemon != NULL); g_assert (screen != NULL && GDK_IS_SCREEN (screen)); -#if GTK_CHECK_VERSION (3, 22, 0) g_assert ((guint)_gtk_get_monitor_num (monitor) < (guint)gdk_display_get_n_monitors (display)); -#else - g_assert (monitor < (guint)gdk_screen_get_n_monitors (screen)); -#endif g_assert (location != NOTIFY_STACK_LOCATION_UNKNOWN); stack = g_new0 (NotifyStack, 1); @@ -307,13 +291,7 @@ notify_stack_shift_notifications (NotifyStack *stack, int n_wins; get_work_area (stack, &workarea); -#if GTK_CHECK_VERSION (3, 22, 0) - gdk_monitor_get_geometry (stack->monitor, &monitor); -#else - gdk_screen_get_monitor_geometry (stack->screen, - stack->monitor, - &monitor); -#endif + gdk_monitor_get_geometry (stack->monitor, &monitor); gdk_rectangle_intersect (&monitor, &workarea, &workarea); add_padding_to_rect (&workarea); diff --git a/src/daemon/stack.h b/src/daemon/stack.h index 5f478b8..4159a9b 100644 --- a/src/daemon/stack.h +++ b/src/daemon/stack.h @@ -38,11 +38,7 @@ typedef enum { typedef struct _NotifyStack NotifyStack; -#if GTK_CHECK_VERSION (3, 22, 0) NotifyStack* notify_stack_new(NotifyDaemon* daemon, GdkScreen* screen, GdkMonitor *monitor, NotifyStackLocation stack_location); -#else -NotifyStack* notify_stack_new(NotifyDaemon* daemon, GdkScreen* screen, guint monitor, NotifyStackLocation stack_location); -#endif void notify_stack_destroy(NotifyStack* stack); void notify_stack_set_location(NotifyStack* stack, NotifyStackLocation location); diff --git a/src/themes/coco/coco-theme.c b/src/themes/coco/coco-theme.c index 52d542c..2401e6c 100644 --- a/src/themes/coco/coco-theme.c +++ b/src/themes/coco/coco-theme.c @@ -453,12 +453,8 @@ create_notification(UrlClickedCb url_clicked) windata->summary_label = gtk_label_new(NULL); gtk_widget_show(windata->summary_label); gtk_box_pack_start(GTK_BOX(vbox), windata->summary_label, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (windata->summary_label), 0.0); gtk_label_set_yalign (GTK_LABEL (windata->summary_label), 0.0); -#else - 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); gtk_label_set_line_wrap_mode (GTK_LABEL (windata->summary_label), PANGO_WRAP_WORD_CHAR); @@ -467,12 +463,8 @@ create_notification(UrlClickedCb url_clicked) windata->body_label = gtk_label_new(NULL); gtk_box_pack_start(GTK_BOX(vbox), windata->body_label, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (windata->body_label), 0.0); gtk_label_set_yalign (GTK_LABEL (windata->body_label), 0.0); -#else - 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); 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); @@ -623,12 +615,8 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key, label = gtk_label_new(NULL); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_yalign (GTK_LABEL (label), 0.5); -#else - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); -#endif buf = g_strdup_printf("<small>%s</small>", text); gtk_label_set_markup(GTK_LABEL(label), buf); g_free(buf); diff --git a/src/themes/nodoka/nodoka-theme.c b/src/themes/nodoka/nodoka-theme.c index 4d3a2a1..6348cd6 100644 --- a/src/themes/nodoka/nodoka-theme.c +++ b/src/themes/nodoka/nodoka-theme.c @@ -800,12 +800,8 @@ create_notification(UrlClickedCb url_clicked) windata->summary_label = gtk_label_new(NULL); gtk_widget_show(windata->summary_label); gtk_box_pack_start(GTK_BOX(hbox), windata->summary_label, TRUE, TRUE, 0); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (windata->summary_label), 0.0); gtk_label_set_yalign (GTK_LABEL (windata->summary_label), 0.0); -#else - 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); gtk_label_set_line_wrap_mode (GTK_LABEL (windata->summary_label), PANGO_WRAP_WORD_CHAR); @@ -853,12 +849,8 @@ create_notification(UrlClickedCb url_clicked) windata->body_label = gtk_label_new(NULL); gtk_box_pack_start(GTK_BOX(vbox), windata->body_label, TRUE, TRUE, 0); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (windata->body_label), 0.0); gtk_label_set_yalign (GTK_LABEL (windata->body_label), 0.0); -#else - 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); 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); @@ -1021,12 +1013,8 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key, label = gtk_label_new(NULL); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_yalign (GTK_LABEL (label), 0.5); -#else - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); -#endif buf = g_strdup_printf("<small>%s</small>", text); gtk_label_set_markup(GTK_LABEL(label), buf); g_free(buf); diff --git a/src/themes/slider/theme.c b/src/themes/slider/theme.c index d7d4823..d1a2826 100644 --- a/src/themes/slider/theme.c +++ b/src/themes/slider/theme.c @@ -405,12 +405,8 @@ GtkWindow* create_notification(UrlClickedCb url_clicked) windata->summary_label = gtk_label_new(NULL); 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) gtk_label_set_xalign (GTK_LABEL (windata->summary_label), 0.0); gtk_label_set_yalign (GTK_LABEL (windata->summary_label), 0.0); -#else - 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); gtk_label_set_line_wrap_mode (GTK_LABEL (windata->summary_label), PANGO_WRAP_WORD_CHAR); @@ -428,12 +424,8 @@ GtkWindow* create_notification(UrlClickedCb url_clicked) windata->body_label = gtk_label_new(NULL); 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) gtk_label_set_xalign (GTK_LABEL (windata->body_label), 0.0); gtk_label_set_yalign (GTK_LABEL (windata->body_label), 0.0); -#else - 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); 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); @@ -763,12 +755,8 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A label = gtk_label_new(NULL); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_yalign (GTK_LABEL (label), 0.5); -#else - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); -#endif buf = g_strdup_printf("<small>%s</small>", text); gtk_label_set_markup(GTK_LABEL(label), buf); g_free(buf); diff --git a/src/themes/standard/theme.c b/src/themes/standard/theme.c index 3366736..0048f01 100644 --- a/src/themes/standard/theme.c +++ b/src/themes/standard/theme.c @@ -266,24 +266,15 @@ static GtkArrowType get_notification_arrow_type(GtkWidget* nw) WindowData* windata; GdkScreen* screen; GdkRectangle monitor_geometry; -#if GTK_CHECK_VERSION (3, 22, 0) GdkDisplay* display; GdkMonitor* monitor; -#else - int monitor; -#endif windata = g_object_get_data(G_OBJECT(nw), "windata"); screen = gdk_window_get_screen(GDK_WINDOW( gtk_widget_get_window(nw))); -#if GTK_CHECK_VERSION (3, 22, 0) display = gdk_screen_get_display (screen); monitor = gdk_display_get_monitor_at_point (display, windata->point_x, windata->point_y); gdk_monitor_get_geometry (monitor, &monitor_geometry); -#else - monitor = gdk_screen_get_monitor_at_point(screen, windata->point_x, windata->point_y); - gdk_screen_get_monitor_geometry(screen, monitor, &monitor_geometry); -#endif if (windata->point_y - monitor_geometry.y + windata->height + DEFAULT_ARROW_HEIGHT > monitor_geometry.height) { @@ -318,26 +309,17 @@ static void create_border_with_arrow(GtkWidget* nw, WindowData* windata) int arrow_offset = DEFAULT_ARROW_OFFSET; GdkPoint* shape_points = NULL; int i = 0; -#if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor* monitor; GdkDisplay* display; -#else - int monitor; -#endif GdkRectangle monitor_geometry; width = windata->width; height = windata->height; screen = gdk_window_get_screen(GDK_WINDOW(gtk_widget_get_window(nw))); -#if GTK_CHECK_VERSION (3, 22, 0) display = gdk_screen_get_display (screen); monitor = gdk_display_get_monitor_at_point (display, windata->point_x, windata->point_y); gdk_monitor_get_geometry (monitor, &monitor_geometry); -#else - monitor = gdk_screen_get_monitor_at_point(screen, windata->point_x, windata->point_y); - gdk_screen_get_monitor_geometry(screen, monitor, &monitor_geometry); -#endif windata->num_border_points = 5; @@ -743,12 +725,8 @@ GtkWindow* create_notification(UrlClickedCb url_clicked) windata->summary_label = gtk_label_new(NULL); gtk_widget_show(windata->summary_label); gtk_box_pack_start(GTK_BOX(hbox), windata->summary_label, TRUE, TRUE, 0); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (windata->summary_label), 0.0); gtk_label_set_yalign (GTK_LABEL (windata->summary_label), 0.0); -#else - 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); gtk_label_set_line_wrap_mode (GTK_LABEL (windata->summary_label), PANGO_WRAP_WORD_CHAR); @@ -797,12 +775,8 @@ GtkWindow* create_notification(UrlClickedCb url_clicked) windata->body_label = gtk_label_new(NULL); 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) gtk_label_set_xalign (GTK_LABEL (windata->body_label), 0.0); gtk_label_set_yalign (GTK_LABEL (windata->body_label), 0.0); -#else - 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); 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); @@ -1086,12 +1060,8 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A label = gtk_label_new(NULL); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_yalign (GTK_LABEL (label), 0.5); -#else - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); -#endif buf = g_strdup_printf("<small>%s</small>", text); gtk_label_set_markup(GTK_LABEL(label), buf); g_free(buf); |