This commit is contained in:
2026-01-04 17:30:20 +01:00
parent 079251a2e8
commit 14fd4f82f7
12 changed files with 390 additions and 999 deletions

View File

@@ -1,53 +1,40 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object id="device-settings" class="GtkPopover">
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="margin">10</property>
<property name="column-spacing">6</property>
<requires lib="gtk" version="4.0"/>
<object class="GtkPopover" id="device-settings">
<property name="child">
<object class="GtkBox">
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="margin-top">10</property>
<property name="margin-bottom">10</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Device name</property>
<property name="halign">GTK_ALIGN_START</property>
<property name="margin_bottom">6</property>
<property name="halign">start</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="this_device_settings_entry">
<property name="visible">True</property>
<object class="GtkBox">
<property name="spacing">6</property>
<child>
<object class="GtkEntry" id="this_device_settings_entry">
<property name="hexpand">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="this_device_settings_button">
<property name="label" translatable="yes">Rename</property>
<style>
<class name="suggested-action"/>
</style>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="this_device_settings_button">
<property name="visible">True</property>
<property name="label" translatable="yes">Rename</property>
<style>
<class name="suggested-action"/>
</style>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</child>
</property>
</object>
</interface>
</interface>

View File

@@ -16,12 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gtk/gtk.h>
#include <adwaita.h>
#include "teleport-app.h"
int
main (int argc, char *argv[])
{
adw_init ();
return g_application_run (G_APPLICATION (teleport_app_new ()), argc, argv);
}

View File

@@ -1,75 +1,15 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<template class="TeleportRemoteDevice" parent="GtkFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="shadow_type">in</property>
<property name="shadow_type">none</property>
<style>
<class name="frame"/>
</style>
<requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.0"/>
<template class="TeleportRemoteDevice" parent="AdwActionRow">
<property name="activatable">True</property>
<property name="selectable">True</property>
<child>
<object class="GtkListBox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selection_mode">none</property>
<child>
<object class="GtkListBoxRow" id="remote_device_row">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activatable">True</property>
<property name="selectable">True</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">0</property>
<property name="column_spacing">32</property>
<property name="margin">12</property>
<property name="margin_start">16</property>
<property name="valign">center</property>
<child>
<object class="GtkLabel" id="device_name">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="valign">end</property>
<property name="label" translatable="yes">Jan's Librem</property>
<property name="use_underline">True</property>
<style>
<class name="device-name"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="send_btn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="label" translatable="yes">Send File</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">2</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<object class="GtkButton" id="send_btn">
<property name="valign">center</property>
<property name="label" translatable="yes">Send File</property>
</object>
</child>
</template>>
</interface>
</template>
</interface>

View File

@@ -1,128 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.16"/>
<requires lib="gtk" version="4.0"/>
<object class="GtkPopover" id="settings">
<property name="can_focus">False</property>
<child>
<property name="child">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="margin">12</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="spacing">12</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">6</property>
<property name="label" translatable="yes">Save received files in:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkFileChooserButton" id="settings_download_directory">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action">select-folder</property>
<property name="title" translatable="yes">Choose download dir</property>
<object class="GtkButton" id="settings_download_directory">
<property name="label" translatable="yes">Choose download dir</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel">
<property name="can_focus">False</property>
<property name="margin_top">18</property>
<property name="margin_bottom">6</property>
<property name="margin-top">6</property>
<property name="label" translatable="yes">Automatically enable Teleport on these networks:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkListBox" id="general-listbox">
<property name="can_focus">False</property>
<property name="selection_mode">none</property>
<property name="selection-mode">none</property>
<style>
<class name="boxed-list"/>
</style>
<child>
<object class="GtkListBoxRow" id="primary-button-row-1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activatable">False</property>
<child>
<object class="GtkGrid" id="primary-button-grid-1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">6</property>
<property name="margin_start">12</property>
<property name="margin_end">6</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="column_spacing">16</property>
<object class="GtkBox">
<property name="margin-start">12</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="device-name-lable-1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">o2-WLAN09</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkButton" id="localSettings-1">
<property name="height_request">35</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">window-close-symbolic</property>
</object>
</child>
<style>
<class name="image-button"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<object class="GtkButton" id="localSettings-1">
<property name="icon-name">window-close-symbolic</property>
<style>
<class name="linked"/>
<class name="flat"/>
</style>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
@@ -130,128 +75,52 @@
</child>
<child>
<object class="GtkListBoxRow" id="primary-button-row">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activatable">False</property>
<child>
<object class="GtkGrid" id="primary-button-grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">6</property>
<property name="margin_start">12</property>
<property name="margin_end">6</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="column_spacing">16</property>
<object class="GtkBox">
<property name="margin-start">12</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="device-name-lable">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Add Network</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkButton" id="localSettings">
<property name="height_request">35</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">list-add-symbolic</property>
</object>
</child>
<style>
<class name="image-button"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<object class="GtkButton" id="localSettings">
<property name="icon-name">list-add-symbolic</property>
<style>
<class name="linked"/>
<class name="flat"/>
</style>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">6</property>
<property name="margin-top">6</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkModelButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<object class="GtkButton">
<property name="action_name">app.about</property>
<property name="text" translatable="yes">_About Teleport</property>
<property name="label" translatable="yes">About Teleport</property>
<style>
<class name="flat"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</property>
</object>
</interface>
</interface>

