[gnome-bluetooth] wizard: get target_name from Device proxy



commit 5698fb511417ab6d001d7099f11df92e40f487e4
Author: Gustavo Padovan <gustavo padovan collabora co uk>
Date:   Thu Jun 13 19:35:26 2013 +0100

    wizard: get target_name from Device proxy
    
    If the we wizard is still searching for devices and a incoming pairing
    request arrives from another device we should get its name to show in the
    many messages. This works nicely for both incoming and outcoming pairing
    requests.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=701399

 wizard/main.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/wizard/main.c b/wizard/main.c
index 59f3305..7fd55f3 100644
--- a/wizard/main.c
+++ b/wizard/main.c
@@ -187,6 +187,17 @@ get_icade_pincode (char **pin_display_str)
        return g_string_free (pin, FALSE);
 }
 
+static void
+replace_target_name_for_device (GDBusProxy *device)
+{
+       GVariant *value;
+
+       g_free (target_name);
+       value = g_dbus_proxy_get_cached_property (device, "Name");
+       target_name = g_variant_dup_string (value, NULL);
+       g_variant_unref (value);
+}
+
 static gboolean
 pincode_callback (GDBusMethodInvocation *invocation,
                  GDBusProxy *device,
@@ -194,6 +205,8 @@ pincode_callback (GDBusMethodInvocation *invocation,
 {
        gtk_assistant_set_current_page (window_assistant, PAGE_SETUP);
 
+       replace_target_name_for_device (device);
+
        if (user_pincode == NULL) {
                char *help, *pincode_display;
 
@@ -304,6 +317,8 @@ authorize_callback (GDBusMethodInvocation *invocation,
 {
        g_dbus_method_invocation_return_value (invocation, NULL);
 
+       replace_target_name_for_device (device);
+
        return TRUE;
 }
 
@@ -317,7 +332,10 @@ confirm_callback (GDBusMethodInvocation *invocation,
 
        gtk_assistant_set_current_page (window_assistant, PAGE_SSP_SETUP);
 
+       replace_target_name_for_device (device);
+
        gtk_widget_show (label_ssp_pin_help);
+
        label = g_strdup_printf (_("Please confirm that the PIN displayed on '%s' matches this one."),
                                 target_name);
        gtk_label_set_markup(GTK_LABEL(label_ssp_pin_help), label);
@@ -346,6 +364,8 @@ display_callback (GDBusMethodInvocation *invocation,
        display_called = TRUE;
        gtk_assistant_set_current_page (window_assistant, PAGE_SSP_SETUP);
 
+       replace_target_name_for_device (device);
+
        code = g_strdup_printf("%06d", pin);
 
        if (entered > 0) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]