Compare commits

..

No commits in common. "flatpak" and "master" have entirely different histories.

7 changed files with 18 additions and 123 deletions

1
.gitignore vendored
View file

@ -1,3 +1,2 @@
.vscode/ .vscode/
build/ build/
.flatpak-builder

View file

@ -6,8 +6,6 @@
[![Build Status](https://travis-ci.org/artemanufrij/webpin.svg?branch=master)](https://travis-ci.org/artemanufrij/webpin) [![Build Status](https://travis-ci.org/artemanufrij/webpin.svg?branch=master)](https://travis-ci.org/artemanufrij/webpin)
Note: You can see current FlatPak dev updates at https://github.com/artemanufrij/webpin/issues/143
### Donate ### Donate
<a href="https://www.paypal.me/ArtemAnufrij">PayPal</a> | <a href="https://liberapay.com/Artem/donate">LiberaPay</a> | <a href="https://www.patreon.com/ArtemAnufrij">Patreon</a> <a href="https://www.paypal.me/ArtemAnufrij">PayPal</a> | <a href="https://liberapay.com/Artem/donate">LiberaPay</a> | <a href="https://www.patreon.com/ArtemAnufrij">Patreon</a>
@ -25,31 +23,7 @@ Note: You can see current FlatPak dev updates at https://github.com/artemanufrij
</p> </p>
## Install from Github ## Install from Github.
### With FlatPak
Install the [elementaryOS developer enviroment](https://docs.elementary.io/develop/writing-apps/the-basic-setup#flatpak)
Clone and enter repository
```
git clone https://github.com/artemanufrij/webpin.git
cd webpin
```
Build with `flatpak-builder`
```
flatpak-builder build com.github.artemanufrij.webpin.yml --user --install --force-clean
```
#### Debugging
[Debugging FlatPak Applications](https://docs.flatpak.org/en/latest/debugging.html)
To enter the container for debugging
```
flatpak run --command=sh com.github.artemanufrij.webpin
```
### Legacy method
As first you need elementary SDK As first you need elementary SDK
``` ```

View file

@ -5,7 +5,7 @@ app-id: com.github.artemanufrij.webpin
# we can use a convenient pre-made runtime and SDK. For this example, we'll be # we can use a convenient pre-made runtime and SDK. For this example, we'll be
# using the runtime and SDK provided by elementary. # using the runtime and SDK provided by elementary.
runtime: io.elementary.Platform runtime: io.elementary.Platform
runtime-version: '6.1' runtime-version: '6'
sdk: io.elementary.Sdk sdk: io.elementary.Sdk
# This should match the exec line in your .desktop file and usually is the same # This should match the exec line in your .desktop file and usually is the same
@ -18,28 +18,12 @@ command: com.github.artemanufrij.webpin
finish-args: finish-args:
- '--share=ipc' - '--share=ipc'
- '--socket=fallback-x11' - '--socket=fallback-x11'
- '--socket=session-bus'
- '--socket=wayland' - '--socket=wayland'
- '--share=network'
- '--filesystem=xdg-data/applications:create'
- '--filesystem=~/.var/app/com.github.artemanufrij.webpin/'
# Need this so that we can find the download dir
- '--filesystem=xdg-download:create'
# DRI - Direct Rendering - without this, rendering is really slow
- '--device=dri'
# This section is where you list all the source code required to build your app. # 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 # If we had external dependencies that weren't included in our SDK, we would list
# them here. # them here.
modules: modules:
- name: flatpak-script
buildsystem: simple
build-commands:
- install -D flatpak.sh /app/bin/flatpak
sources:
- type: file
path: sources/flatpak.sh
- name: webpin - name: webpin
buildsystem: meson buildsystem: meson
sources: sources:

View file

@ -1,8 +0,0 @@
#!/bin/bash
# The build system puts this file as /app/bin/flatpak
# in the container
# This is required so that the container sees "flatpak" as a valid command
# so that it will read the .desktop files
echo "flatpak"

View file

@ -34,7 +34,7 @@ namespace Webpin {
Name=Webpin Name=Webpin
GenericName=Web app GenericName=Web app
Comment=Webpin web app Comment=Webpin web app
Exec=flatpak run com.github.artemanufrij.webpin Exec=com.github.artemanufrij.webpin
Keywords=webpin;webapp;internet; Keywords=webpin;webapp;internet;
Icon=application-default-icon Icon=application-default-icon
Terminal=false Terminal=false
@ -49,7 +49,7 @@ namespace Webpin {
[Desktop Action Remove] [Desktop Action Remove]
Name=Remove Webapp Name=Remove Webapp
Exec=flatpak run com.github.artemanufrij.webpin --remove Exec=com.github.artemanufrij.webpin --remove
Icon=edit-delete-symbolic Icon=edit-delete-symbolic
"""; """;
@ -132,12 +132,12 @@ namespace Webpin {
file.set_string ("Desktop Entry", "Name", name); file.set_string ("Desktop Entry", "Name", name);
file.set_string ("Desktop Entry", "GenericName", name); file.set_string ("Desktop Entry", "GenericName", name);
file.set_string ("Desktop Entry", "X-GNOME-FullName", name); file.set_string ("Desktop Entry", "X-GNOME-FullName", name);
file.set_string ("Desktop Entry", "Exec", "flatpak run com.github.artemanufrij.webpin " + url); file.set_string ("Desktop Entry", "Exec", "com.github.artemanufrij.webpin " + url);
file.set_string ("Desktop Entry", "Icon", icon); file.set_string ("Desktop Entry", "Icon", icon);
file.set_string ("Desktop Entry", "StartupWMClass", url); file.set_string ("Desktop Entry", "StartupWMClass", url);
file.set_string ("Desktop Entry", "X-Webpin-StayOpen", stay_open.to_string ()); file.set_string ("Desktop Entry", "X-Webpin-StayOpen", stay_open.to_string ());
file.set_string ("Desktop Entry", "X-Webpin-View-Mode", minimal_ui ? "minimal" : "default"); file.set_string ("Desktop Entry", "X-Webpin-View-Mode", minimal_ui ? "minimal" : "default");
file.set_string ("Desktop Action Remove", "Exec", "flatpak run com.github.artemanufrij.webpin --remove " + url); file.set_string ("Desktop Action Remove", "Exec", "com.github.artemanufrij.webpin --remove " + url);
} }
public DesktopFile.from_desktopappinfo (GLib.DesktopAppInfo info) { public DesktopFile.from_desktopappinfo (GLib.DesktopAppInfo info) {
@ -151,10 +151,7 @@ namespace Webpin {
this.name = info.get_display_name (); this.name = info.get_display_name ();
this.icon = info.get_icon ().to_string (); this.icon = info.get_icon ().to_string ();
try { try {
// The exec string is "flatpak run com.github.artemanufrij.webpin [url]" this.url = file.get_string ("Desktop Entry", "Exec").substring (31);
this.url = file.get_string ("Desktop Entry", "Exec");
var url = this.url.split(" ");
this.url = url[3];
} catch (Error err) { } catch (Error err) {
warning (err.message); warning (err.message);
} }

View file

@ -35,8 +35,6 @@ namespace Webpin.Widgets {
Gtk.Box container; Gtk.Box container;
Granite.Widgets.Toast app_notification; Granite.Widgets.Toast app_notification;
GLib.Icon icon_for_notification; GLib.Icon icon_for_notification;
// For saving downloads
Gtk.FileChooserNative file_chooser;
public signal void external_request (WebKit.NavigationAction action); public signal void external_request (WebKit.NavigationAction action);
public signal void request_begin (); public signal void request_begin ();
@ -166,54 +164,6 @@ namespace Webpin.Widgets {
} }
return base.key_press_event (event); return base.key_press_event (event);
}); });
web_view.web_context.download_started.connect ((event) => {
file_chooser = new Gtk.FileChooserNative (_("Choose download location"),
WebpinApp.instance.mainwindow,
Gtk.FileChooserAction.SAVE,
_("Save"),
_("Cancel"));
var download_dir = GLib.Environment.get_user_special_dir (GLib.UserDirectory.DOWNLOAD);
file_chooser.set_current_folder (download_dir);
event.decide_destination.connect ((download_event) => {
file_chooser.set_current_name (download_event);
if (file_chooser.run () == Gtk.ResponseType.ACCEPT) {
var filename = file_chooser.get_filename ();
event.set_destination (filename);
warning (filename);
file_chooser.destroy ();
app_notification.title = _ ("Download successful");
app_notification.send_notification ();
return false;
} else {
app_notification.title = _ ("Download failed or was cancelled");
app_notification.send_notification ();
event.cancel ();
return false;
}
});
event.failed.connect((failed_event) => {
error ("Download failed!");
});
event.created_destination.connect ((created_event) => {
message ("Destination created successfully");
});
event.finished.connect ((finished_event) => {
message ("Download finished successfully");
});
});
} }
public void go_home () { public void go_home () {

View file

@ -43,7 +43,7 @@ namespace Webpin.Widgets.Views {
Gtk.CheckButton stay_open_when_closed; Gtk.CheckButton stay_open_when_closed;
Gtk.CheckButton minimal_view_mode; Gtk.CheckButton minimal_view_mode;
Gtk.Popover icon_selector_popover; Gtk.Popover icon_selector_popover;
Gtk.FileChooserNative file_chooser; Gtk.FileChooserDialog file_chooser;
Gtk.Button accept_button; Gtk.Button accept_button;
Gtk.ColorButton primary_color_button; Gtk.ColorButton primary_color_button;
GLib.Regex protocol_regex; GLib.Regex protocol_regex;
@ -432,11 +432,10 @@ namespace Webpin.Widgets.Views {
filter.set_filter_name (_ ("Images")); filter.set_filter_name (_ ("Images"));
filter.add_mime_type ("image/*"); filter.add_mime_type ("image/*");
file_chooser = new Gtk.FileChooserNative (_("Choose icon"), WebpinApp.instance.mainwindow, file_chooser = new Gtk.FileChooserDialog (_("Choose icon"), WebpinApp.instance.mainwindow,
Gtk.FileChooserAction.OPEN, Gtk.FileChooserAction.OPEN,
_("Open"), _ ("Cancel"), Gtk.ResponseType.CANCEL,
_("Cancel")); _ ("Open"), Gtk.ResponseType.ACCEPT);
file_chooser.set_select_multiple (false); file_chooser.set_select_multiple (false);
file_chooser.add_filter (filter); file_chooser.add_filter (filter);