Merge branch 'master' of github.com:frac-tion/teleport
This commit is contained in:
@@ -1,25 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<schemalist>
|
<schemalist>
|
||||||
<schema path="/com/frac_tion/teleport/" id="com.frac_tion.teleport">
|
<schema path="/com/frac_tion/teleport/" id="com.frac_tion.teleport">
|
||||||
<key name="font" type="s">
|
<key name="download-dir" type="s">
|
||||||
<default>'Monospace 12'</default>
|
<default>'~/Downloads'</default>
|
||||||
<summary>Font</summary>
|
<summary>Download directory</summary>
|
||||||
<description>The font to be used for content.</description>
|
<description>The directory to save all incoming files.</description>
|
||||||
</key>
|
</key>
|
||||||
<key name="transition" type="s">
|
<key name="device-name" type="s">
|
||||||
<choices>
|
<default>'unknown'</default>
|
||||||
<choice value='none'/>
|
<summary>Device name</summary>
|
||||||
<choice value='crossfade'/>
|
<description>The device name shown to other devices.</description>
|
||||||
<choice value='slide-left-right'/>
|
|
||||||
</choices>
|
|
||||||
<default>'none'</default>
|
|
||||||
<summary>Transition</summary>
|
|
||||||
<description>The transition to use when switching tabs.</description>
|
|
||||||
</key>
|
|
||||||
<key name="show-words" type="b">
|
|
||||||
<default>false</default>
|
|
||||||
<summary>Show words</summary>
|
|
||||||
<description>Whether to show a word list in the sidebar</description>
|
|
||||||
</key>
|
</key>
|
||||||
</schema>
|
</schema>
|
||||||
</schemalist>
|
</schemalist>
|
||||||
|
|||||||
@@ -5,11 +5,5 @@
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD) == NULL) {
|
|
||||||
g_print("Update XDG user dirs\n");
|
|
||||||
g_spawn_command_line_sync("xdg-user-dirs-update", NULL, NULL, NULL, NULL);
|
|
||||||
}
|
|
||||||
g_print("Download dir: %s\n", g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD));
|
|
||||||
|
|
||||||
return g_application_run (G_APPLICATION (teleport_app_new ()), argc, argv);
|
return g_application_run (G_APPLICATION (teleport_app_new ()), argc, argv);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ sources = files(
|
|||||||
)
|
)
|
||||||
|
|
||||||
sources += gnome.compile_resources(
|
sources += gnome.compile_resources(
|
||||||
'gtd-resources',
|
'teleport-resources',
|
||||||
join_paths(data_dir, 'teleport.gresource.xml'),
|
join_paths(data_dir, 'teleport.gresource.xml'),
|
||||||
source_dir: [ data_dir, join_paths(meson.build_root(), 'plugins') ],
|
source_dir: [ data_dir, join_paths(meson.build_root(), 'plugins') ],
|
||||||
c_name: 'teleport',
|
c_name: 'teleport',
|
||||||
@@ -36,7 +36,7 @@ sources += gnome.compile_resources(
|
|||||||
export: true
|
export: true
|
||||||
)
|
)
|
||||||
|
|
||||||
#enum = 'gtd-enum-types'
|
#enum = 'teleport-enum-types'
|
||||||
|
|
||||||
#sources += gnome.mkenums(
|
#sources += gnome.mkenums(
|
||||||
# enum,
|
# enum,
|
||||||
@@ -96,8 +96,8 @@ teleport = executable(
|
|||||||
# Private library #
|
# Private library #
|
||||||
###################
|
###################
|
||||||
|
|
||||||
libgtd = shared_library(
|
libteleport = shared_library(
|
||||||
'gtd',
|
'teleport',
|
||||||
sources: sources,
|
sources: sources,
|
||||||
version: libversion,
|
version: libversion,
|
||||||
soversion: soversion,
|
soversion: soversion,
|
||||||
@@ -106,8 +106,8 @@ libgtd = shared_library(
|
|||||||
c_args: cflags
|
c_args: cflags
|
||||||
)
|
)
|
||||||
|
|
||||||
libgtd_dep = declare_dependency(
|
libteleport_dep = declare_dependency(
|
||||||
link_with: libgtd,
|
link_with: libteleport,
|
||||||
include_directories: src_inc,
|
include_directories: src_inc,
|
||||||
dependencies: teleport_deps
|
dependencies: teleport_deps
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -23,8 +23,9 @@
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkEntry" id="settings_download_directory">
|
<object class="GtkEntry" id="settings_download_directory">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="sensitive">False</property>
|
<property name="sensitive">True</property>
|
||||||
<property name="text">~/Downloads</property>
|
<property name="text">~/Downloads</property>
|
||||||
|
<property name="width_chars">25</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
@@ -36,7 +37,7 @@
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkButton">
|
<object class="GtkButton">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="sensitive">False</property>
|
<property name="sensitive">false</property>
|
||||||
<property name="label">Browse...</property>
|
<property name="label">Browse...</property>
|
||||||
<property name="margin_start">12</property>
|
<property name="margin_start">12</property>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ teleport_app_activate (GApplication *app) {
|
|||||||
create_finished_notification ("USER", 2000, "FILENAME", value);
|
create_finished_notification ("USER", 2000, "FILENAME", value);
|
||||||
*/
|
*/
|
||||||
teleport_server_run();
|
teleport_server_run();
|
||||||
teleport_publish_run ((gchar *) g_get_host_name());
|
teleport_publish_run (teleport_get_device_name());
|
||||||
teleport_browser_run_avahi_service(peerList);
|
teleport_browser_run_avahi_service(peerList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include <libsoup/soup.h>
|
#include <libsoup/soup.h>
|
||||||
#include "teleport-app.h"
|
#include "teleport-app.h"
|
||||||
|
#include "teleport-window.h"
|
||||||
#include "teleport-get.h"
|
#include "teleport-get.h"
|
||||||
|
|
||||||
static int saveFile (SoupMessage *, const gchar *, const gchar *);
|
static int saveFile (SoupMessage *, const gchar *, const gchar *);
|
||||||
@@ -147,7 +148,7 @@ int
|
|||||||
teleport_get_do_downloading (const char *originDevice,
|
teleport_get_do_downloading (const char *originDevice,
|
||||||
const char *url,
|
const char *url,
|
||||||
const char *filename) {
|
const char *filename) {
|
||||||
const gchar *outputDirectory = g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD);
|
const gchar *outputDirectory = teleport_get_download_directory();
|
||||||
g_print("Downloading %s to %s\n", url, g_uri_escape_string(filename, NULL, TRUE));
|
g_print("Downloading %s to %s\n", url, g_uri_escape_string(filename, NULL, TRUE));
|
||||||
get (g_strdup(url), originDevice, outputDirectory, filename);
|
get (g_strdup(url), originDevice, outputDirectory, filename);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -36,6 +36,26 @@ teleport_window_init (TeleportWindow *win)
|
|||||||
mainWin = win;
|
mainWin = win;
|
||||||
|
|
||||||
priv = teleport_window_get_instance_private (win);
|
priv = teleport_window_get_instance_private (win);
|
||||||
|
priv->settings = g_settings_new ("com.frac_tion.teleport");
|
||||||
|
|
||||||
|
if (g_settings_get_user_value (priv->settings, "download-dir") == NULL) {
|
||||||
|
g_print ("Download dir set to XDG DOWNLOAD directory\n");
|
||||||
|
if (g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD) != NULL) {
|
||||||
|
g_settings_set_string (priv->settings,
|
||||||
|
"download-dir",
|
||||||
|
g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
g_print ("Error: XDG DOWNLOAD is not set.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (g_settings_get_user_value (priv->settings, "device-name") == NULL) {
|
||||||
|
g_settings_set_string (priv->settings,
|
||||||
|
"device-name",
|
||||||
|
g_get_host_name());
|
||||||
|
}
|
||||||
|
|
||||||
gtk_widget_init_template (GTK_WIDGET (win));
|
gtk_widget_init_template (GTK_WIDGET (win));
|
||||||
|
|
||||||
@@ -45,9 +65,12 @@ teleport_window_init (TeleportWindow *win)
|
|||||||
|
|
||||||
gtk_menu_button_set_popover(GTK_MENU_BUTTON (priv->gears), menu);
|
gtk_menu_button_set_popover(GTK_MENU_BUTTON (priv->gears), menu);
|
||||||
|
|
||||||
gtk_label_set_text (GTK_LABEL (priv->this_device_name_label), g_get_host_name());
|
gtk_label_set_text (GTK_LABEL (priv->this_device_name_label),
|
||||||
gtk_entry_set_text (downloadDir, g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD));
|
g_settings_get_string (priv->settings, "device-name"));
|
||||||
gtk_entry_set_width_chars(downloadDir, 30);
|
|
||||||
|
g_settings_bind (priv->settings, "download-dir",
|
||||||
|
downloadDir, "text",
|
||||||
|
G_SETTINGS_BIND_DEFAULT);
|
||||||
|
|
||||||
//g_object_unref (menu);
|
//g_object_unref (menu);
|
||||||
//g_object_unref (label);
|
//g_object_unref (label);
|
||||||
@@ -176,13 +199,13 @@ find_child(GtkWidget *parent, const gchar *name)
|
|||||||
static void
|
static void
|
||||||
teleport_window_dispose (GObject *object)
|
teleport_window_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
//TeleportWindow *win;
|
TeleportWindow *win;
|
||||||
//TeleportWindowPrivate *priv;
|
TeleportWindowPrivate *priv;
|
||||||
|
|
||||||
//win = TELEPORT_WINDOW (object);
|
win = TELEPORT_WINDOW (object);
|
||||||
//priv = teleport_window_get_instance_private (win);
|
priv = teleport_window_get_instance_private (win);
|
||||||
|
|
||||||
//g_clear_object (&priv->settings);
|
g_clear_object (&priv->settings);
|
||||||
|
|
||||||
G_OBJECT_CLASS (teleport_window_parent_class)->dispose (object);
|
G_OBJECT_CLASS (teleport_window_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
@@ -207,6 +230,24 @@ teleport_window_new (TeleportApp *app)
|
|||||||
return g_object_new (TELEPORT_WINDOW_TYPE, "application", app, NULL);
|
return g_object_new (TELEPORT_WINDOW_TYPE, "application", app, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gchar *
|
||||||
|
teleport_get_device_name (void)
|
||||||
|
{
|
||||||
|
TeleportWindowPrivate *priv;
|
||||||
|
priv = teleport_window_get_instance_private (mainWin);
|
||||||
|
|
||||||
|
return g_settings_get_string (priv->settings, "device-name");
|
||||||
|
}
|
||||||
|
|
||||||
|
gchar *
|
||||||
|
teleport_get_download_directory (void)
|
||||||
|
{
|
||||||
|
TeleportWindowPrivate *priv;
|
||||||
|
priv = teleport_window_get_instance_private (mainWin);
|
||||||
|
|
||||||
|
return g_settings_get_string (priv->settings, "download-dir");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
teleport_window_open (TeleportWindow *win,
|
teleport_window_open (TeleportWindow *win,
|
||||||
GFile *file)
|
GFile *file)
|
||||||
|
|||||||
@@ -20,4 +20,7 @@ void update_remote_device_list (TeleportWindow *,
|
|||||||
void update_remote_device_list_remove (TeleportWindow *,
|
void update_remote_device_list_remove (TeleportWindow *,
|
||||||
Peer *);
|
Peer *);
|
||||||
|
|
||||||
|
gchar * teleport_get_download_directory (void);
|
||||||
|
gchar * teleport_get_device_name (void);
|
||||||
|
|
||||||
#endif /* __TELEPORT_WINDOW_H */
|
#endif /* __TELEPORT_WINDOW_H */
|
||||||
|
|||||||
@@ -140,7 +140,7 @@
|
|||||||
<object class="GtkImage">
|
<object class="GtkImage">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="icon_name">emblem-system-symbolic</property>
|
<property name="icon_name">document-edit-symbolic</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
Reference in New Issue
Block a user