[feature] new remote devices are displayed and removed from the window, avahi connection
This commit is contained in:
@@ -2,12 +2,23 @@
|
||||
|
||||
#include "teleportapp.h"
|
||||
#include "teleportappwin.h"
|
||||
#include "browser.h"
|
||||
|
||||
static TeleportAppWindow *win;
|
||||
|
||||
struct _TeleportApp
|
||||
{
|
||||
GtkApplication parent;
|
||||
};
|
||||
|
||||
typedef struct Peers {
|
||||
char *name;
|
||||
char *ip;
|
||||
int port;
|
||||
} Peer;
|
||||
|
||||
static Peer remote_peers[100];
|
||||
|
||||
G_DEFINE_TYPE(TeleportApp, teleport_app, GTK_TYPE_APPLICATION);
|
||||
|
||||
static void
|
||||
@@ -18,10 +29,11 @@ teleport_app_init (TeleportApp *app)
|
||||
static void
|
||||
teleport_app_activate (GApplication *app)
|
||||
{
|
||||
TeleportAppWindow *win;
|
||||
//TeleportAppWindow *win;
|
||||
|
||||
win = teleport_app_window_new (TELEPORT_APP (app));
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
run_avahi_service();
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -31,7 +43,6 @@ teleport_app_open (GApplication *app,
|
||||
const gchar *hint)
|
||||
{
|
||||
GList *windows;
|
||||
TeleportAppWindow *win;
|
||||
int i;
|
||||
|
||||
windows = gtk_application_get_windows (GTK_APPLICATION (app));
|
||||
@@ -61,3 +72,20 @@ teleport_app_new (void)
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
void teleport_app_add_peer (char *name, int port, char* addr) {
|
||||
fprintf(stderr, "\t%s:%u (%s)\n", name, port, addr);
|
||||
if (win == NULL) {
|
||||
fprintf(stderr, "You should do stuff");
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "%s", name);
|
||||
update_remote_device_list(win, name);
|
||||
}
|
||||
}
|
||||
|
||||
void teleport_app_remove_peer (char *name) {
|
||||
fprintf(stderr, "A peer got removed");
|
||||
update_remote_device_list_remove(win, name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user