Skip to content

Commit

Permalink
Merge pull request #55 from peteruithoven/flatpak
Browse files Browse the repository at this point in the history
WIP: Package as Flatpak for elementary OS 6
  • Loading branch information
peteruithoven authored Sep 4, 2021
2 parents 00ce4ff + f3246c0 commit 86f2240
Show file tree
Hide file tree
Showing 15 changed files with 94 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ build/*
debian/build/*
debian/debhelper-build-stamp
*debhelper.log
.flatpak-builder
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@
</a>
</p>

Quickly resize images from the context menu.
Quickly resize images.
Features:
- Use from context menu: right click on image(s), and select "Resize images".
- Use from Applications menu: Drag and drop image(s).
- Open images with Resizer or open Reizer and Drag and drop images
- Maintains aspect ratio.
- Keyboard control: Change the sizes using the up and down keys, press enter to resize.
- Settings are stored for next time.

![Screenshot 1](screenshot.png)
![Screenshot 2](screenshot2.png)
![Screenshot 3](screenshot3.png)
![Screenshot 4](screenshot4.png)
![Screenshot 5](screenshot5.png)
![Screenshot resize image](screenshot.png)
![Screenshot without images](screenshot2.png)
![Screenshot resize multiple images](screenshot3.png)
![Screenshot error](screenshot4.png)

## Building, Testing, and Installation

Expand Down Expand Up @@ -50,5 +48,5 @@ Generate / update `.po` files:

## Credits

A lot of the code is inspired by the [elementary Screenshot tool](https://github.com/elementary/screenshot-tool) and Felipe Escoto's [wallpaperize](https://github.com/Philip-Scott/wallpaperize).
A lot of the code is inspired by the [elementary Screenshot tool](https://github.com/elementary/screenshot-tool) and Felipe Escoto's [wallpaperize](https://github.com/Philip-Scott/wallpaperize).
The icon is based on the [elementary Photos icon](https://github.com/elementary/icons/blob/master/apps/128/multimedia-photo-manager.svgs) and was greatly improved by [TraumaD](https://github.com/TraumaD).
55 changes: 55 additions & 0 deletions com.github.peteruithoven.resizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This is the same ID that you've used in meson.build and other files
app-id: com.github.peteruithoven.resizer

# Instead of manually specifying a long list of build and runtime dependencies,
# we can use a convenient pre-made runtime and SDK. For this example, we'll be
# using the runtime and SDK provided by elementary.
runtime: io.elementary.Platform
runtime-version: '6'
sdk: io.elementary.Sdk

# This should match the exec line in your .desktop file and usually is the same
# as your app ID
command: com.github.peteruithoven.resizer

# Here we can specify the kinds of permissions our app needs to run. Since we're
# not using hardware like webcams, making sound, or reading external files, we
# only need permission to draw our app on screen using either X11 or Wayland.
finish-args:
- '--share=ipc'
- '--socket=fallback-x11'
- '--socket=wayland'
- '--filesystem=home'

# This section is where you list all the source code required to build your app.
# If we had external dependencies that weren't included in our SDK, we would list
# them here.
modules:
- name: resizer
buildsystem: meson
sources:
- type: dir
path: .
# Inspiration: https://github.com/ImageMagick/ImageMagick6/releases/tag/6.9.12-19
- name: imagemagick
config-opts:
- --enable-shared
- --disable-static
- --with-modules
- --with-x
- --with-threads
- --with-magick_plus_plus
- --with-gslib
- --with-wmf
- --with-webp
- --with-openexr
- --with-rsvg
- --with-xml
- --with-jbig
- --with-openjp2
sources:
- type: archive
url: https://github.com/ImageMagick/ImageMagick6/archive/6.9.12-19.tar.gz
sha256: 2f184f1f5c3e19849347b2b4acb6dd074290903d36fa5924956ee06c85ddf783
cleanup:
- /share/doc
10 changes: 3 additions & 7 deletions data/com.github.peteruithoven.resizer.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
<metadata_license>CC0</metadata_license>
<project_license>GPL-3.0+</project_license>
<name>Resizer</name>
<summary>Quickly resize images from the context menu</summary>
<summary>Quickly resize images</summary>
<description>
<p>
A simple image resizer that resizes one or more images, usable from the context menu or as a standalone app.
A simple image resizer that resizes one or more images.
</p>
<p>
Features:
</p>
<ul>
<li>Use from context menu: right click on image(s), and select "Resize images".</li>
<li>Use from Applications menu: Drag and drop image(s).</li>
<li>Open images with Resizer or open Reizer and Drag and drop images</li>
<li>Maintains aspect ratio.</li>
<li>Keyboard control: Change the sizes using the up and down keys, press enter to resize.</li>
<li>Settings are stored for next time.</li>
Expand All @@ -34,9 +33,6 @@
<screenshot>
<image>https://raw.githubusercontent.com/peteruithoven/resizer/master/screenshot4.png</image>
</screenshot>
<screenshot>
<image>https://raw.githubusercontent.com/peteruithoven/resizer/master/screenshot5.png</image>
</screenshot>
</screenshots>
<releases>
<release version="1.1.4" date="2021-05-25">
Expand Down
5 changes: 3 additions & 2 deletions data/com.github.peteruithoven.resizer.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ Name=Resizer
GenericName=Resizer App
Comment=Image resizer
Categories=Graphics;2DGraphics;RasterGraphics;
Exec=com.github.peteruithoven.resizer %f
Exec=com.github.peteruithoven.resizer %F
Icon=com.github.peteruithoven.resizer
Terminal=false
Type=Application
X-GNOME-Gettext-Domain=resizer
Keywords=Image;resize;
Keywords=Image;resize;
MimeType=image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/x-bmp;image/x-png;image/webp;
11 changes: 7 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name()), la
# replacing variables like PROJECT_NAME
conf_data = configuration_data()
conf_data.set_quoted('PROJECT_NAME', meson.project_name())
configure_file(
config_file = configure_file(
input : 'src/config.vala.in',
output : 'config.vala',
configuration : conf_data
)

meson.build_root()

executable(
meson.project_name(),
'src/Application.vala',
Expand All @@ -29,15 +31,16 @@ executable(
'src/Resizer.vala',
'src/DropArea.vala',
'src/MessageCenter.vala',
'build/config.vala',
config_file,
dependencies: [
dependency('gtk+-3.0'),
dependency('granite')
dependency('granite'),
dependency('libhandy-1', version: '>=1.0.0')
],
install : true
)

meson.add_install_script('meson/post_install.py')

subdir('data')
subdir('po')
subdir('po')
Binary file modified screenshot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshot3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshot4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshot5.png
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/

namespace Resizer {
public class Application : Granite.Application {
public class Application : Gtk.Application {
private Window window = null;

public Application () {
Expand Down
6 changes: 3 additions & 3 deletions src/DropArea.vala
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ namespace Resizer {

construct {
image = new Gtk.Image ();
image.get_style_context ().add_class ("card");
image.get_style_context ().add_class (Granite.STYLE_CLASS_CARD);
image.hexpand = true;
image.width_request = 300;
image.height_request = 200;
image.margin = 6;

image2 = new Gtk.Image ();
image2.get_style_context ().add_class ("card");
image2.get_style_context ().add_class (Granite.STYLE_CLASS_CARD);
image2.margin = 6;
image2.margin_start = 6+6;
image2.margin_top = 6;
Expand All @@ -45,7 +45,7 @@ namespace Resizer {
drag_label.justify = Gtk.Justification.CENTER;

var drag_label_style_context = drag_label.get_style_context ();
drag_label_style_context.add_class ("h2");
drag_label_style_context.add_class (Granite.STYLE_CLASS_H2_LABEL);
drag_label_style_context.add_class (Gtk.STYLE_CLASS_DIM_LABEL);

var images = new Gtk.Fixed();
Expand Down
6 changes: 3 additions & 3 deletions src/HeaderBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
*/

