[Gpa-commits] r878 - in trunk: . src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Apr 28 21:29:08 CEST 2008
Author: werner
Date: 2008-04-28 21:29:05 +0200 (Mon, 28 Apr 2008)
New Revision: 878
Modified:
trunk/ChangeLog
trunk/NEWS
trunk/configure.ac
trunk/src/ChangeLog
trunk/src/Makefile.am
trunk/src/confdialog.c
trunk/src/confdialog.h
trunk/src/gpa.c
trunk/src/gpgmetools.c
trunk/src/gpgmetools.h
trunk/src/options.c
trunk/src/server_access.c
trunk/src/settingsdlg.c
Log:
Minor fixes.
Load and store the keyserver from gpg.conf.
Tweak the advanced user interface option.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-04-25 12:51:19 UTC (rev 877)
+++ trunk/ChangeLog 2008-04-28 19:29:05 UTC (rev 878)
@@ -1,3 +1,7 @@
+2008-04-01 Werner Koch <wk at g10code.com>
+
+ * configure.ac (AC_INIT): Fix quoting.
+
2008-03-12 Werner Koch <wk at g10code.com>
* COPYING: Replace by GPLv3 version.
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2008-04-25 12:51:19 UTC (rev 877)
+++ trunk/NEWS 2008-04-28 19:29:05 UTC (rev 878)
@@ -1,7 +1,7 @@
Noteworthy changes in version 0.7.7
------------------------------------------------
- * Add basic UI server mode and option --server.
+ * Add basic UI server mode and option --daemon.
* GPA now supports direct crypto operations to and from the
clipboard, and features a simple text edit area as well.
@@ -12,7 +12,10 @@
* GPA has now basic support for X.509; use the command line switch
--cms to enable this.
+ * The default keyserver is now taken from gpg.conf and not from
+ gpa.conf.
+
Noteworthy changes in version 0.7.6 (2007-05-24)
------------------------------------------------
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2008-04-25 12:51:19 UTC (rev 877)
+++ trunk/configure.ac 2008-04-28 19:29:05 UTC (rev 878)
@@ -34,7 +34,8 @@
m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \
|| echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')]))
-AC_INIT([gpa], my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision]),
+AC_INIT([gpa],
+ [my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision])],
[bug-gpa at gnupg.org])
NEED_GPG_ERROR_VERSION=1.4
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2008-04-25 12:51:19 UTC (rev 877)
+++ trunk/src/ChangeLog 2008-04-28 19:29:05 UTC (rev 878)
@@ -1,3 +1,23 @@
+2008-04-28 Werner Koch <wk at g10code.com>
+
+ * settingsdlg.c (gpa_settings_dialog_new): Put advanced UI
+ selection at top.
+ (user_interface_mode_frame): Change to use a checkbox.
+ (advanced_mode_toggled): Simplified.
+ (ui_mode_changed_for_keyserver): New.
+ (default_keyserver_frame): Call and connect new chnage function.
+
+ * gpgmetools.h (gpa_gpgme_error): Remove surprise by enclosing in
+ do-while and remove all single statement blocks when calling it.
+
+ * options.c (gpa_options_read_settings): Load the default
+ keyserver value from the backend.
+ (gpa_options_save_settings): and store it.
+ * confdialog.c (gpa_load_configured_keyserver): New.
+ (gpa_save_configured_keyserver): New.
+
+ * Signals: New doc file.
+
2008-04-25 Marcus Brinkmann <marcus at g10code.de>
* Makefile.am (EXTRA_DIST): Add gpa-marshal.list.
@@ -43,6 +63,10 @@
argument.
(selected_from_list_cb): Also to caller.
+2008-04-23 Werner Koch <wk at g10code.com>
+
+ * gpa.c (main): Don't start the server unless --daemon is given
+
2008-04-21 Marcus Brinkmann <marcus at g10code.de>
* Makefile.am (gpa_SOURCES): Add gpaprogressbar.h, gpaprogressbar.c.
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2008-04-25 12:51:19 UTC (rev 877)
+++ trunk/src/Makefile.am 2008-04-28 19:29:05 UTC (rev 878)
@@ -4,7 +4,7 @@
pkgdata_DATA = $(logo)
-EXTRA_DIST = $(logo) gpa.ico gpa-resource.rc gpa-marshal.list
+EXTRA_DIST = $(logo) gpa.ico gpa-resource.rc gpa-marshal.list Signals
BUILT_SOURCES = gpa-marshal.h gpa-marshal.c
MOSTLYCLEANFILES = gpa-marshal.h gpa-marshal.c
Modified: trunk/src/confdialog.c
===================================================================
--- trunk/src/confdialog.c 2008-04-25 12:51:19 UTC (rev 877)
+++ trunk/src/confdialog.c 2008-04-28 19:29:05 UTC (rev 878)
@@ -1340,7 +1340,7 @@
G_CALLBACK (dialog_response), NULL);
dialog_vbox = GTK_DIALOG (dialog)->vbox;
- // gtk_box_set_spacing (GTK_CONTAINER (dialog_vbox), 5);
+ /* gtk_box_set_spacing (GTK_CONTAINER (dialog_vbox), 5); */
hbox = gtk_hbox_new (FALSE, 0);
@@ -1408,3 +1408,119 @@
gpgme_release (dialog_ctx);
dialog_ctx = NULL;
}
+
+
+
+/* Read the configured keyserver from the backend. If none is
+ configured, return NULL. Caller must g_free the returned value. */
+char *
+gpa_load_configured_keyserver (void)
+{
+ gpg_error_t err;
+ gpgme_ctx_t ctx;
+ gpgme_conf_comp_t conf_list, conf;
+ gpgme_conf_opt_t opt;
+ char *retval = NULL;
+
+ err = gpgme_new (&ctx);
+ if (err)
+ {
+ gpa_gpgme_error (err);
+ return NULL;
+ }
+
+ err = gpgme_op_conf_load (ctx, &conf_list);
+ if (err)
+ {
+ gpa_gpgme_error (err);
+ gpgme_release (ctx);
+ return NULL;
+ }
+
+ for (conf = conf_list; conf; conf = conf->next)
+ {
+ if ( !strcmp (conf->name, "gpg") )
+ {
+ for (opt = conf->options; opt; opt = opt->next)
+ if ( !(opt->flags & GPGME_CONF_GROUP)
+ && !strcmp (opt->name, "keyserver"))
+ {
+ if (opt->value && opt->alt_type == GPGME_CONF_STRING)
+ retval = g_strdup (opt->value->value.string);
+ break;
+ }
+ break;
+ }
+ }
+
+ gpgme_conf_release (conf_list);
+ gpgme_release (ctx);
+ return retval;
+}
+
+
+/* Save the configured keyserver from the backend. If none is
+ configured, return NULL. Caller must g_free the returned value. */
+void
+gpa_store_configured_keyserver (const char *value)
+{
+ gpg_error_t err;
+ gpgme_ctx_t ctx;
+ gpgme_conf_comp_t conf_list, conf;
+ gpgme_conf_opt_t opt;
+ gpgme_conf_arg_t arg;
+
+ err = gpgme_conf_arg_new (&arg, GPGME_CONF_STRING, (char*)value);
+ if (err)
+ {
+ gpa_gpgme_error (err);
+ return;
+ }
+
+ err = gpgme_new (&ctx);
+ if (err)
+ {
+ gpa_gpgme_error (err);
+ return;
+ }
+
+ err = gpgme_op_conf_load (ctx, &conf_list);
+ if (err)
+ {
+ gpa_gpgme_error (err);
+ gpgme_release (ctx);
+ return;
+ }
+
+
+ for (conf = conf_list; conf; conf = conf->next)
+ {
+ if ( !strcmp (conf->name, "gpg") )
+ {
+ for (opt = conf->options; opt; opt = opt->next)
+ if ( !(opt->flags & GPGME_CONF_GROUP)
+ && !strcmp (opt->name, "keyserver"))
+ {
+ if (opt->alt_type == GPGME_CONF_STRING
+ && !args_are_equal (arg, opt->value, opt->alt_type))
+ {
+ err = gpgme_conf_opt_change (opt, 0, arg);
+ if (err)
+ gpa_gpgme_error (err);
+ else
+ {
+ err = gpgme_op_conf_save (ctx, conf);
+ if (err)
+ gpa_gpgme_error (err);
+ }
+ }
+ break;
+ }
+ break;
+ }
+ }
+
+ gpgme_conf_release (conf_list);
+ gpgme_release (ctx);
+}
+
Modified: trunk/src/confdialog.h
===================================================================
--- trunk/src/confdialog.h 2008-04-25 12:51:19 UTC (rev 877)
+++ trunk/src/confdialog.h 2008-04-28 19:29:05 UTC (rev 878)
@@ -23,4 +23,8 @@
GtkWidget *gpa_backend_config_dialog_new (void);
+char *gpa_load_configured_keyserver (void);
+void gpa_store_configured_keyserver (const char *value);
+
+
#endif
Modified: trunk/src/gpa.c
===================================================================
--- trunk/src/gpa.c 2008-04-25 12:51:19 UTC (rev 877)
+++ trunk/src/gpa.c 2008-04-28 19:29:05 UTC (rev 878)
@@ -410,11 +410,14 @@
keyservers->data);
}
- /* Fire up the server. */
- gpa_start_server ();
-
- if (! args.start_only_server)
+ if (args.start_only_server)
{
+ /* Fire up the server. Note that the server allows to start the
+ other parts too. */
+ gpa_start_server ();
+ }
+ else
+ {
/* Don't open the keyring editor if any files are given on the
command line. Dito for the clipboard. */
if (args.start_keyring_editor && (optind >= argc))
Modified: trunk/src/gpgmetools.c
===================================================================
--- trunk/src/gpgmetools.c 2008-04-25 12:51:19 UTC (rev 877)
+++ trunk/src/gpgmetools.c 2008-04-28 19:29:05 UTC (rev 878)
@@ -87,12 +87,11 @@
gpgme_ctx_t ctx;
gpg_error_t err;
- // g_assert (!"using gpa_gpgme_new");
+ /* g_assert (!"using gpa_gpgme_new"); */
err = gpgme_new (&ctx);
if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
- {
- gpa_gpgme_error (err);
- }
+ gpa_gpgme_error (err);
+
if (! cms_hack)
gpgme_set_passphrase_cb (ctx, gpa_passphrase_cb, NULL);
Modified: trunk/src/gpgmetools.h
===================================================================
--- trunk/src/gpgmetools.h 2008-04-25 12:51:19 UTC (rev 877)
+++ trunk/src/gpgmetools.h 2008-04-28 19:29:05 UTC (rev 878)
@@ -63,7 +63,8 @@
/* Report an unexpected error in GPGME and quit the application.
Better to use the macro instead of the function. */
-#define gpa_gpgme_error(err) _gpa_gpgme_error (err, __FILE__, __LINE__);
+#define gpa_gpgme_error(err) \
+ do { _gpa_gpgme_error (err, __FILE__, __LINE__); } while (0)
void _gpa_gpgme_error (gpg_error_t err, const char *file, int line);
/* The same as gpa_gpgme_error, without quitting. */
Modified: trunk/src/options.c
===================================================================
--- trunk/src/options.c 2008-04-25 12:51:19 UTC (rev 877)
+++ trunk/src/options.c 2008-04-28 19:29:05 UTC (rev 878)
@@ -32,6 +32,8 @@
#include <errno.h>
#include <ctype.h>
+#include "confdialog.h" /* gpa_read_configured_keyserver */
+
/* Internal API */
static void gpa_options_save_settings (GpaOptions *options);
static void gpa_options_read_settings (GpaOptions *options);
@@ -210,7 +212,8 @@
gpa_options_read_settings (options);
}
-const gchar *gpa_options_get_file (GpaOptions *options)
+const gchar *
+gpa_options_get_file (GpaOptions *options)
{
return options->options_file;
}
@@ -403,8 +406,9 @@
}
if (options->default_keyserver)
{
- fprintf (options_file, "keyserver %s\n",
- options->default_keyserver);
+ /* we do not write the keyserver anymore to gpg.conf. */
+/* fprintf (options_file, "keyserver %s\n", */
+/* options->default_keyserver); */
}
if (options->backup_generated)
{
@@ -420,8 +424,13 @@
}
fclose (options_file);
}
+
+ /* Write the keyserver to the backend. */
+ if (options->default_keyserver)
+ gpa_store_configured_keyserver (options->default_keyserver);
}
+
static gboolean
read_next_word (FILE *file, char *buffer, int size)
{
@@ -513,7 +522,8 @@
state = PARSE_OPTIONS_STATE_START;
break;
case PARSE_OPTIONS_STATE_HAVE_KEYSERVER:
- options->default_keyserver = g_strdup (next_word);
+ /* We do not use the keyserver item from the gpa.conf anymore. */
+ /* options->default_keyserver = g_strdup (next_word); */
state = PARSE_OPTIONS_STATE_START;
break;
default:
@@ -523,4 +533,8 @@
}
fclose (options_file);
}
+
+ /* Read the keyserver from the abckend. */
+ g_free (options->default_keyserver);
+ options->default_keyserver = gpa_load_configured_keyserver ();
}
Modified: trunk/src/server_access.c
===================================================================
--- trunk/src/server_access.c 2008-04-25 12:51:19 UTC (rev 877)
+++ trunk/src/server_access.c 2008-04-28 19:29:05 UTC (rev 878)
@@ -568,9 +568,7 @@
/* Create an empty gpgme_data_t, so that we always return a valid one */
err = gpgme_data_new (data);
if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
- {
- gpa_gpgme_error (err);
- }
+ gpa_gpgme_error (err);
gpa_window_error (_("The keyserver you specified is not valid"), parent);
return FALSE;
}
@@ -588,9 +586,7 @@
/* No error checking: the import will take care of that. */
err = gpa_gpgme_data_new_from_file (data, output_filename, parent);
if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
- {
- gpa_gpgme_error (err);
- }
+ gpa_gpgme_error (err);
g_free (keyserver);
/* Delete temp files */
unlink (command_filename);
Modified: trunk/src/settingsdlg.c
===================================================================
--- trunk/src/settingsdlg.c 2008-04-25 12:51:19 UTC (rev 877)
+++ trunk/src/settingsdlg.c 2008-04-28 19:29:05 UTC (rev 878)
@@ -30,6 +30,7 @@
#include "settingsdlg.h"
+
/* Default key section. */
static void
@@ -83,6 +84,18 @@
}
+/* Signal handler for the "changed_ui_mode" signal. */
+static void
+ui_mode_changed_for_keyserver (GpaOptions *options, gpointer param)
+{
+ GtkWidget *keyserver_frame = param;
+
+ if (gpa_options_get_simplified_ui (options))
+ gtk_widget_hide_all (GTK_WIDGET(keyserver_frame));
+ else
+ gtk_widget_show_all (GTK_WIDGET(keyserver_frame));
+}
+
/* Default keyserver section. */
static gboolean
keyserver_selected_cb (GtkWidget *combo, GdkEvent *event, gpointer user_data)
@@ -140,6 +153,10 @@
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo))),
gpa_options_get_default_keyserver
(gpa_options_get_instance ()));
+
+ /* Set default visibility. */
+ ui_mode_changed_for_keyserver (gpa_options_get_instance (), frame);
+
/* Connect signals. Try to follow instant-apply principle. */
g_signal_connect_swapped (G_OBJECT (gtk_bin_get_child (GTK_BIN (combo))),
"focus-out-event",
@@ -147,6 +164,10 @@
g_signal_connect (G_OBJECT (combo),
"changed", G_CALLBACK (selected_from_list_cb), NULL);
+ g_signal_connect (G_OBJECT (gpa_options_get_instance ()),
+ "changed_ui_mode",
+ G_CALLBACK (ui_mode_changed_for_keyserver), frame);
+
return frame;
}
@@ -154,12 +175,10 @@
/* User interface section. */
static void
-advanced_mode_toggled (GtkToggleButton *yes_button, gpointer user_data)
+advanced_mode_toggled (GtkToggleButton *button, gpointer user_data)
{
- if (gtk_toggle_button_get_active (yes_button))
- gpa_options_set_simplified_ui (gpa_options_get_instance (), FALSE);
- else
- gpa_options_set_simplified_ui (gpa_options_get_instance (), TRUE);
+ gpa_options_set_simplified_ui (gpa_options_get_instance (),
+ !gtk_toggle_button_get_active (button));
}
static GtkWidget *
@@ -168,34 +187,28 @@
GtkWidget *frame;
GtkWidget *label;
GtkWidget *hbox;
- GtkWidget *yes_button;
- GtkWidget *no_button;
-
+ GtkWidget *button;
+
/* Build UI. */
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
- label = gtk_label_new_with_mnemonic (_("<b>Use _advanced mode</b>"));
+ label = gtk_label_new (_("<b>User interface</b>"));
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_frame_set_label_widget (GTK_FRAME (frame), label);
- hbox = gtk_hbox_new (TRUE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
- gtk_container_add (GTK_CONTAINER (frame), hbox);
- yes_button = gtk_radio_button_new_with_mnemonic (NULL, _("_Yes"));
- gtk_box_pack_start_defaults (GTK_BOX (hbox), yes_button);
- no_button = gtk_radio_button_new_with_mnemonic_from_widget
- (GTK_RADIO_BUTTON (yes_button), _("_No"));
- gtk_box_pack_start_defaults (GTK_BOX (hbox), no_button);
+ button = gtk_check_button_new_with_mnemonic (_("use _advanced mode"));
+ gtk_container_add (GTK_CONTAINER (frame), button);
+
/* Select default value. */
- if (gpa_options_get_simplified_ui (gpa_options_get_instance ()))
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (no_button), TRUE);
- else
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (yes_button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
+ !gpa_options_get_simplified_ui
+ (gpa_options_get_instance ()));
/* Connect signals. */
- g_signal_connect (G_OBJECT (yes_button), "toggled",
+ g_signal_connect (G_OBJECT (button), "toggled",
G_CALLBACK (advanced_mode_toggled), NULL);
+
return frame;
}
@@ -207,7 +220,7 @@
gpa_settings_dialog_new (void)
{
GtkWidget *dialog;
- GtkWidget *frame;
+ GtkWidget *frame, *keyserver_frame;
dialog = gtk_dialog_new_with_buttons (_("Settings"), NULL, 0,
_("_Close"),
@@ -216,6 +229,10 @@
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 5);
+ /* The UI mode section. */
+ frame = keyserver_frame = user_interface_mode_frame ();
+ gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog)->vbox), frame);
+
/* The default key section. */
frame = default_key_frame ();
gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog)->vbox), frame);
@@ -224,10 +241,6 @@
frame = default_keyserver_frame ();
gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog)->vbox), frame);
- /* The UI mode section. */
- frame = user_interface_mode_frame ();
- gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog)->vbox), frame);
-
/* Close the dialog when asked to. */
g_signal_connect_swapped (GTK_OBJECT (dialog),
"response",
More information about the Gpa-commits
mailing list