[Xfce4-commits] <ristretto:ristretto-0.0> Fix compiler warnings

Stephan Arts noreply at xfce.org
Sun Oct 23 19:16:29 CEST 2011


Updating branch refs/heads/ristretto-0.0
         to 6b6940b9ce336f83d00fc9b50a7beef94c439583 (commit)
       from 50b2fe9210cdab8e3db9bb444c751fe4fc312ac4 (commit)

commit 6b6940b9ce336f83d00fc9b50a7beef94c439583
Author: Stephan Arts <stephan at xfce.org>
Date:   Thu Jun 4 23:44:53 2009 +0200

    Fix compiler warnings

 src/image.c              |    3 -
 src/image.h              |    2 +-
 src/image_list.c         |    2 +-
 src/main_window.c        |   48 ++++--------------
 src/picture_viewer.c     |  123 +++-------------------------------------------
 src/preferences_dialog.c |    4 +-
 src/settings.h           |    3 +-
 src/thumbnail.c          |    7 +--
 src/thumbnail_bar.c      |   10 ++--
 9 files changed, 32 insertions(+), 170 deletions(-)

diff --git a/src/image.c b/src/image.c
index 77b3ed5..382c5e6 100644
--- a/src/image.c
+++ b/src/image.c
@@ -230,7 +230,6 @@ rstto_image_new (GFile *file)
     RsttoImage *image = g_object_new (RSTTO_TYPE_IMAGE, NULL);
     gchar *file_path = g_file_get_path (file);
     ExifEntry *exif_entry = NULL;
-    RsttoImageOrientation orientation;
 
     image->priv->file = file;
     image->priv->exif_data = exif_data_new_from_file (file_path);
@@ -630,8 +629,6 @@ cb_rstto_image_closed (GdkPixbufLoader *loader, RsttoImage *image)
     g_return_if_fail (RSTTO_IS_IMAGE (image));
     g_return_if_fail (loader == image->priv->loader);
 
-    GdkPixbuf *pixbuf = NULL;
-
     g_object_unref (image->priv->loader);
     image->priv->loader = NULL;
 
diff --git a/src/image.h b/src/image.h
index 87b7c27..8b483b5 100644
--- a/src/image.h
+++ b/src/image.h
@@ -74,7 +74,7 @@ GType       rstto_image_get_type ();
 
 GdkPixbuf *rstto_image_get_thumbnail (RsttoImage *image);
 GdkPixbuf *rstto_image_get_pixbuf (RsttoImage *image);
-gint rstto_image_get_widht (RsttoImage *image);
+gint rstto_image_get_width (RsttoImage *image);
 gint rstto_image_get_height (RsttoImage *image);
 
 GFile *rstto_image_get_file (RsttoImage *image);
diff --git a/src/image_list.c b/src/image_list.c
index 11f1145..d3cc9a1 100644
--- a/src/image_list.c
+++ b/src/image_list.c
@@ -481,5 +481,5 @@ rstto_image_list_iter_clone (RsttoImageListIter *iter)
 GCompareFunc
 rstto_image_list_get_compare_func (RsttoImageList *image_list)
 {
-    return cb_rstto_image_list_image_name_compare_func;
+    return (GCompareFunc)cb_rstto_image_list_image_name_compare_func;
 }
diff --git a/src/main_window.c b/src/main_window.c
index 89ea80c..f64ab92 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -33,6 +33,7 @@
 
 #include "settings.h"
 #include "image_list.h"
+#include "image_cache.h"
 #include "picture_viewer.h"
 #include "main_window.h"
 #include "main_window_ui.h"
@@ -136,14 +137,6 @@ static void
 cb_rstto_main_window_state_event(GtkWidget *widget, GdkEventWindowState *event, gpointer user_data);
 static gboolean
 cb_rstto_main_window_show_fs_toolbar_timeout (RsttoMainWindow *window);