namespace Resizer {
public class HeaderBar : Gtk.HeaderBar {
public class HeaderBar : Hdy.HeaderBar {

construct {
show_close_button = true;
var header_context = get_style_context ();
header_context.add_class ("titlebar");
header_context.add_class ("default-decoration");
header_context.add_class (Gtk.STYLE_CLASS_TITLEBAR);
header_context.add_class (Granite.STYLE_CLASS_DEFAULT_DECORATION);
header_context.add_class (Gtk.STYLE_CLASS_FLAT);

var info_text = new Gtk.Label (_("Resizer will never upscale and always maintain the aspect ratio of your images."));
Expand Down
2 changes: 1 addition & 1 deletion src/ResizePage.vala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace Resizer {
private Gtk.Button cancel_btn;
private Gtk.Button resize_btn;

public ResizePage (Gtk.ApplicationWindow app) {
public ResizePage (Window app) {
var spacing = 12;

intro_label = new Gtk.Label ("");
Expand Down
16 changes: 10 additions & 6 deletions src/Window.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/

namespace Resizer {
public class Window : Gtk.ApplicationWindow {
public class Window : Hdy.Window {

private Gtk.Stack pages;
const Gtk.TargetEntry[] DRAG_TARGETS = { { "text/uri-list", 0, 0 } };
Expand All @@ -32,10 +32,9 @@ namespace Resizer {
);
}
construct {
this.get_style_context ().add_class ("rounded");
Hdy.init ();

var header = new HeaderBar ();
this.set_titlebar (header);

var resize_page = new ResizePage (this);
var resizing_page = new ResizingPage ();
Expand All @@ -50,11 +49,16 @@ namespace Resizer {

var message_center = MessageCenter.get_default();

var innerGrid = new Gtk.Grid();
innerGrid.orientation = Gtk.Orientation.VERTICAL;
innerGrid.row_spacing = 12;
innerGrid.add(message_center);
innerGrid.add(pages);

var grid = new Gtk.Grid();
grid.orientation = Gtk.Orientation.VERTICAL;
grid.row_spacing = 12;
grid.add(message_center);
grid.add(pages);
grid.add(header);
grid.add(innerGrid);
this.add(grid);

Resizer.get_default ().state_changed.connect((r, state) => {
Expand Down

0 comments on commit 86f2240

Please # to comment.