[seahorse] Add support for adding manual keyring secrets.



commit e9d379fa809beac670f19c1c608dc305bf479072
Author: Stef Walter <stef memberwebs com>
Date:   Sat Jul 11 20:58:56 2009 +0000

    Add support for adding manual keyring secrets.
    
    User can now manually add items to keyrings from the File | New
    menu. 'Stored Password' is the name.

 gkr/Makefile.am                     |    4 +-
 gkr/seahorse-gkr-add-item.c         |  172 +++++++++++++++++++++++++++++++
 gkr/seahorse-gkr-add-item.xml       |  191 +++++++++++++++++++++++++++++++++++
 gkr/seahorse-gkr-add-keyring.c      |   78 +--------------
 gkr/seahorse-gkr-dialogs.c          |   99 ++++++++++++++++++
 gkr/seahorse-gkr-dialogs.h          |    7 ++
 gkr/seahorse-gkr-keyring-commands.c |   11 ++-
 gkr/seahorse-gkr-keyring.c          |    1 +
 libseahorse/seahorse-gtkstock.c     |    1 +
 po/POTFILES.in                      |    2 +
 10 files changed, 488 insertions(+), 78 deletions(-)
---
diff --git a/gkr/Makefile.am b/gkr/Makefile.am
index 12a9d8f..5c3eb1c 100644
--- a/gkr/Makefile.am
+++ b/gkr/Makefile.am
@@ -19,8 +19,9 @@ noinst_LTLIBRARIES = libseahorse-gkr.la
 
 libseahorse_gkr_la_SOURCES = \
 	seahorse-gkr.c seahorse-gkr.h \
+	seahorse-gkr-add-item.c \
 	seahorse-gkr-add-keyring.c \
-	seahorse-gkr-dialogs.h \
+	seahorse-gkr-dialogs.h seahorse-gkr-dialogs.c \
 	seahorse-gkr-item.c seahorse-gkr-item.h \
 	seahorse-gkr-item-commands.c seahorse-gkr-item-commands.h \
 	seahorse-gkr-item-properties.c \
@@ -38,6 +39,7 @@ libseahorse_gkr_la_LIBADD = \
 
 ui_DATA = \
 	seahorse-add-keyring.xml \
+	seahorse-gkr-add-item.xml \
 	seahorse-gkr-item-properties.xml \
 	seahorse-gkr-keyring.xml
 