-static gboolean
-cb_rstto_main_window_image_list_toolbar_enter_notify_event (GtkWidget *widget,
-                                                           GdkEventCrossing *event,
-                                                           gpointer user_data);
-static gboolean
-cb_rstto_main_window_image_list_toolbar_leave_notify_event (GtkWidget *widget,
-                                                           GdkEventCrossing *evet,
-                                                           gpointer user_data);
 static void
 cb_rstto_main_window_image_list_iter_changed (RsttoImageListIter *iter, RsttoMainWindow *window);
 static void
@@ -152,13 +145,6 @@ rstto_main_window_image_list_iter_changed (RsttoMainWindow *window);
 static void
 cb_rstto_main_window_image_list_new_image (RsttoImageList *image_list, RsttoImage *image, RsttoMainWindow *window);
 
-static gboolean
-cb_rstto_main_window_image_list_toolbar_popup_context_menu (GtkToolbar *toolbar,
-                                                        gint        x,
-                                                        gint        y,
-                                                        gint        button,
-                                                        gpointer    user_data);
-
 static void
 cb_rstto_main_window_zoom_100 (GtkWidget *widget, RsttoMainWindow *window);
 static void
@@ -189,8 +175,6 @@ cb_rstto_main_window_open_folder (GtkWidget *widget, RsttoMainWindow *window);
 static void
 cb_rstto_main_window_open_recent(GtkRecentChooser *chooser, RsttoMainWindow *window);
 static void
-cb_rstto_main_window_file_properties (GtkWidget *widget, RsttoMainWindow *window);
-static void
 cb_rstto_main_window_close (GtkWidget *widget, RsttoMainWindow *window);
 static void
 cb_rstto_main_window_close_all (GtkWidget *widget, RsttoMainWindow *window);
@@ -347,7 +331,7 @@ rstto_main_window_init (RsttoMainWindow *window)
 {
     GtkAccelGroup   *accel_group;
     GValue          show_toolbar_val = {0,}, window_width = {0, }, window_height = {0, };
-    GtkWidget       *separator, *back, *forward, *leave_fullscreen;
+    GtkWidget       *separator, *back, *forward;
     GtkWidget       *main_vbox = gtk_vbox_new (FALSE, 0);
     GtkRecentFilter *recent_filter;
 
@@ -466,7 +450,7 @@ rstto_main_window_init (RsttoMainWindow *window)
     g_signal_connect(G_OBJECT(window->priv->message_bar_button_cancel), "clicked", G_CALLBACK(cb_rstto_main_window_message_bar_cancel), window);
     g_signal_connect(G_OBJECT(window->priv->message_bar_button_open), "clicked", G_CALLBACK(cb_rstto_main_window_message_bar_open), window);
 
-    gtk_container_set_border_width (window->priv->message_bar, 2);
+    gtk_container_set_border_width (GTK_CONTAINER (window->priv->message_bar), 2);
     gtk_box_pack_start (GTK_BOX (window->priv->message_bar), window->priv->message_bar_label, FALSE,FALSE, 5);
     gtk_box_pack_end (GTK_BOX (window->priv->message_bar), window->priv->message_bar_button_cancel, FALSE,FALSE, 5);
     gtk_box_pack_end (GTK_BOX (window->priv->message_bar), window->priv->message_bar_button_open, FALSE,FALSE, 5);
@@ -550,6 +534,8 @@ rstto_main_window_init (RsttoMainWindow *window)
     g_signal_connect(G_OBJECT(window->priv->picture_viewer), "motion-notify-event", G_CALLBACK(cb_rstto_main_window_picture_viewer_motion_notify_event), window);
     g_signal_connect(G_OBJECT(window), "configure-event", G_CALLBACK(cb_rstto_main_window_configure_event), NULL);
     g_signal_connect(G_OBJECT(window), "window-state-event", G_CALLBACK(cb_rstto_main_window_state_event), NULL);
+
+    g_signal_connect(G_OBJECT(window->priv->settings_manager), "notify", G_CALLBACK(cb_rstto_main_window_settings_notify), NULL);
 }
 
 static void