View File

@@ -1,22 +1,22 @@
/* teleport-app.c
*
*
* Copyright 2017 Julian Sparber <julian@sparber.com>
*
* Teleport is free software: you can redistribute it and/or modify
*
* Teleport is free software: you can redistribute and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gtk/gtk.h>
#include <adwaita.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -84,13 +84,13 @@ typedef struct
struct _TeleportApp {
GtkApplication parent;
AdwApplication parent;
/*< private >*/
TeleportAppPrivate *priv;
};
G_DEFINE_TYPE_WITH_PRIVATE (TeleportApp, teleport_app, GTK_TYPE_APPLICATION);
G_DEFINE_TYPE_WITH_PRIVATE (TeleportApp, teleport_app, ADW_TYPE_APPLICATION);
static void
@@ -231,7 +231,7 @@ open_file_callback (GSimpleAction *simple,
g_variant_get_string (g_variant_get_child_value (parameter, 3), NULL),
g_variant_get_string (g_variant_get_child_value (parameter, 2), NULL));
gtk_show_uri_on_window (NULL, g_filename_to_uri(path, NULL, NULL), GDK_CURRENT_TIME, NULL);
gtk_show_uri (NULL, g_filename_to_uri(path, NULL, NULL), GDK_CURRENT_TIME);
}
void
@@ -251,9 +251,6 @@ create_user_notification (const char *file_name, const int file_size, const char
g_notification_set_priority (notification, G_NOTIFICATION_PRIORITY_HIGH);
g_application_send_notification ((GApplication *) mainApplication, NULL, notification);
g_object_unref (notification);
//the example says I have to unref it but it gives a critival error
//https://developer.gnome.org/glib/stable/gvariant-format-strings.html
//g_variant_unref (target);
}
void
@@ -289,7 +286,6 @@ mainLoopRemovePeerCallback (gpointer peer) {
GtkWidget *window = priv->window;
update_remote_device_list_remove((TeleportWindow *) window, (Peer *) peer);
//if (teleport_peer_get_number (priv->peerList) == 0)
if (teleport_peer_get_number (priv->peerList) == 0)
teleport_show_no_device_message (TELEPORT_WINDOW (window), TRUE);
return G_SOURCE_REMOVE;
@@ -307,7 +303,6 @@ callback_remove_peer (GObject *instance, Peer *peer, gpointer window) {
void
callback_notify_user (GObject *instance, gchar *name, gpointer window) {
//create_user_notification("icon.png", 2000, "Mark's laptop");
}
GSettings *
@@ -374,10 +369,10 @@ teleport_app_startup (GApplication *app) {
/* CSS style */
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider),
"com/frac_tion/teleport/style.css");
gtk_style_context_add_provider_for_screen (gdk_screen_get_default(),
provider,
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
"/com/frac_tion/teleport/style.css");
gtk_style_context_add_provider_for_display (gdk_display_get_default(),
provider,
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (provider);
/* PeerList */
@@ -398,15 +393,12 @@ teleport_app_activate (GApplication *app) {
TeleportAppPrivate *priv;
priv = mainApplication->priv;
gtk_widget_show (priv->window);
gtk_window_present (GTK_WINDOW (priv->window));
}
static void
teleport_app_finalize (GObject *object)
{
/*TeleportAppPrivate priv = mainApplication->priv;
g_clear_object (&priv->settings);*/
G_OBJECT_CLASS (teleport_app_parent_class)->finalize (object);
}
@@ -436,45 +428,39 @@ teleport_app_show_about (GSimpleAction *simple,
gpointer user_data)
{
TeleportAppPrivate *priv = TELEPORT_APP (user_data)->priv;
char *copyright;
GDateTime *date;
g_autofree char *copyright = NULL;
g_autoptr(GDateTime) date = g_date_time_new_now_local ();
int created_year = 2017;
static const gchar *authors[] = {
static const char *developers[] = {
"Julian Sparber <julian@sparber.net>",
NULL
};
static const gchar *artists[] = {
static const char *artists[] = {
"Tobias Bernard <tbernard@gnome.org>",
NULL
};
date = g_date_time_new_now_local ();
if (g_date_time_get_year (date) <= created_year)
{
copyright = g_strdup_printf (("Copyright \xC2\xA9 %d "
"The Teleport authors"), created_year);
copyright = g_strdup_printf ("Copyright \xC2\xA9 %d The Teleport authors", created_year);
}
else
{
copyright = g_strdup_printf (("Copyright \xC2\xA9 %d\xE2\x80\x93%d "
"The Telport authors"), created_year, g_date_time_get_year (date));
copyright = g_strdup_printf ("Copyright \xC2\xA9 %d\xE2\x80\x93%d The Teleport authors", created_year, g_date_time_get_year (date));
}
gtk_show_about_dialog (GTK_WINDOW (priv->window),
"program-name", ("Teleport"),
adw_show_about_dialog (priv->window,
"application-name", "Teleport",
"version", VERSION,
"copyright", copyright,
"license-type", GTK_LICENSE_AGPL_3_0,
"authors", authors,
"developers", developers,
"artists", artists,
"logo-icon-name", "com.frac_tion.teleport",
"translator-credits", ("translator-credits"),
"application-icon", "com.frac_tion.teleport",
"translator-credits", "translator-credits",
NULL);
g_free (copyright);
g_date_time_unref (date);
}
@@ -485,7 +471,7 @@ teleport_app_quit (GSimpleAction *simple,
{
TeleportAppPrivate *priv = TELEPORT_APP (user_data)->priv;
gtk_widget_destroy (priv->window);
gtk_window_destroy (GTK_WINDOW (priv->window));
}
TeleportApp *
@@ -504,6 +490,4 @@ teleport_app_init (TeleportApp *app) {
priv->settings = g_settings_new ("com.frac_tion.teleport");
init_settings (priv->settings);
}
}

View File

@@ -19,12 +19,12 @@
#ifndef __TELEPORT_APP_H
#define __TELEPORT_APP_H
#include <gtk/gtk.h>
#include <adwaita.h>
#include "teleport-peer.h"
#define TELEPORT_APP_TYPE (teleport_app_get_type ())
G_DECLARE_FINAL_TYPE (TeleportApp, teleport_app, TELEPORT, APP, GtkApplication)
G_DECLARE_FINAL_TYPE (TeleportApp, teleport_app, TELEPORT, APP, AdwApplication)
TeleportApp *teleport_app_new (void);

View File

@@ -16,59 +16,32 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gtk/gtk.h>
#include <adwaita.h>
#include "teleport-remote-device.h"
#include "teleport-peer.h"
#include "teleport-server.h"
enum {
TARGET_INT32,
TARGET_STRING,
TARGET_URIS,
TARGET_ROOTWIN
};
enum
{
PROP_0,
PROP_PEER,
LAST_PROP
{
PROP_0,
PROP_PEER,
LAST_PROP
};
/* datatype (string), restrictions on DnD (GtkTargetFlags), datatype (int) */
static GtkTargetEntry target_list[] = {
//{ "INTEGER", 0, TARGET_INT32 },
//{ "STRING", 0, TARGET_STRING },
//{ "text/plain", 0, TARGET_STRING },
{ "text/uri-list", 0, TARGET_URIS }
//{ "application/octet-stream", 0, TARGET_STRING },
//{ "application/x-rootwindow-drop", 0, TARGET_ROOTWIN }
};
static guint n_targets = G_N_ELEMENTS (target_list);
struct _TeleportRemoteDevice
{
GtkFrame parent;
GtkWidget *remote_device_row;
GtkWidget *device_name;
AdwActionRow parent;
GtkWidget *send_btn;
/* data */
Peer *peer;
};
G_DEFINE_TYPE (TeleportRemoteDevice, teleport_remote_device, GTK_TYPE_FRAME)
/*
* GObject overrides
*/
G_DEFINE_TYPE (TeleportRemoteDevice, teleport_remote_device, ADW_TYPE_ACTION_ROW)
static void
teleport_remote_device_finalize (GObject *object)
{
//TeleportRemoteDevice *self = TELEPORT_REMOTE_DEVICE (object);
G_OBJECT_CLASS (teleport_remote_device_parent_class)->finalize (object);
}
@@ -127,11 +100,6 @@ teleport_remote_device_class_init (TeleportRemoteDeviceClass *klass)
object_class->get_property = teleport_remote_device_get_property;
object_class->set_property = teleport_remote_device_set_property;
/**
* TeleportRemoteDevice::peer:
*
* The peer that this row represents, or %NULL.
*/
g_object_class_install_property (object_class,
PROP_PEER,
g_param_spec_pointer ("peer",
@@ -139,212 +107,95 @@ teleport_remote_device_class_init (TeleportRemoteDeviceClass *klass)
"The peer that this row represents",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
/*g_param_spec_object ("peer",
"Task of the row",
"The task that this row represents",
(Peer *),
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
*/
gtk_widget_class_set_template_from_resource (widget_class, "/com/frac_tion/teleport/remote_list.ui");
gtk_widget_class_bind_template_child (widget_class, TeleportRemoteDevice, remote_device_row);
gtk_widget_class_bind_template_child (widget_class, TeleportRemoteDevice, device_name);
gtk_widget_class_bind_template_child (widget_class, TeleportRemoteDevice, send_btn);
}
static void
on_file_chooser_response (GtkNativeDialog *dialog,
int response,
gpointer user_data)
{
Peer *device = user_data;
if (response == GTK_RESPONSE_ACCEPT)
{
g_autoptr(GFile) file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
g_autofree char *filename = g_file_get_path (file);
if (filename)
{
g_print("Chosen file is %s\n", filename);
teleport_server_add_route (g_compute_checksum_for_string (G_CHECKSUM_SHA256, filename, -1), g_strdup(filename), device->ip);
}
}
g_object_unref (dialog);
}
static void
open_file_picker(GtkButton *btn,
Peer *device) {
GtkFileChooserNative *dialog;
GtkWidget * window;
GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
gint res;
GtkRoot *root;
g_print("Open file chooser for submitting a file to %s with Address %s\n", device->name, device->ip);
window = gtk_widget_get_toplevel (GTK_WIDGET (btn));
if (gtk_widget_is_toplevel (window))
root = gtk_widget_get_root (GTK_WIDGET (btn));
if (GTK_IS_WINDOW (root))
{
dialog = gtk_file_chooser_native_new ("Open File",
GTK_WINDOW(window),
action,
GTK_WINDOW (root),
GTK_FILE_CHOOSER_ACTION_OPEN,
("_Open"),
("_Cancel"));
res = gtk_native_dialog_run (GTK_NATIVE_DIALOG (dialog));
if (res == GTK_RESPONSE_ACCEPT)
{
char *filename;
GtkFileChooser *chooser = GTK_FILE_CHOOSER (dialog);
filename = gtk_file_chooser_get_filename (chooser);
g_print("Choosen file is %s\n", filename);
g_object_unref (dialog);
teleport_server_add_route (g_compute_checksum_for_string (G_CHECKSUM_SHA256, filename, -1), filename, device->ip);
g_free (filename);
}
else
{
g_object_unref (dialog);
}
g_signal_connect (dialog, "response", G_CALLBACK (on_file_chooser_response), device);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
}
}
static void
send_file_to_device (gchar *uri, gpointer data)
send_file_to_device (GFile *file, Peer *device)
{
Peer *device = (Peer *) data;
GFile *file = g_file_new_for_uri (uri);
gchar *filename = NULL;
g_autofree gchar *filename = g_file_get_path (file);
if (g_file_query_exists (file, NULL)) {
filename = g_file_get_path (file);
teleport_server_add_route (g_compute_checksum_for_string (G_CHECKSUM_SHA256, filename, -1), g_strdup(filename), device->ip);
g_free (filename);
}
else {
g_print ("File doesn't exist: %s\n", uri);
g_print ("File doesn't exist: %s\n", filename);
}
g_object_unref(file);
}
static void
drag_data_received_handl
(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
GtkSelectionData *selection_data, guint target_type, guint time,
gpointer data)
{
glong *_idata;
gchar *_sdata;
gchar **uris;
gboolean dnd_success = FALSE;
gboolean delete_selection_data = FALSE;
/* Deal with what we are given from source */
if((selection_data != NULL) && (gtk_selection_data_get_length(selection_data) >= 0))
{
if (gdk_drag_context_get_suggested_action(context) == GDK_ACTION_ASK)
{
/* Ask the user to move or copy, then set the context action. */
}
if (gdk_drag_context_get_suggested_action(context) == GDK_ACTION_MOVE)
delete_selection_data = TRUE;
/* Check that we got the format we can use */
switch (target_type)
{
case TARGET_INT32:
_idata = (glong*)gtk_selection_data_get_data(selection_data);
g_print ("integer: %ld", *_idata);
dnd_success = TRUE;
break;
case TARGET_STRING:
_sdata = (gchar*)gtk_selection_data_get_data(selection_data);
g_print ("string: %s", _sdata);
dnd_success = TRUE;
break;
case TARGET_URIS:
uris = gtk_selection_data_get_uris(selection_data);
if (uris != NULL && uris[1] == NULL) {
send_file_to_device (uris[0], data);
dnd_success = TRUE;
}
break;
default:
g_print ("Something bad!");
}
}
if (dnd_success == FALSE)
{
g_print ("DnD data transfer failed!\n");
g_print ("You can not drag more then one file!\n");
}
gtk_drag_finish (context, dnd_success, delete_selection_data, time);
}
/* Emitted when a drag is over the destination */
static gboolean
drag_motion_handl
(GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint t,
gpointer user_data)
on_drop (GtkDropTarget *target,
const GValue *value,
double x,
double y,
gpointer user_data)
{
// Fancy stuff here. This signal spams the console something horrible.
//const gchar *name = gtk_widget_get_name (widget);
//g_print ("%s: drag_motion_handl\n", name);
return FALSE;
}
/* Emitted when a drag leaves the destination */
static void
drag_leave_handl
(GtkWidget *widget, GdkDragContext *context, guint time, gpointer user_data)
{
}
/* Emitted when the user releases (drops) the selection. It should check that
* the drop is over a valid part of the widget (if its a complex widget), and
* itself to return true if the operation should continue. Next choose the
* target type it wishes to ask the source for. Finally call gtk_drag_get_data
* which will emit "drag-data-get" on the source. */
static gboolean
drag_drop_handl
(GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time,
gpointer user_data)
{
gboolean is_valid_drop_site;
GdkAtom target_type;
/* Check to see if (x,y) is a valid drop site within widget */
is_valid_drop_site = TRUE;
/* If the source offers a target */
if (gdk_drag_context_list_targets (context))
TeleportRemoteDevice *self = user_data;
if (G_VALUE_HOLDS (value, GDK_TYPE_FILE_LIST))
{
/* Choose the best target type */
target_type = GDK_POINTER_TO_ATOM
(g_list_nth_data (gdk_drag_context_list_targets(context), TARGET_INT32));
/* Request the data from the source. */
gtk_drag_get_data
(
widget, /* will receive 'drag-data-received' signal */
context, /* represents the current state of the DnD */
target_type, /* the target type we want */
time /* time stamp */
);
GSList *list = g_value_get_boxed (value);
for (GSList *l = list; l != NULL; l = l->next)
{
send_file_to_device (G_FILE (l->data), self->peer);
}
return TRUE;
}
/* No target offered by source => error */
else
{
is_valid_drop_site = FALSE;
}
return is_valid_drop_site;
return FALSE;
}
static void
teleport_remote_device_init (TeleportRemoteDevice *self)
{
GtkDropTarget *target;
gtk_widget_init_template (GTK_WIDGET (self));
/* Make the widget a DnD destination. */
gtk_drag_dest_set
(
GTK_WIDGET (self->remote_device_row), /* widget that will accept a drop */
GTK_DEST_DEFAULT_MOTION /* default actions for dest on DnD */
| GTK_DEST_DEFAULT_HIGHLIGHT,
target_list, /* lists of target to support */
n_targets, /* size of list */
GDK_ACTION_COPY /* what to do with data after dropped */
);
target = gtk_drop_target_new (GDK_TYPE_FILE_LIST, GDK_ACTION_COPY);
g_signal_connect (target, "drop", G_CALLBACK (on_drop), self);
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (target));
}
GtkWidget*
@@ -355,17 +206,8 @@ teleport_remote_device_new (Peer *peer)
NULL);
}
/**
* teleport_remote_device_get_peer:
* @row: a #TeleportRemoteDevice
*
* Retrieves the #Peer that @row manages, or %NULL if none
* is set.
*
* Returns: (transfer none): the internal peer of @row
*/
Peer *
teleport_remote_device_get_peer (GtkWidget *widget)
teleport_remote_device_get_peer (GtkWidget *widget)
{
TeleportRemoteDevice *row;
@@ -383,47 +225,14 @@ teleport_remote_device_set_peer (TeleportRemoteDevice *widget,
g_return_if_fail (TELEPORT_IS_REMOTE_DEVICE (widget));
widget->peer = peer;
/*
we need to create a peer object instate of a struct to be able to bind it
if (!g_set_object (&widget->peer, peer))
return;
g_object_bind_property (peer,
"name",
widget->device_name,
"label",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
*/
if (peer)
{
gtk_label_set_text(GTK_LABEL (widget->device_name), peer->name);
adw_preferences_row_set_title (ADW_PREFERENCES_ROW (widget), peer->name);
g_signal_connect (widget->send_btn, "clicked", G_CALLBACK (open_file_picker), peer);
g_signal_connect (widget, "drag-data-received",
G_CALLBACK(drag_data_received_handl), peer);
g_signal_connect (widget, "drag-leave",
G_CALLBACK (drag_leave_handl), peer);
g_signal_connect (widget, "drag-motion",
G_CALLBACK (drag_motion_handl), peer);
g_signal_connect (widget, "drag-drop",
G_CALLBACK (drag_drop_handl), peer);
}
}
/**
* teleport_remote_device_destroy:
* @self: a #TeleportRemoteDevice
*
* Destroy @self after hiding it.
*/
void
teleport_remote_device_destroy (TeleportRemoteDevice *self)
{
}
}

View File

@@ -19,15 +19,14 @@
#ifndef TELEPORT_REMOTE_DEVICE_H
#define TELEPORT_REMOTE_DEVICE_H
#include <glib-object.h>
#include <gtk/gtk.h>
#include <adwaita.h>
#include "teleport-peer.h"
G_BEGIN_DECLS
#define TELEPORT_TYPE_REMOTE_DEVICE (teleport_remote_device_get_type())
G_DECLARE_FINAL_TYPE (TeleportRemoteDevice, teleport_remote_device, TELEPORT, REMOTE_DEVICE, GtkFrame)
G_DECLARE_FINAL_TYPE (TeleportRemoteDevice, teleport_remote_device, TELEPORT, REMOTE_DEVICE, AdwActionRow)
GtkWidget * teleport_remote_device_new (Peer * );

View File

@@ -1,25 +1,23 @@
/* teleport-window.c
*
*
* Copyright 2017 Julian Sparber <julian@sparber.com>
*
*
* Teleport is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gtk/gtk.h>
#include <adwaita.h>
#include <string.h>
#define HANDY_USE_UNSTABLE_API
#include <handy.h>
#include "teleport-app.h"
#include "teleport-window.h"
@@ -29,7 +27,7 @@
struct _TeleportWindow
{
GtkApplicationWindow parent;
AdwApplicationWindow parent;
};
typedef struct _TeleportWindowPrivate TeleportWindowPrivate;
@@ -39,27 +37,51 @@ struct _TeleportWindowPrivate
GtkWidget *gears;
GtkWidget *this_device_settings_button;
GtkWidget *remote_devices_box;
GtkWidget *this_device_name_label;
AdwActionRow *this_device_row;
GtkWidget *remote_no_devices;
GtkWidget *remote_no_avahi;
GtkWidget *this_device_settings_entry;
};
G_DEFINE_TYPE_WITH_PRIVATE(TeleportWindow, teleport_window, GTK_TYPE_APPLICATION_WINDOW);
G_DEFINE_TYPE_WITH_PRIVATE(TeleportWindow, teleport_window, ADW_TYPE_APPLICATION_WINDOW);
static void
change_download_directory_cb (GtkWidget *widget,
gpointer user_data) {
GSettings *settings;
gchar * newDownloadDir;
settings = (GSettings *)user_data;
on_download_dir_response (GtkNativeDialog *dialog,
int response,
gpointer user_data)
{
GSettings *settings = user_data;
newDownloadDir = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
g_print ("Change download directory\n");
g_settings_set_string (settings,
"download-dir",
newDownloadDir);
g_free(newDownloadDir);
if (response == GTK_RESPONSE_ACCEPT)
{
g_autoptr(GFile) file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
g_autofree char *path = g_file_get_path (file);
if (path)
{
g_print ("Change download directory to %s\n", path);
g_settings_set_string (settings, "download-dir", path);
}
}
g_object_unref (dialog);
}
static void
on_choose_download_dir_clicked (GtkButton *btn,
gpointer user_data)
{
GSettings *settings = user_data;
GtkFileChooserNative *dialog;
GtkRoot *root = gtk_widget_get_root (GTK_WIDGET (btn));
dialog = gtk_file_chooser_native_new ("Choose Download Directory",
GTK_WINDOW (root),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
"_Select",
"_Cancel");
g_signal_connect (dialog, "response", G_CALLBACK (on_download_dir_response), settings);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
}
static gboolean
@@ -71,7 +93,7 @@ valid_device_name (const gchar *name) {
static gchar *
get_new_name (GtkWidget *widget) {
return g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (widget))));
return g_strstrip (g_strdup (gtk_editable_get_text (GTK_EDITABLE (widget))));
}
static void
@@ -81,16 +103,6 @@ on_new_device_name (GtkWidget *widget,
gtk_widget_set_sensitive (GTK_WIDGET (data), valid_device_name (name));
}
static void
update_download_directory (GSettings *settings,
gchar *key,
gpointer *data) {
if (g_strcmp0 (key, "download-dir") == 0) {
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (data),
g_settings_get_string(settings, key));
}
}
static void
on_click_this_device_settings_button (GtkWidget *widget,
gpointer user_data) {
@@ -108,7 +120,7 @@ static void
on_show_popover (GtkPopover *widget,
gpointer data) {
TeleportWindowPrivate *priv = (TeleportWindowPrivate *) data;
gtk_entry_set_text(GTK_ENTRY (priv->this_device_settings_entry),
gtk_editable_set_text(GTK_EDITABLE (priv->this_device_settings_entry),
g_settings_get_string(teleport_app_get_settings (),
"device-name"));
}
@@ -119,31 +131,27 @@ teleport_window_init (TeleportWindow *win)
TeleportWindowPrivate *priv;
GtkBuilder *builder;
GtkWidget *menu;
GtkFileChooserButton *downloadDir;
GtkWidget *downloadDirBtn;
GSettings *settings = teleport_app_get_settings ();
priv = teleport_window_get_instance_private (win);
g_type_ensure (HDY_TYPE_COLUMN);
g_type_ensure (ADW_TYPE_CLAMP);
g_type_ensure (ADW_TYPE_TOOLBAR_VIEW);
g_type_ensure (ADW_TYPE_ACTION_ROW);
gtk_widget_init_template (GTK_WIDGET (win));
builder = gtk_builder_new_from_resource ("/com/frac_tion/teleport/settings.ui");
menu = GTK_WIDGET (gtk_builder_get_object (builder, "settings"));
downloadDir = GTK_FILE_CHOOSER_BUTTON (gtk_builder_get_object (builder, "settings_download_directory"));
downloadDirBtn = GTK_WIDGET (gtk_builder_get_object (builder, "settings_download_directory"));
gtk_menu_button_set_popover(GTK_MENU_BUTTON (priv->gears), menu);
g_settings_bind (settings, "device-name",
priv->this_device_name_label, "label",
priv->this_device_row, "title",
G_SETTINGS_BIND_GET);
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (downloadDir),
g_settings_get_string(settings,
"download-dir"));
g_signal_connect (downloadDir, "file-set", G_CALLBACK (change_download_directory_cb), settings);
g_signal_connect (settings, "changed", G_CALLBACK (update_download_directory), downloadDir);
g_signal_connect (downloadDirBtn, "clicked", G_CALLBACK (on_choose_download_dir_clicked), settings);
g_object_unref (builder);
@@ -185,24 +193,12 @@ update_remote_device_list(TeleportWindow *win,
priv = teleport_window_get_instance_private (win);
gtk_widget_hide (priv->remote_no_devices);
gtk_widget_set_visible (priv->remote_no_devices, FALSE);
remote_device = teleport_remote_device_new (device);
gtk_box_pack_end (GTK_BOX (priv->remote_devices_box),
remote_device,
TRUE,
TRUE,
0);
}
static void
remove_remote_peer (GtkWidget *widget,
gpointer data)
{
if (TELEPORT_IS_REMOTE_DEVICE (widget) && teleport_remote_device_get_peer(widget) == ((Peer *) data)) {
gtk_widget_destroy (widget);
}
gtk_box_append (GTK_BOX (priv->remote_devices_box),
remote_device);
}
void
@@ -210,12 +206,18 @@ update_remote_device_list_remove(TeleportWindow *win,
Peer *device)
{
TeleportWindowPrivate *priv;
GtkWidget *child;
priv = teleport_window_get_instance_private (win);
gtk_container_foreach (GTK_CONTAINER(priv->remote_devices_box),
remove_remote_peer,
device);
child = gtk_widget_get_first_child (priv->remote_devices_box);
while (child) {
GtkWidget *next = gtk_widget_get_next_sibling (child);
if (TELEPORT_IS_REMOTE_DEVICE (child) && teleport_remote_device_get_peer(child) == device) {
gtk_box_remove (GTK_BOX (priv->remote_devices_box), child);
}
child = next;
}
}
static void
@@ -234,7 +236,7 @@ teleport_window_class_init (TeleportWindowClass *class)
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportWindow, gears);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportWindow, this_device_settings_button);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportWindow, this_device_name_label);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportWindow, this_device_row);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportWindow, remote_no_devices);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportWindow, remote_devices_box);
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), TeleportWindow, remote_no_avahi);
@@ -251,10 +253,7 @@ teleport_show_no_device_message (TeleportWindow *self, gboolean show)
{
TeleportWindowPrivate *priv;
priv = teleport_window_get_instance_private (self);
if (show)
gtk_widget_show (priv->remote_no_devices);
else
gtk_widget_hide (priv->remote_no_devices);
gtk_widget_set_visible (priv->remote_no_devices, show);
}
void
@@ -262,16 +261,11 @@ teleport_show_no_avahi_message (TeleportWindow *self, gboolean show)
{
TeleportWindowPrivate *priv;
priv = teleport_window_get_instance_private (self);
if (show)
gtk_widget_show (priv->remote_no_avahi);
else
gtk_widget_hide (priv->remote_no_avahi);
gtk_widget_set_visible (priv->remote_no_avahi, show);
}
void
teleport_window_open (TeleportWindow *win,
GFile *file)
{
//TeleportWindowPrivate *priv;
//priv = teleport_window_get_instance_private (win);
}
}

View File

@@ -19,7 +19,7 @@
#ifndef __TELEPORT_WINDOW_H
#define __TELEPORT_WINDOW_H
#include <gtk/gtk.h>
#include <adwaita.h>
#include "teleport-app.h"
#include "teleport-peer.h"
@@ -28,7 +28,7 @@ G_DECLARE_FINAL_TYPE (TeleportWindow,
teleport_window,
TELEPORT,
WINDOW,
GtkApplicationWindow)
AdwApplicationWindow)
TeleportWindow *teleport_window_new (TeleportApp *);
void teleport_window_open (TeleportWindow *,

View File

@@ -1,166 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<requires lib="libhandy" version="0.0"/>
<template class="TeleportWindow" parent="GtkApplicationWindow">
<requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.0"/>
<template class="TeleportWindow" parent="AdwApplicationWindow">
<property name="title" translatable="yes">Teleport</property>
<property name="default_width">650</property>
<property name="default_height">500</property>
<child>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">-1</property>
<property name="upper">1</property>
</object>
<object class="GtkAdjustment" id="adjustment11">
<property name="lower">-1</property>
<property name="upper">1</property>
</object>
<object class="GtkAdjustment" id="adjustment4">
<property name="lower">100</property>
<property name="upper">1000</property>
<property name="value">400</property>
<property name="step_increment">100</property>
<property name="page_increment">100</property>
</object>
<object class="GtkScrolledWindow" id="scrolled-window">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">none</property>
<property name="hscrollbar_policy">never</property>
<child>
<object class="HdyColumn">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="linear-growth-width">600</property>
<property name="maximum-width">600</property>
<child>
<object class="GtkBox" id="general-container">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="margin_left">24</property>
<property name="margin_right">24</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkFrame" id="general-frame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="shadow_type">in</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="shadow_type">none</property>
<child type="label">
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="this-device-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">This device</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_top">6</property>
<property name="label" translatable="yes">How your device appears to others</property>
<style>
<class name="dim-label"/>
</style>
<attributes>
<attribute name="scale" value="0.9"/>
</attributes>
</object>
</child>
</object>
</child>
<property name="content">
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar" id="header">
<property name="show-end-title-buttons">True</property>
<child type="end">
<object class="GtkMenuButton" id="gears">
<property name="icon-name">emblem-system-symbolic</property>
<property name="tooltip-text" translatable="yes">Settings</property>
</object>
</child>
</object>
</child>
<property name="content">
<object class="GtkScrolledWindow" id="scrolled-window">
<property name="hscrollbar-policy">never</property>
<property name="child">
<object class="AdwClamp">
<property name="maximum-size">600</property>
<property name="child">
<object class="GtkBox" id="general-container">
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="margin-start">24</property>
<property name="margin-end">24</property>
<property name="orientation">vertical</property>
<property name="spacing">24</property>
<child>
<object class="GtkFrame" id="general-frame-listbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="shadow_type">in</property>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="this-device-label">
<property name="halign">start</property>
<property name="label" translatable="yes">This device</property>
<style>
<class name="heading"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="margin-top">6</property>
<property name="label" translatable="yes">How your device appears to others</property>
<style>
<class name="dim-label"/>
<class name="caption"/>
</style>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBox" id="this-device-listbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="selection_mode">none</property>
<property name="selection-mode">none</property>
<style>
<class name="boxed-list"/>
</style>
<child>
<object class="GtkListBoxRow" id="this-device-row">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="activatable">false</property>
<object class="AdwActionRow" id="this_device_row">
<property name="title" translatable="yes">Angela's Thinkpad</property>
<property name="activatable">False</property>
<child>
<object class="GtkGrid" id="this-device-grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">0</property>
<property name="column_spacing">16</property>
<property name="margin">12</property>
<property name="margin_start">16</property>
<child>
<object class="GtkLabel" id="this_device_name_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="expand">True</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Angela's Thinkpad</property>
<property name="use_underline">True</property>
<style>
<class name="device-name"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="column_homogeneous">True</property>
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkMenuButton" id="this_device_settings_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="use-popover">True</property>
<property name="height_request">35</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">document-edit-symbolic</property>
</object>
</child>
<style>
<class name="image-button"/>
</style>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">2</property>
</packing>
</child>
<object class="GtkMenuButton" id="this_device_settings_button">
<property name="valign">center</property>
<property name="icon-name">document-edit-symbolic</property>
<style>
<class name="flat"/>
</style>
</object>
</child>
</object>
@@ -169,158 +87,109 @@
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkFrame" id="remote-devices-frame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="shadow_type">none</property>
<property name="label_yalign">0.45</property>
<child type="label">
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="remote-devices-network-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Other devices on the local network</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_top">6</property>
<property name="label" translatable="yes">Drag and drop files on devices to send them</property>
<style>
<class name="dim-label"/>
</style>
<attributes>
<attribute name="scale" value="0.9"/>
</attributes>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="remote_devices_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="margin_top">6</property>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkFrame" id="remote_no_avahi">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="shadow_type">in</property>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkListBox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selection_mode">none</property>
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="activatable">False</property>
<property name="selectable">False</property>
<object class="GtkLabel" id="remote-devices-network-label">
<property name="halign">start</property>
<property name="label" translatable="yes">Other devices on the local network</property>
<style>
<class name="heading"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="margin-top">6</property>
<property name="label" translatable="yes">Drag and drop files on devices to send them</property>
<style>
<class name="dim-label"/>
<class name="caption"/>
</style>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="remote_devices_box">
<property name="spacing">6</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkFrame" id="remote_no_avahi">
<property name="child">
<object class="GtkListBox">
<property name="selection-mode">none</property>
<child>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">50</property>
<property name="bottom_padding">50</property>
<child>
<object class="GtkListBoxRow">
<property name="activatable">False</property>
<property name="selectable">False</property>
<property name="child">
<object class="GtkBox">
<property name="visible">True</property>
<property name="margin-top">50</property>
<property name="margin-bottom">50</property>
<property name="spacing">20</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="max-width-chars">40</property>
<property name="halign">center</property>
<property name="wrap">True</property>
<property name="justify">center</property>
<property name="label">The Avahi daemon is not running. You can run this command to start it now:</property>
<property name="label" translatable="yes">The Avahi daemon is not running. You can run this command to start it now:</property>
</object>
</child>
<child>
<object class="GtkEntry">
<property name="visible">True</property>
<property name="halign">center</property>
<property name="editable">False</property>
<property name="text">systemctl start avahi-daemon</property>
</object>
</child>
</object>
</child>
</property>
</object>
</child>
</object>
</child>
</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkFrame" id="remote_no_devices">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkListBox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selection_mode">none</property>
<child>
<object class="GtkListBoxRow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="activatable">False</property>
<property name="selectable">False</property>
<object class="GtkFrame" id="remote_no_devices">
<property name="child">
<object class="GtkListBox">
<property name="selection-mode">none</property>
<child>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">50</property>
<property name="bottom_padding">50</property>
<child>
<object class="GtkListBoxRow">
<property name="activatable">False</property>
<property name="selectable">False</property>
<property name="child">
<object class="GtkBox">
<property name="visible">True</property>
<property name="margin-top">50</property>
<property name="margin-bottom">50</property>
<property name="spacing">20</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">Searching for other devices...</property>
<property name="label" translatable="yes">Searching for other devices...</property>
</object>
</child>
<child>
<object class="GtkSpinner">
<property name="visible">True</property>
<property name="active">True</property>
<property name="spinning">True</property>
</object>
</child>
</object>
</child>
</property>
</object>
</child>
</object>
</child>
</property>
</object>
</child>
</object>
@@ -328,57 +197,12 @@
</object>
</child>
</object>
</child>
</property>
</object>
</child>
</property>
</object>
</child>
</property>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar" id="header">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_close_button">True</property>
<property name="decoration_layout">:close</property>
<property name="title" translatable="yes">Teleport</property>
<child>
<object class="GtkSwitch" id="visible-on-network-switch">
<property name="visible">False</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="visible-on-network-label">
<property name="visible">False</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Visible on network</property>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="gears">
<property name="visible">True</property>
<property name="direction">none</property>
<property name="use-popover">True</property>
<style>
<class name="image-button"/>
</style>
</object>
<packing>
<property name="pack-type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
</property>
</template>
</interface>
</interface>