seahorse r2498 - in seahorse-plugins/trunk: . libseahorse plugins/applet plugins/epiphany plugins/gedit
- From: nnielsen svn gnome org
- To: svn-commits-list gnome org
- Subject: seahorse r2498 - in seahorse-plugins/trunk: . libseahorse plugins/applet plugins/epiphany plugins/gedit
- Date: Sat, 13 Sep 2008 22:13:48 +0000 (UTC)
Author: nnielsen
Date: Sat Sep 13 22:13:48 2008
New Revision: 2498
URL: http://svn.gnome.org/viewvc/seahorse?rev=2498&view=rev
Log:
* libseahorse/seahorse-util.c:
* plugins/applet/seahorse-applet.c:
* plugins/epiphany/seahorse-extension.c:
* plugins/gedit/seahorse-gedit.c: Don't display DBus errors when
they are the result of a user cancel. See bug #520119
Modified:
seahorse-plugins/trunk/ChangeLog
seahorse-plugins/trunk/libseahorse/seahorse-util.c
seahorse-plugins/trunk/plugins/applet/seahorse-applet.c
seahorse-plugins/trunk/plugins/epiphany/seahorse-extension.c
seahorse-plugins/trunk/plugins/gedit/seahorse-gedit.c
Modified: seahorse-plugins/trunk/libseahorse/seahorse-util.c
==============================================================================
--- seahorse-plugins/trunk/libseahorse/seahorse-util.c (original)
+++ seahorse-plugins/trunk/libseahorse/seahorse-util.c Sat Sep 13 22:13:48 2008
@@ -41,6 +41,8 @@
#include <avahi-glib/glib-malloc.h>
#endif
+#include <dbus/dbus-glib-bindings.h>
+
#include "seahorse-gpgmex.h"
#include "seahorse-util.h"
#include "seahorse-gconf.h"
@@ -114,7 +116,12 @@
if (desc)
t = g_strdup_vprintf (desc, ap);
- va_end(ap);
+ va_end(ap);
+
+ /* Never show an error for 'cancelled' */
+ if (err->code == DBUS_GERROR_REMOTE_EXCEPTION && err->domain == DBUS_GERROR &&
+ strstr (dbus_g_error_get_name (err), "Cancelled"))
+ return;
seahorse_util_show_error (NULL, t, err->message ? err->message : "");
g_free(t);
Modified: seahorse-plugins/trunk/plugins/applet/seahorse-applet.c
==============================================================================
--- seahorse-plugins/trunk/plugins/applet/seahorse-applet.c (original)
+++ seahorse-plugins/trunk/plugins/applet/seahorse-applet.c Sat Sep 13 22:13:48 2008
@@ -365,12 +365,25 @@
}
static void
+notification_error (const char *title, const char *detail, SeahorseApplet *sapplet, GError *err)
+{
+ /* Never show an error for 'cancelled' */
+ if (err->code == DBUS_GERROR_REMOTE_EXCEPTION && err->domain == DBUS_GERROR &&
+ strstr (dbus_g_error_get_name (err), "Cancelled"))
+ return;
+
+ seahorse_notification_display(title, detail, FALSE, NULL,
+ GTK_WIDGET (sapplet));
+}
+
+static void
encrypt_received (GtkClipboard *board, const gchar *text, SeahorseApplet *sapplet)
{
gchar *signer = NULL;
gchar *enctext = NULL;
gchar **keys = NULL;
gboolean ret;
+ GError *err = NULL;
/* No text on clipboard */
if (!text)
@@ -384,7 +397,7 @@
/* User may have cancelled */
if (keys && *keys) {
- ret = dbus_g_proxy_call (dbus_crypto_proxy, "EncryptText", NULL,
+ ret = dbus_g_proxy_call (dbus_crypto_proxy, "EncryptText", &err,
G_TYPE_STRV, keys,
G_TYPE_STRING, signer,
G_TYPE_INT, 0,
@@ -401,12 +414,11 @@
if (seahorse_gconf_get_boolean (DISPLAY_CLIPBOARD_ENC_KEY) == TRUE)
display_text (_("Encrypted Text"), enctext, FALSE);
} else {
- seahorse_notification_display(_("Encryption Failed"),
- _("The clipboard could not be encrypted."),
- FALSE,
- NULL,
- GTK_WIDGET(sapplet));
+ notification_error (_("Encryption Failed"), _("The clipboard could not be encrypted."),
+ sapplet, err);
+ g_clear_error (&err);
}
+
g_strfreev(keys);
g_free (signer);
g_free (enctext);
@@ -431,6 +443,7 @@
gchar *signer = NULL;
gchar *enctext = NULL;
gboolean ret;
+ GError *err = NULL;
/* No text on clipboard */
if (!text)
@@ -445,7 +458,7 @@
return;
/* Perform the signing */
- ret = dbus_g_proxy_call (dbus_crypto_proxy, "SignText", NULL,
+ ret = dbus_g_proxy_call (dbus_crypto_proxy, "SignText", &err,
G_TYPE_STRING, signer,
G_TYPE_INT, 0,
G_TYPE_STRING, text,
@@ -461,11 +474,9 @@
if (seahorse_gconf_get_boolean (DISPLAY_CLIPBOARD_ENC_KEY) == TRUE)
display_text (_("Signed Text"), enctext, FALSE);
} else {
- seahorse_notification_display(_("Signing Failed"),
- _("The clipboard could not be Signed."),
- FALSE,
- NULL,
- GTK_WIDGET(sapplet));
+ notification_error (_("Signing Failed"), _("The clipboard could not be Signed."),
+ sapplet, err);
+ g_clear_error (&err);
}
g_free (signer);
@@ -522,13 +533,14 @@
gchar *rawtext = NULL;
gchar *signer = NULL;
gboolean ret;
+ GError *err = NULL;
if (cryptui_keyset_get_count (dbus_keyset) == 0) {
cryptui_need_to_get_keys (dbus_keyset);
return NULL;
}
- ret = dbus_g_proxy_call (dbus_crypto_proxy, "DecryptText", NULL,
+ ret = dbus_g_proxy_call (dbus_crypto_proxy, "DecryptText", &err,
G_TYPE_STRING, "openpgp",
G_TYPE_INT, 0,
G_TYPE_STRING, text,
@@ -542,11 +554,9 @@
return rawtext;
} else {
- seahorse_notification_display(_("Decrypting Failed"),
- _("Text may be malformed."),
- FALSE,
- NULL,
- GTK_WIDGET(sapplet));
+ notification_error (_("Signing Failed"), _("The clipboard could not be Signed."),
+ sapplet, err);
+ g_clear_error (&err);
return NULL;
}
}
Modified: seahorse-plugins/trunk/plugins/epiphany/seahorse-extension.c
==============================================================================
--- seahorse-plugins/trunk/plugins/epiphany/seahorse-extension.c (original)
+++ seahorse-plugins/trunk/plugins/epiphany/seahorse-extension.c Sat Sep 13 22:13:48 2008
@@ -228,6 +228,24 @@
return type;
}
+static void
+notification_error (const gchar *title, const gchar *details, GError *err)
+{
+ /* Never show an error for 'cancelled' */
+ if (err->code == DBUS_GERROR_REMOTE_EXCEPTION && err->domain == DBUS_GERROR &&
+ strstr (dbus_g_error_get_name (err), "Cancelled"))
+ return;
+
+ dbus_g_proxy_call (dbus_key_proxy, "DisplayNotification", NULL,
+ G_TYPE_STRING, title,
+ G_TYPE_STRING, details,
+ G_TYPE_STRING, NULL,
+ G_TYPE_BOOLEAN, FALSE,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+
+}
+
static void
encrypt_seahorse_cb (GtkAction *action, EphyWindow *window)
{
@@ -366,13 +384,14 @@
gchar *rawtext = NULL;
gchar *signer = NULL;
gboolean ret;
+ GError *err = NULL;
if (cryptui_keyset_get_count (dbus_keyset) == 0) {
cryptui_need_to_get_keys (dbus_keyset);
return NULL;
}
- ret = dbus_g_proxy_call (dbus_crypto_proxy, "DecryptText", NULL,
+ ret = dbus_g_proxy_call (dbus_crypto_proxy, "DecryptText", &err,
G_TYPE_STRING, "openpgp",
G_TYPE_INT, 0,
G_TYPE_STRING, text,
@@ -386,13 +405,8 @@
return rawtext;
} else {
- dbus_g_proxy_call (dbus_key_proxy, "DisplayNotification", NULL,
- G_TYPE_STRING, _("Decrypting Failed"),
- G_TYPE_STRING, _("Text may be malformed."),
- G_TYPE_STRING, NULL,
- G_TYPE_BOOLEAN, FALSE,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
+ notification_error (_("Decrypting Failed"), _("Text may be malformed."), err);
+ g_clear_error (&err);
return NULL;
}
}
Modified: seahorse-plugins/trunk/plugins/gedit/seahorse-gedit.c
==============================================================================
--- seahorse-plugins/trunk/plugins/gedit/seahorse-gedit.c (original)
+++ seahorse-plugins/trunk/plugins/gedit/seahorse-gedit.c Sat Sep 13 22:13:48 2008
@@ -237,6 +237,11 @@
g_assert (heading);
g_assert (error);
+ /* Never show an error for 'cancelled' */
+ if (error->code == DBUS_GERROR_REMOTE_EXCEPTION && error->domain == DBUS_GERROR &&
+ strstr (dbus_g_error_get_name (error), "Cancelled"))
+ return;
+
t = g_strconcat("<big><b>", heading, "</b></big>\n\n",
error->message ? error->message : "", NULL);
@@ -418,8 +423,6 @@
return NULL;
}
-g_printerr ("%s\n", text);
-
ret = dbus_g_proxy_call (dbus_crypto_proxy, "DecryptText", &error,
G_TYPE_STRING, "openpgp",
G_TYPE_INT, 0,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]