@@ -1062,7 +1048,7 @@ cb_rstto_main_window_open_image (GtkWidget *widget, RsttoMainWindow *window)
         files = gtk_file_chooser_get_files (GTK_FILE_CHOOSER (dialog));
         _files_iter = files;
         pos = rstto_image_list_iter_get_position (window->priv->iter);
-        if (g_list_length (files) > 1)
+        if (g_slist_length (files) > 1)
         {
             while (_files_iter)
             {
@@ -1173,7 +1159,7 @@ cb_rstto_main_window_open_folder (GtkWidget *widget, RsttoMainWindow *window)
 
         file_enumarator = g_file_enumerate_children (file, "standard::*", 0, NULL, NULL);
         pos = rstto_image_list_iter_get_position (window->priv->iter);
-        while (file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
+        for(file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL); file_info != NULL; file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
         {
             filename = g_file_info_get_name (file_info);
             content_type  = g_file_info_get_content_type (file_info);
@@ -1217,7 +1203,7 @@ cb_rstto_main_window_open_folder (GtkWidget *widget, RsttoMainWindow *window)
 static void
 cb_rstto_main_window_open_recent(GtkRecentChooser *chooser, RsttoMainWindow *window)
 {
-    GtkWidget *dialog, *err_dialog;
+    GtkWidget *err_dialog;
     gchar *uri = gtk_recent_chooser_get_current_uri (chooser);
     const gchar *filename;
     GError *error = NULL;
@@ -1232,7 +1218,7 @@ cb_rstto_main_window_open_recent(GtkRecentChooser *chooser, RsttoMainWindow *win
         if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
         {
             file_enumarator = g_file_enumerate_children (file, "standard::name", 0, NULL, NULL);
-            while (child_file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
+            for(child_file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL); child_file_info != NULL; child_file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
             {
                 filename = g_file_info_get_name (child_file_info);
                 child_file = g_file_get_child (file, filename);
@@ -1584,19 +1570,6 @@ cb_rstto_main_window_contents (GtkWidget *widget, RsttoMainWindow *window)
 
 
 /**
- * cb_rstto_main_window_file_properties:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_file_properties (GtkWidget *widget, RsttoMainWindow *window)
-{
-
-}
-
-/**
  * cb_rstto_main_window_quit:
  * @widget:
  * @window:
@@ -1870,6 +1843,7 @@ cb_rstto_main_window_picture_viewer_motion_notify_event (RsttoPictureViewer *vie
             }
         }
     }
+    return TRUE;
 }
 
 static gboolean
@@ -1929,7 +1903,7 @@ cb_rstto_main_window_message_bar_open (GtkWidget *widget, RsttoMainWindow *windo
     const gchar *content_type = NULL;
 
     file_enumarator = g_file_enumerate_children (window->priv->message_bar_file, "standard::*", 0, NULL, NULL);
-    while (file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
+    for(file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL); file_info != NULL; file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
     {
         filename = g_file_info_get_name (file_info);
         content_type  = g_file_info_get_content_type (file_info);
diff --git a/src/picture_viewer.c b/src/picture_viewer.c
index e8c7386..4336878 100644
--- a/src/picture_viewer.c
+++ b/src/picture_viewer.c
@@ -120,7 +120,7 @@ static gboolean
 rstto_picture_viewer_expose(GtkWidget *, GdkEventExpose *);
 static void
 rstto_picture_viewer_paint (GtkWidget *widget);
-static gboolean 
+static void 
 rstto_picture_viewer_queued_repaint (RsttoPictureViewer *viewer, gboolean refresh);
 
 static gboolean
@@ -140,6 +140,8 @@ static gboolean
 cb_rstto_picture_viewer_queued_repaint (RsttoPictureViewer *viewer);
 
 static void
+cb_rstto_picture_viewer_scroll_event (RsttoPictureViewer *viewer, GdkEventScroll *event);
+static void
 cb_rstto_picture_viewer_button_press_event (RsttoPictureViewer *viewer, GdkEventButton *event);
 static void
 cb_rstto_picture_viewer_button_release_event (RsttoPictureViewer *viewer, GdkEventButton *event);
@@ -193,6 +195,7 @@ rstto_picture_viewer_init(RsttoPictureViewer *viewer)
                            GDK_BUTTON1_MOTION_MASK |
                            GDK_POINTER_MOTION_MASK);
 
+    g_signal_connect(G_OBJECT(viewer), "scroll_event", G_CALLBACK(cb_rstto_picture_viewer_scroll_event), NULL);
     g_signal_connect(G_OBJECT(viewer), "button_press_event", G_CALLBACK(cb_rstto_picture_viewer_button_press_event), NULL);
     g_signal_connect(G_OBJECT(viewer), "button_release_event", G_CALLBACK(cb_rstto_picture_viewer_button_release_event), NULL);
     g_signal_connect(G_OBJECT(viewer), "motion_notify_event", G_CALLBACK(cb_rstto_picture_viewer_motion_notify_event), NULL);
@@ -690,7 +693,7 @@ rstto_picture_viewer_new()
 void
 rstto_picture_viewer_set_scale(RsttoPictureViewer *viewer, gdouble scale)
 {
-    gdouble *img_scale, *new_scale;
+    gdouble *img_scale;
     GdkPixbuf *src_pixbuf = NULL;
 
     if (viewer->priv->image)
@@ -703,12 +706,6 @@ rstto_picture_viewer_set_scale(RsttoPictureViewer *viewer, gdouble scale)
             gdouble image_width = (gdouble)rstto_image_get_width (viewer->priv->image);
             gdouble image_height = (gdouble)rstto_image_get_height (viewer->priv->image);
 
-            gdouble pixbuf_width = (gdouble)gdk_pixbuf_get_width (src_pixbuf);
-            gdouble pixbuf_height = (gdouble)gdk_pixbuf_get_height (src_pixbuf);
-
-            gdouble image_scale = pixbuf_width / image_width;
-
-
             viewer->hadjustment->upper = image_width *scale;
             gtk_adjustment_changed(viewer->hadjustment);
 
@@ -773,7 +770,6 @@ rstto_picture_viewer_get_scale(RsttoPictureViewer *viewer)
 static gdouble
 rstto_picture_viewer_calculate_scale (RsttoPictureViewer *viewer)
 {
-    GdkPixbuf *p_src_pixbuf;
     gint width = 0, height = 0;
 
     if (viewer->priv->image != NULL)
@@ -1036,11 +1032,9 @@ rstto_picture_viewer_calculate_adjustments (RsttoPictureViewer *viewer, gdouble
 
 }
 
-static gboolean 
+static void
 rstto_picture_viewer_queued_repaint (RsttoPictureViewer *viewer, gboolean refresh)
 {
-    g_return_if_fail (RSTTO_IS_PICTURE_VIEWER (viewer));
-
     if (viewer->priv->repaint.idle_id > 0)
     {
         g_source_remove(viewer->priv->repaint.idle_id);
@@ -1065,7 +1059,7 @@ cb_rstto_picture_viewer_queued_repaint (RsttoPictureViewer *viewer)
     gdouble thumb_scale = 1;
     gdouble thumb_width = 0;
     gboolean fit_to_screen = FALSE;
-    gdouble image_width, image_height;
+    gdouble image_width = 0, image_height = 0;
     gdouble pixbuf_width, pixbuf_height;
     GtkWidget *widget = GTK_WIDGET (viewer);
 
@@ -1094,7 +1088,7 @@ cb_rstto_picture_viewer_queued_repaint (RsttoPictureViewer *viewer)
                     thumb_scale = (thumb_width / image_width);
                 }
                 else
-                    return;
+                    return FALSE;
                 break;
             default:
                 break;
@@ -1568,107 +1562,6 @@ rstto_picture_viewer_zoom_out (RsttoPictureViewer *viewer, gdouble factor)
 /******************************************************************************************/
 
 
-/************************
- * FIXME: DnD
- */
-
-static void
-rstto_picture_viewer_drag_data_received(GtkWidget *widget,
-                                        GdkDragContext *context,
-                                        gint x,
-                                        gint y,
-                                        GtkSelectionData *selection_data,
-                                        guint info,
-                                        guint time)
-{
-    /*
-    RsttoPictureViewer *picture_viewer = RSTTO_PICTURE_VIEWER(widget);
-    gchar **array = gtk_selection_data_get_uris (selection_data);
-
-    context->action = GDK_ACTION_PRIVATE;
-
-    if (array == NULL)
-    {
-        gtk_drag_finish (context, FALSE, FALSE, time);
-    }
-
-    gchar **_array = array;
-
-    while(*_array)
-    {
-        ThunarVfsPath *vfs_path = thunar_vfs_path_new(*_array, NULL);
-        gchar *path = thunar_vfs_path_dup_string(vfs_path);
-        if (g_file_test(path, G_FILE_TEST_EXISTS))
-        {
-            if (g_file_test(path, G_FILE_TEST_IS_DIR))
-            {
-                if(rstto_image_list_open_folder(picture_viewer->priv->image_list, path, FALSE, NULL) == TRUE)
-                {
-                    rstto_image_list_jump_first(picture_viewer->priv->image_list);
-                }
-            }
-            else
-            {
-                rstto_image_list_open_file(picture_viewer->priv->image_list, path, FALSE, NULL);
-            }
-        }
-
-        g_free(path);
-        thunar_vfs_path_unref(vfs_path);
-        _array++;
-    }
-    
-    gtk_drag_finish (context, TRUE, FALSE, time);
-    */
-}
-
-static gboolean
-rstto_picture_viewer_drag_drop (GtkWidget *widget,
-                                GdkDragContext *context,
-                                gint x,
-                                gint y,
-                                guint time)
-{
-    GdkAtom target;
-
-    /* determine the drop target */
-    target = gtk_drag_dest_find_target (widget, context, NULL);
-    if (G_LIKELY (target == gdk_atom_intern ("text/uri-list", FALSE)))
-    {
-        /* set state so the drag-data-received handler
-         * knows that this is really a drop this time.
-         */
-
-        /* request the drag data from the source. */
-        gtk_drag_get_data (widget, context, target, time);
-    }
-    else
-    {
-        return FALSE;
-    }
-    return TRUE;
-}
-
-
-static gboolean
-rstto_picture_viewer_drag_motion (GtkWidget *widget,
-                                GdkDragContext *context,
-                                gint x,
-                                gint y,
-                                guint time)
-{
-    GdkAtom target;
-    target = gtk_drag_dest_find_target (widget, context, NULL);
-    if (G_UNLIKELY (target != gdk_atom_intern ("text/uri-list", FALSE)))
-    {
-        /* we cannot handle the drop */
-        g_debug("FAAAAAAAAAAAAAALSE");
-        return FALSE;
-    }
-    return TRUE;
-}
-
-
 void
 rstto_picture_viewer_set_iter (RsttoPictureViewer *viewer, RsttoImageListIter *iter)
 {
diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c
index adb34b2..60db4c0 100644
--- a/src/preferences_dialog.c
+++ b/src/preferences_dialog.c
@@ -148,7 +148,6 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog)
     GtkWidget *scroll_frame, *scroll_vbox;
     GtkWidget *timeout_frame, *timeout_vbox, *timeout_lbl, *timeout_hscale;
     GtkWidget *scaling_frame, *scaling_vbox;
-    GtkWidget *toolbar_vbox, *toolbar_frame;
 
     GtkWidget *widget;
 
@@ -376,8 +375,7 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog)
 static void
 rstto_preferences_dialog_class_init(RsttoPreferencesDialogClass *dialog_class)
 {
-    GObjectClass *object_class = (GObjectClass*)dialog_class;
-    parent_class = g_type_class_peek_parent(dialog_class);
+    parent_class = g_type_class_peek_parent (dialog_class);
 }
 
 GtkWidget *
diff --git a/src/settings.h b/src/settings.h
index 5cfd5fc..4b526c2 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -57,7 +57,8 @@ struct _RsttoSettingsClass
     GObjectClass parent_class;
 };
 
-RsttoSettings *rstto_settings_new ();
+RsttoSettings *rstto_settings_new (void);
+GType          rstto_settings_get_type (void);
 
 G_END_DECLS
 
diff --git a/src/thumbnail.c b/src/thumbnail.c
index be04e09..5a85d3a 100644
--- a/src/thumbnail.c
+++ b/src/thumbnail.c
@@ -201,7 +201,7 @@ rstto_thumbnail_paint(RsttoThumbnail *thumb)
 GtkWidget *
 rstto_thumbnail_new (RsttoImage *image)
 {
-    gchar *path, *basename, *title;
+    gchar *path, *basename;
     GFile *file = NULL;
 
     g_return_val_if_fail (image != NULL, NULL);
@@ -234,10 +234,7 @@ rstto_thumbnail_get_image (RsttoThumbnail *thumb)
 /*************/
 
 static void
-rstto_thumbnail_clicked(GtkButton *button)
+rstto_thumbnail_clicked (GtkButton *button)
 {
-    RsttoThumbnail *thumb = RSTTO_THUMBNAIL (button);
-    RsttoImage *image = rstto_thumbnail_get_image (thumb);
-
     gtk_widget_queue_draw (GTK_WIDGET (button));
 }
diff --git a/src/thumbnail_bar.c b/src/thumbnail_bar.c
index a29117e..81e9630 100644
--- a/src/thumbnail_bar.c
+++ b/src/thumbnail_bar.c
@@ -589,8 +589,8 @@ static gint
 cb_rstto_thumbnail_bar_compare (GtkWidget *a, GtkWidget *b, gpointer user_data)
 {
     RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR (user_data);
-    RsttoImage *a_i = rstto_thumbnail_get_image (a);
-    RsttoImage *b_i = rstto_thumbnail_get_image (b);
+    RsttoImage *a_i = rstto_thumbnail_get_image (RSTTO_THUMBNAIL (a));
+    RsttoImage *b_i = rstto_thumbnail_get_image (RSTTO_THUMBNAIL (b));
 
     return rstto_image_list_get_compare_func (bar->priv->image_list) (a_i, b_i);
 }
@@ -764,6 +764,8 @@ void
 cb_rstto_thumbnail_bar_image_list_iter_changed (RsttoImageListIter *iter, gpointer user_data)
 {
     RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR (user_data);
+    /* useless, but keepsthe compiler silent */
+    bar->priv->begin=0;
 }
 
 static void
@@ -794,7 +796,7 @@ cb_rstto_thumbnail_bar_image_list_remove_image (RsttoImageList *image_list, Rstt
         if (rstto_thumbnail_get_image (iter->data) == image)
         {
             GtkWidget *widget = iter->data;
-            rstto_thumbnail_bar_remove (bar, widget);
+            gtk_container_remove (GTK_CONTAINER (bar), widget);
             break;
         }
         iter = g_list_next (iter);
@@ -807,7 +809,7 @@ cb_rstto_thumbnail_bar_image_list_remove_all (RsttoImageList *image_list, gpoint
     RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR (user_data);
     if (bar->priv->thumbs)
     {
-        g_list_foreach (bar->priv->thumbs, G_CALLBACK (gtk_widget_destroy), NULL);
+        g_list_foreach (bar->priv->thumbs, (GFunc)(gtk_widget_destroy), NULL);
         g_list_free (bar->priv->thumbs);
         bar->priv->thumbs = NULL;
     }


More information about the Xfce4-commits mailing list