static VALUE mountoperation_set_anonymous(VALUE self, VALUE value) { g_mount_operation_set_anonymous(_SELF(self), RVAL2CBOOL(value)); return self; }
static void pw_dialog_got_response (GtkDialog *dialog, gint response_id, GtkMountOperation *mount_op) { GtkMountOperationPrivate *priv; GMountOperation *op; priv = mount_op->priv; op = G_MOUNT_OPERATION (mount_op); if (response_id == GTK_RESPONSE_OK) { const char *text; if (priv->ask_flags & G_ASK_PASSWORD_ANONYMOUS_SUPPORTED) g_mount_operation_set_anonymous (op, priv->anonymous); if (priv->username_entry) { text = gtk_entry_get_text (GTK_ENTRY (priv->username_entry)); g_mount_operation_set_username (op, text); } if (priv->domain_entry) { text = gtk_entry_get_text (GTK_ENTRY (priv->domain_entry)); g_mount_operation_set_domain (op, text); } if (priv->password_entry) { text = gtk_entry_get_text (GTK_ENTRY (priv->password_entry)); g_mount_operation_set_password (op, text); } if (priv->ask_flags & G_ASK_PASSWORD_SAVING_SUPPORTED) g_mount_operation_set_password_save (op, priv->password_save); g_mount_operation_reply (op, G_MOUNT_OPERATION_HANDLED); } else g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED); priv->dialog = NULL; g_object_notify (G_OBJECT (op), "is-showing"); gtk_widget_destroy (GTK_WIDGET (dialog)); g_object_unref (op); }
static void g_mount_operation_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GMountOperation *operation; operation = G_MOUNT_OPERATION (object); switch (prop_id) { case PROP_USERNAME: g_mount_operation_set_username (operation, g_value_get_string (value)); break; case PROP_PASSWORD: g_mount_operation_set_password (operation, g_value_get_string (value)); break; case PROP_ANONYMOUS: g_mount_operation_set_anonymous (operation, g_value_get_boolean (value)); break; case PROP_DOMAIN: g_mount_operation_set_domain (operation, g_value_get_string (value)); break; case PROP_PASSWORD_SAVE: g_mount_operation_set_password_save (operation, g_value_get_enum (value)); break; case PROP_CHOICE: g_mount_operation_set_choice (operation, g_value_get_int (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void on_find_enclosing_mount_ready (GObject * object, GAsyncResult * res, gpointer data) { GError *error = NULL; GDownloadable *download = G_DOWNLOADABLE (data); GMount *mount = g_file_find_enclosing_mount_finish (G_FILE(object), res, &error); g_assert (download != NULL); if (mount) { handle_error (error); GMountOperation * operation = g_mount_operation_new (); g_mount_operation_set_anonymous (operation, TRUE); g_file_mount_enclosing_volume (download->priv->remote_file, 0, operation, NULL, on_mount_enclosing_ready, data); // TODO: ask username & password g_object_unref (operation); g_object_unref (mount); } else { after_mount_enclosing_volume (download); } }
static void ask_password_cb (GMountOperation *op, const char *message, const char *default_user, const char *default_domain, GAskPasswordFlags flags) { if ((flags & G_ASK_PASSWORD_ANONYMOUS_SUPPORTED) && anonymous) { g_mount_operation_set_anonymous (op, TRUE); } else { char *s; g_print ("%s\n", message); if (flags & G_ASK_PASSWORD_NEED_USERNAME) { s = prompt_for ("User", default_user, TRUE); if (!s) goto error; g_mount_operation_set_username (op, s); g_free (s); } if (flags & G_ASK_PASSWORD_NEED_DOMAIN) { s = prompt_for ("Domain", default_domain, TRUE); if (!s) goto error; g_mount_operation_set_domain (op, s); g_free (s); } if (flags & G_ASK_PASSWORD_NEED_PASSWORD) { s = prompt_for ("Password", NULL, FALSE); if (!s) goto error; g_mount_operation_set_password (op, s); g_free (s); } } /* Only try anonymous access once. */ if (anonymous && GPOINTER_TO_INT (g_object_get_data (G_OBJECT (op), "state")) == MOUNT_OP_ASKED) { g_object_set_data (G_OBJECT (op), "state", GINT_TO_POINTER (MOUNT_OP_ABORTED)); g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED); } else { g_object_set_data (G_OBJECT (op), "state", GINT_TO_POINTER (MOUNT_OP_ASKED)); g_mount_operation_reply (op, G_MOUNT_OPERATION_HANDLED); } return; error: g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED); }