diff --git a/gkr/seahorse-gkr-add-item.c b/gkr/seahorse-gkr-add-item.c
new file mode 100644
index 0000000..09f4853
--- /dev/null
+++ b/gkr/seahorse-gkr-add-item.c
@@ -0,0 +1,172 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2008 Stefan Walter
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "config.h"
+
+#include "seahorse-gkr-dialogs.h"
+#include "seahorse-gkr-keyring.h"
+#include "seahorse-gkr-source.h"
+
+#include "seahorse-secure-entry.h"
+#include "seahorse-widget.h"
+#include "seahorse-util.h"
+
+#include <glib/gi18n.h>
+
+static void
+item_add_done (GnomeKeyringResult result, guint32 item, gpointer data)
+{
+	SeahorseWidget *swidget = SEAHORSE_WIDGET (data);
+	SeahorseOperation *op;
+
+	g_return_if_fail (swidget);
+
+	/* Clear the operation without cancelling it since it is complete */
+	seahorse_gkr_dialog_complete_request (swidget, FALSE);
+    
+	/* Successful. Update the listings and stuff. */
+	if (result == GNOME_KEYRING_RESULT_OK) {
+		
+		op = seahorse_source_load (SEAHORSE_SOURCE (seahorse_gkr_source_default ()));
+		
+		/* 
+		 * HACK: Major hack alert. This whole area needs some serious refactoring,
+		 * so for now we're just going to let any viewers listen in on this
+		 * operation like so:
+		 */
+		g_signal_emit_by_name (seahorse_context_for_app (), "refreshing", op);
+		g_object_unref (op);
+
+	/* Setting the default keyring failed */
+	} else if (result != GNOME_KEYRING_RESULT_CANCELLED) {     
+		seahorse_util_show_error (seahorse_widget_get_toplevel (swidget),
+		                          _("Couldn't add keyring"),
+		                          gnome_keyring_result_to_message (result));
+	}
+	
+	seahorse_widget_destroy (swidget);
+}
+
+G_MODULE_EXPORT void
+on_add_item_label_changed (GtkEntry *entry, SeahorseWidget *swidget)
+{
+	const gchar *keyring = gtk_entry_get_text (entry);
+	seahorse_widget_set_sensitive (swidget, "ok", keyring && keyring[0]);
+}
+
+G_MODULE_EXPORT void 
+on_add_item_password_toggled (GtkToggleButton *button, SeahorseWidget *swidget)
+{
+    GtkWidget *widget;
+    
+    widget = g_object_get_data (G_OBJECT (swidget), "gkr-secure-entry");
+    seahorse_secure_entry_set_visibility (SEAHORSE_SECURE_ENTRY (widget), 
+                                          gtk_toggle_button_get_active (button));
+}
+
+G_MODULE_EXPORT void
+on_add_item_response (GtkDialog *dialog, int response, SeahorseWidget *swidget)
+{
+	GtkWidget *widget;
+	gchar *keyring;
+	const gchar *secret;
+	const gchar *label;
+	gpointer request;
+	GArray *attributes;
+	
+	if (response == GTK_RESPONSE_HELP) {
+		seahorse_widget_show_help (swidget);
+		
+	} else if (response == GTK_RESPONSE_ACCEPT) {
+	    
+		widget = seahorse_widget_get_widget (swidget, "item-label");
+		label = gtk_entry_get_text (GTK_ENTRY (widget));
+		g_return_if_fail (label && label[0]);
+		
+		widget = g_object_get_data (G_OBJECT (swidget), "gkr-secure-entry");
+		secret = seahorse_secure_entry_get_text (SEAHORSE_SECURE_ENTRY (widget));
+		
+		widget = seahorse_widget_get_widget (swidget, "item-keyring");
+		keyring = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget));
+		
+		attributes = gnome_keyring_attribute_list_new ();
+	    
+		request = gnome_keyring_item_create (keyring, GNOME_KEYRING_ITEM_NOTE, label, 
+		                                     attributes, secret, FALSE, item_add_done, 
+		                                     g_object_ref (swidget), g_object_unref);
+		g_return_if_fail (request);
+		seahorse_gkr_dialog_begin_request (swidget, request);
+		
+		g_free (keyring);
+		gnome_keyring_attribute_list_free (attributes);
+		
+	} else {
+		seahorse_widget_destroy (swidget);
+	}
+}
+
+void
+seahorse_gkr_add_item_show (GtkWindow *parent)
+{
+	SeahorseWidget *swidget = NULL;
+	GtkWidget *entry, *widget;
+	GList *keyrings, *l;
+	GtkCellRenderer *cell;
+	GtkListStore *store;
+	GtkTreeIter iter;
+	gint i;
+	
+	swidget = seahorse_widget_new_allow_multiple ("gkr-add-item", parent);
+	g_return_if_fail (swidget);
+	
+	/* Load up a list of all the keyrings, and select the default */
+	widget = seahorse_widget_get_widget (swidget, "item-keyring");
+	store = gtk_list_store_new (1, G_TYPE_STRING);
+	gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store));
+	cell = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget), cell, TRUE);
+	gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (widget), cell, "text", 0);
+	                                    
+	keyrings = seahorse_context_find_objects (NULL, SEAHORSE_GKR, SEAHORSE_USAGE_OTHER, 
+	                                          SEAHORSE_LOCATION_LOCAL);
+	for (i = 0, l = keyrings; l; l = g_list_next (l)) {
+		gtk_list_store_append (store, &iter);
+		gtk_list_store_set (store, &iter, 0, seahorse_gkr_keyring_get_name (l->data), -1);
+		if (seahorse_gkr_keyring_get_is_default (l->data))
+			gtk_combo_box_set_active_iter (GTK_COMBO_BOX (widget), &iter);
+	}
+	
+	g_object_unref (store);
+
+	widget = seahorse_widget_get_widget (swidget, "item-label");
+	g_return_if_fail (widget); 
+	on_add_item_label_changed (GTK_ENTRY (widget), swidget);
+	
+	widget = seahorse_widget_get_widget (swidget, "password-area");
+	g_return_if_fail (widget);
+	entry = seahorse_secure_entry_new ();
+	gtk_container_add (GTK_CONTAINER (widget), GTK_WIDGET (entry));
+	gtk_widget_show (GTK_WIDGET (entry));
+	g_object_set_data (G_OBJECT (swidget), "gkr-secure-entry", entry);
+
+	widget = seahorse_widget_get_toplevel (swidget);
+	gtk_widget_show (widget);
+	gtk_window_present (GTK_WINDOW (widget));
+}
diff --git a/gkr/seahorse-gkr-add-item.xml b/gkr/seahorse-gkr-add-item.xml
new file mode 100644
index 0000000..7952c1c
--- /dev/null
+++ b/gkr/seahorse-gkr-add-item.xml
@@ -0,0 +1,191 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkDialog" id="gkr-add-item">
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Add Password</property>
+    <property name="modal">True</property>
+    <property name="window_position">center-on-parent</property>
+    <property name="type_hint">dialog</property>
+    <property name="skip_taskbar_hint">True</property>
+    <property name="skip_pager_hint">True</property>
+    <property name="has_separator">False</property>
+    <signal name="response" handler="on_add_item_response"/>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkVBox" id="vbox1">
+            <property name="visible">True</property>
+            <property name="border_width">5</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkTable" id="table1">
+                <property name="visible">True</property>
+                <property name="n_rows">4</property>
+                <property name="n_columns">2</property>
+                <property name="column_spacing">12</property>
+                <property name="row_spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="label3">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">_Description:</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="item-label">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="max_length">32</property>
+                    <property name="invisible_char">&#x2022;</property>
+                    <property name="activates_default">True</property>
+                    <property name="width_chars">16</property>
+                    <signal name="changed" handler="on_add_item_label_changed"/>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label1">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">_Password:</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="show-password">
+                    <property name="label" translatable="yes">_Show Password</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                    <signal name="toggled" handler="on_add_item_password_toggled"/>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkAlignment" id="password-area">
+                    <property name="visible">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label2">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">_Keyring:</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkComboBox" id="item-keyring">
+                    <property name="visible">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="cancel">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+                <signal name="clicked" handler="on_widget_closed"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="ok">
+                <property name="label">gtk-add</property>
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">True</property>
+                <property name="has_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">cancel</action-widget>
+      <action-widget response="-3">ok</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/gkr/seahorse-gkr-add-keyring.c b/gkr/seahorse-gkr-add-keyring.c
index efb48e8..ca51565 100644
--- a/gkr/seahorse-gkr-add-keyring.c
+++ b/gkr/seahorse-gkr-add-keyring.c
@@ -30,80 +30,6 @@
 #include <glib/gi18n.h>
 
 static void
