├── src ├── marshal.list ├── ristretto.gresource.xml ├── print.h ├── file_manager_integration_thunar.h ├── privacy_dialog.h ├── app_menu_item.h ├── properties_dialog.h ├── xfce_wallpaper_manager.h ├── gnome_wallpaper_manager.h ├── thumbnailer.h ├── mime_db.h ├── preferences_dialog.h ├── wallpaper_manager.c ├── file_manager_integration.h ├── tumbler-service-dbus.xml.in ├── wallpaper_manager.h ├── monitor_chooser.h ├── main_window.h ├── meson.build ├── icon_bar.h ├── image_viewer.h ├── file_manager_integration.c ├── settings.h ├── util.h ├── mime_db.c ├── image_list.h ├── app_menu_item.c ├── file.h ├── main_window_ui.xml ├── main.c ├── util.c ├── print.c └── file_manager_integration_thunar.c ├── po ├── meson.build ├── POTFILES.in └── LINGUAS ├── .gitlab-ci.yml ├── icons ├── 16x16 │ ├── org.xfce.ristretto.png │ └── org.xfce.ristretto.svg ├── 24x24 │ ├── org.xfce.ristretto.png │ └── org.xfce.ristretto.svg ├── 32x32 │ ├── org.xfce.ristretto.png │ └── org.xfce.ristretto.svg ├── 48x48 │ ├── org.xfce.ristretto.png │ └── org.xfce.ristretto.svg ├── 64x64 │ ├── org.xfce.ristretto.png │ └── org.xfce.ristretto.svg ├── 96x96 │ ├── org.xfce.ristretto.png │ └── org.xfce.ristretto.svg ├── 128x128 │ └── org.xfce.ristretto.png ├── meson.build └── scalable │ └── org.xfce.ristretto.svg ├── AUTHORS ├── meson_options.txt ├── .scan-build-false-positives ├── xfce-revision.h.in ├── org.xfce.ristretto.desktop.in ├── .clang-format ├── README.md ├── org.xfce.ristretto.appdata.xml.in └── meson.build /src/marshal.list: -------------------------------------------------------------------------------- 1 | VOID:OBJECT,OBJECT 2 | VOID:UINT,BOXED 3 | -------------------------------------------------------------------------------- /po/meson.build: -------------------------------------------------------------------------------- 1 | i18n.gettext(meson.project_name(), preset: 'glib') 2 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | include: 2 | - project: 'xfce/xfce4-dev-tools' 3 | file: '/ci/build_project.yml' 4 | 5 | -------------------------------------------------------------------------------- /icons/16x16/org.xfce.ristretto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xfce-mirror/ristretto/HEAD/icons/16x16/org.xfce.ristretto.png -------------------------------------------------------------------------------- /icons/24x24/org.xfce.ristretto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xfce-mirror/ristretto/HEAD/icons/24x24/org.xfce.ristretto.png -------------------------------------------------------------------------------- /icons/32x32/org.xfce.ristretto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xfce-mirror/ristretto/HEAD/icons/32x32/org.xfce.ristretto.png -------------------------------------------------------------------------------- /icons/48x48/org.xfce.ristretto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xfce-mirror/ristretto/HEAD/icons/48x48/org.xfce.ristretto.png -------------------------------------------------------------------------------- /icons/64x64/org.xfce.ristretto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xfce-mirror/ristretto/HEAD/icons/64x64/org.xfce.ristretto.png -------------------------------------------------------------------------------- /icons/96x96/org.xfce.ristretto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xfce-mirror/ristretto/HEAD/icons/96x96/org.xfce.ristretto.png -------------------------------------------------------------------------------- /icons/128x128/org.xfce.ristretto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xfce-mirror/ristretto/HEAD/icons/128x128/org.xfce.ristretto.png -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Stephan Arts 2 | Igor Zakharov 3 | Gaël Bonithon 4 | 5 | The ristretto-icon is drawn by Simon Steinbeiss and is released under the 6 | same license as the ristretto application. 7 | -------------------------------------------------------------------------------- /src/ristretto.gresource.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | main_window_ui.xml 5 | 6 | 7 | -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | option( 2 | 'libx11', 3 | type: 'feature', 4 | value: 'auto', 5 | description: 'Libx11 support', 6 | ) 7 | 8 | option( 9 | 'service-name-prefix', 10 | type: 'string', 11 | value: '', 12 | description: 'Alternative prefix to org.freedesktop.thumbnails for Tumbler services', 13 | ) 14 | -------------------------------------------------------------------------------- /.scan-build-false-positives: -------------------------------------------------------------------------------- 1 | # gdbus-codegen generated code 2 | tumbler.c:[0-9]+:[0-9]+: warning: Value stored to 'skeleton' during its initialization is never read \[deadcode.DeadStores\] 3 | 4 | # it is initialized just above 5 | image_list.c:[0-9]+:[0-9]+: warning: 2nd function call argument is an uninitialized value \[core.CallAndMessage\] 6 | -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | src/main.c 2 | src/main_window.c 3 | src/app_menu_item.c 4 | src/image_viewer.c 5 | src/icon_bar.c 6 | src/privacy_dialog.c 7 | src/preferences_dialog.c 8 | src/properties_dialog.c 9 | src/image_list.c 10 | src/thumbnailer.c 11 | src/wallpaper_manager.c 12 | src/xfce_wallpaper_manager.c 13 | src/gnome_wallpaper_manager.c 14 | org.xfce.ristretto.desktop.in 15 | org.xfce.ristretto.appdata.xml.in 16 | -------------------------------------------------------------------------------- /xfce-revision.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * The file xfce-revision.h is auto-generated and should not be modified 3 | * directly. Modify the xfce-revision.h.in file and re-run the build 4 | * instead. 5 | */ 6 | 7 | #ifndef INC_XFCE_REVISION_H 8 | #define INC_XFCE_REVISION_H 9 | 10 | #define REVISION "@REVISION@" 11 | 12 | #define VERSION_FULL VERSION "-" REVISION 13 | #define PACKAGE_STRING_FULL PACKAGE " " VERSION_FULL 14 | 15 | #endif /* INC_XFCE_REVISION_H */ 16 | -------------------------------------------------------------------------------- /icons/meson.build: -------------------------------------------------------------------------------- 1 | sizes = [16, 24, 32, 48, 64, 96, 128] 2 | 3 | foreach size : sizes 4 | install_data( 5 | '@0@x@0@'.format(size) / 'org.xfce.ristretto.png', 6 | install_dir: get_option('prefix') / get_option('datadir') / 'icons' / 'hicolor' / '@0@x@0@'.format(size) / 'apps', 7 | ) 8 | endforeach 9 | 10 | install_data( 11 | 'scalable' / 'org.xfce.ristretto.svg', 12 | install_dir: get_option('prefix') / get_option('datadir') / 'icons' / 'hicolor' / 'scalable' / 'apps', 13 | ) 14 | -------------------------------------------------------------------------------- /org.xfce.ristretto.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Name=Ristretto Image Viewer 4 | Comment=Look at your images easily 5 | GenericName=Image Viewer 6 | Exec=ristretto %U 7 | Icon=org.xfce.ristretto 8 | Terminal=false 9 | Type=Application 10 | X-MultipleArgs=false 11 | Categories=GTK;Graphics;Viewer; 12 | Keywords=image;photo;picture;viewer;graphics; 13 | StartupNotify=true 14 | MimeType=image/png;image/gif;image/jpeg;image/bmp;image/x-pixmap;image/tiff;image/svg+xml;image/x-xpixmap;image/webp; 15 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- 1 | # Generated by https://gitlab.xfce.org/infra/transifex 2 | ar 3 | ast 4 | be 5 | bg 6 | ca 7 | cs 8 | da 9 | de 10 | el 11 | en_AU 12 | en_GB 13 | es 14 | et 15 | eu 16 | fi 17 | fr 18 | gl 19 | he 20 | hr 21 | hu 22 | hy_AM 23 | hye 24 | id 25 | ie 26 | is 27 | it 28 | ja 29 | kk 30 | ko 31 | lt 32 | lv 33 | ms 34 | nb 35 | nl 36 | oc 37 | pl 38 | pt_BR 39 | pt 40 | ro 41 | ru 42 | sk 43 | sl 44 | sq 45 | sr 46 | sv 47 | te 48 | th 49 | tr 50 | ug 51 | uk 52 | ur_PK 53 | ur 54 | vi 55 | zh_CN 56 | zh_TW 57 | -------------------------------------------------------------------------------- /src/print.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Gaël Bonithon 2023 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RSTTO_PRINT_H__ 21 | #define __RSTTO_PRINT_H__ 22 | 23 | #include "image_viewer.h" 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | #define RSTTO_TYPE_PRINT rstto_print_get_type () 30 | G_DECLARE_FINAL_TYPE (RsttoPrint, rstto_print, RSTTO, PRINT, GtkPrintOperation) 31 | 32 | RsttoPrint * 33 | rstto_print_new (RsttoImageViewer *viewer); 34 | 35 | gboolean 36 | rstto_print_image_interactive (RsttoPrint *print, 37 | GtkWindow *parent, 38 | GError **error); 39 | 40 | G_END_DECLS 41 | 42 | #endif /* !__RSTTO_PRINT_H__ */ 43 | -------------------------------------------------------------------------------- /src/file_manager_integration_thunar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Dmitry Petrachkov 2025 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RISTRETTO_FILE_MANAGER_INTEGRATION_THUNAR_H__ 21 | #define __RISTRETTO_FILE_MANAGER_INTEGRATION_THUNAR_H__ 22 | 23 | #include "file_manager_integration.h" 24 | 25 | G_BEGIN_DECLS 26 | 27 | #define RSTTO_TYPE_FILE_MANAGER_INTEGRATION_THUNAR (rstto_file_manager_integration_thunar_get_type ()) 28 | G_DECLARE_FINAL_TYPE (RsttoFileManagerIntegrationThunar, rstto_file_manager_integration_thunar, RSTTO, FILE_MANAGER_INTEGRATION_THUNAR, GObject) 29 | 30 | RsttoFileManagerIntegration * 31 | rstto_file_manager_integration_thunar_new (void); 32 | 33 | G_END_DECLS 34 | 35 | #endif /* __RISTRETTO_FILE_MANAGER_INTEGRATION_THUNAR_H__ */ 36 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | Language: Cpp 3 | BasedOnStyle: WebKit 4 | 5 | AlignAfterOpenBracket: Align 6 | AlignEscapedNewlines: DontAlign 7 | AlignOperands: Align 8 | AllowAllParametersOfDeclarationOnNextLine: false 9 | AlwaysBreakAfterReturnType: All 10 | BinPackParameters: false 11 | BreakBeforeBinaryOperators: NonAssignment 12 | BreakBeforeBraces: Allman 13 | IncludeBlocks: Regroup 14 | IncludeCategories: 15 | - Regex: '"util\.h"' 16 | Priority: 0 17 | SortPriority: -1 18 | CaseSensitive: true 19 | - Regex: '"[^/]*"' 20 | Priority: 0 21 | SortPriority: 1 22 | CaseSensitive: true 23 | - Regex: '".*"' 24 | Priority: 2 25 | CaseSensitive: true 26 | - Regex: '<.*>' 27 | Priority: 3 28 | CaseSensitive: true 29 | IndentCaseLabels: true 30 | InsertNewlineAtEOF: true 31 | KeepEmptyLinesAtTheStartOfBlocks: false 32 | MaxEmptyLinesToKeep: 3 33 | PointerAlignment: Right 34 | SpaceAfterCStyleCast: true 35 | SpaceBeforeParens: Always 36 | WhitespaceSensitiveMacros: 37 | # Avoid breaking formatting in the code parameter 38 | - G_DEFINE_TYPE_WITH_CODE 39 | # Buggy workaround to add exceptions to 'SpaceBeforeParens: Always' (see below) 40 | - _ 41 | # Workaround to avoid some alignment bugs when adding a macro to WhitespaceSensitiveMacros, 42 | # see https://github.com/llvm/llvm-project/issues/55443#issuecomment-1953268337 43 | # This doesn't fix all alignment bugs though, so I'd rather make an exception only for '_', 44 | # and not also for 'N_' or 'I_' for example. 45 | # See also https://github.com/llvm/llvm-project/issues/82288 46 | Macros: 47 | - _(x)=x 48 | ... 49 | -------------------------------------------------------------------------------- /src/privacy_dialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RISTRETTO_PRIVACY_DIALOG_H__ 21 | #define __RISTRETTO_PRIVACY_DIALOG_H__ 22 | 23 | #include 24 | 25 | G_BEGIN_DECLS 26 | 27 | #define RSTTO_TYPE_PRIVACY_DIALOG rstto_privacy_dialog_get_type () 28 | G_DECLARE_FINAL_TYPE (RsttoPrivacyDialog, rstto_privacy_dialog, RSTTO, PRIVACY_DIALOG, GtkDialog) 29 | 30 | typedef struct _RsttoPrivacyDialogPrivate RsttoPrivacyDialogPrivate; 31 | 32 | struct _RsttoPrivacyDialog 33 | { 34 | GtkDialog parent; 35 | RsttoPrivacyDialogPrivate *priv; 36 | }; 37 | 38 | 39 | 40 | GtkWidget * 41 | rstto_privacy_dialog_new (GtkWindow *parent, 42 | GtkRecentManager *recent_manager); 43 | 44 | G_END_DECLS 45 | 46 | #endif /* __RISTRETTO_PRIVACY_DIALOG_H__ */ 47 | -------------------------------------------------------------------------------- /src/app_menu_item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RISTRETTO_APP_MENU_ITEM_H__ 21 | #define __RISTRETTO_APP_MENU_ITEM_H__ 22 | 23 | #include 24 | 25 | G_BEGIN_DECLS 26 | 27 | #define RSTTO_TYPE_APP_MENU_ITEM (rstto_app_menu_item_get_type ()) 28 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (GtkImageMenuItem, g_object_unref) 29 | G_DECLARE_FINAL_TYPE (RsttoAppMenuItem, rstto_app_menu_item, RSTTO, APP_MENU_ITEM, GtkImageMenuItem) 30 | 31 | typedef struct _RsttoAppMenuItemPrivate RsttoAppMenuItemPrivate; 32 | 33 | struct _RsttoAppMenuItem 34 | { 35 | GtkImageMenuItem parent; 36 | RsttoAppMenuItemPrivate *priv; 37 | }; 38 | 39 | 40 | 41 | GtkWidget * 42 | rstto_app_menu_item_new (GAppInfo *app_info, 43 | GFile *file); 44 | 45 | G_END_DECLS 46 | 47 | #endif /* __RISTRETTO_APP_MENU_ITEM_H__ */ 48 | -------------------------------------------------------------------------------- /src/properties_dialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RISTRETTO_PROPERTIES_DIALOG_H__ 21 | #define __RISTRETTO_PROPERTIES_DIALOG_H__ 22 | 23 | #include 24 | 25 | G_BEGIN_DECLS 26 | 27 | #define RSTTO_TYPE_PROPERTIES_DIALOG rstto_properties_dialog_get_type () 28 | G_DECLARE_FINAL_TYPE (RsttoPropertiesDialog, rstto_properties_dialog, RSTTO, PROPERTIES_DIALOG, GtkDialog) 29 | 30 | typedef struct _RsttoPropertiesDialogPrivate RsttoPropertiesDialogPrivate; 31 | 32 | struct _RsttoPropertiesDialog 33 | { 34 | GtkDialog parent; 35 | RsttoPropertiesDialogPrivate *priv; 36 | }; 37 | 38 | 39 | 40 | GtkWidget * 41 | rstto_properties_dialog_new (GtkWindow *parent, 42 | RsttoFile *file); 43 | 44 | G_END_DECLS 45 | 46 | #endif /* __RISTRETTO_PROPERTIES_DIALOG_H__ */ 47 | -------------------------------------------------------------------------------- /src/xfce_wallpaper_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RISTRETTO_XFCE_WALLPAPER_MANAGER_H__ 21 | #define __RISTRETTO_XFCE_WALLPAPER_MANAGER_H__ 22 | 23 | #include "wallpaper_manager.h" 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | #define RSTTO_TYPE_XFCE_WALLPAPER_MANAGER rstto_xfce_wallpaper_manager_get_type () 30 | G_DECLARE_FINAL_TYPE (RsttoXfceWallpaperManager, rstto_xfce_wallpaper_manager, RSTTO, XFCE_WALLPAPER_MANAGER, GObject) 31 | 32 | typedef struct _RsttoXfceWallpaperManagerPrivate RsttoXfceWallpaperManagerPrivate; 33 | 34 | struct _RsttoXfceWallpaperManager 35 | { 36 | GObject parent; 37 | RsttoXfceWallpaperManagerPrivate *priv; 38 | }; 39 | 40 | 41 | 42 | RsttoWallpaperManager * 43 | rstto_xfce_wallpaper_manager_new (void); 44 | 45 | G_END_DECLS 46 | 47 | #endif /* __RISTRETTO_XFCE_WALLPAPER_MANAGER_H__ */ 48 | -------------------------------------------------------------------------------- /src/gnome_wallpaper_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RISTRETTO_GNOME_WALLPAPER_MANAGER_H__ 21 | #define __RISTRETTO_GNOME_WALLPAPER_MANAGER_H__ 22 | 23 | #include "wallpaper_manager.h" 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | #define RSTTO_TYPE_GNOME_WALLPAPER_MANAGER rstto_gnome_wallpaper_manager_get_type () 30 | G_DECLARE_FINAL_TYPE (RsttoGnomeWallpaperManager, rstto_gnome_wallpaper_manager, RSTTO, GNOME_WALLPAPER_MANAGER, GObject) 31 | 32 | typedef struct _RsttoGnomeWallpaperManagerPrivate RsttoGnomeWallpaperManagerPrivate; 33 | 34 | struct _RsttoGnomeWallpaperManager 35 | { 36 | GObject parent; 37 | RsttoGnomeWallpaperManagerPrivate *priv; 38 | }; 39 | 40 | 41 | 42 | RsttoWallpaperManager * 43 | rstto_gnome_wallpaper_manager_new (void); 44 | 45 | G_END_DECLS 46 | 47 | #endif /* __RISTRETTO_GNOME_WALLPAPER_MANAGER_H__ */ 48 | -------------------------------------------------------------------------------- /src/thumbnailer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RISTRETTO_THUMBNAILER_H__ 21 | #define __RISTRETTO_THUMBNAILER_H__ 22 | 23 | #include "image_list.h" 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | #define RSTTO_TYPE_THUMBNAILER rstto_thumbnailer_get_type () 30 | G_DECLARE_FINAL_TYPE (RsttoThumbnailer, rstto_thumbnailer, RSTTO, THUMBNAILER, GObject) 31 | 32 | typedef struct _RsttoThumbnailerPrivate RsttoThumbnailerPrivate; 33 | 34 | struct _RsttoThumbnailer 35 | { 36 | GObject parent; 37 | RsttoThumbnailerPrivate *priv; 38 | }; 39 | 40 | 41 | 42 | RsttoThumbnailer * 43 | rstto_thumbnailer_new (void); 44 | 45 | void 46 | rstto_thumbnailer_queue_file (RsttoThumbnailer *thumbnailer, 47 | RsttoThumbnailFlavor flavor, 48 | RsttoFile *file); 49 | 50 | G_END_DECLS 51 | 52 | #endif /* __RISTRETTO_THUMBNAILER_H__ */ 53 | -------------------------------------------------------------------------------- /src/mime_db.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RISTRETTO_MIME_DB_H__ 21 | #define __RISTRETTO_MIME_DB_H__ 22 | 23 | #include 24 | 25 | G_BEGIN_DECLS 26 | 27 | #define RSTTO_TYPE_MIME_DB rstto_mime_db_get_type () 28 | G_DECLARE_FINAL_TYPE (RsttoMimeDB, rstto_mime_db, RSTTO, MIME_DB, GObject) 29 | 30 | typedef struct _RsttoMimeDBPrivate RsttoMimeDBPrivate; 31 | 32 | struct _RsttoMimeDB 33 | { 34 | GObject parent; 35 | RsttoMimeDBPrivate *priv; 36 | }; 37 | 38 | 39 | 40 | RsttoMimeDB * 41 | rstto_mime_db_new (const gchar *path, 42 | GError **error); 43 | 44 | const gchar * 45 | rstto_mime_db_lookup (RsttoMimeDB *mime_db, 46 | const gchar *key); 47 | 48 | void 49 | rstto_mime_db_store (RsttoMimeDB *mime_db, 50 | const gchar *key, 51 | const gchar *value); 52 | 53 | G_END_DECLS 54 | 55 | #endif /* __RSTTO_MIME_DB_H__ */ 56 | -------------------------------------------------------------------------------- /src/preferences_dialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RISTRETTO_PREFERENCES_DIALOG_H__ 21 | #define __RISTRETTO_PREFERENCES_DIALOG_H__ 22 | 23 | #include 24 | 25 | G_BEGIN_DECLS 26 | 27 | typedef enum 28 | { 29 | DESKTOP_TYPE_NONE = 0, 30 | DESKTOP_TYPE_XFCE, 31 | DESKTOP_TYPE_GNOME, 32 | DESKTOP_TYPE_COUNT 33 | } RsttoDesktopType; 34 | 35 | 36 | 37 | #define RSTTO_TYPE_PREFERENCES_DIALOG rstto_preferences_dialog_get_type () 38 | G_DECLARE_FINAL_TYPE (RsttoPreferencesDialog, rstto_preferences_dialog, RSTTO, PREFERENCES_DIALOG, GtkDialog) 39 | 40 | typedef struct _RsttoPreferencesDialogPrivate RsttoPreferencesDialogPrivate; 41 | 42 | struct _RsttoPreferencesDialog 43 | { 44 | GtkDialog parent; 45 | RsttoPreferencesDialogPrivate *priv; 46 | }; 47 | 48 | 49 | 50 | GtkWidget * 51 | rstto_preferences_dialog_new (GtkWindow *parent); 52 | 53 | G_END_DECLS 54 | 55 | #endif /* __RISTRETTO_PREFERENCES_DIALOG_H__ */ 56 | -------------------------------------------------------------------------------- /src/wallpaper_manager.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #include "util.h" 21 | #include "wallpaper_manager.h" 22 | 23 | 24 | 25 | G_DEFINE_INTERFACE (RsttoWallpaperManager, rstto_wallpaper_manager, G_TYPE_OBJECT) 26 | 27 | 28 | 29 | gint 30 | rstto_wallpaper_manager_configure_dialog_run (RsttoWallpaperManager *self, 31 | RsttoFile *file, 32 | GtkWindow *parent) 33 | { 34 | return RSTTO_WALLPAPER_MANAGER_GET_IFACE (self)->configure_dialog_run (self, file, parent); 35 | } 36 | 37 | gboolean 38 | rstto_wallpaper_manager_check_running (RsttoWallpaperManager *self) 39 | { 40 | return RSTTO_WALLPAPER_MANAGER_GET_IFACE (self)->check_running (self); 41 | } 42 | 43 | gboolean 44 | rstto_wallpaper_manager_set (RsttoWallpaperManager *self, 45 | RsttoFile *file) 46 | { 47 | return RSTTO_WALLPAPER_MANAGER_GET_IFACE (self)->set (self, file); 48 | } 49 | 50 | 51 | static void 52 | rstto_wallpaper_manager_default_init (RsttoWallpaperManagerInterface *klass) 53 | { 54 | } 55 | -------------------------------------------------------------------------------- /src/file_manager_integration.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Dmitry Petrachkov 2025 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RISTRETTO_FILE_MANAGER_INTEGRATION_H__ 21 | #define __RISTRETTO_FILE_MANAGER_INTEGRATION_H__ 22 | 23 | #include "settings.h" 24 | 25 | #include 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define RSTTO_TYPE_FILE_MANAGER_INTEGRATION (rstto_file_manager_integration_get_type ()) 31 | G_DECLARE_INTERFACE (RsttoFileManagerIntegration, rstto_file_manager_integration, RSTTO, FILE_MANAGER_INTEGRATION, GObject) 32 | 33 | struct _RsttoFileManagerIntegrationInterface 34 | { 35 | GTypeInterface parent; 36 | }; 37 | 38 | void 39 | rstto_file_manager_integration_set_directory (RsttoFileManagerIntegration *self, 40 | GFile *directory); 41 | 42 | gboolean 43 | rstto_file_manager_integration_is_supported_for (RsttoDesktopEnvironment desktop_env); 44 | 45 | RsttoFileManagerIntegration * 46 | rstto_file_manager_integration_factory_create (RsttoDesktopEnvironment desktop_env); 47 | 48 | G_END_DECLS 49 | 50 | #endif /* __RISTRETTO_FILE_MANAGER_INTEGRATION_H__ */ 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![License](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://gitlab.xfce.org/apps/ristretto/-/blob/master/COPYING) 2 | 3 | # ristretto 4 | 5 | Ristretto is an image viewer for the [Xfce](https://www.xfce.org/) desktop environment. 6 | 7 | The Ristretto Image Viewer is an application that can be used to view 8 | and scroll through images, run a slideshow of images, open images with 9 | other applications like an image-editor or configure an image as the 10 | desktop wallpaper. 11 | 12 | ---- 13 | 14 | ### Homepage 15 | 16 | [Ristretto documentation](https://docs.xfce.org/apps/ristretto/start) 17 | 18 | ### Changelog 19 | 20 | See [NEWS](https://gitlab.xfce.org/apps/ristretto/-/blob/master/NEWS) for details on changes and fixes made in the current release. 21 | 22 | ### Source Code Repository 23 | 24 | [Ristretto source code](https://gitlab.xfce.org/apps/ristretto) 25 | 26 | ### Download a Release Tarball 27 | 28 | [Ristretto archive](https://archive.xfce.org/src/apps/ristretto) 29 | or 30 | [Ristretto tags](https://gitlab.xfce.org/apps/ristretto/-/tags) 31 | 32 | ### Installation 33 | 34 | From source code repository: 35 | 36 | % cd ristretto 37 | % meson setup build 38 | % meson compile -C build 39 | % meson install -C build 40 | 41 | From release tarball: 42 | 43 | % tar xf ristretto-.tar.xz 44 | % cd ristretto- 45 | % meson setup build 46 | % meson compile -C build 47 | % meson install -C build 48 | 49 | From [Flathub](https://flathub.org/apps/details/org.xfce.ristretto): 50 | 51 | % flatpak install flathub org.xfce.ristretto 52 | 53 | ### Uninstallation 54 | 55 | From source code repository or tarball: 56 | 57 | % ninja uninstall -C build 58 | 59 | ### Reporting Bugs 60 | 61 | Visit the [reporting bugs](https://docs.xfce.org/apps/ristretto/bugs) page to view currently open bug reports and instructions on reporting new bugs or submitting bugfixes. 62 | 63 | -------------------------------------------------------------------------------- /src/tumbler-service-dbus.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/wallpaper_manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RISTRETTO_WALLPAPER_MANAGER_IFACE__ 21 | #define __RISTRETTO_WALLPAPER_MANAGER_IFACE__ 22 | 23 | #include "file.h" 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | #define RSTTO_WALLPAPER_MANAGER_TYPE rstto_wallpaper_manager_get_type () 30 | G_DECLARE_INTERFACE (RsttoWallpaperManager, rstto_wallpaper_manager, RSTTO, WALLPAPER_MANAGER, GObject) 31 | 32 | typedef struct _RsttoWallpaperManagerInterface RsttoWallpaperManagerInterface; 33 | 34 | struct _RsttoWallpaperManagerInterface 35 | { 36 | GTypeInterface parent; 37 | 38 | gint (*configure_dialog_run) (RsttoWallpaperManager *self, 39 | RsttoFile *file, 40 | GtkWindow *parent); 41 | gboolean (*set) (RsttoWallpaperManager *self, 42 | RsttoFile *file); 43 | gboolean (*check_running) (RsttoWallpaperManager *self); 44 | }; 45 | 46 | 47 | 48 | gboolean 49 | rstto_wallpaper_manager_check_running (RsttoWallpaperManager *self); 50 | 51 | gint 52 | rstto_wallpaper_manager_configure_dialog_run (RsttoWallpaperManager *self, 53 | RsttoFile *file, 54 | GtkWindow *parent); 55 | 56 | gboolean 57 | rstto_wallpaper_manager_set (RsttoWallpaperManager *self, 58 | RsttoFile *file); 59 | 60 | G_END_DECLS 61 | 62 | #endif /* __RISTRETTO_WALLPAPER_MANAGER_IFACE__ */ 63 | -------------------------------------------------------------------------------- /src/monitor_chooser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RISTRETTO_MONITOR_CHOOSER_H__ 21 | #define __RISTRETTO_MONITOR_CHOOSER_H__ 22 | 23 | #include 24 | 25 | G_BEGIN_DECLS 26 | 27 | #define RSTTO_TYPE_MONITOR_CHOOSER rstto_monitor_chooser_get_type () 28 | G_DECLARE_FINAL_TYPE (RsttoMonitorChooser, rstto_monitor_chooser, RSTTO, MONITOR_CHOOSER, GtkWidget) 29 | 30 | typedef struct _RsttoMonitorChooserPrivate RsttoMonitorChooserPrivate; 31 | 32 | struct _RsttoMonitorChooser 33 | { 34 | GtkWidget parent; 35 | RsttoMonitorChooserPrivate *priv; 36 | }; 37 | 38 | 39 | 40 | GtkWidget * 41 | rstto_monitor_chooser_new (void); 42 | 43 | gint 44 | rstto_monitor_chooser_add (RsttoMonitorChooser *chooser, 45 | gint width, 46 | gint height); 47 | 48 | gint 49 | rstto_monitor_chooser_set_image_surface (RsttoMonitorChooser *chooser, 50 | gint monitor_id, 51 | cairo_surface_t *surface, 52 | GError **error); 53 | 54 | gint 55 | rstto_monitor_chooser_get_selected (RsttoMonitorChooser *chooser); 56 | 57 | void 58 | rstto_monitor_chooser_get_dimensions (RsttoMonitorChooser *chooser, 59 | gint nr, 60 | gint *width, 61 | gint *height); 62 | 63 | G_END_DECLS 64 | 65 | #endif /* __RISTRETTO_MONITOR_CHOOSER_H__ */ 66 | -------------------------------------------------------------------------------- /org.xfce.ristretto.appdata.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | org.xfce.ristretto 5 | CC0-1.0 6 | GPL-2.0+ 7 | Ristretto 8 | Fast and lightweight image viewer 9 | 10 | 11 |

