Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
ristretto
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Avinash Sonawane
ristretto
Commits
f11cf02f
Commit
f11cf02f
authored
Jun 06, 2009
by
Stephan Arts
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compile-warnings
parent
6b6940b9
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
143 additions
and
115 deletions
+143
-115
src/image.c
src/image.c
+28
-34
src/image_cache.c
src/image_cache.c
+2
-2
src/image_cache.h
src/image_cache.h
+1
-0
src/image_list.c
src/image_list.c
+10
-6
src/image_list.h
src/image_list.h
+1
-1
src/main.c
src/main.c
+6
-3
src/main_window.c
src/main_window.c
+17
-12
src/picture_viewer.c
src/picture_viewer.c
+27
-20
src/picture_viewer.h
src/picture_viewer.h
+3
-0
src/preferences_dialog.c
src/preferences_dialog.c
+27
-21
src/settings.c
src/settings.c
+2
-2
src/thumbnail.c
src/thumbnail.c
+5
-3
src/thumbnail_bar.c
src/thumbnail_bar.c
+14
-11
No files found.
src/image.c
View file @
f11cf02f
...
...
@@ -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
)
{
...
...
@@ -533,21 +540,6 @@ rstto_image_get_pixbuf (RsttoImage *image)
return
image
->
priv
->
pixbuf
;
}
/**
* 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
(
time
out
!=
-
1
)
{
/* fix borked stuff */
if
(
time
==
0
)
if
(
time
out
==
0
)
{
g_warning
(
"timeout == 0: defaulting to 40ms"
);
time
=
40
;
time
out
=
40
;
}
image
->
priv
->
animation_timeout_id
=
g_timeout_add
(
time
,
(
GSourceFunc
)
cb_rstto_image_update
,
image
);
image
->
priv
->
animation_timeout_id
=
g_timeout_add
(
time
out
,
(
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
(
time
out
==
0
)
{
g_warning
(
"timeout == 0: defaulting to 40ms"
);
time
=
40
;
time
out
=
40
;
}
image
->
priv
->
animation_timeout_id
=
g_timeout_add
(
time
,
(
GSourceFunc
)
cb_rstto_image_update
,
image
);
image
->
priv
->
animation_timeout_id
=
g_timeout_add
(
time
out
,
(
GSourceFunc
)
cb_rstto_image_update
,
image
);
}
g_signal_emit
(
G_OBJECT
(
image
),
rstto_image_signals
[
RSTTO_IMAGE_SIGNAL_UPDATED
],
0
,
image
,
NULL
);
...
...
src/image_cache.c
View file @
f11cf02f
...
...
@@ -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
)
{
...
...
src/image_cache.h
View file @
f11cf02f
...
...
@@ -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
);
...
...
src/image_list.c
View file @
f11cf02f
...
...
@@ -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
;
...
...
src/image_list.h
View file @
f11cf02f
...
...
@@ -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
);
...
...
src/main.c
View file @
f11cf02f
...
...
@@ -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
)
{
...
...
src/main_window.c
View file @
f11cf02f
...
...
@@ -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
))
{
...
...
src/picture_viewer.c
View file @
f11cf02f
...
...
@@ -126,6 +126,14 @@ rstto_picture_viewer_queued_repaint (RsttoPictureViewer *viewer, gboolean refres
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
...
...
@@ -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
;
...
...
src/picture_viewer.h
View file @
f11cf02f
...
...
@@ -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);
...
...
src/preferences_dialog.c
View file @
f11cf02f
...
...
@@ -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
);
...
...
src/settings.c
View file @
f11cf02f
...
...
@@ -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
)
{
...
...
src/thumbnail.c
View file @
f11cf02f
...
...
@@ -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
;