-update_wait_cursor (GtkWidget *dialog, gpointer unused)
-{
-	GdkCursor *cursor;
-    
-	g_return_if_fail (dialog->window);
-    
-	/* No request active? */
-	if (!g_object_get_data (G_OBJECT (dialog), "keyring-request")) {
-		gdk_window_set_cursor (dialog->window, NULL);
-		return;
-	}
-    
-	/* 
-	 * Get the wait cursor. Create a new one and cache it on the widget 
-	 * if first time.
-	 */
-	cursor = (GdkCursor*)g_object_get_data (G_OBJECT (dialog), "wait-cursor");
-	if (!cursor) {
-		cursor = gdk_cursor_new (GDK_WATCH);
-		g_object_set_data_full (G_OBJECT (dialog), "wait-cursor", cursor, 
-		                        (GDestroyNotify)gdk_cursor_unref);
-	}
-    
-	/* Indicate that we're loading stuff */
-	gdk_window_set_cursor (dialog->window, cursor);
-}
-
-static void
-clear_request (SeahorseWidget *swidget, gboolean cancel)
-{
-	GtkWidget *dialog;
-	gpointer request;
-    
-	dialog = seahorse_widget_get_toplevel (swidget);
-	g_return_if_fail (GTK_IS_WIDGET (dialog));
-
-	request = g_object_steal_data (G_OBJECT (dialog), "keyring-request");
-	if (request && cancel)
-		gnome_keyring_cancel_request (request);
-        
-	if (GTK_WIDGET_REALIZED (dialog))
-		update_wait_cursor (dialog, NULL);
-	gtk_widget_set_sensitive (dialog, TRUE);
-}
-
-static void
-setup_request (SeahorseWidget *swidget, gpointer request)
-{
-	GtkWidget *dialog;
-	
-	g_return_if_fail (request);
-    
-	dialog = seahorse_widget_get_toplevel (swidget);
-	g_return_if_fail (GTK_IS_WIDGET (dialog));
-    
-	/* Cancel any old operation going on */
-	clear_request (swidget, TRUE);
-    
-	/* 
-	 * Start the operation and tie it to the widget so that it will get 
-	 * cancelled if the widget is destroyed before the operation is complete
-	 */ 
-	g_object_set_data_full (G_OBJECT (dialog), "keyring-request", request, 
-	                        gnome_keyring_cancel_request); 
-    
-	if (GTK_WIDGET_REALIZED (dialog))
-		update_wait_cursor (dialog, NULL);
-	else
-		g_signal_connect (dialog, "realize", G_CALLBACK (update_wait_cursor), dialog);
-    
-	gtk_widget_set_sensitive (dialog, FALSE);    
-}
-
-static void
 keyring_add_done (GnomeKeyringResult result, gpointer data)
 {
 	SeahorseWidget *swidget = SEAHORSE_WIDGET (data);
@@ -112,7 +38,7 @@ keyring_add_done (GnomeKeyringResult result, gpointer data)
 	g_return_if_fail (swidget);
 
 	/* Clear the operation without cancelling it since it is complete */
-	clear_request (swidget, FALSE);
+	seahorse_gkr_dialog_complete_request (swidget, FALSE);
     
 	/* Successful. Update the listings and stuff. */
 	if (result == GNOME_KEYRING_RESULT_OK) {
@@ -164,7 +90,7 @@ on_add_keyring_properties_response (GtkDialog *dialog, int response, SeahorseWid
 	    
 		request = gnome_keyring_create (keyring, NULL, keyring_add_done, g_object_ref (swidget), g_object_unref);
 		g_return_if_fail (request);
-		setup_request (swidget, request);
+		seahorse_gkr_dialog_begin_request (swidget, request);
 		
 	} else {
 		seahorse_widget_destroy (swidget);
diff --git a/gkr/seahorse-gkr-dialogs.c b/gkr/seahorse-gkr-dialogs.c
new file mode 100644
index 0000000..076b283
--- /dev/null
+++ b/gkr/seahorse-gkr-dialogs.c
@@ -0,0 +1,99 @@
+/* 
+ * Seahorse
+ * 
+ * Copyright (C) 2009 Stefan Walter
+ * 
+ * This program is free software; you can redistribute it and/or modify 
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *  
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *  
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.  
+ */
+
+#include "config.h"
+#include "seahorse-gkr-dialogs.h"
+
+#include <gtk/gtk.h>
+
+static void
+update_wait_cursor (GtkWidget *dialog, gpointer unused)
+{
+	GdkCursor *cursor;
+    
+	g_return_if_fail (dialog->window);
+    
+	/* No request active? */
+	if (!g_object_get_data (G_OBJECT (dialog), "gkr-request")) {
+		gdk_window_set_cursor (dialog->window, NULL);
+		return;
+	}
+    
+	/* 
+	 * Get the wait cursor. Create a new one and cache it on the widget 
+	 * if first time.
+	 */
+	cursor = (GdkCursor*)g_object_get_data (G_OBJECT (dialog), "wait-cursor");
+	if (!cursor) {
+		cursor = gdk_cursor_new (GDK_WATCH);
+		g_object_set_data_full (G_OBJECT (dialog), "wait-cursor", cursor, 
+		                        (GDestroyNotify)gdk_cursor_unref);
+	}
+    
+	/* Indicate that we're loading stuff */
+	gdk_window_set_cursor (dialog->window, cursor);
+}
+
+void
+seahorse_gkr_dialog_begin_request (SeahorseWidget *swidget, gpointer request)
+{
+	GtkWidget *dialog;
+	
+	g_return_if_fail (request);
+    
+	dialog = seahorse_widget_get_toplevel (swidget);
+	g_return_if_fail (GTK_IS_WIDGET (dialog));
+    
+	/* Cancel any old operation going on */
+	seahorse_gkr_dialog_complete_request (swidget, TRUE);
+    
+	/* 
+	 * Start the operation and tie it to the widget so that it will get 
+	 * cancelled if the widget is destroyed before the operation is complete
+	 */ 
+	g_object_set_data_full (G_OBJECT (dialog), "gkr-request", request, 
+				gnome_keyring_cancel_request); 
+    
+	if (GTK_WIDGET_REALIZED (dialog))
+		update_wait_cursor (dialog, NULL);
+	else
+		g_signal_connect (dialog, "realize", G_CALLBACK (update_wait_cursor), dialog);
+    
+	gtk_widget_set_sensitive (dialog, FALSE);    
+}
+
+void
+seahorse_gkr_dialog_complete_request (SeahorseWidget *swidget, gboolean cancel)
+{
+	GtkWidget *dialog;
+	gpointer request;
+	
+	dialog = seahorse_widget_get_toplevel (swidget);
+	g_return_if_fail (GTK_IS_WIDGET (dialog));
+	
+	request = g_object_steal_data (G_OBJECT (dialog), "gkr-request");
+	if (request && cancel)
+		gnome_keyring_cancel_request (request);
+	        
+	if (GTK_WIDGET_REALIZED (dialog))
+		update_wait_cursor (dialog, NULL);
+	gtk_widget_set_sensitive (dialog, TRUE);
+}
diff --git a/gkr/seahorse-gkr-dialogs.h b/gkr/seahorse-gkr-dialogs.h
index da23993..8b81b62 100644
--- a/gkr/seahorse-gkr-dialogs.h
+++ b/gkr/seahorse-gkr-dialogs.h
@@ -26,13 +26,20 @@
 
 #include "seahorse-gkr-item.h"
 #include "seahorse-gkr-keyring.h"
+#include "seahorse-widget.h"
 
 void            seahorse_gkr_add_keyring_register     (void);
 
+void            seahorse_gkr_add_item_show            (GtkWindow *parent);
+
 void            seahorse_gkr_add_keyring_show         (GtkWindow *parent);
 
 void            seahorse_gkr_item_properties_show     (SeahorseGkrItem *git, GtkWindow *parent);
 
 void            seahorse_gkr_keyring_properties_show  (SeahorseGkrKeyring *gkr, GtkWindow *parent);
 
+void            seahorse_gkr_dialog_begin_request     (SeahorseWidget *swidget, gpointer request);
+
+void            seahorse_gkr_dialog_complete_request  (SeahorseWidget *swidget, gboolean cancel);
+
 #endif /* __SEAHORSE_GKR_DIALOGS__ */
diff --git a/gkr/seahorse-gkr-keyring-commands.c b/gkr/seahorse-gkr-keyring-commands.c
index 0081241..5af300a 100644
--- a/gkr/seahorse-gkr-keyring-commands.c
+++ b/gkr/seahorse-gkr-keyring-commands.c
@@ -83,9 +83,18 @@ on_gkr_add_keyring (GtkAction *action, gpointer unused)
 	seahorse_gkr_add_keyring_show (NULL);
 }
 
+static void
+on_gkr_add_item (GtkAction *action, gpointer unused)
+{
+	g_return_if_fail (GTK_IS_ACTION (action));
+	seahorse_gkr_add_item_show (NULL);
+}
+
 static const GtkActionEntry ENTRIES_NEW[] = {
 	{ "gkr-add-keyring", "folder", N_("Password Keyring"), "",
-	  N_("Used to store application and network passwords"), G_CALLBACK (on_gkr_add_keyring) }
+	  N_("Used to store application and network passwords"), G_CALLBACK (on_gkr_add_keyring) },
+	{ "gkr-add-item", "emblem-readonly", N_("Stored Password"), "",
+	  N_("Safely store a password or secret."), G_CALLBACK (on_gkr_add_item) }
 };
 
 static void
diff --git a/gkr/seahorse-gkr-keyring.c b/gkr/seahorse-gkr-keyring.c
index 1390ea7..8f13eee 100644
--- a/gkr/seahorse-gkr-keyring.c
+++ b/gkr/seahorse-gkr-keyring.c
@@ -362,6 +362,7 @@ seahorse_gkr_keyring_realize (SeahorseObject *obj)
 	              "description", "",
 	              "flags", 0,
 	              "icon", "folder",
+	              "usage", SEAHORSE_USAGE_OTHER,
 	              NULL);
 	
 	g_free (name);
diff --git a/libseahorse/seahorse-gtkstock.c b/libseahorse/seahorse-gtkstock.c
index 6d60f52..5f66aea 100644
--- a/libseahorse/seahorse-gtkstock.c
+++ b/libseahorse/seahorse-gtkstock.c
@@ -45,6 +45,7 @@ static const gchar *seahorse_icons[] = {
 static const gchar *themed_icons[] = {
     SEAHORSE_THEMED_WEBBROWSER,
     SEAHORSE_THEMED_FOLDER,
+    "emblem-readonly",
     NULL
 };
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ca98a6c..55092f6 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -8,6 +8,8 @@ daemon/seahorse-service-keyset.c
 daemon/seahorse-sharing.c
 data/seahorse.schemas.in
 [type: gettext/glade]gkr/seahorse-add-keyring.xml
+gkr/seahorse-gkr-add-item.c
+[type: gettext/glade]gkr/seahorse-gkr-add-item.xml
 gkr/seahorse-gkr-add-keyring.c
 gkr/seahorse-gkr-item.c
 gkr/seahorse-gkr-item-commands.c



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