[seahorse] pgp: Remove gpg-options
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse] pgp: Remove gpg-options
- Date: Fri, 20 Aug 2021 12:21:54 +0000 (UTC)
commit eac0cc1e61137b054a0a41ce9d5cbd2badec644e
Author: Niels De Graef <nielsdegraef gmail com>
Date: Fri Aug 20 13:54:47 2021 +0200
pgp: Remove gpg-options
We were only using it to fetch the GPG home directory, but we can just
use `gpgme_get_dirinfo()` since GPGME 1.5.0.
pgp/meson.build | 1 -
pgp/seahorse-gpg-options.c | 541 -------------------------------------------
pgp/seahorse-gpg-options.h | 48 ----
pgp/seahorse-gpgme-keyring.c | 70 +++---
po/POTFILES.in | 1 -
5 files changed, 38 insertions(+), 623 deletions(-)
---
diff --git a/pgp/meson.build b/pgp/meson.build
index 232a02e3..1d4b6db9 100644
--- a/pgp/meson.build
+++ b/pgp/meson.build
@@ -20,7 +20,6 @@ pgp_sources = files(
'seahorse-gpgme-subkey.c',
'seahorse-gpgme-uid.c',
'seahorse-gpg-op.c',
- 'seahorse-gpg-options.c',
'seahorse-pgp-actions.c',
'seahorse-pgp-backend.c',
'seahorse-pgp-key.c',
diff --git a/pgp/seahorse-gpgme-keyring.c b/pgp/seahorse-gpgme-keyring.c
index 445cce90..adb7a0ea 100644
--- a/pgp/seahorse-gpgme-keyring.c
+++ b/pgp/seahorse-gpgme-keyring.c
@@ -28,7 +28,6 @@
#include "seahorse-gpgme-data.h"
#include "seahorse-gpgme.h"
#include "seahorse-gpgme-key-op.h"
-#include "seahorse-gpg-options.h"
#include "seahorse-pgp-actions.h"
#include "seahorse-pgp-key.h"
@@ -691,15 +690,15 @@ seahorse_gpgme_keyring_import_finish (SeahorseGpgmeKeyring *self,
}
static gboolean
-scheduled_refresh (gpointer user_data)
+scheduled_refresh (void *user_data)
{
- SeahorseGpgmeKeyring *self = SEAHORSE_GPGME_KEYRING (user_data);
+ SeahorseGpgmeKeyring *self = SEAHORSE_GPGME_KEYRING (user_data);
- g_debug ("scheduled refresh event ocurring now");
- cancel_scheduled_refresh (self);
- seahorse_gpgme_keyring_load_async (SEAHORSE_PLACE (self), NULL, NULL, NULL);
+ g_debug ("scheduled refresh event ocurring now");
+ cancel_scheduled_refresh (self);
+ seahorse_gpgme_keyring_load_async (SEAHORSE_PLACE (self), NULL, NULL, NULL);
- return FALSE; /* don't run again */
+ return G_SOURCE_REMOVE;
}
static void
@@ -733,33 +732,40 @@ monitor_gpg_homedir (GFileMonitor *file_monitor,
static void
seahorse_gpgme_keyring_init (SeahorseGpgmeKeyring *self)
{
- GError *err = NULL;
- const gchar *gpg_homedir;
- GFile *file;
+ const char *gpg_homedir;
+ g_autoptr(GFile) file = NULL;
+ g_autoptr(GError) err = NULL;
- self->keys = g_hash_table_new_full (seahorse_pgp_keyid_hash,
- seahorse_pgp_keyid_equal,
- g_free, g_object_unref);
+ self->keys = g_hash_table_new_full (seahorse_pgp_keyid_hash,
+ seahorse_pgp_keyid_equal,
+ g_free, g_object_unref);
- self->scheduled_refresh = 0;
- self->monitor_handle = NULL;
-
- gpg_homedir = seahorse_gpg_homedir ();
- if (gpg_homedir) {
- file = g_file_new_for_path (gpg_homedir);
- g_return_if_fail (file != NULL);
-
- self->monitor_handle = g_file_monitor_directory (file, G_FILE_MONITOR_NONE, NULL, &err);
- g_object_unref (file);
-
- if (self->monitor_handle) {
- g_signal_connect (self->monitor_handle, "changed",
- G_CALLBACK (monitor_gpg_homedir), self);
- } else {
- g_warning ("couldn't monitor the GPG home directory: %s: %s",
- gpg_homedir, err && err->message ? err->message : "");
- }
- }
+ self->scheduled_refresh = 0;
+ self->monitor_handle = NULL;
+
+ /* Get the GPG home directory directly from GPGME */
+ gpg_homedir = gpgme_get_dirinfo ("homedir");
+ if (!gpg_homedir) {
+ g_warning ("Can't monitor GPG home directory: GPGME has no homedir");
+ return;
+ }
+
+ /* Try to put a file monitor on it */
+ file = g_file_new_for_path (gpg_homedir);
+ self->monitor_handle = g_file_monitor_directory (file,
+ G_FILE_MONITOR_NONE,
+ NULL,
+ &err);
+ if (!self->monitor_handle) {
+ g_warning ("Can't monitor GPG home directory: %s: %s",
+ gpg_homedir, err && err->message ? err->message : "");
+ return;
+ }
+
+ /* Listen for changes */
+ g_debug ("Monitoring GPG home directory '%s'", gpg_homedir);
+ g_signal_connect (self->monitor_handle, "changed",
+ G_CALLBACK (monitor_gpg_homedir), self);
}
static gchar *
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 67b76914..b4b35eaf 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -59,7 +59,6 @@ pgp/seahorse-gpgme-secret-deleter.c
pgp/seahorse-gpgme-sign-dialog.c
pgp/seahorse-gpgme-sign-dialog.ui
pgp/seahorse-gpgme-subkey.c
-pgp/seahorse-gpg-options.c
pgp/seahorse-hkp-source.c
pgp/seahorse-keyserver-results.c
pgp/seahorse-keyserver-results.ui
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]