From f1c3277a87f7052b7cea3c320e45f8bfc676e519 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 11 Sep 2017 18:24:59 +0200 Subject: [PATCH] Remove GTK_CHECK_VERSION macro usage The checks are obsolete since bump of gtk+ requirement to 3.22. --- src/calendar/gui/e-comp-editor-page-recurrence.c | 20 ---------- src/calendar/gui/e-comp-editor-page-reminders.c | 24 ------------ src/calendar/gui/e-day-view.c | 4 -- src/e-util/e-attachment-bar.c | 2 - src/e-util/e-calendar.c | 47 +++++++++++------------- src/e-util/e-cell-tree.c | 11 ------ src/e-util/e-table.c | 4 -- src/e-util/e-tree.c | 4 -- src/e-util/e-web-view.c | 8 ---- src/modules/calendar/e-cal-base-shell-sidebar.c | 2 - src/modules/mail/e-mail-shell-backend.c | 4 -- src/modules/webkit-editor/e-webkit-editor.c | 4 -- src/shell/e-shell.c | 2 - 13 files changed, 21 insertions(+), 115 deletions(-) diff --git a/src/calendar/gui/e-comp-editor-page-recurrence.c b/src/calendar/gui/e-comp-editor-page-recurrence.c index 7f302dfc7f..4d0ef50115 100644 --- a/src/calendar/gui/e-comp-editor-page-recurrence.c +++ b/src/calendar/gui/e-comp-editor-page-recurrence.c @@ -2018,11 +2018,7 @@ ecep_recurrence_constructed (GObject *object) "halign", GTK_ALIGN_START, "vexpand", FALSE, "valign", GTK_ALIGN_START, - #if GTK_CHECK_VERSION(3, 12, 0) "margin-start", 12, - #else - "margin-left", 12, - #endif "margin-bottom", 6, NULL); gtk_widget_show (widget); @@ -2038,11 +2034,7 @@ ecep_recurrence_constructed (GObject *object) "halign", GTK_ALIGN_FILL, "vexpand", FALSE, "valign", GTK_ALIGN_START, - #if GTK_CHECK_VERSION(3, 12, 0) "margin-start", 12, - #else - "margin-left", 12, - #endif "margin-bottom", 6, NULL); gtk_widget_show (widget); @@ -2148,11 +2140,7 @@ ecep_recurrence_constructed (GObject *object) "halign", GTK_ALIGN_START, "vexpand", FALSE, "valign", GTK_ALIGN_START, - #if GTK_CHECK_VERSION(3, 12, 0) "margin-start", 12, - #else - "margin-left", 12, - #endif "margin-bottom", 6, NULL); gtk_widget_hide (widget); @@ -2176,11 +2164,7 @@ ecep_recurrence_constructed (GObject *object) "halign", GTK_ALIGN_FILL, "vexpand", FALSE, "valign", GTK_ALIGN_FILL, - #if GTK_CHECK_VERSION(3, 12, 0) "margin-start", 12, - #else - "margin-left", 12, - #endif "margin-bottom", 6, "hscrollbar-policy", GTK_POLICY_AUTOMATIC, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, @@ -2269,11 +2253,7 @@ ecep_recurrence_constructed (GObject *object) "halign", GTK_ALIGN_FILL, "vexpand", TRUE, "valign", GTK_ALIGN_FILL, - #if GTK_CHECK_VERSION(3, 12, 0) "margin-start", 12, - #else - "margin-left", 12, - #endif NULL); gtk_widget_show (widget); gtk_grid_attach (grid, widget, 0, 7, 2, 1); diff --git a/src/calendar/gui/e-comp-editor-page-reminders.c b/src/calendar/gui/e-comp-editor-page-reminders.c index e64154da52..ad9a8df949 100644 --- a/src/calendar/gui/e-comp-editor-page-reminders.c +++ b/src/calendar/gui/e-comp-editor-page-reminders.c @@ -1016,11 +1016,7 @@ ecep_reminders_setup_name_selector (ECompEditorPageReminders *page_reminders) "halign", GTK_ALIGN_FILL, "vexpand", FALSE, "valign", GTK_ALIGN_CENTER, - #if GTK_CHECK_VERSION(3, 12, 0) "margin-start", 4, - #else - "margin-left", 4, - #endif NULL); gtk_widget_show (widget); gtk_grid_attach (GTK_GRID (option_grid), widget, 1, 0, 1, 1); @@ -1623,11 +1619,7 @@ ecep_reminders_constructed (GObject *object) "halign", GTK_ALIGN_FILL, "vexpand", FALSE, "valign", GTK_ALIGN_START, - #if GTK_CHECK_VERSION(3, 12, 0) "margin-start", 12, - #else - "margin-left", 12, - #endif "margin-bottom", 6, NULL); gtk_widget_show (widget); @@ -1721,11 +1713,7 @@ ecep_reminders_constructed (GObject *object) "halign", GTK_ALIGN_FILL, "vexpand", FALSE, "valign", GTK_ALIGN_FILL, - #if GTK_CHECK_VERSION(3, 12, 0) "margin-start", 12, - #else - "margin-left", 12, - #endif "margin-bottom", 6, "hscrollbar-policy", GTK_POLICY_AUTOMATIC, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, @@ -1796,11 +1784,7 @@ ecep_reminders_constructed (GObject *object) "halign", GTK_ALIGN_FILL, "vexpand", FALSE, "valign", GTK_ALIGN_START, - #if GTK_CHECK_VERSION(3, 12, 0) "margin-start", 12, - #else - "margin-left", 12, - #endif "margin-bottom", 6, NULL); gtk_widget_show (widget); @@ -1909,11 +1893,7 @@ ecep_reminders_constructed (GObject *object) "halign", GTK_ALIGN_FILL, "vexpand", FALSE, "valign", GTK_ALIGN_START, - #if GTK_CHECK_VERSION(3, 12, 0) "margin-start", 12, - #else - "margin-left", 12, - #endif "margin-bottom", 6, NULL); gtk_widget_show (widget); @@ -2012,11 +1992,7 @@ ecep_reminders_constructed (GObject *object) "halign", GTK_ALIGN_FILL, "vexpand", TRUE, "valign", GTK_ALIGN_FILL, - #if GTK_CHECK_VERSION(3, 12, 0) "margin-start", 12, - #else - "margin-left", 12, - #endif "show-tabs", FALSE, "show-border", FALSE, NULL); diff --git a/src/calendar/gui/e-day-view.c b/src/calendar/gui/e-day-view.c index a79c6f2f4b..d3b52427e6 100644 --- a/src/calendar/gui/e-day-view.c +++ b/src/calendar/gui/e-day-view.c @@ -3256,11 +3256,7 @@ e_day_view_remove_event_cb (EDayView *day_view, day_view->drag_event_num = -1; day_view->drag_event_day = -1; if (day_view->priv->drag_context) { - #if GTK_CHECK_VERSION(3,16,0) gtk_drag_cancel (day_view->priv->drag_context); - #else - gdk_drag_abort (day_view->priv->drag_context, gtk_get_current_event_time ()); - #endif } } else { day_view->drag_event_num--; diff --git a/src/e-util/e-attachment-bar.c b/src/e-util/e-attachment-bar.c index 2da7112f7c..cbdd684d14 100644 --- a/src/e-util/e-attachment-bar.c +++ b/src/e-util/e-attachment-bar.c @@ -571,9 +571,7 @@ e_attachment_bar_class_init (EAttachmentBarClass *class) widget_class->button_release_event = attachment_bar_button_release_event; widget_class->motion_notify_event = attachment_bar_motion_notify_event; - #if GTK_CHECK_VERSION (3, 20, 0) gtk_widget_class_set_css_name (widget_class, G_OBJECT_CLASS_NAME (class)); - #endif g_object_class_install_property ( object_class, diff --git a/src/e-util/e-calendar.c b/src/e-util/e-calendar.c index 706278c4dc..b99d13bf62 100644 --- a/src/e-util/e-calendar.c +++ b/src/e-util/e-calendar.c @@ -152,6 +152,9 @@ static GtkWidget * e_calendar_create_button (GtkArrowType arrow_type) { GtkWidget *button, *pixmap; + GtkCssProvider *css_provider; + GtkStyleContext *style_context; + GError *error = NULL; button = gtk_button_new (); gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); @@ -161,33 +164,25 @@ e_calendar_create_button (GtkArrowType arrow_type) gtk_widget_show (pixmap); gtk_container_add (GTK_CONTAINER (button), pixmap); - #if GTK_CHECK_VERSION (3, 20, 0) - { - GtkCssProvider *css_provider; - GtkStyleContext *style_context; - GError *error = NULL; - - css_provider = gtk_css_provider_new (); - gtk_css_provider_load_from_data (css_provider, - "button.ecalendar {" - " min-height: 0px;" - " min-width: 0px;" - " padding: 0px;" - "}", -1, &error); - style_context = gtk_widget_get_style_context (button); - if (error == NULL) { - gtk_style_context_add_class (style_context, "ecalendar"); - gtk_style_context_add_provider ( - style_context, - GTK_STYLE_PROVIDER (css_provider), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - } else { - g_warning ("%s: %s", G_STRFUNC, error->message); - g_clear_error (&error); - } - g_object_unref (css_provider); + css_provider = gtk_css_provider_new (); + gtk_css_provider_load_from_data (css_provider, + "button.ecalendar {" + " min-height: 0px;" + " min-width: 0px;" + " padding: 0px;" + "}", -1, &error); + style_context = gtk_widget_get_style_context (button); + if (error == NULL) { + gtk_style_context_add_class (style_context, "ecalendar"); + gtk_style_context_add_provider ( + style_context, + GTK_STYLE_PROVIDER (css_provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + } else { + g_warning ("%s: %s", G_STRFUNC, error->message); + g_clear_error (&error); } - #endif + g_object_unref (css_provider); return button; } diff --git a/src/e-util/e-cell-tree.c b/src/e-util/e-cell-tree.c index 2e9cf7d1a6..14e78b2126 100644 --- a/src/e-util/e-cell-tree.c +++ b/src/e-util/e-cell-tree.c @@ -232,19 +232,8 @@ draw_expander (ECellTreeView *ectv, break; } - /* XXX GTK 3.13.7 broke backward-compat on which state flag controls - * how an expander is drawn. - * - * Older versions used GTK_STATE_FLAG_ACTIVE, 3.13.7 and later - * changed it to GTK_STATE_FLAG_CHECKED. - * - * See https://bugzilla.gnome.org/733967 for details. */ if (expander_style == GTK_EXPANDER_EXPANDED) { -#if GTK_CHECK_VERSION(3,13,7) flags |= GTK_STATE_FLAG_CHECKED; -#else - flags |= GTK_STATE_FLAG_ACTIVE; -#endif } gtk_style_context_set_state (style_context, flags); diff --git a/src/e-util/e-table.c b/src/e-util/e-table.c index 685ee12365..769e1e05ac 100644 --- a/src/e-util/e-table.c +++ b/src/e-util/e-table.c @@ -3542,7 +3542,6 @@ e_table_class_init (ETableClass *class) GAL_A11Y_TYPE_E_TABLE); } -#if GTK_CHECK_VERSION (3, 15, 9) static gboolean e_table_scrollable_get_border (GtkScrollable *scrollable, GtkBorder *border) @@ -3565,14 +3564,11 @@ e_table_scrollable_get_border (GtkScrollable *scrollable, return TRUE; } -#endif static void e_table_scrollable_init (GtkScrollableInterface *iface) { -#if GTK_CHECK_VERSION (3, 15, 9) iface->get_border = e_table_scrollable_get_border; -#endif } void diff --git a/src/e-util/e-tree.c b/src/e-util/e-tree.c index ccb8aecc4d..9cd4dca4d5 100644 --- a/src/e-util/e-tree.c +++ b/src/e-util/e-tree.c @@ -3249,7 +3249,6 @@ e_tree_class_init (ETreeClass *class) GAL_A11Y_TYPE_E_TREE); } -#if GTK_CHECK_VERSION (3, 15, 9) static gboolean e_tree_scrollable_get_border (GtkScrollable *scrollable, GtkBorder *border) @@ -3272,14 +3271,11 @@ e_tree_scrollable_get_border (GtkScrollable *scrollable, return TRUE; } -#endif static void e_tree_scrollable_init (GtkScrollableInterface *iface) { -#if GTK_CHECK_VERSION (3, 15, 9) iface->get_border = e_tree_scrollable_get_border; -#endif } static void diff --git a/src/e-util/e-web-view.c b/src/e-util/e-web-view.c index 54a26b6d07..f13d14c292 100644 --- a/src/e-util/e-web-view.c +++ b/src/e-util/e-web-view.c @@ -3573,15 +3573,12 @@ e_web_view_update_fonts_settings (GSettings *font_settings, NULL); if (link == NULL) { - #if GTK_CHECK_VERSION(3,12,0) GdkRGBA rgba; GtkStateFlags state; - #endif link = g_slice_new0 (GdkColor); link->blue = G_MAXINT16; - #if GTK_CHECK_VERSION(3,12,0) rgba.alpha = 1; rgba.red = 0; rgba.green = 0; @@ -3597,19 +3594,15 @@ e_web_view_update_fonts_settings (GSettings *font_settings, gtk_style_context_restore (context); e_rgba_to_color (&rgba, link); - #endif } if (visited == NULL) { - #if GTK_CHECK_VERSION(3,12,0) GdkRGBA rgba; GtkStateFlags state; - #endif visited = g_slice_new0 (GdkColor); visited->red = G_MAXINT16; - #if GTK_CHECK_VERSION(3,12,0) rgba.alpha = 1; rgba.red = 1; rgba.green = 0; @@ -3625,7 +3618,6 @@ e_web_view_update_fonts_settings (GSettings *font_settings, gtk_style_context_restore (context); e_rgba_to_color (&rgba, visited); - #endif } g_string_append_printf ( diff --git a/src/modules/calendar/e-cal-base-shell-sidebar.c b/src/modules/calendar/e-cal-base-shell-sidebar.c index fd79759dfa..ae9b34f34e 100644 --- a/src/modules/calendar/e-cal-base-shell-sidebar.c +++ b/src/modules/calendar/e-cal-base-shell-sidebar.c @@ -748,10 +748,8 @@ cal_base_shell_sidebar_constructed (GObject *object) widget = e_calendar_new (); gtk_widget_set_margin_top (widget, 6); - #if GTK_CHECK_VERSION(3,12,0) gtk_widget_set_margin_start (widget, 6); gtk_widget_set_margin_end (widget, 6); - #endif calitem = e_calendar_get_item (E_CALENDAR (widget)); e_calendar_item_set_days_start_week_sel (calitem, 9); e_calendar_item_set_max_days_sel (calitem, 42); diff --git a/src/modules/mail/e-mail-shell-backend.c b/src/modules/mail/e-mail-shell-backend.c index 5f299ee1ec..78bb8dc6d9 100644 --- a/src/modules/mail/e-mail-shell-backend.c +++ b/src/modules/mail/e-mail-shell-backend.c @@ -748,11 +748,7 @@ mail_shell_backend_create_network_page (EPreferencesWindow *window) pango_attr_list_unref (bold); hbox = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4)); - #if GTK_CHECK_VERSION(3,12,0) gtk_widget_set_margin_start (GTK_WIDGET (hbox), 12); - #else - gtk_widget_set_margin_left (GTK_WIDGET (hbox), 12); - #endif label = gtk_label_new_with_mnemonic (C_("NetworkMonitor", "Method to detect _online state:")); gtk_box_pack_start (hbox, label, FALSE, FALSE, 0); diff --git a/src/modules/webkit-editor/e-webkit-editor.c b/src/modules/webkit-editor/e-webkit-editor.c index 7e9959a1e0..c923a9c271 100644 --- a/src/modules/webkit-editor/e-webkit-editor.c +++ b/src/modules/webkit-editor/e-webkit-editor.c @@ -1581,16 +1581,13 @@ get_color_from_context (GtkStyleContext *context, if (color == NULL) { gboolean is_visited = strstr (name, "visited") != NULL; - #if GTK_CHECK_VERSION(3,12,0) GtkStateFlags state; - #endif out_color->alpha = 1; out_color->red = is_visited ? 1 : 0; out_color->green = 0; out_color->blue = is_visited ? 0 : 1; - #if GTK_CHECK_VERSION(3,12,0) state = gtk_style_context_get_state (context); state = state & (~(GTK_STATE_FLAG_VISITED | GTK_STATE_FLAG_LINK)); state = state | (is_visited ? GTK_STATE_FLAG_VISITED : GTK_STATE_FLAG_LINK); @@ -1599,7 +1596,6 @@ get_color_from_context (GtkStyleContext *context, gtk_style_context_set_state (context, state); gtk_style_context_get_color (context, state, out_color); gtk_style_context_restore (context); - #endif } else { out_color->alpha = 1; out_color->red = ((gdouble) color->red) / G_MAXUINT16; diff --git a/src/shell/e-shell.c b/src/shell/e-shell.c index 87ac9c140f..4078738a54 100644 --- a/src/shell/e-shell.c +++ b/src/shell/e-shell.c @@ -1723,13 +1723,11 @@ shell_initable_init (GInitable *initable, g_object_unref (proxy_source); g_object_unref (registry); -#if GTK_CHECK_VERSION(3,11,5) /* Forbid header bars in stock GTK+ dialogs. * They look very out of place in Evolution. */ g_object_set ( gtk_settings_get_default (), "gtk-dialogs-use-header", FALSE, NULL); -#endif return TRUE; } -- 2.11.4.GIT