| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#include <gtk-frdp.h> |
| 20 |
|
| 21 |
static void |
| 22 |
on_rdp_auth_failure (GObject *source_object, |
| 23 |
const gchar *message, |
| 24 |
gpointer user_data) |
| 25 |
{ |
| 26 |
g_print ("-> %s\n", message); |
| 27 |
|
| 28 |
g_application_quit (user_data); |
| 29 |
} |
| 30 |
|
| 31 |
static void |
| 32 |
on_activate (GtkApplication *app) |
| 33 |
{ |
| 34 |
GtkWindow *window; |
| 35 |
GtkWidget *display; |
| 36 |
|
| 37 |
g_assert (GTK_IS_APPLICATION (app)); |
| 38 |
|
| 39 |
|
| 40 |
window = gtk_application_get_active_window (app); |
| 41 |
if (window == NULL) |
| 42 |
window = g_object_new (GTK_TYPE_APPLICATION_WINDOW, |
| 43 |
"application", app, |
| 44 |
NULL); |
| 45 |
|
| 46 |
display = frdp_display_new (); |
| 47 |
|
| 48 |
g_signal_connect (display, |
| 49 |
"rdp-auth-failure", |
| 50 |
G_CALLBACK (on_rdp_auth_failure), |
| 51 |
app); |
| 52 |
|
| 53 |
gtk_container_add (GTK_CONTAINER (window), display); |
| 54 |
gtk_widget_show (display); |
| 55 |
|
| 56 |
frdp_display_open_host (FRDP_DISPLAY (display), "109.168.97.222", 3389); |
| 57 |
g_object_set (display, |
| 58 |
"username", "demo2", |
| 59 |
"password", "D3m02014*Test", |
| 60 |
NULL); |
| 61 |
|
| 62 |
|
| 63 |
gtk_window_present (window); |
| 64 |
} |
| 65 |
|
| 66 |
int |
| 67 |
main (int argc, |
| 68 |
char *argv[]) |
| 69 |
{ |
| 70 |
g_autoptr(GtkApplication) app = NULL; |
| 71 |
int ret; |
| 72 |
|
| 73 |
app = gtk_application_new ("org.gnome.GtkFrdpViewer", G_APPLICATION_FLAGS_NONE); |
| 74 |
|
| 75 |
g_signal_connect (app, "activate", G_CALLBACK (on_activate), NULL); |
| 76 |
|
| 77 |
ret = g_application_run (G_APPLICATION (app), argc, argv); |
| 78 |
|
| 79 |
return ret; |
| 80 |
} |