Exemplo n.º 1
0
static void
on_import_complete (GObject *source, GAsyncResult *result, gpointer user_data)
{
    SeahorsePgpBackend *backend = SEAHORSE_PGP_BACKEND (source);
    g_autoptr(SeahorseKeyserverResultsRow) row =
        SEAHORSE_KEYSERVER_RESULTS_ROW (user_data);
    const gchar *result_icon_name;
    g_autoptr(GtkWidget) result_icon = NULL;
    g_autofree gchar *result_tooltip = NULL;
    g_autoptr(GError) err = NULL;

    if (!seahorse_pgp_backend_transfer_finish (backend, result, &err)) {
        result_icon_name = "dialog-warning-symbolic";
        result_tooltip = g_strdup_printf (_("Couldn’t import key: %s"),
                                          err->message);
    } else {
        result_icon_name = "emblem-ok-symbolic";
        result_tooltip = g_strdup (_("Key import succeeded"));
    }

    result_icon = gtk_image_new_from_icon_name (result_icon_name,
                                                GTK_ICON_SIZE_BUTTON);
    gtk_button_set_image (row->import_button, g_steal_pointer (&result_icon));
    gtk_widget_set_tooltip_text (GTK_WIDGET (row->import_button),
                                 result_tooltip);
}
Exemplo n.º 2
0
static void
on_import_complete (GObject *source,
                    GAsyncResult *result,
                    gpointer user_data)
{
	SeahorseCatalog *self = SEAHORSE_CATALOG (user_data);
	GError *error = NULL;

	if (!seahorse_pgp_backend_transfer_finish (SEAHORSE_PGP_BACKEND (source),
	                                           result, &error))
		seahorse_util_handle_error (&error, seahorse_catalog_get_window (self),
		                            _("Couldn't import keys"));

	g_object_unref (self);
}