[evince/wip/gpoo/gtk4-rebase-port: 55/65] ev-view: try to eliminate some warnings




commit 665294ce4bea5adac466a4faa030f42b14acc96b
Author: Qiu Wenbo <qiuwenbo kylinos com cn>
Date:   Wed Sep 1 10:12:35 2021 +0800

    ev-view: try to eliminate some warnings
    
    Signed-off-by: Qiu Wenbo <qiuwenbo kylinos com cn>

 libview/ev-view.c | 63 +++++++++----------------------------------------------
 1 file changed, 10 insertions(+), 53 deletions(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 6b9a37dd7..78ca3b920 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -201,7 +201,6 @@ static void       ev_view_size_allocate                      (GtkWidget
                                                              int                 width,
                                                              int                 height,
                                                              int                 baseline);
-static void       ev_view_style_updated                      (GtkWidget          *widget);
 static void       ev_view_remove_all                         (EvView             *view);
 static void       ev_view_remove_all_form_fields             (EvView             *view);
 
@@ -492,7 +491,6 @@ ev_view_get_scrollbar_size (EvView        *view,
        GtkWidget *swindow = gtk_widget_get_parent (GTK_WIDGET (view));
        GtkAllocation allocation;
        GtkRequisition req;
-       gint spacing;
 
        if (!GTK_IS_SCROLLED_WINDOW (swindow))
                return 0;
@@ -1740,8 +1738,8 @@ ev_view_put (EvView      *view,
        child->page = page;
        child->doc_rect = *doc_rect;
 
-       g_object_set_data_full (child_widget, "ev-child",
-                       child, ev_child_free);
+       g_object_set_data_full (G_OBJECT (child_widget), "ev-child",
+                       child, (GDestroyNotify)ev_child_free);
 
        gtk_widget_set_parent (child_widget, GTK_WIDGET (view));
 }
@@ -2727,7 +2725,7 @@ ev_view_form_field_text_create_widget (EvView      *view,
                                view);
        gtk_widget_add_controller (text, controller);
 
-       controller = gtk_gesture_click_new ();
+       controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
        g_signal_connect (controller, "pressed",
                                G_CALLBACK (ev_view_form_field_text_button_pressed), NULL);
        gtk_widget_add_controller (text, controller);
@@ -3105,7 +3103,7 @@ ev_view_find_player_for_media (EvView  *view,
                if (!GTK_IS_VIDEO (child))
                        continue;
 
-               if (g_object_get_data (child, "media") == media)
+               if (g_object_get_data (G_OBJECT(child), "media") == media)
                        return TRUE;
        }
 
@@ -3133,10 +3131,10 @@ ev_view_handle_media (EvView  *view,
 
        uri = g_file_new_for_uri (ev_media_get_uri (media));
        player = gtk_video_new_for_file (uri);
-       gtk_video_set_autoplay (player, TRUE);
+       gtk_video_set_autoplay (GTK_VIDEO (player), TRUE);
        g_object_unref (uri);
 
-       g_object_set_data_full (player, "media",
+       g_object_set_data_full (G_OBJECT (player), "media",
                                g_object_ref (media),
                                (GDestroyNotify)g_object_unref);
 
@@ -3199,7 +3197,6 @@ ev_view_window_child_put (EvView    *view,
                          gdouble    orig_y)
 {
        EvViewWindowChild *child;
-       gint               root_x, root_y;
 
        child = g_new0 (EvViewWindowChild, 1);
        child->window = window;
@@ -3255,7 +3252,7 @@ ev_view_window_children_free (EvView *view)
                EvViewWindowChild *child;
 
                child = (EvViewWindowChild *)l->data;
-               gtk_window_destroy (GTK_WIDGET (child->window));
+               gtk_window_destroy (GTK_WINDOW (child->window));
                g_free (child);
        }
        g_list_free (view->window_children);
@@ -3551,14 +3548,12 @@ ev_view_handle_annotation (EvView       *view,
                        parent = GTK_WINDOW (gtk_widget_get_native (GTK_WIDGET (view)));
                        window = ev_view_create_annotation_window (view, annot, parent);
                } else if (window && ev_annotation_markup_has_popup (EV_ANNOTATION_MARKUP (annot))) {
-                       EvViewWindowChild *child;
                        EvMappingList     *annots;
                        EvRectangle        popup_rect;
                        EvMapping         *mapping;
                        GdkPoint           view_point;
                        EvPoint            annotation_corner;
 
-                       child = ev_view_get_window_child (view, window);
                        annots = ev_page_cache_get_annot_mapping (view->page_cache,
                                                                  ev_annotation_get_page_index (annot));
                        mapping = ev_mapping_list_find (annots, annot);
@@ -4392,7 +4387,6 @@ ev_view_size_allocate (GtkWidget      *widget,
                       int             baseline)
 {
        EvView *view = EV_VIEW (widget);
-       gint    root_x, root_y;
 
        if (!view->document)
                return;
@@ -4705,7 +4699,6 @@ stroke_doc_rect (EvView       *view,
                 EvRectangle  *doc_rect)
 {
        GdkRectangle view_rect;
-       GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (view));
 
        _ev_view_transform_doc_rect_to_view_rect (view, page, doc_rect, &view_rect);
        view_rect.x -= view->scroll_x;
@@ -5132,9 +5125,6 @@ static void
 link_preview_job_finished_cb (EvJobThumbnail *job,
                              EvView *view)
 {
-       GtkWidget *popover = view->link_preview.popover;
-       gint       device_scale = 1;
-
        if (ev_job_is_failed (EV_JOB (job))) {
                gtk_widget_unparent (view->link_preview.popover);
                view->link_preview.popover = NULL;
@@ -5750,7 +5740,7 @@ ev_view_remove_all_form_fields (EvView *view)
        while (child != NULL) {
                GtkWidget *next = gtk_widget_get_next_sibling (child);
 
-               if (g_object_get_data (child, "form-field"))
+               if (g_object_get_data (G_OBJECT (child), "form-field"))
                        gtk_widget_unparent (child);
 
                child = next;
@@ -5857,7 +5847,6 @@ ev_view_motion_notify_event (GtkEventControllerMotion     *self,
        EvView    *view = EV_VIEW (user_data);
        GtkWidget *widget = GTK_WIDGET (view);
        GdkSurface *surface = gtk_native_get_surface (gtk_widget_get_native (widget));
-       GdkEvent *event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (self));
        GdkModifierType state = gtk_event_controller_get_current_event_state (GTK_EVENT_CONTROLLER (self));
 
        if (!view->document)
@@ -7109,32 +7098,6 @@ highlight_forward_search_results (EvView *view,
                         rect.width, rect.height));
 }
 
-static GdkTexture *
-gdk_texture_new_for_surface(cairo_surface_t *surface)
-{
-       GdkTexture *texture;
-       GBytes *bytes;
-
-       g_return_val_if_fail(cairo_surface_get_type(surface) == CAIRO_SURFACE_TYPE_IMAGE, NULL);
-       g_return_val_if_fail(cairo_image_surface_get_width(surface) > 0, NULL);
-       g_return_val_if_fail(cairo_image_surface_get_height(surface) > 0, NULL);
-
-       bytes = g_bytes_new_with_free_func(cairo_image_surface_get_data(surface),
-                                          cairo_image_surface_get_height(surface) * 
cairo_image_surface_get_stride(surface),
-                                          (GDestroyNotify)cairo_surface_destroy,
-                                          cairo_surface_reference(surface));
-
-       texture = gdk_memory_texture_new(cairo_image_surface_get_width(surface),
-                                        cairo_image_surface_get_height(surface),
-                                        GDK_MEMORY_DEFAULT,
-                                        bytes,
-                                        cairo_image_surface_get_stride(surface));
-
-       g_bytes_unref(bytes);
-
-       return texture;
-}
-
 static void
 draw_surface (GtkSnapshot     *snapshot,
              GdkTexture      *texture,
@@ -8170,7 +8133,7 @@ ev_view_init (EvView *view)
        g_signal_connect (view->zoom_gesture, "scale-changed",
                          G_CALLBACK (zoom_gesture_scale_changed_cb), view);
 
-       gtk_widget_add_controller(widget, view->zoom_gesture);
+       gtk_widget_add_controller(widget, GTK_EVENT_CONTROLLER (view->zoom_gesture));
 
 
        controller = GTK_EVENT_CONTROLLER (gtk_gesture_drag_new ());
@@ -8262,10 +8225,8 @@ on_adjustment_value_changed (GtkAdjustment *adjustment,
 {
        GtkWidget *widget = GTK_WIDGET (view);
        int dx = 0, dy = 0;
-       gdouble x, y;
        gint value;
        GdkEvent *event;
-       gboolean cursor_updated;
 
        if (!gtk_widget_get_realized (widget))
                return;
@@ -8296,7 +8257,7 @@ on_adjustment_value_changed (GtkAdjustment *adjustment,
        for (GtkWidget *child = gtk_widget_get_first_child (widget);
                child != NULL;
                child = gtk_widget_get_next_sibling (child)) {
-               EvViewChild *data = g_object_get_data (child, "ev-child");
+               EvViewChild *data = g_object_get_data (G_OBJECT (child), "ev-child");
 
                if (!data)
                        continue;
@@ -8347,8 +8308,6 @@ ev_view_new (void)
 static void
 setup_caches (EvView *view)
 {
-       gboolean inverted_colors;
-
        view->height_to_page_cache = ev_view_get_height_to_page_cache (view);
        view->pixbuf_cache = ev_pixbuf_cache_new (GTK_WIDGET (view), view->model, view->pixbuf_cache_size);
        view->page_cache = ev_page_cache_new (view->document);
@@ -9841,8 +9800,6 @@ ev_view_copy_link_address (EvView       *view,
 static void
 ev_view_set_cursor (EvView *view, EvViewCursor new_cursor)
 {
-       GtkWidget *widget;
-
        if (view->cursor == new_cursor) {
                return;
        }


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