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

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


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

commit f11cf02f6589eb413490a32d4230fb5de62c2c24
Author: Stephan Arts <stephan at xfce.org>
Date:   Sat Jun 6 11:00:42 2009 +0200

    Fix compile-warnings

 src/image.c              |   62 ++++++++++++++++++++-------------------------
 src/image_cache.c        |    4 +-
 src/image_cache.h        |    1 +
 src/image_list.c         |   16 +++++++----
 src/image_list.h         |    2 +-
 src/main.c               |    9 ++++--
 src/main_window.c        |   29 ++++++++++++---------
 src/picture_viewer.c     |   47 ++++++++++++++++++++---------------
 src/picture_viewer.h     |    3 ++
 src/preferences_dialog.c |   48 ++++++++++++++++++++---------------
 src/settings.c           |    4 +-
 src/thumbnail.c          |    8 +++--
 src/thumbnail_bar.c      |   25 ++++++++++--------
 13 files changed, 143 insertions(+), 115 deletions(-)

diff --git a/src/image.c b/src/image.c
index 382c5e6..a7e2d80 100644
--- a/src/image.c
+++ b/src/image.c
@@ -68,7 +68,7 @@ static GObjectClass *parent_class = NULL;
 static gint rstto_image_signals[RSTTO_IMAGE_SIGNAL_COUNT];
 
 GType
