[evince/wip/gpoo/gtk4-preparation: 2/2] Remove legacy code path for Gtk < 3.22




commit 49b75ccd6145e5e935c295e66260aa5389a244f0
Author: Qiu Wenbo <qiuwenbo kylinos com cn>
Date:   Mon Aug 16 15:05:30 2021 +0800

    Remove legacy code path for Gtk < 3.22
    
    Evince depends on GTK 3.22, hence we do not need those safeguards
    for running on old GTK versions as they would fail anyway.
    
    Signed-off-by: Qiu Wenbo <qiuwenbo kylinos com cn>

 libview/ev-annotation-window.c |  2 --
 libview/ev-view-presentation.c | 48 ------------------------------------------
 libview/ev-view.c              |  2 --
 shell/ev-sidebar-thumbnails.c  |  2 --
 4 files changed, 54 deletions(-)
---
diff --git a/libview/ev-annotation-window.c b/libview/ev-annotation-window.c
index 41192125..f9cb5248 100644
--- a/libview/ev-annotation-window.c
+++ b/libview/ev-annotation-window.c
@@ -574,9 +574,7 @@ ev_annotation_window_class_init (EvAnnotationWindowClass *klass)
        gtk_widget_class->focus_out_event = ev_annotation_window_focus_out_event;
         gtk_widget_class->key_press_event = ev_annotation_window_key_press_event;
 
-#if GTK_CHECK_VERSION(3, 20, 0)
        gtk_widget_class_set_css_name (gtk_widget_class, "evannotationwindow");
-#endif
        g_object_class_install_property (g_object_class,
                                         PROP_ANNOTATION,
                                         g_param_spec_object ("annotation",
diff --git a/libview/ev-view-presentation.c b/libview/ev-view-presentation.c
index 8dab0ef4..f21e8337 100644
--- a/libview/ev-view-presentation.c
+++ b/libview/ev-view-presentation.c
@@ -116,11 +116,6 @@ static void ev_view_presentation_set_cursor_for_location (EvViewPresentation *pv
 
 G_DEFINE_TYPE (EvViewPresentation, ev_view_presentation, GTK_TYPE_WIDGET)
 
-#if !GTK_CHECK_VERSION(3, 20, 0)
-static GdkRGBA black = { 0., 0., 0., 1. };
-static GdkRGBA white = { 1., 1., 1., 1. };
-#endif
-
 static void
 ev_view_presentation_set_normal (EvViewPresentation *pview)
 {
@@ -130,12 +125,8 @@ ev_view_presentation_set_normal (EvViewPresentation *pview)
                return;
 
        pview->state = EV_PRESENTATION_NORMAL;
-#if GTK_CHECK_VERSION(3, 20, 0)
        gtk_style_context_remove_class (gtk_widget_get_style_context (widget),
                                        "white-mode");
-#else
-        gdk_window_set_background_rgba (gtk_widget_get_window (widget), &black);
-#endif
         gtk_widget_queue_draw (widget);
 }
 
@@ -148,12 +139,8 @@ ev_view_presentation_set_black (EvViewPresentation *pview)
                return;
 
        pview->state = EV_PRESENTATION_BLACK;
-#if GTK_CHECK_VERSION(3, 20, 0)
        gtk_style_context_remove_class (gtk_widget_get_style_context (widget),
                                        "white-mode");
-#else
-        gdk_window_set_background_rgba (gtk_widget_get_window (widget), &black);
-#endif
         gtk_widget_queue_draw (widget);
 }
 
@@ -166,13 +153,8 @@ ev_view_presentation_set_white (EvViewPresentation *pview)
                return;
 
        pview->state = EV_PRESENTATION_WHITE;
-#if GTK_CHECK_VERSION(3, 20, 0)
        gtk_style_context_add_class (gtk_widget_get_style_context (widget),
                                     "white-mode");
-#else
-        gdk_window_set_background_rgba (gtk_widget_get_window (widget), &white);
-        gtk_widget_queue_draw (widget);
-#endif
 }
 
 static void
@@ -1078,7 +1060,6 @@ ev_view_presentation_draw (GtkWidget *widget,
        GdkRectangle        overlap;
        cairo_surface_t    *surface;
         GdkRectangle        clip_rect;
-#if GTK_CHECK_VERSION(3, 20, 0)
        GtkStyleContext    *context;
 
        context = gtk_widget_get_style_context (GTK_WIDGET (pview));
@@ -1086,7 +1067,6 @@ ev_view_presentation_draw (GtkWidget *widget,
                                0, 0,
                                gtk_widget_get_allocated_width (widget),
                                gtk_widget_get_allocated_height (widget));
-#endif
 
         if (!gdk_cairo_get_clip_rectangle (cr, &clip_rect))
                 return FALSE;
@@ -1522,9 +1502,7 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass)
        widget_class->motion_notify_event = ev_view_presentation_motion_notify_event;
        widget_class->scroll_event = ev_view_presentation_scroll_event;
 
-#if GTK_CHECK_VERSION(3, 20, 0)
        gtk_widget_class_set_css_name (widget_class, "evpresentationview");
-#endif
 
        gobject_class->constructor = ev_view_presentation_constructor;
        gobject_class->set_property = ev_view_presentation_set_property;
@@ -1629,37 +1607,11 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass)
                                      GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_BACKWARD);
 }
 
-#if !GTK_CHECK_VERSION(3, 20, 0)
-static void
-ev_view_presentation_init_css(void)
-{
-        static gsize initialization_value = 0;
-
-        if (g_once_init_enter (&initialization_value)) {
-                GtkCssProvider *provider;
-
-                provider = gtk_css_provider_new ();
-                gtk_css_provider_load_from_data (provider,
-                                                 "EvViewPresentation {\n"
-                                                 " background-color: black; }",
-                                                 -1, NULL);
-                gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
-                                                           GTK_STYLE_PROVIDER (provider),
-                                                           GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-                g_object_unref (provider);
-                g_once_init_leave (&initialization_value, 1);
-        }
-}
-#endif
-
 static void
 ev_view_presentation_init (EvViewPresentation *pview)
 {
        gtk_widget_set_can_focus (GTK_WIDGET (pview), TRUE);
         pview->is_constructing = TRUE;
-#if !GTK_CHECK_VERSION(3, 20, 0)
-        ev_view_presentation_init_css();
-#endif
 }
 
 GtkWidget *
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 354b6ce6..ee6526cb 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -8165,9 +8165,7 @@ ev_view_class_init (EvViewClass *class)
        widget_class->parent_set = ev_view_parent_set;
        widget_class->hierarchy_changed = ev_view_hierarchy_changed;
 
-#if GTK_CHECK_VERSION(3, 20, 0)
        gtk_widget_class_set_css_name (widget_class, "evview");
-#endif
 
        container_class->remove = ev_view_remove;
        container_class->forall = ev_view_forall;
diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c
index 9ade692d..1993fd53 100644
--- a/shell/ev-sidebar-thumbnails.c
+++ b/shell/ev-sidebar-thumbnails.c
@@ -361,9 +361,7 @@ ev_sidebar_thumbnails_class_init (EvSidebarThumbnailsClass *ev_sidebar_thumbnail
        widget_class->map = ev_sidebar_thumbnails_map;
         widget_class->size_allocate = ev_sidebar_thumbnails_size_allocate;
 
-#if GTK_CHECK_VERSION(3, 20, 0)
         gtk_widget_class_set_css_name (widget_class, "evsidebarthumbnails");
-#endif
 
        g_object_class_override_property (g_object_class,
                                          PROP_WIDGET,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]