[gtk-frdp/improve-connection-initialization: 2/3] frdp-display: Add "rdp-auth-failure" signal
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-frdp/improve-connection-initialization: 2/3] frdp-display: Add "rdp-auth-failure" signal
- Date: Fri, 6 Aug 2021 09:50:22 +0000 (UTC)
commit dd71338d727c7bafede33f0ec119a07de044a7ab
Author: Felipe Borges <felipeborges gnome org>
Date: Fri Aug 6 09:44:50 2021 +0200
frdp-display: Add "rdp-auth-failure" signal
examples/gtk-frdp-viewer.c | 15 +++++++++++++++
src/frdp-display.c | 18 ++++++++++++++++++
src/frdp-session.c | 11 +++++++++++
3 files changed, 44 insertions(+)
---
diff --git a/examples/gtk-frdp-viewer.c b/examples/gtk-frdp-viewer.c
index 12f5925..0211203 100644
--- a/examples/gtk-frdp-viewer.c
+++ b/examples/gtk-frdp-viewer.c
@@ -18,6 +18,16 @@
#include <gtk-frdp.h>
+static void
+on_rdp_auth_failure (GObject *source_object,
+ const gchar *message,
+ gpointer user_data)
+{
+ g_print ("-> %s\n", message);
+
+ g_application_quit (user_data);
+}
+
static void
on_activate (GtkApplication *app)
{
@@ -35,6 +45,11 @@ on_activate (GtkApplication *app)
display = frdp_display_new ();
+ g_signal_connect (display,
+ "rdp-auth-failure",
+ G_CALLBACK (on_rdp_auth_failure),
+ app);
+
gtk_container_add (GTK_CONTAINER (window), display);
gtk_widget_show (display);
diff --git a/src/frdp-display.c b/src/frdp-display.c
index a04b879..05d856f 100644
--- a/src/frdp-display.c
+++ b/src/frdp-display.c
@@ -40,6 +40,7 @@ enum
RDP_CONNECTED,
RDP_DISCONNECTED,
RDP_NEEDS_AUTHENTICATION,
+ RDP_AUTH_FAILURE,
LAST_SIGNAL
};
@@ -219,6 +220,14 @@ frdp_leave_notify_event (GtkWidget *widget,
return TRUE;
}
+static void
+frdp_display_auth_failure (GObject *source_object,
+ const gchar *message,
+ gpointer user_data)
+{
+ g_signal_emit (user_data, signals[RDP_AUTH_FAILURE], 0, message);
+}
+
static void
frdp_display_disconnected (GObject *source_object,
gpointer user_data)
@@ -374,6 +383,12 @@ frdp_display_class_init (FrdpDisplayClass *klass)
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
+ signals[RDP_AUTH_FAILURE] = g_signal_new ("rdp-auth-failure",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
}
static void
@@ -417,6 +432,9 @@ frdp_display_open_host (FrdpDisplay *display,
g_signal_connect (priv->session, "rdp-disconnected",
G_CALLBACK (frdp_display_disconnected),
display);
+ g_signal_connect (priv->session, "rdp-auth-failure",
+ G_CALLBACK (frdp_display_auth_failure),
+ display);
frdp_session_connect (priv->session,
host,
diff --git a/src/frdp-session.c b/src/frdp-session.c
index 0c0787c..ca53d89 100644
--- a/src/frdp-session.c
+++ b/src/frdp-session.c
@@ -78,6 +78,7 @@ enum
{
RDP_CONNECTED,
RDP_DISCONNECTED,
+ RDP_AUTH_FAILURE,
LAST_SIGNAL
};
@@ -591,6 +592,10 @@ frdp_session_connect_thread (GTask *task,
case STATUS_LOGON_FAILURE:
case FREERDP_ERROR_CONNECT_TRANSPORT_FAILED:
case ERRCONNECT_CONNECT_TRANSPORT_FAILED:
+ g_signal_emit (self,
+ signals[RDP_AUTH_FAILURE], 0,
+ freerdp_get_last_error_string (error_code));
+
g_warning ("Failed to connect RPD host with error '%s'",
freerdp_get_last_error_string (error_code));
break;
@@ -774,6 +779,12 @@ frdp_session_class_init (FrdpSessionClass *klass)
G_SIGNAL_RUN_FIRST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
+ signals[RDP_AUTH_FAILURE] = g_signal_new ("rdp-auth-failure",
+ FRDP_TYPE_SESSION,
+ G_SIGNAL_RUN_FIRST,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]