Ristretto is an image viewer for the Xfce desktop environment. 12 |

13 |

The Ristretto Image Viewer is an application that can be used to view 14 | and scroll through images, run a slideshow of images, open images with 15 | other applications like an image-editor or configure an image as the 16 | desktop wallpaper. 17 |

18 |
19 | 20 | 21 | 22 | https://docs.xfce.org/_media/apps/ristretto/view-images.png 23 | 24 | 25 | 26 | https://docs.xfce.org/apps/ristretto/start 27 | https://gitlab.xfce.org/apps/ristretto/issues 28 | https://docs.xfce.org/apps/ristretto/start 29 | https://opencollective.com/xfce/donate 30 | https://docs.xfce.org/contribute/translate/start 31 | 32 | XFCE 33 | xfce4-dev@xfce.org 34 | Xfce Developers 35 | ristretto 36 | org.xfce.ristretto.desktop 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | ristretto 53 | 54 |
55 | -------------------------------------------------------------------------------- /src/main_window.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RISTRETTO_MAIN_WINDOW_H__ 21 | #define __RISTRETTO_MAIN_WINDOW_H__ 22 | 23 | #include "icon_bar.h" 24 | #include "image_list.h" 25 | 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | 30 | typedef enum 31 | { 32 | RSTTO_DESKTOP_NONE, 33 | RSTTO_DESKTOP_XFCE, 34 | RSTTO_DESKTOP_GNOME 35 | } RsttoDesktop; 36 | 37 | 38 | 39 | #define RSTTO_TYPE_MAIN_WINDOW rstto_main_window_get_type () 40 | G_DECLARE_FINAL_TYPE (RsttoMainWindow, rstto_main_window, RSTTO, MAIN_WINDOW, GtkWindow) 41 | 42 | typedef struct _RsttoMainWindowPrivate RsttoMainWindowPrivate; 43 | 44 | struct _RsttoMainWindow 45 | { 46 | GtkWindow parent; 47 | RsttoMainWindowPrivate *priv; 48 | }; 49 | 50 | 51 | 52 | RsttoMainWindow * 53 | rstto_main_window_get_app_window (void); 54 | 55 | gboolean 56 | rstto_main_window_get_app_exited (void); 57 | 58 | RsttoImageList * 59 | rstto_main_window_get_app_image_list (void); 60 | 61 | RsttoIconBar * 62 | rstto_main_window_get_app_icon_bar (void); 63 | 64 | GtkFileFilter * 65 | rstto_main_window_get_app_file_filter (void); 66 | 67 | GtkWidget * 68 | rstto_main_window_new (RsttoImageList *image_list, 69 | gboolean fullscreen); 70 | 71 | RsttoImageListIter * 72 | rstto_main_window_get_iter (RsttoMainWindow *window); 73 | 74 | void 75 | rstto_main_window_open (RsttoMainWindow *window, 76 | GSList *files); 77 | 78 | gboolean 79 | rstto_main_window_play_slideshow (RsttoMainWindow *window); 80 | 81 | void 82 | rstto_main_window_fullscreen (GtkWidget *widget, 83 | RsttoMainWindow *window); 84 | 85 | G_END_DECLS 86 | 87 | #endif /* __RISTRETTO_MAIN_WINDOW_H__ */ 88 | -------------------------------------------------------------------------------- /src/meson.build: -------------------------------------------------------------------------------- 1 | ristretto_sources = [ 2 | 'app_menu_item.c', 3 | 'app_menu_item.h', 4 | 'file.c', 5 | 'file.h', 6 | 'file_manager_integration.h', 7 | 'file_manager_integration.c', 8 | 'file_manager_integration_thunar.h', 9 | 'file_manager_integration_thunar.c', 10 | 'gnome_wallpaper_manager.c', 11 | 'gnome_wallpaper_manager.h', 12 | 'icon_bar.c', 13 | 'icon_bar.h', 14 | 'image_list.c', 15 | 'image_list.h', 16 | 'image_viewer.c', 17 | 'image_viewer.h', 18 | 'main.c', 19 | 'main_window.c', 20 | 'main_window.h', 21 | 'mime_db.c', 22 | 'mime_db.h', 23 | 'monitor_chooser.c', 24 | 'monitor_chooser.h', 25 | 'preferences_dialog.c', 26 | 'preferences_dialog.h', 27 | 'print.c', 28 | 'print.h', 29 | 'privacy_dialog.c', 30 | 'privacy_dialog.h', 31 | 'properties_dialog.c', 32 | 'properties_dialog.h', 33 | 'settings.c', 34 | 'settings.h', 35 | 'thumbnailer.c', 36 | 'thumbnailer.h', 37 | 'util.c', 38 | 'util.h', 39 | 'wallpaper_manager.c', 40 | 'wallpaper_manager.h', 41 | 'xfce_wallpaper_manager.c', 42 | 'xfce_wallpaper_manager.h', 43 | ] 44 | 45 | service_file = configure_file( 46 | configuration: configuration_data({ 47 | 'TUMBLER_SERVICE_NAME_PREFIX': tumbler_service_name_prefix, 48 | 'TUMBLER_SERVICE_PATH_PREFIX': tumbler_service_path_prefix, 49 | }), 50 | input: 'tumbler-service-dbus.xml.in', 51 | output: 'tumbler-service-dbus.xml', 52 | install: false, 53 | ) 54 | 55 | ristretto_sources += gnome.gdbus_codegen( 56 | 'tumbler', 57 | sources: service_file, 58 | interface_prefix: tumbler_service_name_prefix, 59 | namespace: 'Tumbler', 60 | install_header: false, 61 | ) 62 | 63 | ristretto_sources += gnome.genmarshal( 64 | 'marshal', 65 | sources: 'marshal.list', 66 | prefix: '_rstto_marshal', 67 | internal: true, 68 | install_header: false, 69 | ) 70 | 71 | ristretto_sources += gnome.compile_resources( 72 | 'ristretto-resources', 73 | 'ristretto.gresource.xml', 74 | ) 75 | 76 | executable( 77 | 'ristretto', 78 | ristretto_sources, 79 | sources: xfce_revision_h, 80 | c_args: [ 81 | '-DG_LOG_DOMAIN="@0@"'.format('ristretto'), 82 | '-DTUMBLER_SERVICE_NAME_PREFIX="@0@"'.format(tumbler_service_name_prefix), 83 | '-DTUMBLER_SERVICE_PATH_PREFIX="@0@"'.format(tumbler_service_path_prefix), 84 | ], 85 | include_directories: [ 86 | include_directories('..'), 87 | ], 88 | dependencies: [ 89 | glib, 90 | gio, 91 | gio_unix, 92 | gtk, 93 | cairo, 94 | libexif, 95 | exo, 96 | libxfce4ui, 97 | libxfce4util, 98 | xfconf, 99 | libx11, 100 | libmagic, 101 | libm, 102 | ], 103 | install: true, 104 | install_dir: get_option('prefix') / get_option('bindir'), 105 | ) 106 | -------------------------------------------------------------------------------- /src/icon_bar.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2004 os-cillation e.K. 3 | * Copyright (c) 2012 Stephan Arts 4 | * 5 | * Written by Benedikt Meurer . 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Library General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2 of the License, or (at your option) any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Library General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Library General Public 18 | * License along with this library; if not, write to the 19 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 | * Boston, MA 02111-1307, USA. 21 | */ 22 | 23 | #ifndef __RSTTO_ICON_BAR_H__ 24 | #define __RSTTO_ICON_BAR_H__ 25 | 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define RSTTO_TYPE_ICON_BAR (rstto_icon_bar_get_type ()) 31 | G_DECLARE_FINAL_TYPE (RsttoIconBar, rstto_icon_bar, RSTTO, ICON_BAR, GtkContainer) 32 | 33 | typedef struct _RsttoIconBarPrivate RsttoIconBarPrivate; 34 | 35 | struct _RsttoIconBar 36 | { 37 | GtkContainer parent; 38 | RsttoIconBarPrivate *priv; 39 | }; 40 | 41 | 42 | 43 | GtkWidget * 44 | rstto_icon_bar_new (GtkWidget *s_window); 45 | GtkWidget * 46 | rstto_icon_bar_new_with_model (GtkTreeModel *model); 47 | 48 | GtkTreeModel * 49 | rstto_icon_bar_get_model (RsttoIconBar *icon_bar); 50 | void 51 | rstto_icon_bar_set_model (RsttoIconBar *icon_bar, 52 | GtkTreeModel *model); 53 | 54 | GtkOrientation 55 | rstto_icon_bar_get_orientation (RsttoIconBar *icon_bar); 56 | void 57 | rstto_icon_bar_set_orientation (RsttoIconBar *icon_bar, 58 | GtkOrientation orientation); 59 | 60 | gint 61 | rstto_icon_bar_get_active (RsttoIconBar *icon_bar); 62 | void 63 | rstto_icon_bar_set_active (RsttoIconBar *icon_bar, 64 | gint idx); 65 | 66 | gboolean 67 | rstto_icon_bar_get_active_iter (RsttoIconBar *icon_bar, 68 | GtkTreeIter *iter); 69 | void 70 | rstto_icon_bar_set_active_iter (RsttoIconBar *icon_bar, 71 | GtkTreeIter *iter); 72 | 73 | gint 74 | rstto_icon_bar_get_n_visible_items (RsttoIconBar *icon_bar); 75 | 76 | gboolean 77 | rstto_icon_bar_get_show_text (RsttoIconBar *icon_bar); 78 | void 79 | rstto_icon_bar_set_show_text (RsttoIconBar *icon_bar, 80 | gboolean show_text); 81 | 82 | void 83 | rstto_icon_bar_show_active (RsttoIconBar *icon_bar); 84 | 85 | G_END_DECLS 86 | 87 | #endif /* !__RSTTO_ICON_BAR_H__ */ 88 | -------------------------------------------------------------------------------- /src/image_viewer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RISTRETTO_IMAGE_VIEWER_H__ 21 | #define __RISTRETTO_IMAGE_VIEWER_H__ 22 | 23 | #include "file.h" 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | #define RSTTO_SCALE_FACTOR 1.1 30 | 31 | 32 | 33 | #define RSTTO_TYPE_IMAGE_VIEWER rstto_image_viewer_get_type () 34 | G_DECLARE_FINAL_TYPE (RsttoImageViewer, rstto_image_viewer, RSTTO, IMAGE_VIEWER, GtkWidget) 35 | 36 | typedef struct _RsttoImageViewerPrivate RsttoImageViewerPrivate; 37 | 38 | struct _RsttoImageViewer 39 | { 40 | GtkWidget parent; 41 | RsttoImageViewerPrivate *priv; 42 | }; 43 | 44 | 45 | 46 | GtkWidget * 47 | rstto_image_viewer_new (void); 48 | 49 | void 50 | rstto_image_viewer_set_file (RsttoImageViewer *viewer, 51 | RsttoFile *file, 52 | gdouble scale, 53 | RsttoScale auto_scale, 54 | RsttoImageOrientation orientation); 55 | 56 | void 57 | rstto_image_viewer_set_scale (RsttoImageViewer *viewer, 58 | gdouble scale); 59 | 60 | GdkPixbuf * 61 | rstto_image_viewer_get_pixbuf (RsttoImageViewer *viewer); 62 | 63 | gdouble 64 | rstto_image_viewer_get_scale (RsttoImageViewer *viewer); 65 | 66 | void 67 | rstto_image_viewer_set_orientation (RsttoImageViewer *viewer, 68 | RsttoImageOrientation orientation); 69 | 70 | RsttoImageOrientation 71 | rstto_image_viewer_get_orientation (RsttoImageViewer *viewer); 72 | 73 | gint 74 | rstto_image_viewer_get_width (RsttoImageViewer *viewer); 75 | 76 | gint 77 | rstto_image_viewer_get_height (RsttoImageViewer *viewer); 78 | 79 | void 80 | rstto_image_viewer_set_menu (RsttoImageViewer *viewer, 81 | GtkMenu *menu); 82 | 83 | GError * 84 | rstto_image_viewer_get_error (RsttoImageViewer *viewer); 85 | 86 | void 87 | rstto_image_viewer_set_show_clock (RsttoImageViewer *viewer, 88 | gboolean value); 89 | 90 | gboolean 91 | rstto_image_viewer_is_busy (RsttoImageViewer *viewer); 92 | 93 | G_END_DECLS 94 | 95 | #endif /* __RISTRETTO_IMAGE_VIEWER_H__ */ 96 | -------------------------------------------------------------------------------- /src/file_manager_integration.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Dmitry Petrachkov 2025 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #include "file_manager_integration.h" 21 | #include "file_manager_integration_thunar.h" 22 | #include "settings.h" 23 | 24 | G_DEFINE_INTERFACE (RsttoFileManagerIntegration, rstto_file_manager_integration, G_TYPE_OBJECT) 25 | 26 | static void 27 | rstto_file_manager_integration_default_init (RsttoFileManagerIntegrationInterface *iface) 28 | { 29 | g_object_interface_install_property (iface, 30 | g_param_spec_object ("directory", 31 | NULL, 32 | NULL, 33 | G_TYPE_FILE, 34 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 35 | 36 | g_object_interface_install_property (iface, 37 | g_param_spec_int ("sort-type", 38 | NULL, 39 | NULL, 40 | -1, SORT_TYPE_COUNT, 41 | -1, 42 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); 43 | 44 | 45 | g_object_interface_install_property (iface, 46 | g_param_spec_int ("sort-order", 47 | NULL, 48 | NULL, 49 | -1, SORT_ORDER_COUNT, 50 | -1, 51 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); 52 | } 53 | 54 | void 55 | rstto_file_manager_integration_set_directory (RsttoFileManagerIntegration *self, 56 | GFile *directory) 57 | { 58 | g_object_set (self, "directory", directory, NULL); 59 | } 60 | 61 | gboolean 62 | rstto_file_manager_integration_is_supported_for (RsttoDesktopEnvironment desktop_env) 63 | { 64 | switch (desktop_env) 65 | { 66 | case DESKTOP_ENVIRONMENT_XFCE: 67 | return TRUE; 68 | 69 | default: 70 | return FALSE; 71 | } 72 | } 73 | 74 | RsttoFileManagerIntegration * 75 | rstto_file_manager_integration_factory_create (RsttoDesktopEnvironment desktop_env) 76 | { 77 | switch (desktop_env) 78 | { 79 | case DESKTOP_ENVIRONMENT_XFCE: 80 | return rstto_file_manager_integration_thunar_new (); 81 | 82 | default: 83 | return NULL; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/settings.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RISTRETTO_SETTINGS_H__ 21 | #define __RISTRETTO_SETTINGS_H__ 22 | 23 | #include 24 | 25 | G_BEGIN_DECLS 26 | 27 | typedef enum 28 | { 29 | SORT_TYPE_NAME = 0, 30 | SORT_TYPE_TYPE, 31 | SORT_TYPE_DATE, 32 | SORT_TYPE_RANDOM, 33 | SORT_TYPE_SIZE, 34 | SORT_TYPE_COUNT, 35 | } RsttoSortType; 36 | 37 | typedef enum 38 | { 39 | SORT_ORDER_ASC = 0, 40 | SORT_ORDER_DESC, 41 | SORT_ORDER_COUNT, 42 | } RsttoSortOrder; 43 | 44 | typedef enum 45 | { 46 | DESKTOP_ENVIRONMENT_NONE, 47 | DESKTOP_ENVIRONMENT_XFCE, 48 | DESKTOP_ENVIRONMENT_GNOME, 49 | DESKTOP_ENVIRONMENT_COUNT 50 | } RsttoDesktopEnvironment; 51 | 52 | 53 | #define RSTTO_TYPE_SETTINGS rstto_settings_get_type () 54 | G_DECLARE_FINAL_TYPE (RsttoSettings, rstto_settings, RSTTO, SETTINGS, GObject) 55 | 56 | typedef struct _RsttoSettingsPrivate RsttoSettingsPrivate; 57 | 58 | struct _RsttoSettings 59 | { 60 | GObject parent; 61 | RsttoSettingsPrivate *priv; 62 | }; 63 | 64 | 65 | 66 | gboolean 67 | rstto_settings_get_xfconf_disabled (void); 68 | 69 | void 70 | rstto_settings_set_xfconf_disabled (gboolean disabled); 71 | 72 | RsttoSettings * 73 | rstto_settings_new (void); 74 | 75 | void 76 | rstto_settings_set_navbar_position (RsttoSettings *settings, 77 | guint pos); 78 | guint 79 | rstto_settings_get_navbar_position (RsttoSettings *settings); 80 | 81 | void 82 | rstto_settings_set_uint_property (RsttoSettings *settings, 83 | const gchar *property_name, 84 | guint value); 85 | guint 86 | rstto_settings_get_uint_property (RsttoSettings *settings, 87 | const gchar *property_name); 88 | void 89 | rstto_settings_set_int_property (RsttoSettings *settings, 90 | const gchar *property_name, 91 | gint value); 92 | gint 93 | rstto_settings_get_int_property (RsttoSettings *settings, 94 | const gchar *property_name); 95 | void 96 | rstto_settings_set_string_property (RsttoSettings *settings, 97 | const gchar *property_name, 98 | const gchar *value); 99 | gchar * 100 | rstto_settings_get_string_property (RsttoSettings *settings, 101 | const gchar *property_name); 102 | void 103 | rstto_settings_set_boolean_property (RsttoSettings *settings, 104 | const gchar *property_name, 105 | gboolean value); 106 | gboolean 107 | rstto_settings_get_boolean_property (RsttoSettings *settings, 108 | const gchar *property_name); 109 | 110 | /* RsttoDesktopEnvironment */ 111 | 112 | const gchar * 113 | rstto_desktop_environment_get_name (RsttoDesktopEnvironment desktop_env); 114 | 115 | RsttoDesktopEnvironment 116 | rstto_desktop_environment_from_name (const gchar *name); 117 | 118 | G_END_DECLS 119 | 120 | #endif /* __RISTRETTO_SETTINGS_H__ */ 121 | -------------------------------------------------------------------------------- /src/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | /* 21 | * This file also serves as a private.h, so it should be included at the 22 | * top of every source file, but never in any other header. 23 | */ 24 | 25 | #ifndef __RISTRETTO_UTIL_H__ 26 | #define __RISTRETTO_UTIL_H__ 27 | 28 | /* our config header */ 29 | #ifdef HAVE_XFCE_REVISION_H 30 | #include "xfce-revision.h" 31 | #endif 32 | 33 | /* standard headers */ 34 | #include 35 | 36 | /* external non standard headers */ 37 | #include 38 | 39 | /* internal headers */ 40 | #include "file.h" 41 | #include "settings.h" 42 | 43 | G_BEGIN_DECLS 44 | 45 | #define RISTRETTO_APP_ID "org.xfce.ristretto" 46 | 47 | /* for personal testing */ 48 | #define TIMER_START GTimer *__FUNCTION__timer = g_timer_new (); 49 | #define TIMER_SPLIT g_printerr ("%s: %.2f ms\n", G_STRLOC, \ 50 | g_timer_elapsed (__FUNCTION__timer, NULL) * 1000); 51 | #define TIMER_STOP TIMER_SPLIT g_timer_destroy (__FUNCTION__timer); 52 | 53 | #define PRINT_LOCATION g_printerr ("%s\n", G_STRLOC) 54 | #define RTRACE(fmt, var) \ 55 | G_STMT_START \ 56 | { \ 57 | g_printerr ("%s:%s: ", G_STRLOC, #var); \ 58 | g_printerr (fmt, var); \ 59 | g_printerr ("\n"); \ 60 | } \ 61 | G_STMT_END 62 | 63 | /* Macro to remove and clear a source id */ 64 | #define REMOVE_SOURCE(ID) \ 65 | G_STMT_START \ 66 | { \ 67 | g_source_remove (ID); \ 68 | ID = 0; \ 69 | } \ 70 | G_STMT_END 71 | 72 | /* convenient macros for setting object data */ 73 | #define rstto_object_set_data(object, key, data) \ 74 | g_object_set_qdata (G_OBJECT (object), g_quark_from_static_string (key), data) 75 | #define rstto_object_set_data_full(object, key, data, destroy) \ 76 | g_object_set_qdata_full (G_OBJECT (object), g_quark_from_static_string (key), data, destroy) 77 | #define rstto_object_get_data(object, key) \ 78 | g_object_get_qdata (G_OBJECT (object), g_quark_try_string (key)) 79 | 80 | 81 | 82 | gpointer 83 | rstto_util_source_autoremove (gpointer object); 84 | 85 | cairo_pattern_t * 86 | rstto_util_set_source_pixbuf (cairo_t *ctx, 87 | const GdkPixbuf *pixbuf, 88 | gdouble pixbuf_x, 89 | gdouble pixbuf_y); 90 | 91 | void 92 | rstto_util_paint_background_color (GtkWidget *widget, 93 | RsttoSettings *settings, 94 | cairo_t *ctx); 95 | 96 | void 97 | rstto_util_dialog_error (const gchar *message, 98 | GError *error); 99 | 100 | void 101 | rstto_util_set_scale_factor (gint scale_factor); 102 | 103 | RsttoThumbnailFlavor 104 | rstto_util_get_thumbnail_flavor (RsttoThumbnailSize size); 105 | 106 | const gchar * 107 | rstto_util_get_thumbnail_flavor_name (RsttoThumbnailFlavor flavor); 108 | 109 | guint 110 | rstto_util_get_thumbnail_n_pixels (RsttoThumbnailSize size); 111 | 112 | /* Forwards read bytes from in to out */ 113 | gboolean 114 | rstto_util_sendfile (GOutputStream *out, 115 | GInputStream *in, 116 | GError **error); 117 | 118 | G_END_DECLS 119 | 120 | #endif /* __RSTTO_UTIL_H__ */ 121 | -------------------------------------------------------------------------------- /src/mime_db.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #include "util.h" 21 | #include "mime_db.h" 22 | 23 | #include 24 | 25 | 26 | 27 | enum 28 | { 29 | PROP_0, 30 | PROP_FILE 31 | }; 32 | 33 | 34 | 35 | static void 36 | rstto_mime_db_finalize (GObject *object); 37 | static void 38 | rstto_mime_db_set_property (GObject *object, 39 | guint property_id, 40 | const GValue *value, 41 | GParamSpec *pspec); 42 | static void 43 | rstto_mime_db_get_property (GObject *object, 44 | guint property_id, 45 | GValue *value, 46 | GParamSpec *pspec); 47 | 48 | 49 | 50 | struct _RsttoMimeDBPrivate 51 | { 52 | GFile *file; 53 | XfceRc *rc; 54 | }; 55 | 56 | 57 | 58 | G_DEFINE_TYPE_WITH_PRIVATE (RsttoMimeDB, rstto_mime_db, G_TYPE_OBJECT) 59 | 60 | 61 | 62 | static void 63 | rstto_mime_db_init (RsttoMimeDB *mime_db) 64 | { 65 | mime_db->priv = rstto_mime_db_get_instance_private (mime_db); 66 | } 67 | 68 | static void 69 | rstto_mime_db_class_init (RsttoMimeDBClass *klass) 70 | { 71 | GObjectClass *object_class = G_OBJECT_CLASS (klass); 72 | 73 | object_class->finalize = rstto_mime_db_finalize; 74 | 75 | object_class->set_property = rstto_mime_db_set_property; 76 | object_class->get_property = rstto_mime_db_get_property; 77 | } 78 | 79 | /** 80 | * rstto_mime_db_finalize: 81 | * @object: 82 | * 83 | */ 84 | static void 85 | rstto_mime_db_finalize (GObject *object) 86 | { 87 | RsttoMimeDB *mime_db = RSTTO_MIME_DB (object); 88 | 89 | xfce_rc_close (mime_db->priv->rc); 90 | 91 | G_OBJECT_CLASS (rstto_mime_db_parent_class)->finalize (object); 92 | } 93 | 94 | static void 95 | rstto_mime_db_set_property (GObject *object, 96 | guint property_id, 97 | const GValue *value, 98 | GParamSpec *pspec) 99 | { 100 | switch (property_id) 101 | { 102 | case PROP_FILE: 103 | break; 104 | default: 105 | break; 106 | } 107 | } 108 | 109 | static void 110 | rstto_mime_db_get_property (GObject *object, 111 | guint property_id, 112 | GValue *value, 113 | GParamSpec *pspec) 114 | { 115 | switch (property_id) 116 | { 117 | case PROP_FILE: 118 | break; 119 | default: 120 | break; 121 | } 122 | } 123 | 124 | RsttoMimeDB * 125 | rstto_mime_db_new (const gchar *path, 126 | GError **error) 127 | { 128 | RsttoMimeDB *mime_db = NULL; 129 | XfceRc *rc = NULL; 130 | 131 | rc = xfce_rc_simple_open (path, FALSE); 132 | 133 | if (rc != NULL) 134 | { 135 | mime_db = g_object_new (RSTTO_TYPE_MIME_DB, NULL); 136 | mime_db->priv->rc = rc; 137 | 138 | xfce_rc_set_group (rc, "preferred-editor"); 139 | } 140 | 141 | return mime_db; 142 | } 143 | 144 | 145 | const gchar * 146 | rstto_mime_db_lookup (RsttoMimeDB *mime_db, 147 | const gchar *key) 148 | { 149 | return xfce_rc_read_entry (mime_db->priv->rc, key, NULL); 150 | } 151 | 152 | 153 | void 154 | rstto_mime_db_store (RsttoMimeDB *mime_db, 155 | const gchar *key, 156 | const gchar *value) 157 | { 158 | xfce_rc_write_entry (mime_db->priv->rc, key, value); 159 | xfce_rc_flush (mime_db->priv->rc); 160 | } 161 | -------------------------------------------------------------------------------- /src/image_list.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RISTRETTO_IMAGE_LIST_H__ 21 | #define __RISTRETTO_IMAGE_LIST_H__ 22 | 23 | #include "file.h" 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | #define RSTTO_TYPE_IMAGE_LIST rstto_image_list_get_type () 30 | G_DECLARE_FINAL_TYPE (RsttoImageList, rstto_image_list, RSTTO, IMAGE_LIST, GObject) 31 | 32 | typedef struct _RsttoImageListPrivate RsttoImageListPrivate; 33 | 34 | struct _RsttoImageList 35 | { 36 | GObject parent; 37 | RsttoImageListPrivate *priv; 38 | }; 39 | 40 | #define RSTTO_TYPE_IMAGE_LIST_ITER rstto_image_list_iter_get_type () 41 | G_DECLARE_FINAL_TYPE (RsttoImageListIter, rstto_image_list_iter, RSTTO, IMAGE_LIST_ITER, GObject) 42 | 43 | typedef struct _RsttoImageListIterPrivate RsttoImageListIterPrivate; 44 | 45 | struct _RsttoImageListIter 46 | { 47 | GObject parent; 48 | RsttoImageListIterPrivate *priv; 49 | }; 50 | 51 | 52 | 53 | RsttoImageList * 54 | rstto_image_list_new (void); 55 | 56 | gint 57 | rstto_image_list_get_n_images (RsttoImageList *image_list); 58 | 59 | gboolean 60 | rstto_image_list_is_empty (RsttoImageList *image_list); 61 | 62 | gboolean 63 | rstto_image_list_add_file (RsttoImageList *image_list, 64 | RsttoFile *file, 65 | GError **error); 66 | 67 | void 68 | rstto_image_list_remove_file (RsttoImageList *image_list, 69 | RsttoFile *file); 70 | 71 | gboolean 72 | rstto_image_list_set_directory (RsttoImageList *image_list, 73 | GFile *dir, 74 | RsttoFile *file, 75 | GError **error); 76 | 77 | GFile * 78 | rstto_image_list_get_directory (RsttoImageList *image_list); 79 | 80 | gboolean 81 | rstto_image_list_is_busy (RsttoImageList *list); 82 | 83 | /** Built-in Sorting Functions */ 84 | void 85 | rstto_image_list_set_sort_by_name (RsttoImageList *image_list); 86 | 87 | void 88 | rstto_image_list_set_sort_by_type (RsttoImageList *image_list); 89 | 90 | void 91 | rstto_image_list_set_sort_by_date (RsttoImageList *image_list); 92 | 93 | void 94 | rstto_image_list_set_sort_by_random (RsttoImageList *image_list); 95 | 96 | void 97 | rstto_image_list_set_sort_by_size (RsttoImageList *image_list); 98 | 99 | void 100 | rstto_image_list_set_sort_order (RsttoImageList *image_list, 101 | RsttoSortOrder order); 102 | 103 | RsttoImageListIter * 104 | rstto_image_list_get_iter (RsttoImageList *image_list); 105 | 106 | 107 | 108 | /** Iter functions */ 109 | RsttoFile * 110 | rstto_image_list_iter_get_file (RsttoImageListIter *iter); 111 | 112 | gboolean 113 | rstto_image_list_iter_previous (RsttoImageListIter *iter); 114 | 115 | gboolean 116 | rstto_image_list_iter_next (RsttoImageListIter *iter); 117 | 118 | gboolean 119 | rstto_image_list_iter_has_previous (RsttoImageListIter *iter); 120 | 121 | gboolean 122 | rstto_image_list_iter_has_next (RsttoImageListIter *iter); 123 | 124 | gint 125 | rstto_image_list_iter_get_position (RsttoImageListIter *iter); 126 | 127 | void 128 | rstto_image_list_iter_set_position (RsttoImageListIter *iter, 129 | gint pos); 130 | 131 | gboolean 132 | rstto_image_list_iter_find_file (RsttoImageListIter *iter, 133 | RsttoFile *file); 134 | 135 | RsttoImageListIter * 136 | rstto_image_list_iter_clone (RsttoImageListIter *iter); 137 | 138 | gboolean 139 | rstto_image_list_iter_get_sticky (RsttoImageListIter *iter); 140 | 141 | G_END_DECLS 142 | 143 | #endif /* __RISTRETTO_IMAGE_LIST_H__ */ 144 | -------------------------------------------------------------------------------- /src/app_menu_item.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #include "util.h" 21 | #include "app_menu_item.h" 22 | 23 | 24 | 25 | static void 26 | rstto_app_menu_item_finalize (GObject *object); 27 | 28 | static void 29 | rstto_app_menu_item_activate (GtkMenuItem *object); 30 | 31 | 32 | 33 | struct _RsttoAppMenuItemPrivate 34 | { 35 | GAppInfo *app_info; 36 | GFile *file; 37 | }; 38 | 39 | 40 | 41 | G_GNUC_BEGIN_IGNORE_DEPRECATIONS 42 | G_DEFINE_TYPE_WITH_PRIVATE (RsttoAppMenuItem, rstto_app_menu_item, GTK_TYPE_IMAGE_MENU_ITEM) 43 | G_GNUC_END_IGNORE_DEPRECATIONS 44 | 45 | 46 | 47 | static void 48 | rstto_app_menu_item_init (RsttoAppMenuItem *menu_item) 49 | { 50 | menu_item->priv = rstto_app_menu_item_get_instance_private (menu_item); 51 | } 52 | 53 | static void 54 | rstto_app_menu_item_class_init (RsttoAppMenuItemClass *klass) 55 | { 56 | GObjectClass *object_class = G_OBJECT_CLASS (klass); 57 | GtkMenuItemClass *menu_item_class = GTK_MENU_ITEM_CLASS (klass); 58 | 59 | object_class->finalize = rstto_app_menu_item_finalize; 60 | 61 | menu_item_class->activate = rstto_app_menu_item_activate; 62 | } 63 | 64 | /** 65 | * rstto_app_menu_item_finalize: 66 | * @object: application-menu-item 67 | * 68 | * Cleanup the app-menu-item internals 69 | * 70 | */ 71 | static void 72 | rstto_app_menu_item_finalize (GObject *object) 73 | { 74 | RsttoAppMenuItem *menu_item = RSTTO_APP_MENU_ITEM (object); 75 | 76 | if (menu_item->priv->app_info) 77 | { 78 | g_object_unref (menu_item->priv->app_info); 79 | menu_item->priv->app_info = NULL; 80 | } 81 | if (menu_item->priv->file) 82 | { 83 | g_object_unref (menu_item->priv->file); 84 | menu_item->priv->file = NULL; 85 | } 86 | 87 | G_OBJECT_CLASS (rstto_app_menu_item_parent_class)->finalize (object); 88 | } 89 | 90 | /** 91 | * rstto_app_menu_item_activate: 92 | * @object: GtkMenuItem that is activated 93 | * 94 | * Launch the associated application 95 | */ 96 | static void 97 | rstto_app_menu_item_activate (GtkMenuItem *object) 98 | { 99 | RsttoAppMenuItem *app_menu_item = RSTTO_APP_MENU_ITEM (object); 100 | GList *files = g_list_append (NULL, app_menu_item->priv->file); 101 | 102 | g_app_info_launch (app_menu_item->priv->app_info, files, NULL, NULL); 103 | 104 | GTK_MENU_ITEM_CLASS (rstto_app_menu_item_parent_class)->activate (object); 105 | } 106 | 107 | /** 108 | * rstto_app_menu_item_new: 109 | * @app_info: Application info 110 | * @file: File 111 | * 112 | * Creates new RsttoAppMenuItem 113 | * 114 | * Returns: RsttoAppMenuItem that launches application @app_info with @file 115 | */ 116 | GtkWidget * 117 | rstto_app_menu_item_new (GAppInfo *app_info, 118 | GFile *file) 119 | { 120 | RsttoAppMenuItem *menu_item; 121 | GtkWidget *image = NULL; 122 | GIcon *icon = NULL; 123 | 124 | g_return_val_if_fail (app_info != NULL, NULL); 125 | 126 | menu_item = g_object_new (RSTTO_TYPE_APP_MENU_ITEM, NULL); 127 | 128 | menu_item->priv->app_info = app_info; 129 | g_object_ref (app_info); 130 | 131 | menu_item->priv->file = file; 132 | g_object_ref (file); 133 | 134 | icon = g_app_info_get_icon (app_info); 135 | if (icon) 136 | { 137 | image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU); 138 | } 139 | 140 | gtk_menu_item_set_label (GTK_MENU_ITEM (menu_item), g_app_info_get_name (app_info)); 141 | G_GNUC_BEGIN_IGNORE_DEPRECATIONS 142 | gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image); 143 | G_GNUC_END_IGNORE_DEPRECATIONS 144 | 145 | return GTK_WIDGET (menu_item); 146 | } 147 | -------------------------------------------------------------------------------- /src/file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __RISTRETTO_FILE_H__ 21 | #define __RISTRETTO_FILE_H__ 22 | 23 | #include 24 | #include 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef enum 29 | { 30 | RSTTO_IMAGE_ORIENT_NONE = 1, 31 | RSTTO_IMAGE_ORIENT_FLIP_HORIZONTAL, 32 | RSTTO_IMAGE_ORIENT_180, 33 | RSTTO_IMAGE_ORIENT_FLIP_VERTICAL, 34 | RSTTO_IMAGE_ORIENT_FLIP_TRANSPOSE, 35 | RSTTO_IMAGE_ORIENT_90, 36 | RSTTO_IMAGE_ORIENT_FLIP_TRANSVERSE, 37 | RSTTO_IMAGE_ORIENT_270, 38 | RSTTO_IMAGE_ORIENT_NOT_DETERMINED, 39 | } RsttoImageOrientation; 40 | 41 | typedef enum 42 | { 43 | RSTTO_SCALE_NONE = -2, 44 | RSTTO_SCALE_LIMIT_TO_VIEW, 45 | RSTTO_SCALE_FIT_TO_VIEW, 46 | RSTTO_SCALE_REAL_SIZE 47 | } RsttoScale; 48 | 49 | typedef enum 50 | { 51 | RSTTO_THUMBNAIL_FLAVOR_NORMAL, 52 | RSTTO_THUMBNAIL_FLAVOR_LARGE, 53 | RSTTO_THUMBNAIL_FLAVOR_X_LARGE, 54 | RSTTO_THUMBNAIL_FLAVOR_XX_LARGE, 55 | RSTTO_THUMBNAIL_FLAVOR_COUNT 56 | } RsttoThumbnailFlavor; 57 | 58 | typedef enum 59 | { 60 | RSTTO_THUMBNAIL_SIZE_VERY_SMALL, 61 | RSTTO_THUMBNAIL_SIZE_SMALLER, 62 | RSTTO_THUMBNAIL_SIZE_SMALL, 63 | RSTTO_THUMBNAIL_SIZE_NORMAL, 64 | RSTTO_THUMBNAIL_SIZE_LARGE, 65 | RSTTO_THUMBNAIL_SIZE_LARGER, 66 | RSTTO_THUMBNAIL_SIZE_VERY_LARGE, 67 | RSTTO_THUMBNAIL_SIZE_COUNT, 68 | } RsttoThumbnailSize; 69 | 70 | typedef enum 71 | { 72 | RSTTO_THUMBNAIL_STATE_UNPROCESSED, 73 | RSTTO_THUMBNAIL_STATE_IN_PROCESS, 74 | RSTTO_THUMBNAIL_STATE_PROCESSED, 75 | RSTTO_THUMBNAIL_STATE_ERROR 76 | } RsttoThumbnailState; 77 | 78 | 79 | 80 | #define RSTTO_TYPE_FILE rstto_file_get_type () 81 | G_DECLARE_FINAL_TYPE (RsttoFile, rstto_file, RSTTO, FILE, GObject) 82 | 83 | typedef struct _RsttoFilePrivate RsttoFilePrivate; 84 | 85 | struct _RsttoFile 86 | { 87 | GObject parent; 88 | RsttoFilePrivate *priv; 89 | }; 90 | 91 | 92 | 93 | RsttoFile * 94 | rstto_file_new (GFile *file); 95 | 96 | gboolean 97 | rstto_file_is_valid (RsttoFile *r_file); 98 | 99 | GFile * 100 | rstto_file_get_file (RsttoFile *r_file); 101 | 102 | const gchar * 103 | rstto_file_get_display_name (RsttoFile *r_file); 104 | 105 | const gchar * 106 | rstto_file_get_path (RsttoFile *r_file); 107 | 108 | const gchar * 109 | rstto_file_get_uri (RsttoFile *r_file); 110 | 111 | const gchar * 112 | rstto_file_get_collate_key (RsttoFile *r_file); 113 | 114 | const gchar * 115 | rstto_file_get_content_type (RsttoFile *r_file); 116 | 117 | void 118 | rstto_file_set_content_type (RsttoFile *r_file, 119 | const gchar *type); 120 | 121 | void 122 | rstto_file_set_thumbnail_state (RsttoFile *r_file, 123 | RsttoThumbnailFlavor flavor, 124 | RsttoThumbnailState state); 125 | 126 | void 127 | rstto_file_set_is_thumbnail (RsttoFile *r_file, 128 | gboolean is_thumbnail); 129 | 130 | const GdkPixbuf * 131 | rstto_file_get_thumbnail (RsttoFile *r_file, 132 | RsttoThumbnailSize size); 133 | 134 | guint64 135 | rstto_file_get_modified_time (RsttoFile *r_file); 136 | 137 | goffset 138 | rstto_file_get_size (RsttoFile *r_file); 139 | 140 | ExifEntry * 141 | rstto_file_get_exif (RsttoFile *r_file, 142 | ExifTag id); 143 | 144 | RsttoImageOrientation 145 | rstto_file_get_orientation (RsttoFile *r_file); 146 | 147 | void 148 | rstto_file_set_orientation (RsttoFile *r_file, 149 | RsttoImageOrientation orientation); 150 | 151 | gdouble 152 | rstto_file_get_scale (RsttoFile *r_file); 153 | 154 | void 155 | rstto_file_set_scale (RsttoFile *r_file, 156 | gdouble scale); 157 | 158 | RsttoScale 159 | rstto_file_get_auto_scale (RsttoFile *r_file); 160 | 161 | void 162 | rstto_file_set_auto_scale (RsttoFile *r_file, 163 | RsttoScale auto_scale); 164 | 165 | gdouble 166 | rstto_file_get_h_adjustment (RsttoFile *r_file); 167 | 168 | gdouble 169 | rstto_file_get_v_adjustment (RsttoFile *r_file); 170 | 171 | void 172 | rstto_file_set_h_adjustment (RsttoFile *r_file, 173 | gdouble h_adjust); 174 | 175 | void 176 | rstto_file_set_v_adjustment (RsttoFile *r_file, 177 | gdouble v_adjust); 178 | 179 | gboolean 180 | rstto_file_has_exif (RsttoFile *r_file); 181 | 182 | void 183 | rstto_file_changed (RsttoFile *r_file); 184 | 185 | gboolean 186 | rstto_file_is_ephemeral (RsttoFile *r_file); 187 | 188 | gboolean 189 | rstto_file_materialize (RsttoFile *r_file, 190 | GError **error); 191 | 192 | G_END_DECLS 193 | 194 | #endif /* __RISTRETTO_FILE_H__ */ 195 | -------------------------------------------------------------------------------- /src/main_window_ui.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /src/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #include "util.h" 21 | #include "main_window.h" 22 | #include "preferences_dialog.h" 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | 32 | gboolean version = FALSE; 33 | gboolean start_fullscreen = FALSE; 34 | gboolean start_slideshow = FALSE; 35 | gboolean show_settings = FALSE; 36 | 37 | 38 | 39 | static gboolean 40 | cb_rstto_open_files (gpointer user_data); 41 | 42 | static gboolean 43 | rstto_stdin_has_data (void); 44 | 45 | 46 | static GOptionEntry entries[] = { 47 | { "version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &version, 48 | N_ ("Version information"), 49 | NULL }, 50 | { "fullscreen", 'f', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &start_fullscreen, 51 | N_ ("Start in fullscreen mode"), 52 | NULL }, 53 | { "slideshow", 's', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &start_slideshow, 54 | N_ ("Start a slideshow"), 55 | NULL }, 56 | { "settings", 'S', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &show_settings, 57 | N_ ("Show settings dialog"), 58 | NULL }, 59 | { NULL, ' ', 0, 0, NULL, NULL, NULL } 60 | }; 61 | 62 | 63 | 64 | typedef struct 65 | { 66 | gint argc; 67 | gchar **argv; 68 | RsttoMainWindow *window; 69 | } RsttoOpenFiles; 70 | 71 | 72 | 73 | int 74 | main (int argc, 75 | char **argv) 76 | { 77 | GError *error = NULL; 78 | RsttoSettings *settings; 79 | RsttoImageList *image_list; 80 | GtkWidget *window; 81 | gboolean xfconf_disabled; 82 | 83 | xfce_textdomain (GETTEXT_PACKAGE, LOCALEDIR, "UTF-8"); 84 | 85 | if (!gtk_init_with_args (&argc, &argv, NULL, entries, PACKAGE, &error)) 86 | { 87 | if (error != NULL) 88 | { 89 | g_printerr (_("%s: %s\n\n" 90 | "Try %s --help to see a full list of\n" 91 | "available command line options.\n"), 92 | PACKAGE, error->message, PACKAGE_NAME); 93 | 94 | g_error_free (error); 95 | return 1; 96 | } 97 | } 98 | 99 | if (version) 100 | { 101 | g_print ("%s %s\n", PACKAGE_NAME, VERSION_FULL); 102 | return 0; 103 | } 104 | 105 | xfconf_disabled = !xfconf_init (&error); 106 | rstto_settings_set_xfconf_disabled (xfconf_disabled); 107 | if (xfconf_disabled) 108 | { 109 | g_warning ("Failed to initialize Xfconf: %s", error->message); 110 | g_error_free (error); 111 | } 112 | 113 | g_set_prgname (RISTRETTO_APP_ID); 114 | gtk_window_set_default_icon_name (RISTRETTO_APP_ID); 115 | settings = rstto_settings_new (); 116 | 117 | if (!show_settings) 118 | { 119 | RsttoOpenFiles rof; 120 | 121 | image_list = rstto_image_list_new (); 122 | window = rstto_main_window_new (image_list, FALSE); 123 | 124 | rof.argc = argc; 125 | rof.argv = argv; 126 | rof.window = RSTTO_MAIN_WINDOW (window); 127 | 128 | /* add a weak pointer to guard our handler */ 129 | g_object_add_weak_pointer (G_OBJECT (window), (gpointer *) &(rof.window)); 130 | g_idle_add (cb_rstto_open_files, &rof); 131 | 132 | if (rstto_settings_get_boolean_property (settings, "maximize-on-startup")) 133 | { 134 | gtk_window_maximize (GTK_WINDOW (window)); 135 | } 136 | 137 | /* Start fullscreen */ 138 | if (start_fullscreen) 139 | { 140 | gtk_window_fullscreen (GTK_WINDOW (window)); 141 | } 142 | 143 | g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); 144 | gtk_widget_show_all (window); 145 | 146 | gtk_main (); 147 | 148 | g_object_unref (image_list); 149 | } 150 | else 151 | { 152 | window = rstto_preferences_dialog_new (NULL); 153 | while (gtk_dialog_run (GTK_DIALOG (window)) == GTK_RESPONSE_HELP) 154 | { 155 | xfce_dialog_show_help (GTK_WINDOW (window), "ristretto", "preferences", NULL); 156 | } 157 | gtk_widget_destroy (window); 158 | } 159 | 160 | g_object_unref (settings); 161 | 162 | if (!xfconf_disabled) 163 | xfconf_shutdown (); 164 | 165 | return 0; 166 | } 167 | 168 | static gboolean 169 | cb_rstto_open_files (gpointer user_data) 170 | { 171 | RsttoOpenFiles *rof = user_data; 172 | GSList *files = NULL; 173 | GFile *file; 174 | gint n; 175 | 176 | if (rof->window == NULL) 177 | return FALSE; 178 | 179 | for (n = 1; n < rof->argc; n++) 180 | { 181 | file = g_file_new_for_commandline_arg (rof->argv[n]); 182 | files = g_slist_prepend (files, file); 183 | } 184 | 185 | if (rstto_stdin_has_data ()) 186 | { 187 | file = g_file_new_for_commandline_arg ("/dev/stdin"); 188 | files = g_slist_prepend (files, file); 189 | } 190 | 191 | if (files != NULL) 192 | { 193 | files = g_slist_reverse (files); 194 | rstto_main_window_open (rof->window, files); 195 | g_slist_free_full (files, g_object_unref); 196 | 197 | if (start_slideshow) 198 | rstto_main_window_play_slideshow (rof->window); 199 | } 200 | 201 | return FALSE; 202 | } 203 | 204 | static gboolean 205 | rstto_stdin_has_data (void) 206 | { 207 | /* stdin should not be connected to the terminal */ 208 | if (isatty (STDIN_FILENO)) 209 | return FALSE; 210 | 211 | /* The number of bytes must be greater than zero */ 212 | gint n; 213 | if (ioctl (STDIN_FILENO, FIONREAD, &n) == 0 && n > 0) 214 | return TRUE; 215 | 216 | return FALSE; 217 | } 218 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | project( 2 | 'ristretto', 3 | 'c', 4 | version : '0.13.4-dev', 5 | license : 'GPL-2.0-or-later', 6 | meson_version : '>= 0.54.0', 7 | default_options : ['c_std=gnu11', 'buildtype=debugoptimized', 'warning_level=2'] 8 | ) 9 | 10 | project_namespace = 'apps' 11 | pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name() 12 | copyright_year = '2025' 13 | 14 | cc = meson.get_compiler('c') 15 | pkgconfig = import('pkgconfig') 16 | gnome = import('gnome') 17 | i18n = import('i18n') 18 | 19 | dependency_versions = { 20 | 'glib': '>= 2.56.0', 21 | 'gtk': '>= 3.22.0', 22 | 'cairo': '>= 1.10.0', 23 | 'libexif': '>= 0.6.0', 24 | 'xfce4': '>= 4.16.0', 25 | 26 | 'libx11': '>= 1.6.7', 27 | } 28 | 29 | glib = dependency('glib-2.0', version: dependency_versions['glib']) 30 | gio = dependency('gio-2.0', version: dependency_versions['glib']) 31 | gio_unix = dependency('gio-unix-2.0', version: dependency_versions['glib']) 32 | gtk = dependency('gtk+-3.0', version: dependency_versions['gtk']) 33 | cairo = dependency('cairo', version: dependency_versions['cairo']) 34 | libexif = dependency('libexif', version: dependency_versions['libexif']) 35 | libxfce4ui = dependency('libxfce4ui-2', version: dependency_versions['xfce4']) 36 | if libxfce4ui.version().version_compare('< 4.21.0') 37 | exo = dependency('exo-2', version: dependency_versions['xfce4']) 38 | else 39 | exo = dependency('', required: false) 40 | endif 41 | libxfce4util = dependency('libxfce4util-1.0', version: dependency_versions['xfce4']) 42 | xfconf = dependency('libxfconf-0', version: dependency_versions['xfce4']) 43 | 44 | feature_cflags = [] 45 | 46 | libx11 = dependency('x11', version: dependency_versions['libx11'], required: get_option('libx11')) 47 | if libx11.found() 48 | feature_cflags += '-DHAVE_LIBX11=1' 49 | endif 50 | 51 | tumbler_service_name_prefix = get_option('service-name-prefix') 52 | if tumbler_service_name_prefix == '' 53 | tumbler_service_name_prefix = 'org.freedesktop.thumbnails' 54 | endif 55 | tumbler_service_path_prefix = '/@0@'.format('/'.join(tumbler_service_name_prefix.split('.'))) 56 | 57 | headers = [ 58 | 'math.h', 59 | 'string.h', 60 | ] 61 | foreach header : headers 62 | if cc.check_header(header) 63 | feature_cflags += '-DHAVE_@0@=1'.format(header.underscorify().to_upper()) 64 | endif 65 | endforeach 66 | 67 | libmagic = cc.find_library('magic', required: false) 68 | if libmagic.found() and cc.check_header('magic.h') and cc.has_function('magic_open', dependencies: libmagic) 69 | feature_cflags += '-DHAVE_MAGIC_H=1' 70 | endif 71 | 72 | libm = cc.find_library('m', required: true) 73 | 74 | extra_cflags = [] 75 | extra_cflags_check = [ 76 | '-Wmissing-declarations', 77 | '-Wmissing-noreturn', 78 | '-Wold-style-definition', 79 | '-Wredundant-decls', 80 | '-Wpointer-arith', 81 | '-Wcast-align', 82 | '-Winit-self', 83 | '-Wshadow', 84 | '-Wmissing-include-dirs', 85 | '-Wundef', 86 | '-Wformat', 87 | '-Wformat-security', 88 | '-Wformat-y2k', 89 | '-Wnested-externs', 90 | '-Wno-unused-parameter', 91 | '-Wno-declaration-after-statement', 92 | '-Wno-missing-field-initializers', 93 | '-Werror=implicit-function-declaration', 94 | '-Wno-error=deprecated-declarations', 95 | ] 96 | 97 | optimization = get_option('optimization') 98 | if get_option('debug') and optimization in ['0', 'g'] 99 | extra_cflags_check += '-fstack-protector-strong' 100 | extra_cflags += [ 101 | '-DDEBUG=1', 102 | '-DDEBUG_TRACE=1', 103 | '-DG_ENABLE_DEBUG', 104 | ] 105 | elif optimization in ['3', 's'] 106 | extra_cflags += [ 107 | '-DNDEBUG', 108 | '-DG_DISABLE_CAST_CHECKS', 109 | '-DG_DISABLE_ASSERT', 110 | ] 111 | endif 112 | 113 | if dependency_versions.has_key('glib') 114 | glib_version_parts = dependency_versions['glib'].split(' ') 115 | glib_min_version_parts = glib_version_parts[1].split('.') 116 | glib_min_version_define = 'GLIB_VERSION_@0@_@1@'.format(glib_min_version_parts[0], glib_min_version_parts[1]) 117 | extra_cflags += [ 118 | '-DGLIB_VERSION_MIN_REQUIRED=@0@'.format(glib_min_version_define), 119 | '-DGLIB_VERSION_MAX_ALLOWED=@0@'.format(glib_min_version_define), 120 | '-DG_LOG_USE_STRUCTURED=1', 121 | ] 122 | endif 123 | 124 | version_parts = meson.project_version().split('-dev')[0].split('.') 125 | version_short = '@0@.@1@'.format(version_parts[0], version_parts[1]) 126 | 127 | extra_cflags += [ 128 | '-DPACKAGE="@0@"'.format(meson.project_name()), 129 | '-DPACKAGE_NAME="@0@"'.format(meson.project_name()), 130 | '-DPACKAGE_VERSION="@0@"'.format(meson.project_version()), 131 | '-DVERSION="@0@"'.format(meson.project_version()), 132 | '-DVERSION_SHORT="@0@"'.format(version_short), 133 | '-DPACKAGE_STRING="@0@ @1@"'.format(meson.project_name(), meson.project_version()), 134 | '-DPACKAGE_DATADIR="@0@"'.format(pkgdatadir), 135 | '-DCOPYRIGHT_YEAR="@0@"'.format(copyright_year), 136 | '-DPACKAGE_LOCALE_DIR="@0@"'.format(get_option('prefix') / get_option('localedir')), 137 | '-DPACKAGE_BUGREPORT="https://gitlab.xfce.org/@0@/@1@/-/issues"'.format(project_namespace, meson.project_name()), 138 | '-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()), 139 | '-DPREFIX="@0@"'.format(get_option('prefix')), 140 | '-DBINDIR="@0@"'.format(get_option('prefix') / get_option('bindir')), 141 | '-DDATADIR="@0@"'.format(get_option('prefix') / get_option('datadir')), 142 | '-DINCLUDEDIR="@0@"'.format(get_option('prefix') / get_option('includedir')), 143 | '-DLIBDIR="@0@"'.format(get_option('prefix') / get_option('libdir')), 144 | '-DLIBEXECDIR="@0@"'.format(get_option('prefix') / get_option('libexecdir')), 145 | '-DLOCALEDIR="@0@"'.format(get_option('prefix') / get_option('localedir')), 146 | '-DLOCALSTATEDIR="@0@"'.format(get_option('prefix') / get_option('localstatedir')), 147 | '-DSBINDIR="@0@"'.format(get_option('prefix') / get_option('sbindir')), 148 | '-DSYSCONFDIR="@0@"'.format(get_option('prefix') / get_option('sysconfdir')), 149 | '-DHAVE_XFCE_REVISION_H=1', 150 | ] 151 | 152 | add_project_arguments(cc.get_supported_arguments(extra_cflags_check), language: 'c') 153 | add_project_arguments(extra_cflags, language: 'c') 154 | add_project_arguments(feature_cflags, language: 'c') 155 | 156 | xfce_revision_h = vcs_tag( 157 | command: ['git', 'rev-parse', '--short', 'HEAD'], 158 | fallback: 'UNKNOWN', 159 | input: 'xfce-revision.h.in', 160 | output: 'xfce-revision.h', 161 | replace_string: '@REVISION@', 162 | ) 163 | 164 | i18n.merge_file( 165 | input: 'org.xfce.ristretto.desktop.in', 166 | output: 'org.xfce.ristretto.desktop', 167 | po_dir: 'po', 168 | type: 'desktop', 169 | install: true, 170 | install_dir: get_option('prefix') / get_option('datadir') / 'applications', 171 | ) 172 | 173 | i18n.merge_file( 174 | input: 'org.xfce.ristretto.appdata.xml.in', 175 | output: 'org.xfce.ristretto.appdata.xml', 176 | po_dir: 'po', 177 | type: 'xml', 178 | install: true, 179 | install_dir: get_option('prefix') / get_option('datadir') / 'metainfo', 180 | ) 181 | 182 | subdir('icons') 183 | subdir('po') 184 | subdir('src') 185 | -------------------------------------------------------------------------------- /src/util.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Stephan Arts 2006-2012 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #include "util.h" 21 | #include "main_window.h" 22 | 23 | #include 24 | 25 | 26 | #define RSTTO_THUMBNAIL_FLAVOR_NORMAL_N_PIXELS 128 27 | #define RSTTO_THUMBNAIL_FLAVOR_LARGE_N_PIXELS 256 28 | #define RSTTO_THUMBNAIL_FLAVOR_X_LARGE_N_PIXELS 512 29 | #define RSTTO_THUMBNAIL_FLAVOR_XX_LARGE_N_PIXELS 1024 30 | 31 | static const gchar *rstto_thumbnail_flavor_names[] = { "normal", "large", "x-large", "xx-large" }; 32 | static const guint rstto_thumbnail_n_pixels_unscaled[] = { 32, 48, 64, 96, 128, 192, 256 }; 33 | static guint rstto_thumbnail_n_pixels[RSTTO_THUMBNAIL_SIZE_COUNT]; 34 | 35 | 36 | 37 | static void 38 | rstto_util_source_remove_all (gpointer data, 39 | GObject *object) 40 | { 41 | while (g_source_remove_by_user_data (object)) 42 | ; 43 | } 44 | 45 | 46 | 47 | /* an often sufficient way to automate memory management of sources, without having 48 | * to store a source id and use an ad hoc handler */ 49 | gpointer 50 | rstto_util_source_autoremove (gpointer object) 51 | { 52 | g_return_val_if_fail (G_IS_OBJECT (object), object); 53 | 54 | if (!rstto_object_get_data (object, "source-autoremove")) 55 | { 56 | g_object_weak_ref (object, rstto_util_source_remove_all, NULL); 57 | rstto_object_set_data (object, "source-autoremove", GINT_TO_POINTER (TRUE)); 58 | } 59 | 60 | return object; 61 | } 62 | 63 | 64 | 65 | /* 66 | * Workaround to avoid using Cairo Xlib backend which has some memory issues: 67 | * https://gitlab.freedesktop.org/cairo/cairo/-/issues/500 68 | * https://gitlab.freedesktop.org/cairo/cairo/-/issues/510 69 | */ 70 | cairo_pattern_t * 71 | rstto_util_set_source_pixbuf (cairo_t *ctx, 72 | const GdkPixbuf *pixbuf, 73 | gdouble pixbuf_x, 74 | gdouble pixbuf_y) 75 | { 76 | cairo_t *cr; 77 | cairo_surface_t *surface; 78 | cairo_pattern_t *pattern; 79 | cairo_format_t format; 80 | 81 | /* for non-Xlib backends, this is just a wrapper */ 82 | if (ctx != NULL && cairo_surface_get_type (cairo_get_target (ctx)) != CAIRO_SURFACE_TYPE_XLIB) 83 | { 84 | gdk_cairo_set_source_pixbuf (ctx, pixbuf, pixbuf_x, pixbuf_y); 85 | return NULL; 86 | } 87 | 88 | /* copied from gdk_cairo_set_source_pixbuf() */ 89 | if (gdk_pixbuf_get_n_channels (pixbuf) == 3) 90 | format = CAIRO_FORMAT_RGB24; 91 | else 92 | format = CAIRO_FORMAT_ARGB32; 93 | 94 | /* create a generic image surface on which to apply gdk_cairo_set_source_pixbuf() */ 95 | surface = cairo_image_surface_create (format, 96 | gdk_pixbuf_get_width (pixbuf), 97 | gdk_pixbuf_get_height (pixbuf)); 98 | cr = cairo_create (surface); 99 | cairo_surface_destroy (surface); 100 | 101 | /* apply it and get the resulting source */ 102 | gdk_cairo_set_source_pixbuf (cr, pixbuf, pixbuf_x, pixbuf_y); 103 | pattern = cairo_pattern_reference (cairo_get_source (cr)); 104 | cairo_destroy (cr); 105 | 106 | /* put the source in the original context, if any */ 107 | if (ctx != NULL) 108 | { 109 | cairo_set_source (ctx, pattern); 110 | cairo_pattern_destroy (pattern); 111 | pattern = NULL; 112 | } 113 | 114 | return pattern; 115 | } 116 | 117 | 118 | 119 | void 120 | rstto_util_paint_background_color (GtkWidget *widget, 121 | RsttoSettings *settings, 122 | cairo_t *ctx) 123 | { 124 | GdkWindow *window; 125 | GdkRGBA *bgcolor = NULL; 126 | gboolean bgcolor_override = FALSE; 127 | 128 | /* see if we have a non-default background color */ 129 | window = gdk_window_get_toplevel (gtk_widget_get_window (widget)); 130 | if (gdk_window_get_state (window) & GDK_WINDOW_STATE_FULLSCREEN) 131 | g_object_get (settings, "bgcolor-fullscreen", &bgcolor, NULL); 132 | else 133 | { 134 | g_object_get (settings, "bgcolor-override", &bgcolor_override, NULL); 135 | if (bgcolor_override) 136 | g_object_get (settings, "bgcolor", &bgcolor, NULL); 137 | } 138 | 139 | /* override default background color if needed */ 140 | if (bgcolor != NULL) 141 | { 142 | cairo_save (ctx); 143 | gdk_cairo_set_source_rgba (ctx, bgcolor); 144 | cairo_paint (ctx); 145 | cairo_restore (ctx); 146 | gdk_rgba_free (bgcolor); 147 | } 148 | } 149 | 150 | 151 | 152 | void 153 | rstto_util_dialog_error (const gchar *message, 154 | GError *error) 155 | { 156 | GtkWidget *dialog; 157 | GtkWindow *window; 158 | 159 | window = GTK_WINDOW (rstto_main_window_get_app_window ()); 160 | if (message != NULL && error != NULL) 161 | dialog = gtk_message_dialog_new (window, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, 162 | GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, 163 | "%s: %s", message, error->message); 164 | else if (message != NULL) 165 | dialog = gtk_message_dialog_new (window, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, 166 | GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", message); 167 | else if (error != NULL) 168 | dialog = gtk_message_dialog_new (window, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, 169 | GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", error->message); 170 | else 171 | { 172 | g_warn_if_reached (); 173 | return; 174 | } 175 | 176 | gtk_dialog_run (GTK_DIALOG (dialog)); 177 | gtk_widget_destroy (dialog); 178 | } 179 | 180 | 181 | 182 | void 183 | rstto_util_set_scale_factor (gint scale_factor) 184 | { 185 | for (gint n = 0; n < RSTTO_THUMBNAIL_SIZE_COUNT; n++) 186 | rstto_thumbnail_n_pixels[n] = rstto_thumbnail_n_pixels_unscaled[n] * scale_factor; 187 | } 188 | 189 | 190 | 191 | RsttoThumbnailFlavor 192 | rstto_util_get_thumbnail_flavor (RsttoThumbnailSize size) 193 | { 194 | if (rstto_thumbnail_n_pixels[size] <= RSTTO_THUMBNAIL_FLAVOR_NORMAL_N_PIXELS) 195 | return RSTTO_THUMBNAIL_FLAVOR_NORMAL; 196 | else if (rstto_thumbnail_n_pixels[size] <= RSTTO_THUMBNAIL_FLAVOR_LARGE_N_PIXELS) 197 | return RSTTO_THUMBNAIL_FLAVOR_LARGE; 198 | else if (rstto_thumbnail_n_pixels[size] <= RSTTO_THUMBNAIL_FLAVOR_X_LARGE_N_PIXELS) 199 | return RSTTO_THUMBNAIL_FLAVOR_X_LARGE; 200 | else 201 | return RSTTO_THUMBNAIL_FLAVOR_XX_LARGE; 202 | } 203 | 204 | 205 | 206 | const gchar * 207 | rstto_util_get_thumbnail_flavor_name (RsttoThumbnailFlavor flavor) 208 | { 209 | return rstto_thumbnail_flavor_names[flavor]; 210 | } 211 | 212 | 213 | 214 | guint 215 | rstto_util_get_thumbnail_n_pixels (RsttoThumbnailSize size) 216 | { 217 | return rstto_thumbnail_n_pixels[size]; 218 | } 219 | 220 | 221 | 222 | gboolean 223 | rstto_util_sendfile (GOutputStream *out, 224 | GInputStream *in, 225 | GError **error) 226 | { 227 | gsize buff_size = 1 * 1024 * 1024; 228 | gchar *buff = g_malloc (buff_size); 229 | gboolean status = FALSE; 230 | 231 | while (TRUE) 232 | { 233 | gssize n_in = g_input_stream_read (in, buff, buff_size, NULL, error); 234 | if (n_in == -1) 235 | { 236 | break; 237 | } 238 | else if (n_in == 0) 239 | { 240 | status = TRUE; 241 | break; 242 | } 243 | 244 | gssize n_out = g_output_stream_write (out, buff, n_in, NULL, error); 245 | if (n_out == -1) 246 | { 247 | break; 248 | } 249 | else if (n_out != n_in) 250 | { 251 | g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Cannot write all bytes")); 252 | break; 253 | } 254 | } 255 | 256 | g_free (buff); 257 | 258 | return status; 259 | } 260 | -------------------------------------------------------------------------------- /src/print.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Gaël Bonithon 2023 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #include "util.h" 21 | #include "print.h" 22 | 23 | #include 24 | 25 | 26 | static void 27 | rstto_print_draw_page (GtkPrintOperation *operation, 28 | GtkPrintContext *context, 29 | gint page_nr); 30 | static void 31 | rstto_print_done (GtkPrintOperation *operation, 32 | GtkPrintOperationResult result); 33 | 34 | 35 | 36 | struct _RsttoPrint 37 | { 38 | GtkPrintOperation parent; 39 | 40 | RsttoImageViewer *viewer; 41 | }; 42 | 43 | 44 | 45 | G_DEFINE_TYPE (RsttoPrint, rstto_print, GTK_TYPE_PRINT_OPERATION) 46 | 47 | 48 | 49 | static void 50 | rstto_print_class_init (RsttoPrintClass *klass) 51 | { 52 | GtkPrintOperationClass *op_class; 53 | 54 | op_class = GTK_PRINT_OPERATION_CLASS (klass); 55 | op_class->draw_page = rstto_print_draw_page; 56 | op_class->done = rstto_print_done; 57 | } 58 | 59 | 60 | 61 | static void 62 | rstto_print_init (RsttoPrint *print) 63 | { 64 | } 65 | 66 | 67 | 68 | static void 69 | rstto_print_draw_page (GtkPrintOperation *operation, 70 | GtkPrintContext *context, 71 | gint page_nr) 72 | { 73 | RsttoPrint *print = RSTTO_PRINT (operation); 74 | cairo_t *cr; 75 | gdouble x0, y0; 76 | gdouble scale; 77 | gdouble p_width, p_height; 78 | gint width, height; 79 | GtkPageSetup *page_setup; 80 | GdkPixbuf *pixbuf; 81 | 82 | page_setup = gtk_print_context_get_page_setup (context); 83 | x0 = gtk_page_setup_get_left_margin (page_setup, GTK_UNIT_POINTS); 84 | y0 = gtk_page_setup_get_top_margin (page_setup, GTK_UNIT_POINTS); 85 | cr = gtk_print_context_get_cairo_context (context); 86 | cairo_translate (cr, x0, y0); 87 | 88 | p_width = gtk_page_setup_get_page_width (page_setup, GTK_UNIT_POINTS); 89 | p_height = gtk_page_setup_get_page_height (page_setup, GTK_UNIT_POINTS); 90 | width = rstto_image_viewer_get_width (print->viewer); 91 | height = rstto_image_viewer_get_height (print->viewer); 92 | scale = rstto_image_viewer_get_scale (print->viewer); 93 | cairo_rectangle (cr, 0, 0, MIN (width * scale, p_width), MIN (height * scale, p_height)); 94 | cairo_clip (cr); 95 | cairo_scale (cr, scale, scale); 96 | 97 | pixbuf = rstto_image_viewer_get_pixbuf (print->viewer); 98 | if (pixbuf != NULL) 99 | { 100 | gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); 101 | cairo_paint (cr); 102 | g_object_unref (pixbuf); 103 | } 104 | } 105 | 106 | 107 | 108 | static void 109 | rstto_print_settings_save_foreach (const gchar *key, 110 | const gchar *value, 111 | gpointer rc) 112 | { 113 | if (G_LIKELY (key != NULL && value != NULL)) 114 | xfce_rc_write_entry (rc, key, value); 115 | } 116 | 117 | 118 | 119 | static void 120 | rstto_print_settings_save (GtkPrintOperation *operation) 121 | { 122 | XfceRc *rc; 123 | GtkPrintSettings *settings; 124 | GtkPageSetup *page_setup; 125 | 126 | settings = gtk_print_operation_get_print_settings (operation); 127 | if (G_UNLIKELY (settings == NULL)) 128 | return; 129 | 130 | rc = xfce_rc_config_open (XFCE_RESOURCE_CONFIG, "ristretto/print-settings", FALSE); 131 | if (G_UNLIKELY (rc == NULL)) 132 | return; 133 | 134 | page_setup = gtk_print_operation_get_default_page_setup (operation); 135 | 136 | gtk_print_settings_set_orientation (settings, gtk_page_setup_get_orientation (page_setup)); 137 | gtk_print_settings_set_paper_size (settings, gtk_page_setup_get_paper_size (page_setup)); 138 | 139 | gtk_print_settings_set_double (settings, "top-margin", 140 | gtk_page_setup_get_top_margin (page_setup, GTK_UNIT_MM)); 141 | gtk_print_settings_set_double (settings, "bottom-margin", 142 | gtk_page_setup_get_bottom_margin (page_setup, GTK_UNIT_MM)); 143 | gtk_print_settings_set_double (settings, "right-margin", 144 | gtk_page_setup_get_right_margin (page_setup, GTK_UNIT_MM)); 145 | gtk_print_settings_set_double (settings, "left-margin", 146 | gtk_page_setup_get_left_margin (page_setup, GTK_UNIT_MM)); 147 | 148 | xfce_rc_set_group (rc, "Print Settings"); 149 | gtk_print_settings_foreach (settings, rstto_print_settings_save_foreach, rc); 150 | 151 | xfce_rc_close (rc); 152 | } 153 | 154 | 155 | 156 | static void 157 | rstto_print_done (GtkPrintOperation *operation, 158 | GtkPrintOperationResult result) 159 | { 160 | if (result == GTK_PRINT_OPERATION_RESULT_APPLY) 161 | rstto_print_settings_save (operation); 162 | } 163 | 164 | 165 | 166 | RsttoPrint * 167 | rstto_print_new (RsttoImageViewer *viewer) 168 | { 169 | RsttoPrint *print; 170 | 171 | g_return_val_if_fail (RSTTO_IS_IMAGE_VIEWER (viewer), NULL); 172 | 173 | print = g_object_new (RSTTO_TYPE_PRINT, "embed-page-setup", TRUE, NULL); 174 | print->viewer = viewer; 175 | 176 | return print; 177 | } 178 | 179 | 180 | 181 | static void 182 | rstto_print_settings_load (GtkPrintOperation *operation) 183 | { 184 | XfceRc *rc; 185 | GtkPrintSettings *settings = NULL; 186 | GtkPageSetup *page_setup; 187 | GtkPaperSize *paper_size; 188 | gchar **keys; 189 | const gchar *value; 190 | gdouble margin; 191 | 192 | rc = xfce_rc_config_open (XFCE_RESOURCE_CONFIG, "ristretto/print-settings", TRUE); 193 | if (G_UNLIKELY (rc == NULL)) 194 | return; 195 | 196 | keys = xfce_rc_get_entries (rc, "Print Settings"); 197 | if (G_LIKELY (keys != NULL)) 198 | { 199 | xfce_rc_set_group (rc, "Print Settings"); 200 | settings = gtk_print_settings_new (); 201 | for (gchar **key = keys; *key != NULL; key++) 202 | { 203 | value = xfce_rc_read_entry (rc, *key, NULL); 204 | if (G_LIKELY (value != NULL)) 205 | gtk_print_settings_set (settings, *key, value); 206 | } 207 | 208 | g_strfreev (keys); 209 | } 210 | 211 | xfce_rc_close (rc); 212 | 213 | if (G_LIKELY (settings != NULL)) 214 | { 215 | page_setup = gtk_page_setup_new (); 216 | 217 | gtk_page_setup_set_orientation (page_setup, gtk_print_settings_get_orientation (settings)); 218 | 219 | paper_size = gtk_print_settings_get_paper_size (settings); 220 | gtk_page_setup_set_paper_size (page_setup, paper_size); 221 | gtk_paper_size_free (paper_size); 222 | 223 | margin = gtk_print_settings_get_double (settings, "top-margin"); 224 | gtk_page_setup_set_top_margin (page_setup, margin, GTK_UNIT_MM); 225 | margin = gtk_print_settings_get_double (settings, "bottom-margin"); 226 | gtk_page_setup_set_bottom_margin (page_setup, margin, GTK_UNIT_MM); 227 | margin = gtk_print_settings_get_double (settings, "right-margin"); 228 | gtk_page_setup_set_right_margin (page_setup, margin, GTK_UNIT_MM); 229 | margin = gtk_print_settings_get_double (settings, "left-margin"); 230 | gtk_page_setup_set_left_margin (page_setup, margin, GTK_UNIT_MM); 231 | 232 | gtk_print_operation_set_default_page_setup (operation, page_setup); 233 | gtk_print_operation_set_print_settings (operation, settings); 234 | 235 | g_object_unref (page_setup); 236 | g_object_unref (settings); 237 | } 238 | } 239 | 240 | 241 | 242 | gboolean 243 | rstto_print_image_interactive (RsttoPrint *print, 244 | GtkWindow *parent, 245 | GError **error) 246 | { 247 | GtkPrintOperationResult result; 248 | 249 | g_return_val_if_fail (RSTTO_IS_PRINT (print), FALSE); 250 | g_return_val_if_fail (GTK_IS_WINDOW (parent), FALSE); 251 | g_return_val_if_fail (error == NULL || *error == NULL, FALSE); 252 | 253 | rstto_print_settings_load (GTK_PRINT_OPERATION (print)); 254 | gtk_print_operation_set_n_pages (GTK_PRINT_OPERATION (print), 1); 255 | gtk_print_operation_set_allow_async (GTK_PRINT_OPERATION (print), TRUE); 256 | 257 | result = gtk_print_operation_run (GTK_PRINT_OPERATION (print), 258 | GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, 259 | parent, error); 260 | 261 | return (result != GTK_PRINT_OPERATION_RESULT_ERROR); 262 | } 263 | -------------------------------------------------------------------------------- /icons/48x48/org.xfce.ristretto.svg: -------------------------------------------------------------------------------- 1 | 2 | 22 | 49 | 53 | 58 | 63 | 64 | Adwaita Icon Template 66 | 68 | 71 | 75 | 79 | 80 | 91 | 94 | 98 | 102 | 103 | 114 | 117 | 121 | 125 | 126 | 137 | 140 | 144 | 148 | 149 | 159 | 162 | 166 | 170 | 171 | 172 | 174 | 175 | 177 | Adwaita Icon Template 178 | 179 | 180 | 181 | 187 | 191 | 197 | 203 | 209 | 210 | 216 | 222 | 227 | 233 | 240 | 241 | -------------------------------------------------------------------------------- /icons/96x96/org.xfce.ristretto.svg: -------------------------------------------------------------------------------- 1 | 2 | 22 | 49 | 55 | 60 | 65 | 66 | Adwaita Icon Template 68 | 70 | 73 | 77 | 81 | 82 | 93 | 96 | 100 | 104 | 105 | 116 | 119 | 123 | 127 | 128 | 139 | 142 | 146 | 150 | 151 | 161 | 164 | 168 | 172 | 173 | 174 | 176 | 177 | 179 | Adwaita Icon Template 180 | 181 | 182 | 183 | 189 | 193 | 199 | 205 | 211 | 212 | 218 | 224 | 229 | 235 | 242 | 243 | -------------------------------------------------------------------------------- /icons/16x16/org.xfce.ristretto.svg: -------------------------------------------------------------------------------- 1 | 2 | 22 | 49 | 53 | 58 | 63 | 64 | Adwaita Icon Template 66 | 68 | 79 | 82 | 86 | 90 | 91 | 102 | 105 | 109 | 113 | 114 | 125 | 128 | 132 | 136 | 137 | 147 | 150 | 154 | 158 | 159 | 160 | 162 | 163 | 165 | image/svg+xml 166 | 168 | 169 | 170 | GNOME Design Team 171 | 172 | 173 | 174 | 176 | Adwaita Icon Template 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 204 | 206 | 208 | 210 | 212 | 214 | 216 | 217 | 218 | 219 | 225 | 229 | 235 | 241 | 247 | 248 | 254 | 260 | 266 | 273 | 279 | 280 | -------------------------------------------------------------------------------- /icons/32x32/org.xfce.ristretto.svg: -------------------------------------------------------------------------------- 1 | 2 | 22 | 49 | 53 | 58 | 63 | 64 | Adwaita Icon Template 66 | 68 | 71 | 75 | 79 | 80 | 91 | 94 | 98 | 102 | 103 | 114 | 117 | 121 | 125 | 126 | 137 | 140 | 144 | 148 | 149 | 159 | 162 | 166 | 170 | 171 | 172 | 174 | 175 | 177 | image/svg+xml 178 | 180 | 181 | 182 | GNOME Design Team 183 | 184 | 185 | 186 | 188 | Adwaita Icon Template 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 216 | 218 | 220 | 222 | 224 | 226 | 228 | 229 | 230 | 231 | 237 | 241 | 247 | 253 | 259 | 260 | 266 | 271 | 277 | 284 | 288 | 289 | -------------------------------------------------------------------------------- /src/file_manager_integration_thunar.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Dmitry Petrachkov 2025 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 | * 02110-1301, USA. 18 | */ 19 | 20 | #include "file_manager_integration_thunar.h" 21 | 22 | #include 23 | #include 24 | 25 | enum 26 | { 27 | PROP_0, 28 | PROP_DIRECTORY, 29 | PROP_SORT_TYPE, 30 | PROP_SORT_ORDER, 31 | }; 32 | 33 | static void 34 | rstto_file_manager_integration_thunar_finalize (GObject *object); 35 | 36 | static void 37 | rstto_file_manager_integration_thunar_get_property (GObject *object, 38 | guint prop_id, 39 | GValue *value, 40 | GParamSpec *pspec); 41 | 42 | static void 43 | rstto_file_manager_integration_thunar_set_property (GObject *object, 44 | guint prop_id, 45 | const GValue *value, 46 | GParamSpec *pspec); 47 | 48 | static void 49 | rstto_file_manager_integration_thunar_file_manager_integration_interface_init (RsttoFileManagerIntegrationInterface *iface); 50 | 51 | static void 52 | rstto_file_manager_integration_thunar_xfconf_property_changed (RsttoFileManagerIntegrationThunar *self, 53 | const gchar *prop_name, 54 | const GValue *value); 55 | 56 | static void 57 | rstto_file_manager_integration_thunar_set_directory (RsttoFileManagerIntegrationThunar *self, 58 | GFile *directory); 59 | 60 | static RsttoSortType 61 | rstto_file_manager_integration_thunar_get_sort_type_from_string (const gchar *column); 62 | 63 | static RsttoSortOrder 64 | rstto_file_manager_integration_thunar_get_sort_order_from_string (const gchar *order); 65 | 66 | static gboolean 67 | rstto_file_manager_integration_thunar_get_sort_settings_per_directory (RsttoFileManagerIntegrationThunar *self); 68 | 69 | static gboolean 70 | rstto_file_manager_integration_thunar_get_sort_settings_global (RsttoFileManagerIntegrationThunar *self); 71 | 72 | static gboolean 73 | rstto_file_manager_integration_thunar_fetch_sort_settings (RsttoFileManagerIntegrationThunar *self); 74 | 75 | struct _RsttoFileManagerIntegrationThunar 76 | { 77 | GObject parent; 78 | 79 | GFile *directory; 80 | RsttoSortType sort_type; 81 | RsttoSortOrder sort_order; 82 | XfconfChannel *channel; 83 | }; 84 | 85 | G_DEFINE_TYPE_WITH_CODE (RsttoFileManagerIntegrationThunar, rstto_file_manager_integration_thunar, G_TYPE_OBJECT, 86 | G_IMPLEMENT_INTERFACE (RSTTO_TYPE_FILE_MANAGER_INTEGRATION, 87 | rstto_file_manager_integration_thunar_file_manager_integration_interface_init)) 88 | 89 | static void 90 | rstto_file_manager_integration_thunar_class_init (RsttoFileManagerIntegrationThunarClass *klass) 91 | { 92 | GObjectClass *object_class = G_OBJECT_CLASS (klass); 93 | 94 | object_class->finalize = rstto_file_manager_integration_thunar_finalize; 95 | 96 | object_class->get_property = rstto_file_manager_integration_thunar_get_property; 97 | object_class->set_property = rstto_file_manager_integration_thunar_set_property; 98 | 99 | g_object_class_override_property (object_class, PROP_DIRECTORY, "directory"); 100 | g_object_class_override_property (object_class, PROP_SORT_TYPE, "sort-type"); 101 | g_object_class_override_property (object_class, PROP_SORT_ORDER, "sort-order"); 102 | } 103 | 104 | static void 105 | rstto_file_manager_integration_thunar_init (RsttoFileManagerIntegrationThunar *self) 106 | { 107 | self->sort_type = -1; 108 | self->sort_order = -1; 109 | 110 | if (!rstto_settings_get_xfconf_disabled ()) 111 | { 112 | self->channel = xfconf_channel_get ("thunar"); 113 | g_signal_connect_swapped (self->channel, "property-changed", 114 | G_CALLBACK (rstto_file_manager_integration_thunar_xfconf_property_changed), 115 | self); 116 | } 117 | } 118 | 119 | static void 120 | rstto_file_manager_integration_thunar_finalize (GObject *object) 121 | { 122 | RsttoFileManagerIntegrationThunar *self = RSTTO_FILE_MANAGER_INTEGRATION_THUNAR (object); 123 | 124 | g_clear_object (&self->directory); 125 | 126 | if (self->channel != NULL) 127 | g_signal_handlers_disconnect_by_data (self->channel, self); 128 | 129 | G_OBJECT_CLASS (rstto_file_manager_integration_thunar_parent_class)->finalize (object); 130 | } 131 | 132 | static void 133 | rstto_file_manager_integration_thunar_get_property (GObject *object, 134 | guint prop_id, 135 | GValue *value, 136 | GParamSpec *pspec) 137 | { 138 | RsttoFileManagerIntegrationThunar *self = RSTTO_FILE_MANAGER_INTEGRATION_THUNAR (object); 139 | 140 | switch (prop_id) 141 | { 142 | case PROP_DIRECTORY: 143 | g_value_set_object (value, self->directory); 144 | break; 145 | 146 | case PROP_SORT_TYPE: 147 | g_value_set_int (value, self->sort_type); 148 | break; 149 | 150 | case PROP_SORT_ORDER: 151 | g_value_set_int (value, self->sort_order); 152 | break; 153 | 154 | default: 155 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 156 | } 157 | } 158 | 159 | static void 160 | rstto_file_manager_integration_thunar_set_property (GObject *object, 161 | guint prop_id, 162 | const GValue *value, 163 | GParamSpec *pspec) 164 | { 165 | RsttoFileManagerIntegrationThunar *self = RSTTO_FILE_MANAGER_INTEGRATION_THUNAR (object); 166 | 167 | switch (prop_id) 168 | { 169 | case PROP_DIRECTORY: 170 | rstto_file_manager_integration_thunar_set_directory (self, g_value_get_object (value)); 171 | break; 172 | 173 | default: 174 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 175 | } 176 | } 177 | 178 | static void 179 | rstto_file_manager_integration_thunar_file_manager_integration_interface_init (RsttoFileManagerIntegrationInterface *iface) 180 | { 181 | } 182 | 183 | static void 184 | rstto_file_manager_integration_thunar_xfconf_property_changed (RsttoFileManagerIntegrationThunar *self, 185 | const gchar *prop_name, 186 | const GValue *value) 187 | { 188 | const char *monitored_props[] = { 189 | "/misc-directory-specific-settings", 190 | "/last-sort-column", 191 | "/last-sort-order", 192 | }; 193 | 194 | for (guint i = 0; i < G_N_ELEMENTS (monitored_props); ++i) 195 | { 196 | if (g_strcmp0 (prop_name, monitored_props[i]) == 0) 197 | { 198 | rstto_file_manager_integration_thunar_fetch_sort_settings (self); 199 | g_object_notify (G_OBJECT (self), "sort-type"); 200 | g_object_notify (G_OBJECT (self), "sort-order"); 201 | break; 202 | } 203 | } 204 | } 205 | 206 | static void 207 | rstto_file_manager_integration_thunar_set_directory (RsttoFileManagerIntegrationThunar *self, 208 | GFile *directory) 209 | { 210 | g_clear_object (&self->directory); 211 | self->sort_type = -1; 212 | self->sort_order = -1; 213 | 214 | if (directory == NULL) 215 | return; 216 | 217 | self->directory = g_object_ref (directory); 218 | rstto_file_manager_integration_thunar_fetch_sort_settings (self); 219 | } 220 | 221 | static RsttoSortType 222 | rstto_file_manager_integration_thunar_get_sort_type_from_string (const gchar *column) 223 | { 224 | if (g_strcmp0 (column, "THUNAR_COLUMN_DATE_MODIFIED") == 0) 225 | { 226 | return SORT_TYPE_DATE; 227 | } 228 | else if (g_strcmp0 (column, "THUNAR_COLUMN_SIZE") == 0) 229 | { 230 | return SORT_TYPE_SIZE; 231 | } 232 | else if (g_strcmp0 (column, "THUNAR_COLUMN_TYPE") == 0) 233 | { 234 | return SORT_TYPE_TYPE; 235 | } 236 | else if (g_strcmp0 (column, "THUNAR_COLUMN_NAME") == 0) 237 | { 238 | return SORT_TYPE_NAME; 239 | } 240 | else 241 | { 242 | g_warning ("Unknown Thunar column"); 243 | return SORT_TYPE_NAME; 244 | } 245 | } 246 | 247 | static RsttoSortOrder 248 | rstto_file_manager_integration_thunar_get_sort_order_from_string (const gchar *order) 249 | { 250 | if (g_strcmp0 (order, "GTK_SORT_DESCENDING") == 0) 251 | { 252 | return SORT_ORDER_DESC; 253 | } 254 | else if (g_strcmp0 (order, "GTK_SORT_ASCENDING") == 0) 255 | { 256 | return SORT_ORDER_ASC; 257 | } 258 | else 259 | { 260 | g_warning ("Unknown Thunar sort order"); 261 | return SORT_ORDER_ASC; 262 | } 263 | } 264 | 265 | static gboolean 266 | rstto_file_manager_integration_thunar_get_sort_settings_per_directory (RsttoFileManagerIntegrationThunar *self) 267 | { 268 | GError *error = NULL; 269 | GFileInfo *file_info = g_file_query_info (self->directory, 270 | "metadata::thunar-sort-column,metadata::thunar-sort-order", 271 | G_FILE_QUERY_INFO_NONE, 272 | NULL, 273 | &error); 274 | 275 | if (error != NULL) 276 | { 277 | g_clear_object (&file_info); 278 | g_clear_error (&error); 279 | return rstto_file_manager_integration_thunar_get_sort_settings_global (self); 280 | } 281 | 282 | const gchar *thunar_sort_column = g_file_info_get_attribute_string (file_info, "metadata::thunar-sort-column"); 283 | const gchar *thunar_sort_order = g_file_info_get_attribute_string (file_info, "metadata::thunar-sort-order"); 284 | 285 | if (thunar_sort_column == NULL || thunar_sort_order == NULL) 286 | { 287 | g_clear_object (&file_info); 288 | return rstto_file_manager_integration_thunar_get_sort_settings_global (self); 289 | } 290 | 291 | self->sort_type = rstto_file_manager_integration_thunar_get_sort_type_from_string (thunar_sort_column); 292 | self->sort_order = rstto_file_manager_integration_thunar_get_sort_order_from_string (thunar_sort_order); 293 | 294 | g_clear_object (&file_info); 295 | 296 | return TRUE; 297 | } 298 | 299 | static gboolean 300 | rstto_file_manager_integration_thunar_get_sort_settings_global (RsttoFileManagerIntegrationThunar *self) 301 | { 302 | gchar *thunar_last_sort_column = xfconf_channel_get_string (self->channel, "/last-sort-column", NULL); 303 | gchar *thunar_last_sort_order = xfconf_channel_get_string (self->channel, "/last-sort-order", NULL); 304 | 305 | if (thunar_last_sort_column == NULL || thunar_last_sort_order == NULL) 306 | { 307 | g_free (thunar_last_sort_column); 308 | g_free (thunar_last_sort_order); 309 | return FALSE; 310 | } 311 | 312 | self->sort_type = rstto_file_manager_integration_thunar_get_sort_type_from_string (thunar_last_sort_column); 313 | self->sort_order = rstto_file_manager_integration_thunar_get_sort_order_from_string (thunar_last_sort_order); 314 | 315 | g_free (thunar_last_sort_column); 316 | g_free (thunar_last_sort_order); 317 | 318 | return TRUE; 319 | } 320 | 321 | static gboolean 322 | rstto_file_manager_integration_thunar_fetch_sort_settings (RsttoFileManagerIntegrationThunar *self) 323 | { 324 | gboolean status = FALSE; 325 | 326 | if (!rstto_settings_get_xfconf_disabled ()) 327 | { 328 | if (xfconf_channel_get_bool (self->channel, "/misc-directory-specific-settings", FALSE)) 329 | { 330 | if (self->directory != NULL) 331 | { 332 | status = rstto_file_manager_integration_thunar_get_sort_settings_per_directory (self); 333 | } 334 | else 335 | { 336 | status = rstto_file_manager_integration_thunar_get_sort_settings_global (self); 337 | } 338 | } 339 | else 340 | { 341 | status = rstto_file_manager_integration_thunar_get_sort_settings_global (self); 342 | } 343 | } 344 | 345 | return status; 346 | } 347 | 348 | RsttoFileManagerIntegration * 349 | rstto_file_manager_integration_thunar_new (void) 350 | { 351 | return g_object_new (RSTTO_TYPE_FILE_MANAGER_INTEGRATION_THUNAR, NULL); 352 | } 353 | -------------------------------------------------------------------------------- /icons/64x64/org.xfce.ristretto.svg: -------------------------------------------------------------------------------- 1 | 2 | 22 | 49 | 55 | 60 | 65 | 66 | Adwaita Icon Template 68 | 70 | 73 | 77 | 81 | 82 | 93 | 96 | 100 | 104 | 105 | 116 | 119 | 123 | 127 | 128 | 139 | 142 | 146 | 150 | 151 | 161 | 164 | 168 | 172 | 173 | 174 | 176 | 177 | 179 | image/svg+xml 180 | 182 | 183 | 184 | GNOME Design Team 185 | 186 | 187 | 188 | 190 | Adwaita Icon Template 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 218 | 220 | 222 | 224 | 226 | 228 | 230 | 231 | 232 | 233 | 239 | 243 | 249 | 255 | 261 | 262 | 268 | 273 | 279 | 286 | 291 | 292 | -------------------------------------------------------------------------------- /icons/24x24/org.xfce.ristretto.svg: -------------------------------------------------------------------------------- 1 | 2 | 22 | 49 | 53 | 58 | 63 | 64 | Adwaita Icon Template 66 | 68 | 71 | 75 | 79 | 80 | 91 | 94 | 98 | 102 | 103 | 114 | 117 | 121 | 125 | 126 | 137 | 140 | 144 | 148 | 149 | 159 | 162 | 166 | 170 | 171 | 172 | 174 | 175 | 177 | image/svg+xml 178 | 180 | 181 | 182 | GNOME Design Team 183 | 184 | 185 | 186 | 188 | Adwaita Icon Template 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 216 | 218 | 220 | 222 | 224 | 226 | 228 | 229 | 230 | 231 | 237 | 241 | 247 | 253 | 259 | 260 | 266 | 272 | 277 | 283 | 290 | 291 | -------------------------------------------------------------------------------- /icons/scalable/org.xfce.ristretto.svg: -------------------------------------------------------------------------------- 1 | 2 | 22 | 49 | 53 | 58 | 59 | Adwaita Icon Template 61 | 63 | 66 | 70 | 74 | 75 | 86 | 97 | 100 | 104 | 108 | 109 | 120 | 123 | 127 | 131 | 132 | 140 | 144 | 145 | 146 | 148 | 149 | 151 | image/svg+xml 152 | 154 | 155 | 156 | GNOME Design Team 157 | 158 | 159 | 160 | 162 | Adwaita Icon Template 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 190 | 192 | 194 | 196 | 198 | 200 | 202 | 203 | 204 | 205 | 211 | 217 | 222 | 227 | 233 | 238 | 244 | 249 | 255 | 261 | 266 | 273 | 274 | --------------------------------------------------------------------------------