static int progress_main (int argc, char* argv[]) { SeahorseOperation *op; GIOChannel *io; gtk_init (&argc, &argv); op = g_object_new (SEAHORSE_TYPE_OPERATION, NULL); seahorse_operation_mark_start (op); /* Watch for done (ie: in this case only cancel) */ g_signal_connect (op, "done", G_CALLBACK (done_handler), NULL); /* Hook up an IO channel to stdin */ io = g_io_channel_unix_new (0); g_io_channel_set_encoding (io, NULL, NULL); g_io_add_watch (io, G_IO_IN | G_IO_HUP, (GIOFunc)io_handler, op); progress_visible = FALSE; progress_title = argc > 2 ? argv[2] : NULL; g_timeout_add (PROGRESS_DELAY, (GSourceFunc)progress_show, op); gtk_main (); if (seahorse_operation_is_running (op)) seahorse_operation_mark_done (op, FALSE, NULL); return 0; }
static GObject* seahorse_pkcs11_refresher_constructor (GType type, guint n_props, GObjectConstructParam *props) { SeahorsePkcs11Refresher *self = SEAHORSE_PKCS11_REFRESHER (G_OBJECT_CLASS (seahorse_pkcs11_refresher_parent_class)->constructor(type, n_props, props)); GP11Slot *slot; GList *objects, *l; gulong handle; g_return_val_if_fail (self, NULL); g_return_val_if_fail (self->source, NULL); objects = seahorse_context_get_objects (NULL, SEAHORSE_SOURCE (self->source)); for (l = objects; l; l = g_list_next (l)) { if (g_object_class_find_property (G_OBJECT_GET_CLASS (l->data), "pkcs11-handle")) { g_object_get (l->data, "pkcs11-handle", &handle, NULL); g_hash_table_insert (self->checks, g_memdup (&handle, sizeof (handle)), g_object_ref (l->data)); } } g_list_free (objects); /* Step 1. Load the session */ slot = seahorse_pkcs11_source_get_slot (self->source); gp11_slot_open_session_async (slot, CKF_RW_SESSION, NULL, NULL, self->cancellable, (GAsyncReadyCallback)on_open_session, self); seahorse_operation_mark_start (SEAHORSE_OPERATION (self)); return G_OBJECT (self); }
static SeahorseHKPOperation* setup_hkp_operation (SeahorseHKPSource *hsrc) { SeahorseHKPOperation *hop; g_return_val_if_fail (SEAHORSE_IS_HKP_SOURCE (hsrc), NULL); hop = g_object_new (SEAHORSE_TYPE_HKP_OPERATION, NULL); hop->hsrc = hsrc; g_object_ref (hsrc); seahorse_operation_mark_start (SEAHORSE_OPERATION (hop)); return hop; }
static GObject* seahorse_pkcs11_deleter_constructor (GType type, guint n_props, GObjectConstructParam *props) { SeahorsePkcs11Deleter *self = SEAHORSE_PKCS11_DELETER (G_OBJECT_CLASS (seahorse_pkcs11_deleter_parent_class)->constructor(type, n_props, props)); g_return_val_if_fail (self, NULL); g_return_val_if_fail (self->object, NULL); /* Start the delete */ gp11_object_destroy_async (seahorse_pkcs11_object_get_pkcs11_object (self->object), self->cancellable, (GAsyncReadyCallback)on_deleted, self); seahorse_operation_mark_start (SEAHORSE_OPERATION (self)); return G_OBJECT (self); }
static gboolean import_start (SeahorseToolMode *mode, const gchar *uri, gpgme_data_t uridata, SeahorsePGPOperation *pop, GError **err) { size_t size; SeahorseOperation *op; gpgme_error_t gerr; /* Start actual import */ op = SEAHORSE_OPERATION (pop); init_crypt(); buffer = g_malloc0(IMPORT_BUFFER_SIZE); /* Allocate memory for key data */ size = gpgme_data_read (uridata, (void*) buffer, IMPORT_BUFFER_SIZE); if (size > 0) { import_proxy_call = dbus_g_proxy_begin_call (dbus_key_proxy, "ImportKeys", proxy_call_notification, pop, NULL, G_TYPE_STRING, "openpgp", G_TYPE_STRING, buffer, G_TYPE_INVALID); seahorse_operation_mark_start (op); seahorse_operation_mark_progress (op, _("Importing keys ..."), 0.5); } else { g_free (buffer); gerr = gpgme_err_code_from_errno (errno); seahorse_util_gpgme_to_error (gerr, err); return FALSE; } return TRUE; }