Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

Commit

Permalink
use FileChooserNative, update de.haeckerfelix.gradio.json
Browse files Browse the repository at this point in the history
  • Loading branch information
haecker-felix committed Nov 3, 2018
1 parent 24977ce commit ff0b79d
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 123 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
*_source.tar*
*.snap
.buildconfig
de.haeckerfelix.gradio.json~
de.haeckerfelix.gradio.json~
_build
114 changes: 55 additions & 59 deletions de.haeckerfelix.gradio.json
Original file line number Diff line number Diff line change
@@ -1,60 +1,56 @@
{
"app-id" : "de.haeckerfelix.gradio",
"runtime" : "org.gnome.Platform",
"runtime-version" : "master",
"sdk" : "org.gnome.Sdk",
"command" : "gradio",
"finish-args" : [
"--share=ipc",
"--share=network",
"--socket=x11",
"--socket=wayland",
"--socket=pulseaudio",
"--device=dri",
"--env=DCONF_USER_CONFIG_DIR=.config/dconf",
"--filesystem=xdg-run/dconf",
"--filesystem=~/.config/dconf:ro",
"--filesystem=host",
"--talk-name=ca.desrt.dconf",
"--own-name=org.mpris.MediaPlayer2.gradio"
],
"modules" : [
{
"name" : "gst-libav",
"config-opts" : [
"--disable-gtk-doc",
"--with-system-libav"
],
"cleanup" : [
"*.la",
"/share/gtk-doc"
],
"sources" : [
{
"type" : "archive",
"url" : "https://gstreamer.freedesktop.org/src/gst-libav/gst-libav-1.10.4.tar.xz",
"sha256" : "6ca0feca75e3d48315e07f20ec37cf6260ed1e9dde58df355febd5016246268b"
}
],
"modules" : [
"org.ffmpeg.FFmpeg.json"
]
},
{
"name" : "gradio",
"buildsystem" : "meson",
"builddir" : true,
"sources" : [
{
"type" : "archive",
"url" : "https://github.com/haecker-felix/gradio/archive/v6.0.zip",
"sha256" : "22c576656c8b7c81d45a749a88eeceb059d3e3f3e9814f7c44ae0770df68a638"
}
]
}
],
"build-options" : {
"env" : {
}
}
}
"app-id":"de.haeckerfelix.gradio",
"runtime":"org.gnome.Platform",
"runtime-version":"3.28",
"sdk":"org.gnome.Sdk",
"command":"gradio",
"finish-args":[
"--share=ipc",
"--share=network",
"--socket=x11",
"--socket=wayland",
"--socket=pulseaudio",
"--device=dri",
"--env=DCONF_USER_CONFIG_DIR=.config/dconf",
"--filesystem=xdg-run/dconf",
"--filesystem=~/.config/dconf:ro",
"--talk-name=ca.desrt.dconf",
"--own-name=org.mpris.MediaPlayer2.gradio"
],
"modules":[
{
"name": "gst-libav",
"buildsystem": "meson",
"sources": [
{
"type": "archive",
"url": "https://gstreamer.freedesktop.org/src/gst-libav/gst-libav-1.12.4.tar.xz",
"sha256": "2a56aa5d2d8cd912f2bce17f174713d2c417ca298f1f9c28ee66d4aa1e1d9e62"
}
]
},
{
"name": "gst-plugins-ugly",
"config-opts": [ "--disable-gtk-doc"],
"cleanup": [ "*.la", "/share/gtk-doc" ],
"sources": [
{
"type": "archive",
"url": "https://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-1.12.4.tar.xz",
"sha256": "1c165b8d888ed350acd8e6ac9f6fe06508e6fcc0a3afc6ccc9fbeb30df9be522"
}
]
},
{
"name": "gradio",
"buildsystem": "meson",
"sources":[
{
"type": "archive",
"url": "https://github.com/haecker-felix/gradio/archive/v7.1.tar.gz",
"sha256": "7b350583124f00f9030daaf4042cd54c9d340d67124dad298266d2dfa81ba766"
}
]
}
]
}
40 changes: 0 additions & 40 deletions org.ffmpeg.FFmpeg.json

This file was deleted.

42 changes: 19 additions & 23 deletions src/gradio-utils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -124,44 +124,40 @@ namespace Gradio{
}

public static string export_library_dialog (string current_name){
Gtk.FileChooserDialog chooser = new Gtk.FileChooserDialog (
_("Export current library"), App.window, Gtk.FileChooserAction.SAVE,
_("_Cancel"),
Gtk.ResponseType.CANCEL,
_("Export"),
Gtk.ResponseType.ACCEPT);
Gtk.FileChooserNative export_dialog = new Gtk.FileChooserNative (
_("Export current library"),
App.window, Gtk.FileChooserAction.SAVE,
_("_Export"),
_("_Cancel"));

chooser.set_current_name(current_name);
chooser.set_do_overwrite_confirmation(true);
export_dialog.set_current_name(current_name);
export_dialog.set_do_overwrite_confirmation(true);

string path = "";
if (chooser.run () == Gtk.ResponseType.ACCEPT) {
path = chooser.get_file().get_path();
if (export_dialog.run () == Gtk.ResponseType.ACCEPT) {
path = export_dialog.get_file().get_path();
}
chooser.close();
chooser.destroy();
export_dialog.destroy();
return path;
}

public static string import_library_dialog (){
Gtk.FileChooserDialog chooser = new Gtk.FileChooserDialog (
_("Select database to import"), App.window, Gtk.FileChooserAction.OPEN,
_("_Cancel"),
Gtk.ResponseType.CANCEL,
_("Import"),
Gtk.ResponseType.ACCEPT);
Gtk.FileChooserNative import_dialog = new Gtk.FileChooserNative (
_("Select database to import"),
App.window, Gtk.FileChooserAction.OPEN,
_("_Import"),
_("_Cancel"));

Gtk.FileFilter filter = new Gtk.FileFilter ();
chooser.set_filter (filter);
import_dialog.set_filter (filter);
filter.add_mime_type ("application/x-sqlite3");


string path = "";
if (chooser.run () == Gtk.ResponseType.ACCEPT) {
path = chooser.get_file().get_path();
if (import_dialog.run () == Gtk.ResponseType.ACCEPT) {
path = import_dialog.get_file().get_path();
}
chooser.close();
chooser.destroy();
import_dialog.destroy();
return path;
}

Expand Down

0 comments on commit ff0b79d

Please sign in to comment.