Commit 9e7ab4fe authored by Felix Häcker's avatar Felix Häcker

initial commit

parents
org.gnome.Remotely.json~
\ No newline at end of file
This diff is collapsed.
# Remotely
More information soon.
\ No newline at end of file
# Resources
resources = gnome.compile_resources(
'org.gnome.Remotely',
'org.gnome.Remotely.gresource.xml',
c_name: 'resources'
)
# Settings schema
install_data('org.gnome.Remotely.gschema.xml', install_dir : get_option('datadir') + '/glib-2.0/schemas/')
# Desktop file
i18n.merge_file(
'org.gnome.Remotely.desktop',
type: 'desktop',
input: 'org.gnome.Remotely.desktop.in',
output: 'org.gnome.Remotely.desktop',
po_dir: po_dir,
install: true,
install_dir: join_paths(get_option('datadir'), 'applications')
)
# Appdata
i18n.merge_file(
'org.gnome.Remotely.appdata.xml',
input: 'org.gnome.Remotely.appdata.xml.in',
output: 'org.gnome.Remotely.appdata.xml',
po_dir: po_dir,
install: true,
install_dir: join_paths(get_option('datadir'), 'metainfo')
)
# Icons
install_subdir(
'icons/hicolor',
install_dir: join_paths(get_option('datadir'), 'icons')
)
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>org.gnome.Remotely.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
<description>
</description>
</component>
[Desktop Entry]
Name=Remotely
Exec=remotely
Terminal=false
Type=Application
Categories=GTK;
StartupNotify=true
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/Remotely">
<file>ui/window.ui</file>
<file>ui/vnc-box.ui</file>
</gresource>
</gresources>
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="remotely">
<schema id="org.gnome.Remotely" path="/org/gnome/Remotely/">
</schema>
</schemalist>
This diff is collapsed.
This diff is collapsed.
project(
'remotely', ['vala', 'c'],
version: '0.0.1',
license: 'GPL3',
meson_version: '>= 0.40.0'
)
gnome = import('gnome')
i18n = import('i18n')
cc = meson.get_compiler('c')
valac = meson.get_compiler('vala')
vapi_dir = join_paths (meson.source_root (), 'src', 'vapis')
po_dir = join_paths(meson.source_root(), 'po')
# Remotely dependencies
gtk_vnc_dep = dependency('gtk-vnc-2.0')
gtk_dep = dependency('gtk+-3.0', version : '>=3.20.10')
subdir('data')
subdir('src')
subdir('po')
meson.add_install_script('postinstall.py')
{
"app-id" : "org.gnome.Remotely",
"runtime" : "org.gnome.Platform",
"runtime-version" : "master",
"sdk" : "org.gnome.Sdk",
"command" : "remotely",
"finish-args" : [
"--share=network",
"--share=ipc",
"--socket=x11",
"--socket=wayland",
"--filesystem=xdg-run/dconf",
"--filesystem=~/.config/dconf:ro",
"--talk-name=ca.desrt.dconf",
"--env=DCONF_USER_CONFIG_DIR=.config/dconf"
],
"build-options" : {
"cflags" : "-O2 -g",
"cxxflags" : "-O2 -g",
"env" : {
"V" : "1"
}
},
"cleanup" : [
"/include",
"/lib/pkgconfig",
"/man",
"/share/doc",
"/share/gtk-doc",
"/share/man",
"/share/pkgconfig",
"/share/vala",
"*.la",
"*.a"
],
"modules" : [
{
"name" : "libgpg-error",
"sources" : [
{
"type" : "archive",
"url" : "https://gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.27.tar.gz",
"sha256" : "04bdc7fd12001c797cc689b007fe24909f55aa0ee1d6d6aef967d9eebf5b2461"
}
]
},
{
"name" : "libgcrypt",
"config-opts" : [
"--disable-doc"
],
"sources" : [
{
"type" : "archive",
"url" : "https://github.com/gpg/libgcrypt/archive/libgcrypt-1.8.2.tar.gz",
"sha256" : "ddad335a5cf73c812dd06bb0ce6af86a803333fc2f98ae86a449ea02e0dda0f9"
}
]
},
{
"name" : "gtkvnc",
"sources" : [
{
"type" : "archive",
"url" : "https://download.gnome.org/sources/gtk-vnc/0.7/gtk-vnc-0.7.1.tar.xz",
"sha256" : "f34baa696615ef67666e8465b4d0ac563355e999a77d2cc42ad4625a24f7aab1"
}
]
},
{
"name" : "remotely",
"buildsystem" : "meson",
"config-opts" : [
"--libdir=lib"
],
"builddir" : true,
"sources" : [
{
"type" : "git",
"url" : "https://github.com/haecker-felix/Remotely"
}
]
}
]
}
data/org.gnome.Remotely.desktop.in
data/org.gnome.Remotely.appdata.xml.in
data/org.gnome.Remotely.gschema.xml
i18n.gettext('remotely', preset: 'glib')
#!/usr/bin/env python3
from os import environ, path
from subprocess import call
prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
datadir = path.join(prefix, 'share')
destdir = environ.get('DESTDIR', '')
# Package managers set this so we don't need to run
if not destdir:
print('Updating icon cache...')
call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')])
print('Updating desktop database...')
call(['update-desktop-database', '-q', path.join(datadir, 'applications')])
print('Compiling GSettings schemas...')
call(['glib-compile-schemas', path.join(datadir, 'glib-2.0', 'schemas')])
vala_sources = [
'remotely-app.vala',
'remotely-window.vala',
'remotely-vnc-box.vala',
]
deps = [
gtk_dep,
gtk_vnc_dep,
]
c_args = [
'-DVERSION="' + meson.project_version() + '"',
'-DGETTEXT_PACKAGE="remotely"',
'-DGNOMELOCALEDIR="' + get_option('prefix') + '/' + get_option('localedir') + '"'
]
vala_args = [
'--target-glib=2.38'
]
executable(
meson.project_name(),
vala_sources + resources,
dependencies: deps,
vala_args: vala_args,
c_args: c_args,
install: true
)
\ No newline at end of file
/* remotely-app.vala
*
* Copyright (C) 2018 Felix Häcker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
int main (string[] args) {
var app = new Gtk.Application ("org.gnome.Remotely", ApplicationFlags.FLAGS_NONE);
app.activate.connect (() => {
var win = app.active_window;
if (win == null) {
win = new Remotely.Window (app);
}
win.present ();
});
return app.run (args);
}
/* remotely-vnc-box.vala
*
* Copyright (C) 2018 Felix Häcker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Vnc;
using Gtk;
public enum Remotely.ZoomMode{
FIT_WINDOW,
BEST_FIT,
ORIGINAL_SIZE
}
[GtkTemplate (ui = "/org/gnome/Remotely/ui/vnc-box.ui")]
public class Remotely.VncBox : Box {
private Display display;
[GtkChild] Box vnc_box;
[GtkChild] ScrolledWindow scrolled_window;
[GtkChild] Stack connection_stack;
[GtkChild] Label status_label;
[GtkChild] Revealer notification_revealer;
[GtkChild] Stack notification_stack;
[GtkChild] Label notification_label;
[GtkChild] Entry username_entry;
[GtkChild] Entry clientname_entry;
[GtkChild] Entry password_entry;
[GtkChild] Box username_box;
[GtkChild] Box clientname_box;
[GtkChild] Box password_box;
public string host;
public string port;
public VncBox (string host, string port) {
this.name = host;
this.host = host;
this.port = port;
display = new Display();
//display.depth = DisplayDepthColor.MEDIUM;
display.local_pointer = true;
//display.lossy_encoding = true;
vnc_box.add(display);
connect();
connect_signals();
this.show_all();
}
private void connect_signals(){
display.vnc_connected.connect(() => {
status_label.set_text("Warte auf Host...");
});
display.vnc_disconnected.connect(() => {
status_label.set_text("Verbindung getrennt");
connection_stack.set_visible_child_name("error");
});
display.vnc_initialized.connect(() => {
connection_stack.set_visible_child_name("vnc");
});
display.vnc_auth_credential.connect((authlist) => {
status_label.set_text("Warte auf Authentifizierung...");
show_password_entry(authlist);
});
display.vnc_auth_failure.connect((error) => {
show_notification("Authentifizierungsfehler");
connection_stack.set_visible_child_name("error");
});
display.vnc_error.connect((error) => {
show_notification(error);
connection_stack.set_visible_child_name("error");
});
display.vnc_auth_unsupported.connect(() => {
show_notification("Authentifizierung wird nicht unterstützt");
connection_stack.set_visible_child_name("error");
});
}
private void connect(){
status_label.set_text("Verbindung wird hergestellt...");
display.open_host(host,port);
}
public void disconnect(){
display.close();
this.destroy();
}
public void set_zoom_mode(ZoomMode mode){
switch(mode){
case ZoomMode.FIT_WINDOW: {
display.expand=true;
display.set_scaling(true);
display.height_request = 0;
display.width_request = 0;
scrolled_window.hscrollbar_policy = PolicyType.NEVER;
scrolled_window.vscrollbar_policy = PolicyType.NEVER;
break;
}
case ZoomMode.BEST_FIT: {
display.expand=false;
display.set_scaling(true);
//display.height_request = vnc_box.get_allocated_heigth();
//display.width_request = vnc_box.get_allocated_heigth();
scrolled_window.hscrollbar_policy = PolicyType.NEVER;
scrolled_window.vscrollbar_policy = PolicyType.NEVER;
break;
}
case ZoomMode.ORIGINAL_SIZE: {
display.expand=false;
display.set_scaling(false);
display.height_request = display.height;
display.width_request = display.width;
scrolled_window.hscrollbar_policy = PolicyType.ALWAYS;
scrolled_window.vscrollbar_policy = PolicyType.ALWAYS;
break;
}
}
}
private void show_notification(string text){
notification_label.set_label(text);
notification_revealer.set_reveal_child(true);
notification_stack.set_visible_child_name("notification");
}
private void show_password_entry(ValueArray authlist){
notification_revealer.set_reveal_child(true);
notification_stack.set_visible_child_name("auth");
password_box.set_visible(false);
username_box.set_visible(false);
clientname_box.set_visible(false);
foreach (Value val in authlist.values) {
DisplayCredential cred = (DisplayCredential)val.get_enum();
switch(cred){
case DisplayCredential.PASSWORD: password_box.set_visible(true); break;
case DisplayCredential.USERNAME: username_box.set_visible(true); break;
case DisplayCredential.CLIENTNAME: clientname_box.set_visible(true); break;
}
}
}
[GtkCallback]
private void reconnect_button_clicked(){
connect();
}
[GtkCallback]
private void notification_close_button_clicked(){
notification_revealer.set_reveal_child(false);
}
[GtkCallback]
private void password_cancel_button_clicked(){
notification_revealer.set_reveal_child(false);
display.close();
}
[GtkCallback]
private void passwort_connect_button_clicked(){
notification_revealer.set_reveal_child(false);
display.set_credential(DisplayCredential.PASSWORD, password_entry.get_text());
display.set_credential(DisplayCredential.USERNAME, username_entry.get_text());
display.set_credential(DisplayCredential.CLIENTNAME, clientname_entry.get_text());
}
private void optiscale(int box_width, int box_heigth, int image_width, int image_heigth, out int newwidth, out int newheigth){
}
}
\ No newline at end of file
/* remotely-window.vala
*
* Copyright (C) 2018 Felix Häcker
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Vnc;
using Gtk;
[GtkTemplate (ui = "/org/gnome/Remotely/ui/window.ui")]
public class Remotely.Window : Gtk.ApplicationWindow {
[GtkChild] Entry connect_entry;
[GtkChild] Popover new_connection_popover;
[GtkChild] Revealer connection_revealer;
[GtkChild] Notebook vnc_notebook;
[GtkChild] Stack vnc_stack;
[GtkChild] HeaderBar header_bar;
public Window (Gtk.Application app) {
Object (application: app);
var gtk_settings = Gtk.Settings.get_default ();
gtk_settings.gtk_application_prefer_dark_theme = true;
vnc_notebook.page_added.connect(update_view);
vnc_notebook.page_removed.connect(update_view);
vnc_notebook.switch_page.connect((page, num) => {
VncBox cbox = (VncBox)page;
header_bar.set_subtitle("%s".printf(cbox.host));
});
}
[GtkCallback]
private void connect_button_clicked(){
VncBox cbox = new VncBox(connect_entry.get_text(),"5902");
Gtk.Box titlebox = new Gtk.Box(Orientation.HORIZONTAL,0);
Gtk.Label title = new Gtk.Label (connect_entry.get_text());
title.expand = true;
Gtk.Button close_button = new Gtk.Button.from_icon_name("window-close-symbolic", IconSize.MENU);
close_button.clicked.connect(() => {cbox.disconnect();});
close_button.relief = ReliefStyle.NONE;
titlebox.add(title);
titlebox.add(close_button);
titlebox.expand = true;
titlebox.show_all();
vnc_notebook.append_page(cbox, titlebox);
vnc_notebook.set_current_page(vnc_notebook.page_num(cbox));
vnc_notebook.set_tab_reorderable(cbox,true);
new_connection_popover.hide();
connect_entry.set_text("");
}
[GtkCallback]
private void disconnect_button_clicked(){
VncBox cbox = (VncBox)vnc_notebook.get_nth_page(vnc_notebook.get_current_page());
cbox.disconnect();
}
[GtkCallback]
private void zoom_fit_window_button_clicked(){
VncBox cbox = (VncBox)vnc_notebook.get_nth_page(vnc_notebook.get_current_page());
cbox.set_zoom_mode(ZoomMode.FIT_WINDOW);
}
[GtkCallback]
private void zoom_best_fit_button_clicked(){
VncBox cbox = (VncBox)vnc_notebook.get_nth_page(vnc_notebook.get_current_page());
cbox.set_zoom_mode(ZoomMode.BEST_FIT);
}
[GtkCallback]
private void zoom_original_button_clicked(){
VncBox cbox = (VncBox)vnc_notebook.get_nth_page(vnc_notebook.get_current_page());
cbox.set_zoom_mode(ZoomMode.ORIGINAL_SIZE);
}
private void update_view(){
if(vnc_notebook.get_n_pages() > 1) vnc_notebook.show_tabs = true;
else vnc_notebook.show_tabs = false;
if(vnc_notebook.get_n_pages() == 0){
vnc_stack.set_visible_child_name("no-connection");
connection_revealer.set_reveal_child(false);
}else{
vnc_stack.set_visible_child_name("notebook");
connection_revealer.set_reveal_child(true);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment