[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r28481 - gnunet/doc/man gnunet/src/identity gnunet-gtk/src/
From: |
gnunet |
Subject: |
[GNUnet-SVN] r28481 - gnunet/doc/man gnunet/src/identity gnunet-gtk/src/identity |
Date: |
Thu, 8 Aug 2013 23:40:39 +0200 |
Author: grothoff
Date: 2013-08-08 23:40:39 +0200 (Thu, 08 Aug 2013)
New Revision: 28481
Removed:
gnunet-gtk/src/identity/gnunet-identity-gtk_create_ego.c
Modified:
gnunet-gtk/src/identity/gnunet-identity-gtk.c
gnunet/doc/man/gnunet-identity.1
gnunet/src/identity/gnunet-identity.c
Log:
-working on identity service create/rename/delete
Modified: gnunet/doc/man/gnunet-identity.1
===================================================================
--- gnunet/doc/man/gnunet-identity.1 2013-08-08 21:00:16 UTC (rev 28480)
+++ gnunet/doc/man/gnunet-identity.1 2013-08-08 21:40:39 UTC (rev 28481)
@@ -25,12 +25,12 @@
Print help page.
.TP
-\fB\-L\fR, \fB\-\-list\fR
-list all ouf our egos
+\fB\-d\fR, \fB\-\-display\fR
+display all ouf our egos
.TP
\fB\-m\fR, \fB\-\-monitor\fR
-run in monitor mode, listing all ouf our egos until CTRL-C is pressed
+run in monitor mode, listing all ouf our egos until CTRL-C is pressed. Each
ego is listed together with a unique pointer value; if egos are renamed, that
pointer value remains the same; if egos are deleted, they are listed one more
time with a name of "<null>".
.SH FILES
Modified: gnunet/src/identity/gnunet-identity.c
===================================================================
--- gnunet/src/identity/gnunet-identity.c 2013-08-08 21:00:16 UTC (rev
28480)
+++ gnunet/src/identity/gnunet-identity.c 2013-08-08 21:40:39 UTC (rev
28481)
@@ -176,8 +176,7 @@
struct GNUNET_IDENTITY_Ego *ego,
void **ctx,
const char *identifier)
-{
-
+{
if (! (list | monitor))
return;
if ( (NULL == ego) && (! monitor) )
@@ -185,7 +184,10 @@
GNUNET_SCHEDULER_shutdown ();
return;
}
- fprintf (stderr, "%s\n", identifier);
+ if (monitor)
+ fprintf (stderr, "%s - %p\n", identifier, ego);
+ else if (NULL != identifier)
+ fprintf (stderr, "%s\n", identifier);
}
@@ -237,8 +239,8 @@
{'D', "delete", "NAME",
gettext_noop ("delete ego NAME "),
1, &GNUNET_GETOPT_set_string, &delete_ego},
- {'L', "list", NULL,
- gettext_noop ("list all egos"),
+ {'d', "display", NULL,
+ gettext_noop ("display all egos"),
0, &GNUNET_GETOPT_set_one, &list},
{'m', "monitor", NULL,
gettext_noop ("run in monitor mode egos"),
Modified: gnunet-gtk/src/identity/gnunet-identity-gtk.c
===================================================================
--- gnunet-gtk/src/identity/gnunet-identity-gtk.c 2013-08-08 21:00:16 UTC
(rev 28480)
+++ gnunet-gtk/src/identity/gnunet-identity-gtk.c 2013-08-08 21:40:39 UTC
(rev 28481)
@@ -72,6 +72,111 @@
/**
+ * We need to track active operations with the identity service.
+ */
+struct OperationContext
+{
+
+ /**
+ * Kept in a DLL.
+ */
+ struct OperationContext *next;
+
+ /**
+ * Kept in a DLL.
+ */
+ struct OperationContext *prev;
+
+ /**
+ * Operation handle with the identity service.
+ */
+ struct GNUNET_IDENTITY_Operation *op;
+
+};
+
+
+/**
+ * Identity operation was finished, clean up.
+ *
+ * @param cls the 'struct OperationContext'
+ * @param emsg error message (NULL on success)
+ */
+static void
+operation_finished (void *cls,
+ const char *emsg)
+{
+ struct OperationContext *oc = cls;
+
+ GNUNET_free (oc);
+}
+
+
+/**
+ * The user edited one of the names of the egos. Change it
+ * in the IDENTITY service.
+ *
+ * @param renderer renderer where the change happened
+ * @param path location in the model where the change happened
+ * @param new_text updated text
+ * @param user_data internal context (not used)
+ */
+void
+GNUNET_GTK_namespace_organizer_namespaces_treeview_column_name_text_edited_cb
+(GtkCellRendererText *renderer,
+ gchar *path,
+ gchar *new_text,
+ gpointer user_data)
+{
+ GtkTreePath *treepath;
+ GtkTreeIter iter;
+ struct GNUNET_IDENTITY_Ego *ego;
+ gchar *old;
+ struct OperationContext *oc;
+
+ treepath = gtk_tree_path_new_from_string (path);
+ if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (ls),
+ &iter,
+ treepath))
+ {
+ GNUNET_break (0);
+ gtk_tree_path_free (treepath);
+ return;
+ }
+ gtk_tree_path_free (treepath);
+ gtk_tree_model_get (GTK_TREE_MODEL (ls),
+ &iter,
+ IDENTITY_MC_NAME, &old,
+ IDENTITY_MC_EGO, &ego,
+ -1);
+ oc = GNUNET_new (struct OperationContext);
+ if (NULL == ego)
+ {
+ /* create operation */
+ oc->op = GNUNET_IDENTITY_create (identity,
+ new_text,
+ &operation_finished,
+ oc);
+ }
+ else if (0 != strlen (new_text))
+ {
+ /* rename operation */
+ oc->op = GNUNET_IDENTITY_rename (identity,
+ old, new_text,
+ &operation_finished,
+ oc);
+ }
+ else
+ {
+ /* delete operation */
+ oc->op = GNUNET_IDENTITY_delete (identity,
+ old,
+ &operation_finished,
+ oc);
+ }
+}
+
+
+/**
* Get cfg.
*/
static const struct GNUNET_CONFIGURATION_Handle *
@@ -208,6 +313,7 @@
run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
GtkWidget *main_window;
+ GtkTreeIter iter;
ml = cls;
if (GNUNET_OK != GNUNET_GTK_main_loop_build_window (ml, NULL))
@@ -218,6 +324,11 @@
main_window = GTK_WIDGET (get_object ("GNUNET_GTK_identity_window"));
ls = GTK_LIST_STORE (get_object ("GNUNET_GTK_identity_liststore"));
GNUNET_assert (NULL != ls);
+ gtk_list_store_insert_with_values (ls,
+ &iter, G_MAXINT,
+ IDENTITY_MC_NAME, "<create>",
+ -1);
+
gtk_window_maximize (GTK_WINDOW (main_window));
GNUNET_GTK_tray_icon_create (ml,
GTK_WINDOW (main_window),
Deleted: gnunet-gtk/src/identity/gnunet-identity-gtk_create_ego.c
===================================================================
--- gnunet-gtk/src/identity/gnunet-identity-gtk_create_ego.c 2013-08-08
21:00:16 UTC (rev 28480)
+++ gnunet-gtk/src/identity/gnunet-identity-gtk_create_ego.c 2013-08-08
21:40:39 UTC (rev 28481)
@@ -1,123 +0,0 @@
-/*
- This file is part of GNUnet
- (C) 2005, 2006, 2010, 2012 Christian Grothoff (and other contributing
authors)
-
- GNUnet 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, or (at your
- option) any later version.
-
- GNUnet 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 GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-/**
- * @file src/fs/gnunet-fs-gtk_create-pseudonym.c
- * @author Christian Grothoff
- * @brief code to handle the main menu action to create a pseudonym
- */
-#include "gnunet-fs-gtk_common.h"
-#include "gnunet-fs-gtk.h"
-
-
-/**
- * Function called whenever text is added to the GtkEntry
- * with the name of the namespace. Here, we check that only
- * "valid" characters are used (as the result must be a valid
- * filename on most OSes).
- *
- * @param entry GtkEntry being edited
- * @param text the text
- * @param length length of the text
- * @param position where the text is being inserted
- * @param data the builder of the dialog (unused)
- */
-void
-GNUNET_FS_GTK_create_namespace_insert_text_cb (GtkEntry *entry,
- const gchar *text,
- gint length,
- gint *position,
- gpointer data)
-{
- GtkEditable *editable = GTK_EDITABLE(entry);
- gint i;
-
- for (i=0; i < length; i++)
- if ( (! isalnum((int) text[i])) && (text[i] != '_') && (text[i] != '-') )
- g_signal_stop_emission_by_name (G_OBJECT (editable), "insert_text");
-}
-
-
-/**
- * User completed the 'create pseudonym' dialog. Run the desired action.
- *
- * @param dialog the dialog
- * @param response_id GTK_RESPONSE_OK on "OK"
- * @param user_data the builder of the dialog
- */
-void
-GNUNET_GTK_create_namespace_dialog_response_cb (GtkDialog * dialog,
- gint response_id,
- gpointer user_data)
-{
- GtkBuilder *builder = GTK_BUILDER (user_data);
- const char *name;
- struct GNUNET_FS_Namespace *ns;
-
- if (GTK_RESPONSE_OK != response_id)
- {
- gtk_widget_destroy (GTK_WIDGET (dialog));
- g_object_unref (G_OBJECT (builder));
- return;
- }
- name = gtk_entry_get_text (GTK_ENTRY (gtk_builder_get_object (builder,
-
"GNUNET_GTK_create_namespace_name_entry")));
- if (NULL != name)
- {
- ns = GNUNET_FS_namespace_create (GNUNET_FS_GTK_get_fs_handle (), name);
- GNUNET_break (NULL != ns);
- if (NULL != ns)
- GNUNET_FS_namespace_delete (ns, GNUNET_NO);
- }
- gtk_widget_destroy (GTK_WIDGET (dialog));
- g_object_unref (G_OBJECT (builder));
-}
-
-
-/**
- * User selected "create pseudonym" in the menu of the main window.
- *
- * @param dummy the menu entry
- * @param user_data the main dialog builder, unused
- */
-void
-GNUNET_GTK_main_menu_create_pseudonym_activate_cb (GtkWidget * dummy,
- gpointer user_data)
-{
- GtkWidget *ad;
- GtkWidget *toplevel;
- GtkBuilder *builder;
-
- builder = GNUNET_GTK_get_new_builder
("gnunet_fs_gtk_create_namespace_dialog.glade", NULL);
- if (NULL == builder)
- {
- GNUNET_break (0);
- return;
- }
- ad = GTK_WIDGET (gtk_builder_get_object
- (builder, "GNUNET_GTK_create_namespace_dialog"));
- toplevel = gtk_widget_get_toplevel (dummy);
- if (GTK_IS_WINDOW (toplevel))
- gtk_window_set_transient_for (GTK_WINDOW (ad), GTK_WINDOW (toplevel));
- gtk_window_present (GTK_WINDOW (ad));
-}
-
-
-/* end of gnunet-fs-gtk_create-pseudonym.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r28481 - gnunet/doc/man gnunet/src/identity gnunet-gtk/src/identity,
gnunet <=