-rstto_image_get_type ()
+rstto_image_get_type (void)
 {
     static GType rstto_image_type = 0;
 
@@ -225,12 +225,12 @@ rstto_image_dispose (GObject *object)
 RsttoImage *
 rstto_image_new (GFile *file)
 {
-    g_object_ref (file);
-
     RsttoImage *image = g_object_new (RSTTO_TYPE_IMAGE, NULL);
     gchar *file_path = g_file_get_path (file);
     ExifEntry *exif_entry = NULL;
 
+    g_object_ref (file);
+
     image->priv->file = file;
     image->priv->exif_data = exif_data_new_from_file (file_path);
     image->priv->thumbnail = NULL;
@@ -341,9 +341,11 @@ cb_rstto_image_read_input_stream_ready (GObject *source_object, GAsyncResult *re
 gboolean
 rstto_image_load (RsttoImage *image, gboolean empty_cache, guint max_size, gboolean preload, GError **error)
 {
+    RsttoImageCache *cache;
+
     g_return_val_if_fail (image != NULL, FALSE);
 
-    RsttoImageCache *cache = rstto_image_cache_new ();
+    cache = rstto_image_cache_new ();
 
     /* NEW */
     image->priv->max_size = max_size;
@@ -490,13 +492,18 @@ rstto_image_get_height (RsttoImage *image)
 GdkPixbuf *
 rstto_image_get_thumbnail (RsttoImage *image)
 {
+    gchar *file_uri;
+    gchar *file_uri_checksum;
+    gchar *thumbnail_filename;
+    gchar *thumbnail_path;
+
     g_return_val_if_fail (image != NULL, NULL);
     g_return_val_if_fail (image->priv != NULL, NULL);
 
-    gchar *file_uri = g_file_get_uri (image->priv->file);
-    gchar *file_uri_checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, file_uri, strlen (file_uri));
-    gchar *thumbnail_filename = g_strconcat (file_uri_checksum, ".png", NULL);
-    gchar *thumbnail_path = g_build_path ("/", g_get_home_dir(), ".thumbnails", "normal", thumbnail_filename, NULL);
+    file_uri = g_file_get_uri (image->priv->file);
+    file_uri_checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, file_uri, strlen (file_uri));
+    thumbnail_filename = g_strconcat (file_uri_checksum, ".png", NULL);
+    thumbnail_path = g_build_path ("/", g_get_home_dir(), ".thumbnails", "normal", thumbnail_filename, NULL);
 
     if (image->priv->thumbnail == NULL)
     {
@@ -534,21 +541,6 @@ rstto_image_get_pixbuf (RsttoImage *image)
 }
 
 /**
- * rstto_image_set_pixbuf:
- * @image  : 
- * @pixbuf :
- *
- */
-void
-rstto_image_set_pixbuf (RsttoImage *image, GdkPixbuf *pixbuf)
-{
-    if (image->priv->pixbuf)
-        g_object_unref (image->priv->pixbuf);
-
-    image->priv->pixbuf = pixbuf;
-}
-
-/**
  * PRIVATE CALLBACKS 
  */
 
@@ -585,7 +577,7 @@ cb_rstto_image_size_prepared (GdkPixbufLoader *loader, gint width, gint height,
 static void
 cb_rstto_image_area_prepared (GdkPixbufLoader *loader, RsttoImage *image)
 {
-
+    gint timeout = 0;
     image->priv->animation = gdk_pixbuf_loader_get_animation (loader);
     image->priv->iter = gdk_pixbuf_animation_get_iter (image->priv->animation, NULL);
     if (image->priv->pixbuf)
@@ -596,18 +588,18 @@ cb_rstto_image_area_prepared (GdkPixbufLoader *loader, RsttoImage *image)
 
     g_object_ref (image->priv->animation);
 
-    gint time = gdk_pixbuf_animation_iter_get_delay_time (image->priv->iter);
+    timeout = gdk_pixbuf_animation_iter_get_delay_time (image->priv->iter);
 
-    if (time != -1)
+    if (timeout != -1)
     {
         /* fix borked stuff */
-        if (time == 0)
+        if (timeout == 0)
         {
             g_warning("timeout == 0: defaulting to 40ms");
-            time = 40;
+            timeout = 40;
         }
 
-        image->priv->animation_timeout_id = g_timeout_add(time, (GSourceFunc)cb_rstto_image_update, image);
+        image->priv->animation_timeout_id = g_timeout_add(timeout, (GSourceFunc)cb_rstto_image_update, image);
     }   
     else
     {
@@ -648,6 +640,7 @@ cb_rstto_image_closed (GdkPixbufLoader *loader, RsttoImage *image)
 static gboolean
 cb_rstto_image_update(RsttoImage *image)
 {
+    gint timeout = 0;
 
     if (image->priv->iter)
     {
@@ -663,15 +656,16 @@ cb_rstto_image_update(RsttoImage *image)
             image->priv->pixbuf = gdk_pixbuf_animation_iter_get_pixbuf (image->priv->iter);
         }
 
-        gint time = gdk_pixbuf_animation_iter_get_delay_time (image->priv->iter);
-        if (time != -1)
+        timeout = gdk_pixbuf_animation_iter_get_delay_time (image->priv->iter);
+
+        if (timeout != -1)
         {
-            if (time == 0)
+            if (timeout == 0)
             {
                 g_warning("timeout == 0: defaulting to 40ms");
-                time = 40;
+                timeout = 40;
             }
-            image->priv->animation_timeout_id = g_timeout_add(time, (GSourceFunc)cb_rstto_image_update, image);
+            image->priv->animation_timeout_id = g_timeout_add(timeout, (GSourceFunc)cb_rstto_image_update, image);
         }
         g_signal_emit (G_OBJECT(image), rstto_image_signals[RSTTO_IMAGE_SIGNAL_UPDATED], 0, image, NULL);
 
diff --git a/src/image_cache.c b/src/image_cache.c
index 9055f6b..5eb9451 100644
--- a/src/image_cache.c
+++ b/src/image_cache.c
@@ -48,7 +48,7 @@ struct _RsttoImageCacheClass
 
 
 GType
-rstto_image_cache_get_type ()
+rstto_image_cache_get_type (void)
 {
     static GType rstto_image_cache_type = 0;
 
@@ -173,7 +173,7 @@ rstto_image_cache_push_image (RsttoImageCache *cache, RsttoImage *image, gboolea
  * Return value: 
  */
 RsttoImageCache *
-rstto_image_cache_new ()
+rstto_image_cache_new (void)
 {
     if (rstto_global_image_cache == NULL)
     {
diff --git a/src/image_cache.h b/src/image_cache.h
index 73812ca..01e1adc 100644
--- a/src/image_cache.h
+++ b/src/image_cache.h
@@ -45,6 +45,7 @@ typedef struct _RsttoImageCache RsttoImageCache;
 
 typedef struct _RsttoImageCacheClass RsttoImageCacheClass;
 
+GType rstto_image_cache_get_type (void);
 RsttoImageCache *rstto_image_cache_new ();
 
 gboolean rstto_image_cache_push_image (RsttoImageCache *cache, RsttoImage *image, gboolean last);
diff --git a/src/image_list.c b/src/image_list.c
index d3cc9a1..f1c1110 100644
--- a/src/image_list.c
+++ b/src/image_list.c
@@ -82,7 +82,7 @@ static gint rstto_image_list_signals[RSTTO_IMAGE_LIST_SIGNAL_COUNT];
 static gint rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_COUNT];
 
 GType
-rstto_image_list_get_type ()
+rstto_image_list_get_type (void)
 {
     static GType rstto_image_list_type = 0;
 
@@ -165,7 +165,7 @@ rstto_image_list_dispose(GObject *object)
 }
 
 RsttoImageList *
-rstto_image_list_new ()
+rstto_image_list_new (void)
 {
     RsttoImageList *image_list;
 
@@ -217,10 +217,11 @@ RsttoImageListIter *
 rstto_image_list_get_iter (RsttoImageList *image_list)
 {
     RsttoImage *image = NULL;
+    RsttoImageListIter *iter = NULL;
     if (image_list->priv->images)
         image = image_list->priv->images->data;
 
-    RsttoImageListIter *iter = rstto_image_list_iter_new (image_list, image);
+    iter = rstto_image_list_iter_new (image_list, image);
 
     image_list->priv->iterators = g_slist_prepend (image_list->priv->iterators, iter);
 
@@ -231,11 +232,13 @@ rstto_image_list_get_iter (RsttoImageList *image_list)
 void
 rstto_image_list_remove_image (RsttoImageList *image_list, RsttoImage *image)
 {
+    GSList *iter = NULL;
+
     if (g_list_find (image_list->priv->images, image))
     {
         image_list->priv->images = g_list_remove (image_list->priv->images, image);
 
-        GSList *iter = image_list->priv->iterators;
+        iter = image_list->priv->iterators;
         while (iter)
         {
             if (rstto_image_list_iter_get_image (iter->data) == image)
@@ -252,11 +255,12 @@ rstto_image_list_remove_image (RsttoImageList *image_list, RsttoImage *image)
 void
 rstto_image_list_remove_all (RsttoImageList *image_list)
 {
+    GSList *iter = NULL;
     g_list_foreach (image_list->priv->images, (GFunc)g_object_unref, NULL);
     g_list_free (image_list->priv->images);
     image_list->priv->images = NULL;
 
-    GSList *iter = image_list->priv->iterators;
+    iter = image_list->priv->iterators;
     while (iter)
     {
         rstto_image_list_iter_set_position (iter->data, 0);
@@ -289,7 +293,7 @@ cb_rstto_image_list_image_name_compare_func (RsttoImage *a, RsttoImage *b)
 }
 
 GType
-rstto_image_list_iter_get_type ()
+rstto_image_list_iter_get_type (void)
 {
     static GType rstto_image_list_iter_type = 0;
 
diff --git a/src/image_list.h b/src/image_list.h
index 02594da..49ec8a2 100644
--- a/src/image_list.h
+++ b/src/image_list.h
@@ -101,7 +101,7 @@ gboolean rstto_image_list_add_file (RsttoImageList *image_list, GFile *file, GEr
 RsttoImageListIter *rstto_image_list_get_iter (RsttoImageList *image_list);
 
 /** Iter functions */
-GType       rstto_image_list_get_type ();
+GType       rstto_image_list_iter_get_type ();
 RsttoImage *rstto_image_list_iter_get_image (RsttoImageListIter *iter);
 void        rstto_image_list_iter_previous (RsttoImageListIter *iter);
 void        rstto_image_list_iter_next (RsttoImageListIter *iter);
diff --git a/src/main.c b/src/main.c
index da7c896..0a7aba1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -73,6 +73,9 @@ int
 main(int argc, char **argv)
 {
     GError *cli_error = NULL;
+    RsttoSettings *settings;
+    RsttoImageList *image_list;
+    GtkWidget *window;
 
     #ifdef ENABLE_NLS
     bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
@@ -99,10 +102,10 @@ main(int argc, char **argv)
     xfconf_init(NULL);
 
     gtk_window_set_default_icon_name("ristretto");
-    RsttoSettings *settings = rstto_settings_new();
+    settings = rstto_settings_new();
 
-    RsttoImageList *image_list = rstto_image_list_new ();
-    GtkWidget *window = rstto_main_window_new (image_list, FALSE);
+    image_list = rstto_image_list_new ();
+    window = rstto_main_window_new (image_list, FALSE);
 
     if (argc > 1)
     {
diff --git a/src/main_window.c b/src/main_window.c
index f64ab92..2d5dfbd 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -301,7 +301,7 @@ static const GtkRadioActionEntry radio_action_sort_entries[] =
 
 
 GType
-rstto_main_window_get_type ()
+rstto_main_window_get_type (void)
 {
     static GType rstto_main_window_type = 0;
 
@@ -1013,12 +1013,13 @@ cb_rstto_main_window_open_image (GtkWidget *widget, RsttoMainWindow *window)
     GSList *files = NULL, *_files_iter;
     GValue current_uri_val = {0, };
     gchar *uri = NULL;
-    guint pos = 0;
+    gint pos = 0;
+    GtkFileFilter *filter;
 
     g_value_init (&current_uri_val, G_TYPE_STRING);
     g_object_get_property (G_OBJECT(window->priv->settings_manager), "current-uri", &current_uri_val);
 
-    GtkFileFilter *filter = gtk_file_filter_new();
+    filter = gtk_file_filter_new();
 
     dialog = gtk_file_chooser_dialog_new(_("Open image"),
                                          GTK_WINDOW(window),
@@ -1136,12 +1137,13 @@ cb_rstto_main_window_open_folder (GtkWidget *widget, RsttoMainWindow *window)
     const gchar *content_type = NULL;
     gchar *uri = NULL;
     GValue current_uri_val = {0, };
-    guint pos = 0;
+    gint pos = 0;
+    GtkWidget *dialog;
 
     g_value_init (&current_uri_val, G_TYPE_STRING);
     g_object_get_property (G_OBJECT(window->priv->settings_manager), "current-uri", &current_uri_val);
 
-    GtkWidget *dialog = gtk_file_chooser_dialog_new(_("Open folder"),
+    dialog = gtk_file_chooser_dialog_new(_("Open folder"),
                                                     GTK_WINDOW(window),
                                                     GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
                                                     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@@ -1315,10 +1317,11 @@ cb_rstto_main_window_print (GtkWidget *widget, RsttoMainWindow *window)
 {
 
     GtkPrintSettings *print_settings = gtk_print_settings_new ();
-    gtk_print_settings_set_resolution (print_settings, 300);
-
     GtkPrintOperation *print_operation = gtk_print_operation_new (); 
     GtkPageSetup *page_setup = gtk_page_setup_new ();
+
+    gtk_print_settings_set_resolution (print_settings, 300);
+
     gtk_page_setup_set_orientation (page_setup, GTK_PAGE_ORIENTATION_LANDSCAPE);
 
     gtk_print_operation_set_default_page_setup (print_operation, page_setup);
@@ -1495,11 +1498,12 @@ static void
 cb_rstto_main_window_preferences (GtkWidget *widget, RsttoMainWindow *window)
 {
     GValue val1 = {0,};
-    g_value_init (&val1, G_TYPE_UINT);
     GValue val2 = {0,};
+    GtkWidget *dialog = rstto_preferences_dialog_new (GTK_WINDOW (window));
+
+    g_value_init (&val1, G_TYPE_UINT);
     g_value_init (&val2, G_TYPE_UINT);
 
-    GtkWidget *dialog = rstto_preferences_dialog_new (GTK_WINDOW (window));
 
     g_object_get_property (G_OBJECT (window->priv->settings_manager), "image-quality", &val1);
 
@@ -1624,13 +1628,13 @@ cb_rstto_main_window_delete (GtkWidget *widget, RsttoMainWindow *window)
     GFile *file = rstto_image_get_file (image);
     gchar *path = g_file_get_path (file);
     gchar *basename = g_path_get_basename (path);
-    g_object_ref (image);
     GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (window),
                                                 GTK_DIALOG_DESTROY_WITH_PARENT,
                                                 GTK_MESSAGE_WARNING,
                                                 GTK_BUTTONS_OK_CANCEL,
                                                 N_("Are you sure you want to delete image '%s' from disk?"),
                                                 basename);
+    g_object_ref (image);
     if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
     {
         if (g_file_trash (file, NULL, NULL) == TRUE)
@@ -1894,14 +1898,15 @@ cb_rstto_main_window_message_bar_cancel (GtkWidget *widget, RsttoMainWindow *win
 static void
 cb_rstto_main_window_message_bar_open (GtkWidget *widget, RsttoMainWindow *window)
 {
-    gtk_widget_hide (window->priv->message_bar);
-
     GFile *child_file = NULL;
     GFileEnumerator *file_enumarator = NULL;
     GFileInfo *file_info = NULL;
     const gchar *filename = NULL;
     const gchar *content_type = NULL;
 
+    gtk_widget_hide (window->priv->message_bar);
+
+
     file_enumarator = g_file_enumerate_children (window->priv->message_bar_file, "standard::*", 0, 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))
     {
diff --git a/src/picture_viewer.c b/src/picture_viewer.c
index 4336878..1a06d40 100644
--- a/src/picture_viewer.c
+++ b/src/picture_viewer.c
@@ -127,6 +127,14 @@ static gboolean
 rstto_picture_viewer_set_scroll_adjustments(RsttoPictureViewer *, GtkAdjustment *, GtkAdjustment *);
 
 static void
+rstto_marshal_VOID__OBJECT_OBJECT (GClosure     *closure,
+                                   GValue       *return_value,
+                                   guint         n_param_values,
+                                   const GValue *param_values,
+                                   gpointer      invocation_hint,
+                                   gpointer      marshal_data);
+
+static void
 cb_rstto_picture_viewer_value_changed(GtkAdjustment *, RsttoPictureViewer *);
 static void
 cb_rstto_picture_viewer_nav_iter_changed (RsttoImageListIter *iter, gpointer user_data);
@@ -155,7 +163,7 @@ cb_rstto_picture_viewer_popup_menu (RsttoPictureViewer *viewer, gboolean user_da
 static GtkWidgetClass *parent_class = NULL;
 
 GType
-rstto_picture_viewer_get_type ()
+rstto_picture_viewer_get_type (void)
 {
     static GType rstto_picture_viewer_type = 0;
 
@@ -216,7 +224,7 @@ rstto_picture_viewer_init(RsttoPictureViewer *viewer)
  *
  * A marshaller for the set_scroll_adjustments signal.
  */
-void
+static void
 rstto_marshal_VOID__OBJECT_OBJECT (GClosure     *closure,
                                    GValue       *return_value,
                                    guint         n_param_values,
@@ -299,12 +307,12 @@ rstto_picture_viewer_class_init(RsttoPictureViewerClass *viewer_class)
 static void
 rstto_picture_viewer_realize(GtkWidget *widget)
 {
-    g_return_if_fail (widget != NULL);
-    g_return_if_fail (RSTTO_IS_PICTURE_VIEWER(widget));
-
     GdkWindowAttr attributes;
     gint attributes_mask;
 
+    g_return_if_fail (widget != NULL);
+    g_return_if_fail (RSTTO_IS_PICTURE_VIEWER(widget));
+
     GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
 
     attributes.x = widget->allocation.x;
@@ -403,6 +411,10 @@ rstto_picture_viewer_paint (GtkWidget *widget)
     GdkPixbuf *pixbuf = viewer->priv->dst_pixbuf;
     GdkColor color;
     GdkColor line_color;
+    gint i, a, height, width;
+    GdkColor *bg_color = NULL;
+    gdouble m_x1, m_x2, m_y1, m_y2;
+    gint x1, x2, y1, y2;
     GValue val_bg_color = {0, }, val_bg_color_override = {0, }, val_bg_color_fs = {0, };
     g_value_init (&val_bg_color, GDK_TYPE_COLOR);
     g_value_init (&val_bg_color_fs, GDK_TYPE_COLOR);
@@ -417,10 +429,6 @@ rstto_picture_viewer_paint (GtkWidget *widget)
     color.pixel = 0x0;
     line_color.pixel = 0x0;
 
-    gint i, a, height, width;
-
-    GdkColor *bg_color = NULL;
-
     /* required for transparent pixbufs... add double buffering to fix flickering*/
     if(GTK_WIDGET_REALIZED(widget))
     {          
@@ -450,10 +458,10 @@ rstto_picture_viewer_paint (GtkWidget *widget)
         /* Check if there is a destination pixbuf */
         if(pixbuf)
         {
-            gint x1 = (widget->allocation.width-gdk_pixbuf_get_width(pixbuf))<0?0:(widget->allocation.width-gdk_pixbuf_get_width(pixbuf))/2;
-            gint y1 = (widget->allocation.height-gdk_pixbuf_get_height(pixbuf))<0?0:(widget->allocation.height-gdk_pixbuf_get_height(pixbuf))/2;
-            gint x2 = gdk_pixbuf_get_width(pixbuf);
-            gint y2 = gdk_pixbuf_get_height(pixbuf);
+            x1 = (widget->allocation.width-gdk_pixbuf_get_width(pixbuf))<0?0:(widget->allocation.width-gdk_pixbuf_get_width(pixbuf))/2;
+            y1 = (widget->allocation.height-gdk_pixbuf_get_height(pixbuf))<0?0:(widget->allocation.height-gdk_pixbuf_get_height(pixbuf))/2;
+            x2 = gdk_pixbuf_get_width(pixbuf);
+            y2 = gdk_pixbuf_get_height(pixbuf);
             
             /* We only need to paint a checkered background if the image is transparent */
             if(gdk_pixbuf_get_has_alpha(pixbuf))
@@ -509,7 +517,6 @@ rstto_picture_viewer_paint (GtkWidget *widget)
             {
                 gdk_gc_set_foreground(gc,
                         &(widget->style->fg[GTK_STATE_SELECTED]));
-                gdouble m_x1, m_x2, m_y1, m_y2;
 
                 if (viewer->priv->motion.x < viewer->priv->motion.current_x)
                 {
@@ -604,10 +611,10 @@ rstto_picture_viewer_paint (GtkWidget *widget)
             gdk_pixbuf_saturate_and_pixelate (pixbuf, pixbuf, 0, TRUE);
             pixbuf = gdk_pixbuf_composite_color_simple (pixbuf, (size*0.8), (size*0.8), GDK_INTERP_BILINEAR, 40, 40, bg_color->pixel, bg_color->pixel);
 
-            gint x1 = (widget->allocation.width-gdk_pixbuf_get_width(pixbuf))<0?0:(widget->allocation.width-gdk_pixbuf_get_width(pixbuf))/2;
-            gint y1 = (widget->allocation.height-gdk_pixbuf_get_height(pixbuf))<0?0:(widget->allocation.height-gdk_pixbuf_get_height(pixbuf))/2;
-            gint x2 = gdk_pixbuf_get_width(pixbuf);
-            gint y2 = gdk_pixbuf_get_height(pixbuf);
+            x1 = (widget->allocation.width-gdk_pixbuf_get_width(pixbuf))<0?0:(widget->allocation.width-gdk_pixbuf_get_width(pixbuf))/2;
+            y1 = (widget->allocation.height-gdk_pixbuf_get_height(pixbuf))<0?0:(widget->allocation.height-gdk_pixbuf_get_height(pixbuf))/2;
+            x2 = gdk_pixbuf_get_width(pixbuf);
+            y2 = gdk_pixbuf_get_height(pixbuf);
 
             gdk_draw_pixbuf(GDK_DRAWABLE(buffer), 
                             NULL, 
@@ -681,7 +688,7 @@ cb_rstto_picture_viewer_value_changed(GtkAdjustment *adjustment, RsttoPictureVie
 }
 
 GtkWidget *
-rstto_picture_viewer_new()
+rstto_picture_viewer_new (void)
 {
     GtkWidget *widget;
 
@@ -691,7 +698,7 @@ rstto_picture_viewer_new()
 }
 
 void
-rstto_picture_viewer_set_scale(RsttoPictureViewer *viewer, gdouble scale)
+rstto_picture_viewer_set_scale (RsttoPictureViewer *viewer, gdouble scale)
 {
     gdouble *img_scale;
     GdkPixbuf *src_pixbuf = NULL;
diff --git a/src/picture_viewer.h b/src/picture_viewer.h
index d17b830..655a012 100644
--- a/src/picture_viewer.h
+++ b/src/picture_viewer.h
@@ -70,12 +70,15 @@ GType      rstto_picture_viewer_get_type();
 GtkWidget *rstto_picture_viewer_new ();
 void       rstto_picture_viewer_set_iter (RsttoPictureViewer *, RsttoImageListIter *);
 gdouble    rstto_picture_viewer_get_scale(RsttoPictureViewer *viewer);
+void       rstto_picture_viewer_set_scale (RsttoPictureViewer *,gdouble);
 
 void       rstto_picture_viewer_zoom_fit (RsttoPictureViewer *viewer);
 void       rstto_picture_viewer_zoom_100 (RsttoPictureViewer *viewer);
 void       rstto_picture_viewer_zoom_in  (RsttoPictureViewer *viewer, gdouble factor);
 void       rstto_picture_viewer_zoom_out (RsttoPictureViewer *viewer, gdouble factor);
 
+void       rstto_picture_viewer_set_menu (RsttoPictureViewer *viewer, GtkMenu *menu);
+
 /**
 gdouble    rstto_picture_viewer_fit_scale(RsttoPictureViewer *viewer);
 
diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c
index 60db4c0..2db41e4 100644
--- a/src/preferences_dialog.c
+++ b/src/preferences_dialog.c
@@ -95,7 +95,7 @@ struct _RsttoPreferencesDialogPriv
 };
 
 GType
-rstto_preferences_dialog_get_type ()
+rstto_preferences_dialog_get_type (void)
 {
     static GType rstto_preferences_dialog_type = 0;
 
@@ -123,16 +123,31 @@ rstto_preferences_dialog_get_type ()
 static void
 rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog)
 {
-    dialog->priv = g_new0 (RsttoPreferencesDialogPriv, 1);
-
-    dialog->priv->settings = rstto_settings_new ();
     guint uint_image_quality;
     guint uint_cache_size;
     guint uint_preload_images;
     gboolean bool_enable_cache;
     gboolean bool_bgcolor_override;
     GdkColor *bgcolor;
+    GtkWidget *scroll_frame, *scroll_vbox;
+    GtkWidget *timeout_frame, *timeout_vbox, *timeout_lbl, *timeout_hscale;
+    GtkWidget *scaling_frame, *scaling_vbox;
+    GtkWidget *widget;
+    GtkObject *cache_adjustment;
+    GtkWidget *display_main_vbox;
+    GtkWidget *display_main_lbl;
+    GtkWidget *slideshow_main_vbox;
+    GtkWidget *slideshow_main_lbl;
+    GtkWidget *control_main_vbox;
+    GtkWidget *control_main_lbl;
+    GtkWidget *behaviour_main_vbox;
+    GtkWidget *behaviour_main_lbl;
+    GtkWidget *notebook = gtk_notebook_new ();
+
+
+    dialog->priv = g_new0 (RsttoPreferencesDialogPriv, 1);
 
+    dialog->priv->settings = rstto_settings_new ();
     g_object_get (G_OBJECT (dialog->priv->settings),
                   "image-quality", &uint_image_quality,
                   "cache-size", &uint_cache_size,
@@ -142,20 +157,11 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog)
                   "bgcolor", &bgcolor,
                   NULL);
 
-    GtkObject *cache_adjustment;
-
-    GtkWidget *notebook = gtk_notebook_new ();
-    GtkWidget *scroll_frame, *scroll_vbox;
-    GtkWidget *timeout_frame, *timeout_vbox, *timeout_lbl, *timeout_hscale;
-    GtkWidget *scaling_frame, *scaling_vbox;
-
-    GtkWidget *widget;
-
 /*****************/
 /** DISPLAY TAB **/
 /*****************/
-    GtkWidget *display_main_vbox = gtk_vbox_new(FALSE, 0);
-    GtkWidget *display_main_lbl = gtk_label_new(_("Display"));
+    display_main_vbox = gtk_vbox_new(FALSE, 0);
+    display_main_lbl = gtk_label_new(_("Display"));
     gtk_notebook_append_page(GTK_NOTEBOOK(notebook), display_main_vbox, display_main_lbl);
 
 /** Bg-color frame */
@@ -239,8 +245,8 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog)
 /*******************/
 /** Slideshow tab **/
 /*******************/
-    GtkWidget *slideshow_main_vbox = gtk_vbox_new(FALSE, 0);
-    GtkWidget *slideshow_main_lbl = gtk_label_new(_("Slideshow"));
+    slideshow_main_vbox = gtk_vbox_new(FALSE, 0);
+    slideshow_main_lbl = gtk_label_new(_("Slideshow"));
     gtk_notebook_append_page(GTK_NOTEBOOK(notebook), slideshow_main_vbox, slideshow_main_lbl);
     /* not used */
     gtk_widget_set_sensitive (slideshow_main_vbox, FALSE);
@@ -260,8 +266,8 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog)
 
 
 /********************************************/
-    GtkWidget *control_main_vbox = gtk_vbox_new(FALSE, 0);
-    GtkWidget *control_main_lbl = gtk_label_new(_("Control"));
+    control_main_vbox = gtk_vbox_new(FALSE, 0);
+    control_main_lbl = gtk_label_new(_("Control"));
     gtk_notebook_append_page(GTK_NOTEBOOK(notebook), control_main_vbox, control_main_lbl);
 
     scroll_vbox = gtk_vbox_new(FALSE, 0);
@@ -279,8 +285,8 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog)
 /*******************/
 /** Behaviour tab **/
 /*******************/
-    GtkWidget *behaviour_main_vbox = gtk_vbox_new(FALSE, 0);
-    GtkWidget *behaviour_main_lbl = gtk_label_new(_("Behaviour"));
+    behaviour_main_vbox = gtk_vbox_new(FALSE, 0);
+    behaviour_main_lbl = gtk_label_new(_("Behaviour"));
     gtk_notebook_append_page(GTK_NOTEBOOK(notebook), behaviour_main_vbox, behaviour_main_lbl);
 
 
diff --git a/src/settings.c b/src/settings.c
index 95a5a06..1bf543d 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -70,7 +70,7 @@ enum
 };
 
 GType
-rstto_settings_get_type ()
+rstto_settings_get_type (void)
 {
     static GType rstto_settings_type = 0;
 
@@ -351,7 +351,7 @@ rstto_settings_finalize (GObject *object)
  * Singleton
  */
 RsttoSettings *
-rstto_settings_new ()
+rstto_settings_new (void)
 {
     if (settings_object == NULL)
     {
diff --git a/src/thumbnail.c b/src/thumbnail.c
index 5a85d3a..18e38e3 100644
--- a/src/thumbnail.c
+++ b/src/thumbnail.c
@@ -53,7 +53,7 @@ static void
 rstto_thumbnail_clicked(GtkButton *);
 
 GType
-rstto_thumbnail_get_type ()
+rstto_thumbnail_get_type (void)
 {
     static GType rstto_thumbnail_type = 0;
 
@@ -161,6 +161,7 @@ rstto_thumbnail_paint(RsttoThumbnail *thumb)
     GtkWidget *widget = GTK_WIDGET(thumb);
 
     GtkStateType state = GTK_WIDGET_STATE(widget);
+    GdkPixbuf *pixbuf;
 
     if(thumb->priv->image)
     {
@@ -169,7 +170,7 @@ rstto_thumbnail_paint(RsttoThumbnail *thumb)
         {
         }
 
-        GdkPixbuf *pixbuf = rstto_image_get_thumbnail (
+        pixbuf = rstto_image_get_thumbnail (
                                 thumb->priv->image);
 
         gtk_paint_box(widget->style,
@@ -203,10 +204,11 @@ rstto_thumbnail_new (RsttoImage *image)
 {
     gchar *path, *basename;
     GFile *file = NULL;
+    RsttoThumbnail *thumb;
 
     g_return_val_if_fail (image != NULL, NULL);
 
-    RsttoThumbnail *thumb = g_object_new(RSTTO_TYPE_THUMBNAIL, NULL);
+    thumb = g_object_new(RSTTO_TYPE_THUMBNAIL, NULL);
 
     thumb->priv->image = image;
     g_object_ref (image);
diff --git a/src/thumbnail_bar.c b/src/thumbnail_bar.c
index 81e9630..a0d80a9 100644
--- a/src/thumbnail_bar.c
+++ b/src/thumbnail_bar.c
@@ -108,7 +108,7 @@ static gint
 cb_rstto_thumbnail_bar_compare (GtkWidget *a, GtkWidget *b, gpointer);
 
 GType
-rstto_thumbnail_bar_get_type ()
+rstto_thumbnail_bar_get_type (void)
 {
     static GType rstto_thumbnail_bar_type = 0;
 
@@ -196,12 +196,11 @@ rstto_thumbnail_bar_size_request(GtkWidget *widget, GtkRequisition *requisition)
 {
     RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(widget);
     gint border_width = GTK_CONTAINER(bar)->border_width;
+    GList *iter;
+	GtkRequisition child_requisition;
 
     gtk_widget_style_get(widget, "border-width", &border_width, NULL);
 
-    GList *iter;
-
-	GtkRequisition child_requisition;
 
     requisition->height = 70;
     requisition->width = 70;
@@ -226,17 +225,18 @@ rstto_thumbnail_bar_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
     RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(widget);
     gint border_width = GTK_CONTAINER(bar)->border_width;
     gint spacing = 0;
-	gtk_widget_style_get(widget, "spacing", &spacing, NULL);
-    widget->allocation = *allocation;
     GtkAllocation child_allocation;
     GtkRequisition child_requisition;
+    GList *iter = bar->priv->thumbs;
+
+	gtk_widget_style_get(widget, "spacing", &spacing, NULL);
+    widget->allocation = *allocation;
 
     child_allocation.x = border_width;
     child_allocation.y = border_width;
     child_allocation.height = border_width * 2;
     child_allocation.width = border_width * 2;
 
-    GList *iter = bar->priv->thumbs;
 
     if (GTK_WIDGET_REALIZED(widget))
     {
@@ -541,8 +541,8 @@ rstto_thumbnail_bar_get_orientation (RsttoThumbnailBar *bar)
 static void
 rstto_thumbnail_bar_add(GtkContainer *container, GtkWidget *child)
 {
-	g_return_if_fail(GTK_IS_WIDGET(child));
     RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(container);
+	g_return_if_fail(GTK_IS_WIDGET(child));
 
 	gtk_widget_set_parent(child, GTK_WIDGET(container));
 
@@ -552,11 +552,12 @@ rstto_thumbnail_bar_add(GtkContainer *container, GtkWidget *child)
 static void
 rstto_thumbnail_bar_remove(GtkContainer *container, GtkWidget *child)
 {
-	g_return_if_fail(GTK_IS_WIDGET(child));
-
     RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(container);
 	gboolean widget_was_visible;
 
+	g_return_if_fail(GTK_IS_WIDGET(child));
+
+
 	widget_was_visible = GTK_WIDGET_VISIBLE(child);
 
     bar->priv->thumbs = g_list_remove(bar->priv->thumbs, child);
@@ -772,10 +773,12 @@ static void
 cb_rstto_thumbnail_bar_image_list_new_image (RsttoImageList *image_list, RsttoImage *image, gpointer user_data)
 {
     RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR (user_data);
+    GtkWidget *thumb;
 
     g_return_if_fail (rstto_image_list_iter_find_image (bar->priv->internal_iter, image));
 
-    GtkWidget *thumb = rstto_thumbnail_new (image);
+    thumb = rstto_thumbnail_new (image);
+
     gtk_container_add (GTK_CONTAINER (bar), thumb);
     gtk_widget_show (thumb);
 


More information about the Xfce4-commits mailing list