[Xfce4-commits] ristretto:master Add comments
Updating branch refs/heads/master to fc5c6144829101e0403382a0533ed98eac4c6f5a (commit) from fe8798d4f12b306f6a97c1f63a4fb94bde329c49 (commit) commit fc5c6144829101e0403382a0533ed98eac4c6f5a Author: Stephan Arts step...@xfce.org Date: Sat Apr 28 19:17:26 2012 +0200 Add comments src/preferences_dialog.c | 191 +++--- 1 files changed, 181 insertions(+), 10 deletions(-) diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c index d384a5f..7f63284 100644 --- a/src/preferences_dialog.c +++ b/src/preferences_dialog.c @@ -579,63 +579,234 @@ cb_rstto_preferences_dialog_hide_thumbnails_fullscreen_check_button_toggled ( rstto_settings_set_boolean_property (dialog-priv-settings, hide-thumbnailbar-fullscreen, gtk_toggle_button_get_active(button)); } +/** + * cb_wrap_images_check_button_toggled: + * @button:The check-button the user clicked. + * @user_data: The user-data provided when connecting the + * callback-function, the preferences-dialog. + * + * + * This function is called when a user toggles the 'wrap-images' + * check-button. This function then sets the right property in the + * ristretto settings container. + * + * When this property is set, the list of images can 'wrap', allowing + * the user to go to the first image when moving beyond the last image + * and vice-versa. + * + * + * active = toggle_button_get_active () + * + * if ( active == TRUE ) then + * + * set_property ( wrap-images, TRUE ); + * + * else + * + * set_property ( wrap-images, FALSE ); + * + * endif + */ static void -cb_wrap_images_check_button_toggled (GtkToggleButton *button, - gpointer user_data) +cb_wrap_images_check_button_toggled ( +GtkToggleButton *button, +gpointer user_data) { -RsttoPreferencesDialog *dialog = RSTTO_PREFERENCES_DIALOG (user_data); +/* Variable Section */ + +RsttoPreferencesDialog *dialog = RSTTO_PREFERENCES_DIALOG ( user_data ); +gboolean wrap_images = gtk_toggle_button_get_active ( button ); + + +/* Code Section */ rstto_settings_set_boolean_property ( dialog-priv-settings, wrap-images, -gtk_toggle_button_get_active(button)); +wrap_images ); } +/** + * cb_maximize_on_startup_check_button_toggled: + * @button:The check-button the user clicked. + * @user_data: The user-data provided when connecting the + * callback-function, the preferences-dialog. + * + * + * This function is called when a user toggles the 'maximize-on-startup' + * check-button. This function then sets the right property in the + * ristretto settings container. + * + * When this property is set, the main-window is maximized directly when + * an image is opened on startup. + * + * + * active = toggle_button_get_active () + * + * if ( active == TRUE ) then + * + * set_property ( maximize-on-startup, TRUE ); + * + * else + * + * set_property ( maximize-on-startup, FALSE ); + * + * endif + */ static void cb_maximize_on_startup_check_button_toggled ( GtkToggleButton *button, gpointer user_data) { -RsttoPreferencesDialog *dialog = RSTTO_PREFERENCES_DIALOG (user_data); +/* Variable Section */ + +RsttoPreferencesDialog *dialog = RSTTO_PREFERENCES_DIALOG ( user_data ); +gboolean maximize_on_startup = gtk_toggle_button_get_active ( button ); + + +/* Code Section */ rstto_settings_set_boolean_property ( dialog-priv-settings, maximize-on-startup, -gtk_toggle_button_get_active(button)); +maximize_on_startup ); } +/** + * cb_show_clock_check_button_toggled: + * @button:The check-button the user clicked. + * @user_data: The user-data provided when connecting the + * callback-function, the preferences-dialog. + * + * + * This function is called when a user toggles the 'show-clock' + * check-button. This function then sets the right property in the + * ristretto settings container. + * + * When this property is set, a clock is rendered on the image-viewer + * widget when the window is in fullscreen mode. + * + * + * active = toggle_button_get_active () + * + * if ( active == TRUE ) then + * + * set_property ( show-clock, TRUE ); + * + * else + * + * set_property ( show-clock, FALSE ); + * + * endif + */ static void cb_show_clock_check_button_toggled ( GtkToggleButton *button, gpointer user_data) { -RsttoPreferencesDialog *dialog = RSTTO_PREFERENCES_DIALOG (user_data); +/* Variable Section */ + +RsttoPreferencesDialog *dialog = RSTTO_PREFERENCES_DIALOG ( user_data ); +gboolean show_clock = gtk_toggle_button_get_active ( button ); + +/* Code Section */ rstto_settings_set_boolean_property ( dialog-priv-settings, show-clock, -
[Xfce4-commits] ristretto:master Add comments and improve code-style
Updating branch refs/heads/master to cadd5c8eb1d4ecfdad1c7f420f89deeff30ef256 (commit) from f098e3cee22637634e52f2d1072de715bd221e43 (commit) commit cadd5c8eb1d4ecfdad1c7f420f89deeff30ef256 Author: Stephan Arts step...@xfce.org Date: Sat Apr 28 20:50:46 2012 +0200 Add comments and improve code-style src/main_window.c|6 +- src/preferences_dialog.c | 288 +- src/settings.c | 40 +++--- 3 files changed, 257 insertions(+), 77 deletions(-) diff --git a/src/main_window.c b/src/main_window.c index 3bc2fd7..df4d8e4 100644 --- a/src/main_window.c +++ b/src/main_window.c @@ -1584,7 +1584,7 @@ rstto_main_window_update_buttons (RsttoMainWindow *window) { if (rstto_settings_get_boolean_property ( window-priv-settings_manager, -hide-thumbnailbar-fullscreen)) +hide-thumbnails-fullscreen)) { gtk_widget_hide (window-priv-t_bar_s_window); } @@ -1690,7 +1690,7 @@ rstto_main_window_update_buttons (RsttoMainWindow *window) { if (rstto_settings_get_boolean_property ( window-priv-settings_manager, -hide-thumbnailbar-fullscreen)) +hide-thumbnails-fullscreen)) { gtk_widget_hide (window-priv-t_bar_s_window); } @@ -2242,7 +2242,7 @@ cb_rstto_main_window_state_event(GtkWidget *widget, GdkEventWindowState *event, } } -if (rstto_settings_get_boolean_property (window-priv-settings_manager, hide-thumbnailbar-fullscreen)) +if (rstto_settings_get_boolean_property (window-priv-settings_manager, hide-thumbnails-fullscreen)) { gtk_widget_hide (window-priv-t_bar_s_window); } diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c index 7f63284..574bd75 100644 --- a/src/preferences_dialog.c +++ b/src/preferences_dialog.c @@ -45,17 +45,22 @@ rstto_preferences_dialog_dispose (GObject *object); static void -cb_rstto_preferences_dialog_bgcolor_override_toggled (GtkToggleButton *, gpointer); +cb_bgcolor_override_toggled ( +GtkToggleButton *, +gpointer); static void -cb_rstto_preferences_dialog_bgcolor_color_set (GtkColorButton *, gpointer); - +cb_bgcolor_color_set ( +GtkColorButton *, +gpointer ); static void -cb_rstto_preferences_dialog_zoom_revert_check_button_toggled (GtkToggleButton *, gpointer); +cb_invert_zoom_direction_check_button_toggled ( +GtkToggleButton *, +gpointer ); static void -cb_rstto_preferences_dialog_hide_thumbnails_fullscreen_check_button_toggled ( -GtkToggleButton *button, -gpointer user_data); +cb_hide_thumbnails_fullscreen_check_button_toggled ( +GtkToggleButton *button, +gpointer user_data); static void cb_show_clock_check_button_toggled ( GtkToggleButton *button, @@ -77,7 +82,9 @@ cb_choose_desktop_combo_box_changed ( GtkComboBox *combo_box, gpointer user_data); static void -cb_rstto_preferences_dialog_slideshow_timeout_value_changed (GtkRange *, gpointer); +cb_slideshow_timeout_value_changed ( +GtkRange *, +gpointer); static GtkWidgetClass *parent_class = NULL; @@ -123,7 +130,7 @@ struct _RsttoPreferencesDialogPriv { GtkWidget *scroll_frame; GtkWidget *scroll_vbox; -GtkWidget *zoom_revert_check_button; +GtkWidget *zoom_invert_check_button; } control_tab; struct @@ -170,10 +177,10 @@ rstto_preferences_dialog_get_type (void) static void rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog) { -gboolean bool_revert_zoom_direction; +gboolean bool_invert_zoom_direction; gboolean bool_bgcolor_override; guint uint_slideshow_timeout; -gboolean bool_hide_thumbnailbar_fullscreen; +gboolean bool_hide_thumbnails_fullscreen; gboolean bool_wrap_images; gboolean bool_maximize_on_startup; gboolean bool_show_clock; @@ -200,11 +207,11 @@ rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog) dialog-priv-settings = rstto_settings_new (); g_object_get (G_OBJECT (dialog-priv-settings), - revert-zoom-direction, bool_revert_zoom_direction, + invert-zoom-direction, bool_invert_zoom_direction, bgcolor-override, bool_bgcolor_override, bgcolor, bgcolor, slideshow-timeout, uint_slideshow_timeout, - hide-thumbnailbar-fullscreen, bool_hide_thumbnailbar_fullscreen, +
[Xfce4-commits] ristretto:master Add comments
Updating branch refs/heads/master to 5431a9e9a3b74efaf99f76e1874bb6c91995d806 (commit) from 0203622b877a2bf7d8eb8b3211df2405c9b1593f (commit) commit 5431a9e9a3b74efaf99f76e1874bb6c91995d806 Author: Stephan Arts step...@xfce.org Date: Sun Apr 29 00:55:58 2012 +0200 Add comments src/monitor_chooser.c | 45 + 1 files changed, 45 insertions(+), 0 deletions(-) diff --git a/src/monitor_chooser.c b/src/monitor_chooser.c index cc8231e..c5a449f 100644 --- a/src/monitor_chooser.c +++ b/src/monitor_chooser.c @@ -611,6 +611,11 @@ paint_monitor ( GtkWidget *widget, pango_font_description_free (font_description); } +/** + * rstto_monitor_chooser_new: + * + * @Returns: a new monitor-chooser object. + */ GtkWidget * rstto_monitor_chooser_new ( void ) { @@ -621,6 +626,14 @@ rstto_monitor_chooser_new ( void ) return GTK_WIDGET(chooser); } +/** + * rstto_monitor_chooser_add: + * @chooser: MonitorChooser + * @width: monitor-width (pixels) + * @height: monitor-height (pixels) + * + * Add a monitor to the monitor-chooser. + */ gint rstto_monitor_chooser_add ( RsttoMonitorChooser *chooser, @@ -657,6 +670,16 @@ rstto_monitor_chooser_add ( return id; } +/** + * rstto_monitor_chooser_set_image_surface: + * @chooser:Monitor chooser + * @monitor_id: Monitor number + * @surface:Surface + * @error: + * + * Set the image-surface for a specific monitor. (the image visible in + * the monitor ) + */ gint rstto_monitor_chooser_set_image_surface ( RsttoMonitorChooser *chooser, @@ -690,6 +713,13 @@ rstto_monitor_chooser_set_image_surface ( return retval; } +/** + * cb_rstto_button_press_event: + * @widget: Monitor-Chooser widget + * @event: Event + * + * Switch the monitor based on the location where a user clicks. + */ static void cb_rstto_button_press_event ( GtkWidget *widget, @@ -745,6 +775,12 @@ cb_rstto_button_press_event ( } } +/** + * rstto_monitor_chooser_get_selected: + * @chooser: The monitor-chooser widget + * + * Returns the id of the selected monitor. + */ gint rstto_monitor_chooser_get_selected ( RsttoMonitorChooser *chooser ) @@ -752,6 +788,15 @@ rstto_monitor_chooser_get_selected ( return chooser-priv-selected; } +/** + * rstto_monitor_chooser_get_dimensions: + * @chooser: The monitor-chooser widget + * @nr: The monitor-number + * @width: A gint to store the width of the monitor (in pixels) + * @height: A gint to store the height of the monitor (in pixels) + * + * Returns the dimensions of a monitor identified by 'nr'. + */ void rstto_monitor_chooser_get_dimensions ( RsttoMonitorChooser *chooser, ___ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits
[Xfce4-commits] ristretto:master Add comments
Updating branch refs/heads/master to d72dfdd29ff81875b7a78e2f27517353367c5fc3 (commit) from c331e49671a8cf578e7159732d6a84e08db42670 (commit) commit d72dfdd29ff81875b7a78e2f27517353367c5fc3 Author: Stephan Arts step...@xfce.org Date: Fri Jan 6 18:38:00 2012 +0100 Add comments src/main_window.c | 38 +++--- 1 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/main_window.c b/src/main_window.c index 26577fe..cb13fd4 100644 --- a/src/main_window.c +++ b/src/main_window.c @@ -2998,16 +2998,21 @@ cb_rstto_main_window_properties (GtkWidget *widget, RsttoMainWindow *window) gboolean use_thunar_properties = rstto_settings_get_boolean_property ( window-priv-settings_manager, use-thunar-properties); -if (file) + +if (NULL != file) { -/* TODO: Add a property that allows forcing the built-in - * properties dialog - * - * For now this is here for development purposes. +/* Check if we should first ask Thunar + * to show the file properties dialog. */ if ( TRUE == use_thunar_properties ) { +/* Get the file-uri */ uri = rstto_file_get_uri(file); + +/* Call the DisplayFileProperties dbus + * interface. If it fails, fall back to the + * internal properties-dialog. + */ if(dbus_g_proxy_call(window-priv-filemanager_proxy, DisplayFileProperties, error, @@ -3018,42 +3023,53 @@ cb_rstto_main_window_properties (GtkWidget *widget, RsttoMainWindow *window) G_TYPE_INVALID) == FALSE) { g_warning(DBUS CALL FAILED: '%s', error-message); + +/* Create the internal file-properties dialog */ dialog = rstto_properties_dialog_new ( GTK_WINDOW (window), file); + gtk_dialog_run (GTK_DIALOG(dialog)); + +/* Cleanup the file-properties dialog */ gtk_widget_destroy(dialog); } } else { +/* Create the internal file-properties dialog */ dialog = rstto_properties_dialog_new ( GTK_WINDOW (window), file); + gtk_dialog_run (GTK_DIALOG(dialog)); + +/* Cleanup the file-properties dialog */ gtk_widget_destroy(dialog); } } } + /** * cb_rstto_main_window_close: * @widget: * @window: * + * Close all images. * + * Set the directory to NULL, the image-list-iter will emit an + * 'iter-changed' signal. The ui will be updated in response to + * that just like it is when an image is opened. */ static void -cb_rstto_main_window_close (GtkWidget *widget, RsttoMainWindow *window) +cb_rstto_main_window_close ( +GtkWidget *widget, +RsttoMainWindow *window) { rstto_image_list_set_directory ( window-priv-image_list, NULL, NULL); - -rstto_main_window_image_list_iter_changed (window); - -rstto_main_window_update_buttons (window); -rstto_main_window_image_list_iter_changed (window); } /** ___ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits
[Xfce4-commits] ristretto:master Add comments
Updating branch refs/heads/master to 28e64d4b4847b4f1068e6eeb9f177282693b09f4 (commit) from c1c9ec7cc7465d7c042ddbfe758446657553dc29 (commit) commit 28e64d4b4847b4f1068e6eeb9f177282693b09f4 Author: Stephan Arts step...@xfce.org Date: Tue Jul 26 20:57:04 2011 +0200 Add comments src/image_viewer.c | 25 +++-- 1 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/image_viewer.c b/src/image_viewer.c index fff16a4..155e886 100644 --- a/src/image_viewer.c +++ b/src/image_viewer.c @@ -422,6 +422,7 @@ rstto_image_viewer_set_scroll_adjustments(RsttoImageViewer *viewer, GtkAdjustmen return TRUE; } + static void rstto_image_viewer_paint (GtkWidget *widget) { @@ -450,9 +451,17 @@ rstto_image_viewer_paint (GtkWidget *widget) /* required for transparent pixbufs... add double buffering to fix flickering*/ if(GTK_WIDGET_REALIZED(widget)) { + +/* + * Create a buffer to draw on + */ GdkPixmap *buffer = gdk_pixmap_new(NULL, widget-allocation.width, widget-allocation.height, gdk_drawable_get_depth(widget-window)); GdkGC *gc = gdk_gc_new(GDK_DRAWABLE(buffer)); +/* + * Determine the background-color and draw the background. + */ + if(gdk_window_get_state(gdk_window_get_toplevel(GTK_WIDGET(viewer)-window)) GDK_WINDOW_STATE_FULLSCREEN) { bg_color = g_value_get_boxed (val_bg_color_fs); @@ -477,9 +486,15 @@ rstto_image_viewer_paint (GtkWidget *widget) gdk_draw_rectangle(GDK_DRAWABLE(buffer), gc, TRUE, 0, 0, widget-allocation.width, widget-allocation.height); -/* Check if there is a destination pixbuf */ + +/* + * Check if there is a source image + */ if(pixbuf) { +/* + * Draw the image on the background + */ 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); @@ -505,7 +520,9 @@ rstto_image_viewer_paint (GtkWidget *widget) } else { -/* HACK HACK HACK HACK */ +/* + * There is no image, draw the ristretto icon on the background + */ guint size = 0; if ((GTK_WIDGET (viewer)-allocation.width) (GTK_WIDGET (viewer)-allocation.height)) { @@ -545,6 +562,10 @@ rstto_image_viewer_paint (GtkWidget *widget) } } +/* + * Draw the buffer on the window + */ + gdk_draw_drawable(GDK_DRAWABLE(widget-window), gdk_gc_new(widget-window), buffer, ___ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits
[Xfce4-commits] ristretto:master Add comments
Updating branch refs/heads/master to dce4a45dd28776e3c1ab7b5acd98c8f08a20904d (commit) from e4fc47673dd86cc63a9ec691ed91e0da94218188 (commit) commit dce4a45dd28776e3c1ab7b5acd98c8f08a20904d Author: Stephan Arts step...@xfce.org Date: Sun Aug 7 00:36:01 2011 +0200 Add comments src/image_viewer.c | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/image_viewer.c b/src/image_viewer.c index 04f7031..0108814 100644 --- a/src/image_viewer.c +++ b/src/image_viewer.c @@ -1777,6 +1777,11 @@ cb_rstto_image_viewer_button_release_event (RsttoImageViewer *viewer, GdkEventBu viewer-priv-scale = scale; +/* + * Prevent the adjustments from emitting the 'changed' signal, + * this way both the upper-limit and value can be changed before the + * rest of the application is informed. + */ g_object_freeze_notify(G_OBJECT(viewer-hadjustment)); g_object_freeze_notify(G_OBJECT(viewer-vadjustment)); @@ -1785,9 +1790,16 @@ cb_rstto_image_viewer_button_release_event (RsttoImageViewer *viewer, GdkEventBu gtk_adjustment_set_upper (viewer-vadjustment, (gdouble)height*(viewer-priv-scale/viewer-priv-image_scale)); gtk_adjustment_set_value (viewer-vadjustment, (tmp_y * scale - ((gdouble)gtk_adjustment_get_page_size(viewer-vadjustment)/2))); +/* + * Enable signals on the adjustments. + */ g_object_thaw_notify(G_OBJECT(viewer-vadjustment)); g_object_thaw_notify(G_OBJECT(viewer-hadjustment)); +/* + * Trigger the 'changed' signal, update the rest of + * the appliaction. + */ gtk_adjustment_changed(viewer-hadjustment); gtk_adjustment_changed(viewer-vadjustment); ___ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits
[Xfce4-commits] ristretto:master Add comments to app_menu_item.c
Updating branch refs/heads/master to d522c352924e929be1dbda2a64bda4a5dda7156e (commit) from d096f15910ca42d01660047f2065c36096767277 (commit) commit d522c352924e929be1dbda2a64bda4a5dda7156e Author: Stephan Arts step...@xfce.org Date: Thu Jul 15 23:37:54 2010 +0200 Add comments to app_menu_item.c src/app_menu_item.c | 23 ++- 1 files changed, 22 insertions(+), 1 deletions(-) diff --git a/src/app_menu_item.c b/src/app_menu_item.c index 01aa634..697aaab 100644 --- a/src/app_menu_item.c +++ b/src/app_menu_item.c @@ -88,6 +88,13 @@ rstto_app_menu_item_class_init(RsttoAppMenuItemClass *app_menu_item_class) menu_item_class-activate = rstto_app_menu_item_activate; } +/** + * rstto_app_menu_item_finalize: + * @object: application-menu-item + * + * Cleanup the app-menu-item internals + * + */ static void rstto_app_menu_item_finalize(GObject *object) { @@ -105,6 +112,12 @@ rstto_app_menu_item_finalize(GObject *object) } +/** + * rstto_app_menu_item_activate: + * @object: GtkMenuItem that is activated + * + * Launch the associated application + */ static void rstto_app_menu_item_activate (GtkMenuItem *object) { @@ -116,7 +129,15 @@ rstto_app_menu_item_activate (GtkMenuItem *object) GTK_MENU_ITEM_CLASS(parent_class)-activate (GTK_MENU_ITEM (object)); } - +/** + * rstto_app_menu_item_new: + * @app_info: Application info + * @file: File + * + * Creates new RsttoAppMenuItem + * + * Returns: RsttoAppMenuItem that launches application @app_info with @file + */ GtkWidget * rstto_app_menu_item_new (GAppInfo *app_info, GFile *file) { ___ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits
[Xfce4-commits] ristretto:master Add comments to image.c
Updating branch refs/heads/master to 0102b0dcef5b71edbf274f167eccdd2eba2f8c5f (commit) from d522c352924e929be1dbda2a64bda4a5dda7156e (commit) commit 0102b0dcef5b71edbf274f167eccdd2eba2f8c5f Author: Stephan Arts step...@xfce.org Date: Fri Jul 16 00:09:11 2010 +0200 Add comments to image.c src/image.c | 281 --- 1 files changed, 172 insertions(+), 109 deletions(-) diff --git a/src/image.c b/src/image.c index 316cd2c..f0344cc 100644 --- a/src/image.c +++ b/src/image.c @@ -116,6 +116,8 @@ struct _RsttoImagePriv gint height; guint max_size; +/* Animation data for animated images (like .gif/.mng) */ +/***/ GdkPixbufAnimation *animation; GdkPixbufAnimationIter *iter; gintanimation_timeout_id; @@ -129,6 +131,7 @@ rstto_image_init (GObject *object) image-priv = g_new0 (RsttoImagePriv, 1); +/* Initialize buffer for image-loading */ image-priv-buffer = g_new0 (guchar, RSTTO_IMAGE_BUFFER_SIZE); image-priv-cancellable = g_cancellable_new(); @@ -144,6 +147,15 @@ rstto_image_class_init (GObjectClass *object_class) object_class-dispose = rstto_image_dispose; +/* The 'updated' signal is emitted when the contents + * of the root pixbuf is changed. This can happen when: + *1) The image-loading is complete, this can be caused by: + * a) The initial load of the image in memory + * b) The image is updated on disk, the monitor has + * triggered a reload, and the loading is complete. + * c) A reload is issued with a different scale + *2) The next frame in an animated image is ready + */ rstto_image_signals[RSTTO_IMAGE_SIGNAL_UPDATED] = g_signal_new(updated, G_TYPE_FROM_CLASS (image_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, @@ -155,6 +167,9 @@ rstto_image_class_init (GObjectClass *object_class) 0, NULL); +/* The 'prepared' signal is emitted when the size of the image is known + * and the initial pixbuf is loaded. - Usually this is still missing the data. + */ rstto_image_signals[RSTTO_IMAGE_SIGNAL_PREPARED] = g_signal_new(prepared, G_TYPE_FROM_CLASS (image_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, @@ -257,14 +272,18 @@ rstto_image_new (GFile *file) if (image-priv-exif_data) { exif_entry = exif_data_get_entry (image-priv-exif_data, EXIF_TAG_ORIENTATION); } +/* Check if the image has exif-data available */ if (exif_entry exif_entry-data != NULL) { +/* Get the image-orientation from EXIF data */ image-priv-orientation = exif_get_short (exif_entry-data, exif_data_get_byte_order (exif_entry-parent-parent)); if (image-priv-orientation == 0) +/* Default orientation */ image-priv-orientation = RSTTO_IMAGE_ORIENT_NONE; } else { +/* Default orientation */ image-priv-orientation = RSTTO_IMAGE_ORIENT_NONE; } @@ -272,83 +291,6 @@ rstto_image_new (GFile *file) } -static void -cb_rstto_image_read_file_ready (GObject *source_object, GAsyncResult *result, gpointer user_data) -{ -GFile *file = G_FILE (source_object); -RsttoImage *image = RSTTO_IMAGE (user_data); -GFileInputStream *file_input_stream = g_file_read_finish (file, result, NULL); - -if (g_cancellable_is_cancelled (image-priv-cancellable)) -{ -g_object_unref (image); -return; -} - - -g_input_stream_read_async (G_INPUT_STREAM (file_input_stream), - image-priv-buffer, - RSTTO_IMAGE_BUFFER_SIZE, - G_PRIORITY_DEFAULT, - NULL, - (GAsyncReadyCallback) cb_rstto_image_read_input_stream_ready, - image); -} - -static void -cb_rstto_image_read_input_stream_ready (GObject *source_object, GAsyncResult *result, gpointer user_data) -{ -RsttoImage *image = RSTTO_IMAGE (user_data); -gssize read_bytes = g_input_stream_read_finish (G_INPUT_STREAM (source_object), result, NULL); -GError *error = NULL; - -if (g_cancellable_is_cancelled (image-priv-cancellable)) -{ -g_object_unref (image); -return; -} - -if (image-priv-loader == NULL) -return; - - -if (read_bytes 0) -{ -if(gdk_pixbuf_loader_write (image-priv-loader, (const guchar *)image-priv-buffer, read_bytes, error) == FALSE) -{ -g_input_stream_close (G_INPUT_STREAM (source_object), NULL, NULL); -g_object_unref (image); -} -else -{ -g_input_stream_read_async (G_INPUT_STREAM (source_object), - image-priv-buffer, -