~alecu/ubuntuone-client/the-other-signal-stable

« back to all changes in this revision

Viewing changes to libsyncdaemon/syncdaemon-authentication.c

  • Committer: Alejandro J. Cura
  • Date: 2011-04-19 14:35:10 UTC
  • Revision ID: alecu@canonical.com-20110419143510-7xm22cnawxezfl7z
Revert changes from revision 956

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include "syncdaemon-authentication.h"
27
27
#include "syncdaemon-marshal.h"
28
28
 
29
 
#define DEFAULT_ERROR_MESSAGE "No error specified"
30
 
 
31
29
G_DEFINE_TYPE(SyncdaemonAuthentication, syncdaemon_authentication, G_TYPE_OBJECT)
32
30
 
33
31
struct _SyncdaemonAuthenticationPrivate {
133
131
static void
134
132
credentials_error_cb (DBusGProxy *proxy,
135
133
                      const gchar *app_name,
136
 
                      GHashTable *error_dict,
 
134
                      const gchar *error_message,
 
135
                      const gchar *detailed_error,
137
136
                      gpointer user_data)
138
137
{
139
 
        gchar *error_message;
140
 
 
141
138
        g_debug ("Authorization error");
142
139
        if (g_strcmp0 (app_name, SSO_APP_NAME) != 0) {
143
140
                g_debug ("Credentials are not for '" SSO_APP_NAME "', ignoring");
144
141
                return;
145
142
        }
146
143
 
147
 
        error_message = g_hash_table_lookup (error_dict, "error_message");
148
 
        if (error_message == NULL)
149
 
                error_message = DEFAULT_ERROR_MESSAGE;
150
 
 
151
144
        g_signal_emit (user_data, auth_signals[ERROR_SIGNAL], 0, error_message);
152
145
}
153
146
 
166
159
                g_error_free (error);
167
160
        } else {
168
161
                auth->priv->proxy = dbus_g_proxy_new_for_name (auth->priv->bus, "com.ubuntu.sso",
169
 
                                                               "/com/ubuntu/sso/credentials", "com.ubuntu.sso.CredentialsManagement");
 
162
                                                               "/credentials", "com.ubuntu.sso.ApplicationCredentials");
170
163
                if (auth->priv->proxy != NULL) {
171
164
                        dbus_g_object_register_marshaller (_syncdaemon_marshal_VOID__STRING_POINTER,
172
165
                                                           G_TYPE_NONE,
193
186
 
194
187
                        dbus_g_proxy_add_signal (auth->priv->proxy, "CredentialsError",
195
188
                                                 G_TYPE_STRING,
196
 
                                                 dbus_g_type_get_map ("GHashTable",
197
 
                                                                      G_TYPE_STRING,
198
 
                                                                      G_TYPE_STRING),
 
189
                                                 G_TYPE_STRING,
 
190
                                                 G_TYPE_STRING,
199
191
                                                 G_TYPE_INVALID);
200
192
                        dbus_g_proxy_connect_signal (auth->priv->proxy, "CredentialsError",
201
193
                                                     G_CALLBACK (credentials_error_cb), auth, NULL);