diary r88 - in trunk: . data src



Author: pwithnall
Date: Wed Oct 15 06:43:50 2008
New Revision: 88
URL: http://svn.gnome.org/viewvc/diary?rev=88&view=rev

Log:
2008-10-15  Philip Withnall  <philip tecnocode co uk>

	* data/almanah.ui:
	* src/preferences-dialog.c (almanah_preferences_dialog_new),
	(pd_new_key_button_clicked_cb): Add a button to launch Seahorse
	to enable creation of new keys from the preferences dialogue.
	(Closes: #539792)



Modified:
   trunk/ChangeLog
   trunk/data/almanah.ui
   trunk/src/preferences-dialog.c

Modified: trunk/data/almanah.ui
==============================================================================
--- trunk/data/almanah.ui	(original)
+++ trunk/data/almanah.ui	Wed Oct 15 06:43:50 2008
@@ -543,7 +543,7 @@
 				<child>
 					<object class="GtkTable" id="dry_pd_table">
 						<property name="n-rows">1</property>
-						<property name="n-columns">2</property>
+						<property name="n-columns">3</property>
 						<property name="column-spacing">5</property>
 						<property name="row-spacing">5</property>
 						<property name="border-width">5</property>

Modified: trunk/src/preferences-dialog.c
==============================================================================
--- trunk/src/preferences-dialog.c	(original)
+++ trunk/src/preferences-dialog.c	Wed Oct 15 06:43:50 2008
@@ -25,6 +25,7 @@
 #define LIBCRYPTUI_API_SUBJECT_TO_CHANGE
 #include <libcryptui/cryptui-key-combo.h>
 #include <libcryptui/cryptui-keyset.h>
+#include <libcryptui/cryptui.h>
 #endif /* ENABLE_ENCRYPTION */
 
 #include "preferences-dialog.h"
@@ -36,6 +37,7 @@
 static void almanah_preferences_dialog_dispose (GObject *object);
 #ifdef ENABLE_ENCRYPTION
 static void pd_key_combo_changed_cb (GtkComboBox *combo_box, AlmanahPreferencesDialog *preferences_dialog);
+static void pd_new_key_button_clicked_cb (GtkButton *button, AlmanahPreferencesDialog *preferences_dialog);
 #endif /* ENABLE_ENCRYPTION */
 static void pd_response_cb (GtkDialog *dialog, gint response_id, AlmanahPreferencesDialog *preferences_dialog);
 
@@ -96,7 +98,7 @@
 {
 	GtkBuilder *builder;
 #ifdef ENABLE_ENCRYPTION
-	GtkWidget *label;
+	GtkWidget *label, *button;
 	GtkTable *table;
 	gchar *key;
 #endif /* ENABLE_ENCRYPTION */
@@ -164,6 +166,10 @@
 	g_free (key);
 
 	g_signal_connect (priv->key_combo, "changed", G_CALLBACK (pd_key_combo_changed_cb), preferences_dialog);
+
+	button = gtk_button_new_with_mnemonic (_("New _Key"));
+	gtk_table_attach (table, button, 3, 4, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
+	g_signal_connect (button, "clicked", G_CALLBACK (pd_new_key_button_clicked_cb), preferences_dialog);
 #endif /* ENABLE_ENCRYPTION */
 
 	g_object_unref (builder);
@@ -190,6 +196,21 @@
 		g_error_free (error);
 	}
 }
+
+static void
+pd_new_key_button_clicked_cb (GtkButton *button, AlmanahPreferencesDialog *preferences_dialog)
+{
+	/* NOTE: pilfered from cryptui_need_to_get_keys */
+	gchar *argv[2] = { "seahorse", NULL };
+	GError *error = NULL;
+
+	if (g_spawn_async (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error) == FALSE) {
+		gchar *error_message = g_strdup_printf (_("There was an error opening Seahorse: %s"), error->message);
+		diary_interface_error (error_message, GTK_WIDGET (preferences_dialog));
+		g_free (error_message);
+		g_error_free (error);
+	}
+}
 #endif /* ENABLE_ENCRYPTION */
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]