[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet-gtk] branch master updated: revising gnunet-namesto
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet-gtk] branch master updated: revising gnunet-namestore-gtk to make TLD==NICK and enable nicer zone editing |
Date: |
Sat, 03 Mar 2018 18:16:35 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet-gtk.
The following commit(s) were added to refs/heads/master by this push:
new d439a97b revising gnunet-namestore-gtk to make TLD==NICK and enable
nicer zone editing
d439a97b is described below
commit d439a97be0eaf8bc005f2ce60d744e62d3920a93
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat Mar 3 18:16:33 2018 +0100
revising gnunet-namestore-gtk to make TLD==NICK and enable nicer zone
editing
---
contrib/gnunet_namestore_gtk_main_window.glade | 656 ++++++++-----
src/conversation/gnunet-conversation-gtk_phone.c | 2 +-
src/namestore/gnunet-namestore-gtk.c | 1085 +++++++++++++++-------
3 files changed, 1167 insertions(+), 576 deletions(-)
diff --git a/contrib/gnunet_namestore_gtk_main_window.glade
b/contrib/gnunet_namestore_gtk_main_window.glade
index 11c4a6ee..ac224f03 100644
--- a/contrib/gnunet_namestore_gtk_main_window.glade
+++ b/contrib/gnunet_namestore_gtk_main_window.glade
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.2 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<object class="GtkMenu" id="gnunet_namestore_gtk_edit_popup_menu">
@@ -138,169 +138,319 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox"
id="gnunet_namestore_gtk_dialog-action_area">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton"
id="gnunet_namestore_gtk_cancel_button">
+ <property name="label">gtk-cancel</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton"
id="gnunet_namestore_gtk_save_as_button">
+ <property name="label">gtk-save-as</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</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>
+ <child>
+ <object class="GtkButton" id="gnunet_namestore_gtk_save_button">
+ <property name="label">gtk-save</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
<child>
- <object class="GtkVBox" id="gnunet_namestore_gtk_vbox">
+ <object class="GtkBox" id="gnunet_namestore_gtk_vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkHBox" id="gnunet_namestore_gtk_top_hbox">
+ <object class="GtkBox" id="gnunet_namestore_gtk_top_hbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkVBox" id="gnunet_namestore_gtk_zone_vbox">
+ <object class="GtkBox"
id="gnunet_namestore_gtk_zone_setup_vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkHBox"
id="gnunet_namestore_gtk_zone_label_hbox">
+ <object class="GtkFrame" id="gnunet_namestore_add_frame">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
<child>
- <object class="GtkLabel"
id="gnunet_namestore_gtk_zone_label">
+ <object class="GtkAlignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label"
translatable="yes"><b>SET TO PUBLIC KEY OF THE ZONE</b></property>
- <property name="use_markup">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkBox"
id="gnunet_namestore_gtk_add_zone_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel"
id="gnunet_namestore_gtk_zone_labell">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text"
translatable="yes">The label will be the TLD of the zone for you, and the
suggested nickname for the zone for other users. It must be a valid DNS
label.</property>
+ <property
name="double_buffered">False</property>
+ <property name="label"
translatable="yes">Zone label:</property>
+ <property
name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">5</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry"
id="gnunet_namestore_gtk_zone_add_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="max_length">63</property>
+ <signal name="changed"
handler="gnunet_namestore_gtk_zone_add_entry_changed_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="padding">5</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton"
id="gnunet_namestore_gtk_zone_add_button">
+ <property name="label">gtk-new</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property
name="receives_default">True</property>
+ <property name="tooltip_text"
translatable="yes">Create a new zone with the given label</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked"
handler="gnunet_namestore_gtk_zone_add_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">5</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
- <child>
- <object class="GtkButton"
id="gnunet_namestore_gtk_public_key_copy_button">
- <property name="label">gtk-copy</property>
+ <child type="label">
+ <object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- <signal name="clicked"
handler="gnunet_namestore_gtk_public_key_copy_button_clicked_cb" swapped="no"/>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text"
translatable="yes">Create a new zone (GNU Name System top-level
domain)</property>
+ <property name="label" translatable="yes"> _Add
Zone</property>
+ <property name="use_underline">True</property>
+ <property name="selectable">True</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="padding">2</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="fill">True</property>
+ <property name="padding">5</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkHBox"
id="gnunet_namestore_gtk_pseu_hbox">
+ <object class="GtkFrame"
id="gnunet_namestore_gtk_select_zone_frame">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
<child>
- <object class="GtkLabel"
id="gnunet_namestore_gtk_pseu_label">
+ <object class="GtkAlignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label"
translatable="yes">Preferred zone name (NICK):</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkBox"
id="gnunet_namestore_gtk_select_zone_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">1</property>
+ <child>
+ <object class="GtkComboBox"
id="gnunet_namestore_gtk_zone_combobox">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">False</property>
+ <property
name="model">zone_liststore</property>
+ <property name="has_entry">True</property>
+ <property
name="entry_text_column">0</property>
+ <signal name="changed"
handler="gnunet_namestore_gtk_zone_combobox_changed_cb" swapped="no"/>
+ <child internal-child="entry">
+ <object class="GtkEntry"
id="gnunet_namestore_gtk_zone_entry">
+ <property
name="can_focus">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="padding">5</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton"
id="gnunet_namestore_gtk_zone_del_button">
+ <property
name="label">gtk-delete</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property
name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked"
handler="gnunet_namestore_gtk_zone_del_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">5</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="padding">5</property>
- <property name="position">0</property>
- </packing>
</child>
- <child>
- <object class="GtkEntry"
id="gnunet_namestore_gtk_pseu_entry">
+ <child type="label">
+ <object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="max_length">63</property>
- <property name="invisible_char">●</property>
- <property name="width_chars">32</property>
- <property
name="primary_icon_activatable">False</property>
- <property
name="secondary_icon_activatable">False</property>
- <signal name="changed"
handler="gnunet_namestore_gtk_pseu_entry_changed_cb" swapped="no"/>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text"
translatable="yes">Select zone to edit (below) or delete (button)</property>
+ <property name="label" translatable="yes"> _Select
Zone</property>
+ <property name="use_underline">True</property>
+ <property name="selectable">True</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="padding">5</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox"
id="gnunet_namestore_gtk_zone_combobox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="model">zone_liststore</property>
- <property name="tearoff_title">Ego</property>
- <signal name="changed"
handler="gnunet_namestore_gtk_zone_combobox_changed_cb" swapped="no"/>
- <child>
- <object class="GtkCellRendererText"
id="gnunet_namestore_gtk_zone_ego_name_cellrenderertext"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="fill">True</property>
<property name="padding">5</property>
- <property name="position">2</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkVSeparator"
id="gnunet_namestore_gtk_qr_vseparator">
+ <object class="GtkSeparator"
id="gnunet_namestore_gtk_qr_vseparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="fill">True</property>
<property name="padding">10</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkImage" id="gnunet_namestore_gtk_qr_image">
- <property name="width_request">64</property>
- <property name="height_request">64</property>
+ <property name="width_request">128</property>
+ <property name="height_request">128</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">QR code
for the selected zone</property>
<property name="stock">gtk-missing-image</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="padding">5</property>
<property name="position">2</property>
</packing>
</child>
<child>
- <object class="GtkButton"
id="gnunet_namestore_gtk_qr_saveas_button">
- <property name="label">gtk-save-as</property>
+ <object class="GtkBox"
id="gnunet_namestore_gtk_zone_key_export_button_vbox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- <signal name="clicked"
handler="gnunet_namestore_gtk_qr_saveas_button_clicked_cb" swapped="no"/>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkButton"
id="gnunet_namestore_gtk_qr_saveas_button">
+ <property name="label">gtk-save-as</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Saves
QR code with zone public key to disk.</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked"
handler="gnunet_namestore_gtk_qr_saveas_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">5</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton"
id="gnunet_namestore_gtk_public_key_copy_button">
+ <property name="label">gtk-copy</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text"
translatable="yes">Copies zone public key as text to clipboard.</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked"
handler="gnunet_namestore_gtk_public_key_copy_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">5</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
- <property name="padding">5</property>
- <property name="position">3</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
</packing>
</child>
</object>
@@ -311,128 +461,191 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="gnunet_namestore_gtk_status_label">
+ <object class="GtkFrame"
id="gnunet_namestore_gtk_zone_editing_frame">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label"
translatable="yes"><b><big>Loading...</big></b></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow"
id="gnunet_namestore_gtk_scrolledwindow">
- <property name="can_focus">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
<child>
- <object class="GtkTreeView"
id="gnunet_namestore_gtk_treeview">
+ <object class="GtkAlignment">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property
name="model">gnunet_namestore_gtk_treestore</property>
- <property name="search_column">0</property>
- <signal name="button-press-event"
handler="gnunet_namestore_gtk_treeview_button_press_event_cb" swapped="no"/>
- <signal name="key-press-event"
handler="gnunet_namestore_gtk_treeview_key_press_event_cb" swapped="no"/>
- <signal name="popup-menu"
handler="gnunet_namestore_gtk_treeview_popup_menu_cb" swapped="no"/>
- <child internal-child="selection">
- <object class="GtkTreeSelection"
id="treeview-selection1"/>
- </child>
+ <property name="can_focus">False</property>
+ <property name="left_padding">12</property>
<child>
- <object class="GtkTreeViewColumn"
id="gnunet_namestore_gtk_name_treeviewcolumn">
- <property name="title">Name</property>
- <property name="clickable">True</property>
- <property name="reorderable">True</property>
- <property name="sort_indicator">True</property>
- <property name="sort_column_id">0</property>
+ <object class="GtkBox"
id="gnunet_namestore_gtk_zone_editing_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkCellRendererText"
id="gnunet_namestore_gtk_name_cellrenderertext">
- <signal name="edited"
handler="gnunet_namestore_gtk_name_cellrenderertext_edited_cb" swapped="no"/>
+ <object class="GtkLabel"
id="gnunet_namestore_gtk_status_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes"><b><big>Loading...</big></b></property>
+ <property name="use_markup">True</property>
</object>
- <attributes>
- <attribute name="visible">9</attribute>
- <attribute name="background">13</attribute>
- <attribute name="editable">16</attribute>
- <attribute name="text">0</attribute>
- </attributes>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn"
id="gnunet_namestore_gtk_type_treeviewcolumn">
- <property name="sizing">autosize</property>
- <property name="fixed_width">90</property>
- <property name="title">Type</property>
- <property name="clickable">True</property>
- <property name="reorderable">True</property>
- <property name="sort_indicator">True</property>
- <property name="sort_column_id">3</property>
<child>
- <object class="GtkCellRendererCombo"
id="gnunet_namestore_gtk_type_cellrenderercombo">
- <property
name="model">gnunet_namestore_gtk_type_liststore</property>
- <property name="text_column">1</property>
- <signal name="changed"
handler="gnunet_namestore_gtk_type_cellrenderercombo_changed_cb" swapped="no"/>
+ <object class="GtkScrolledWindow"
id="gnunet_namestore_gtk_scrolledwindow">
+ <property name="can_focus">True</property>
+ <child>
+ <object class="GtkTreeView"
id="gnunet_namestore_gtk_treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property
name="model">gnunet_namestore_gtk_treestore</property>
+ <property name="search_column">0</property>
+ <signal name="button-press-event"
handler="gnunet_namestore_gtk_treeview_button_press_event_cb" swapped="no"/>
+ <signal name="key-press-event"
handler="gnunet_namestore_gtk_treeview_key_press_event_cb" swapped="no"/>
+ <signal name="popup-menu"
handler="gnunet_namestore_gtk_treeview_popup_menu_cb" swapped="no"/>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn"
id="gnunet_namestore_gtk_name_treeviewcolumn">
+ <property name="title">Name</property>
+ <property name="clickable">True</property>
+ <property
name="reorderable">True</property>
+ <property
name="sort_indicator">True</property>
+ <property
name="sort_column_id">0</property>
+ <child>
+ <object class="GtkCellRendererText"
id="gnunet_namestore_gtk_name_cellrenderertext">
+ <signal name="edited"
handler="gnunet_namestore_gtk_name_cellrenderertext_edited_cb" swapped="no"/>
+ </object>
+ <attributes>
+ <attribute name="visible">9</attribute>
+ <attribute
name="background">13</attribute>
+ <attribute
name="editable">16</attribute>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn"
id="gnunet_namestore_gtk_type_treeviewcolumn">
+ <property name="sizing">autosize</property>
+ <property name="fixed_width">90</property>
+ <property name="title">Type</property>
+ <property name="clickable">True</property>
+ <property
name="reorderable">True</property>
+ <property
name="sort_indicator">True</property>
+ <property
name="sort_column_id">3</property>
+ <child>
+ <object class="GtkCellRendererCombo"
id="gnunet_namestore_gtk_type_cellrenderercombo">
+ <property
name="model">gnunet_namestore_gtk_type_liststore</property>
+ <property
name="text_column">1</property>
+ <signal name="changed"
handler="gnunet_namestore_gtk_type_cellrenderercombo_changed_cb" swapped="no"/>
+ </object>
+ <attributes>
+ <attribute
name="visible">10</attribute>
+ <attribute
name="editable">14</attribute>
+ <attribute name="text">3</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn"
id="gnunet_namestore_gtk_value_treeviewcolumn">
+ <property name="sizing">autosize</property>
+ <property name="title">Value</property>
+ <property name="expand">True</property>
+ <property name="clickable">True</property>
+ <property
name="sort_column_id">7</property>
+ <child>
+ <object class="GtkCellRendererText"
id="gnunet_namestore_gtk_value_cellrenderertext"/>
+ <attributes>
+ <attribute
name="sensitive">11</attribute>
+ <attribute
name="visible">10</attribute>
+ <attribute
name="background">8</attribute>
+ <attribute name="text">7</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn"
id="gnunet_namestore_gtk_expiration_treeviewcolumn">
+ <property
name="title">Expiration</property>
+ <property name="clickable">True</property>
+ <property
name="reorderable">True</property>
+ <property
name="sort_indicator">True</property>
+ <property
name="sort_column_id">4</property>
+ <child>
+ <object class="GtkCellRendererText"
id="gnunet_namestore_gtk_expiration_cellrenderertext"/>
+ <attributes>
+ <attribute
name="sensitive">11</attribute>
+ <attribute
name="visible">10</attribute>
+ <attribute
name="background">12</attribute>
+ <attribute name="text">6</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn"
id="gnunet_namestore_gtk_ispublic_treeviewcolumn">
+ <property name="sizing">fixed</property>
+ <property name="fixed_width">50</property>
+ <property name="title">Public</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererToggle"
id="gnunet_namestore_gtk_ispublic_cellrenderertoggle">
+ <property
name="sensitive">False</property>
+ </object>
+ <attributes>
+ <attribute
name="visible">11</attribute>
+ <attribute name="active">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
- <attributes>
- <attribute name="visible">10</attribute>
- <attribute name="editable">14</attribute>
- <attribute name="text">3</attribute>
- </attributes>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn"
id="gnunet_namestore_gtk_value_treeviewcolumn">
- <property name="sizing">autosize</property>
- <property name="title">Value</property>
- <property name="expand">True</property>
- <property name="clickable">True</property>
- <property name="sort_column_id">7</property>
- <child>
- <object class="GtkCellRendererText"
id="gnunet_namestore_gtk_value_cellrenderertext"/>
- <attributes>
- <attribute name="sensitive">11</attribute>
- <attribute name="visible">10</attribute>
- <attribute name="background">8</attribute>
- <attribute name="text">7</attribute>
- </attributes>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</object>
</child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkBox"
id="gnunet_namestore_gtk_zone_editing_frame_label_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
- <object class="GtkTreeViewColumn"
id="gnunet_namestore_gtk_expiration_treeviewcolumn">
- <property name="title">Expiration</property>
- <property name="clickable">True</property>
- <property name="reorderable">True</property>
- <property name="sort_indicator">True</property>
- <property name="sort_column_id">4</property>
- <child>
- <object class="GtkCellRendererText"
id="gnunet_namestore_gtk_expiration_cellrenderertext"/>
- <attributes>
- <attribute name="sensitive">11</attribute>
- <attribute name="visible">10</attribute>
- <attribute name="background">12</attribute>
- <attribute name="text">6</attribute>
- </attributes>
- </child>
+ <object class="GtkLabel"
id="gnunet_namestore_gtk_zone_editing_frame_fixed_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"> _Edit Zone
</property>
+ <property name="use_underline">True</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
- <object class="GtkTreeViewColumn"
id="gnunet_namestore_gtk_ispublic_treeviewcolumn">
- <property name="sizing">fixed</property>
- <property name="fixed_width">50</property>
- <property name="title">Public</property>
- <property name="clickable">True</property>
- <child>
- <object class="GtkCellRendererToggle"
id="gnunet_namestore_gtk_ispublic_cellrenderertoggle">
- <property name="sensitive">False</property>
- </object>
- <attributes>
- <attribute name="visible">11</attribute>
- <attribute name="active">1</attribute>
- </attributes>
- </child>
+ <object class="GtkLabel"
id="gnunet_namestore_gtk_zone_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"><b>SET
TO PUBLIC KEY OF THE ZONE</b></property>
+ <property name="use_markup">True</property>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">5</property>
+ <property name="position">1</property>
+ </packing>
</child>
</object>
</child>
@@ -440,7 +653,8 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="padding">5</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
@@ -450,57 +664,6 @@
<property name="position">0</property>
</packing>
</child>
- <child internal-child="action_area">
- <object class="GtkButtonBox"
id="gnunet_namestore_gtk_dialog-action_area">
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton"
id="gnunet_namestore_gtk_cancel_button">
- <property name="label">gtk-cancel</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton"
id="gnunet_namestore_gtk_save_as_button">
- <property name="label">gtk-save-as</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</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>
- <child>
- <object class="GtkButton" id="gnunet_namestore_gtk_save_button">
- <property name="label">gtk-save</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">1</property>
- </packing>
- </child>
</object>
</child>
<action-widgets>
@@ -508,5 +671,8 @@
<action-widget
response="-5">gnunet_namestore_gtk_save_as_button</action-widget>
<action-widget
response="-3">gnunet_namestore_gtk_save_button</action-widget>
</action-widgets>
+ <child>
+ <placeholder/>
+ </child>
</object>
</interface>
diff --git a/src/conversation/gnunet-conversation-gtk_phone.c
b/src/conversation/gnunet-conversation-gtk_phone.c
index a6cc9ff0..7f2f90a0 100644
--- a/src/conversation/gnunet-conversation-gtk_phone.c
+++ b/src/conversation/gnunet-conversation-gtk_phone.c
@@ -1716,7 +1716,7 @@
gnunet_conversation_gtk_ego_label_entry_preedit_changed_cb (GtkEntry *entry,
{
GCG_log (_("Invalid label `%s'\n"),
preedit);
- gdk_beep ();
+ gdk_display_beep (gdk_display_get_default());
return;
}
cbt = GTK_COMBO_BOX_TEXT (GCG_get_main_window_object
diff --git a/src/namestore/gnunet-namestore-gtk.c
b/src/namestore/gnunet-namestore-gtk.c
index 0cec62b4..d6f6e53d 100644
--- a/src/namestore/gnunet-namestore-gtk.c
+++ b/src/namestore/gnunet-namestore-gtk.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet
- Copyright (C) 2012, 2013, 2014 GNUnet e.V.
+ Copyright (C) 2012, 2013, 2014, 2018 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -36,6 +36,12 @@
* Text we use for the 'name' entry for the user to select
* for creating a new name.
*/
+#define NEW_ZONE_STR gettext_noop ("<new zone>")
+
+/**
+ * Text we use for the 'name' entry for the user to select
+ * for creating a new name.
+ */
#define NEW_NAME_STR gettext_noop ("<new name>")
/**
@@ -295,12 +301,12 @@ struct RecordInfo
void *data;
/**
- * Number of bytes in 'data'.
+ * Number of bytes in @e data.
*/
size_t data_size;
/**
- * Number of records serialized in 'data'.
+ * Number of records serialized in @e data.
*/
unsigned int rd_count;
@@ -308,6 +314,49 @@ struct RecordInfo
/**
+ * Representation of a TLD, mapping the respective TLD string
+ * (i.e. ".gnu") to the respective public key of the zone.
+ */
+struct GNS_TopLevelDomain
+{
+
+ /**
+ * Kept in a DLL, as there are unlikely enough of these to
+ * warrant a hash map.
+ */
+ struct GNS_TopLevelDomain *next;
+
+ /**
+ * Kept in a DLL, as there are unlikely enough of these to
+ * warrant a hash map.
+ */
+ struct GNS_TopLevelDomain *prev;
+
+ /**
+ * Public key associated with the @a tld.
+ */
+ struct GNUNET_CRYPTO_EddsaPublicKey pkey;
+
+ /**
+ * Top-level domain as a string, including leading ".".
+ */
+ char *tld;
+
+};
+
+
+
+/**
+ * Head of DLL of TLDs we map to GNS zones.
+ */
+static struct GNS_TopLevelDomain *tld_head;
+
+/**
+ * Tail of DLL of TLDs we map to GNS zones.
+ */
+static struct GNS_TopLevelDomain *tld_tail;
+
+/**
* When do NICK records expire?
*/
static struct GNUNET_TIME_Relative nick_expiration_time;
@@ -379,10 +428,9 @@ static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
static char *current_pseudonym;
/**
- * Pointer to name of the configuration option that gives the
- * zone key for the zone we are editing right now.
+ * Currently selected entry in #zone_liststore.
*/
-static char *current_zone_option;
+static GtkTreeIter zone_iter;
/**
* List of all known zones/egos.
@@ -405,11 +453,26 @@ static struct GNUNET_GTK_MainLoop *ml;
static GtkWidget *main_window;
/**
+ * Status label in main window.
+ */
+static GtkLabel *status_label;
+
+/**
+ * Zone combo box in the main window.
+ */
+static GtkComboBox *zone_combo_box;
+
+/**
* Our configuration.
*/
static const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
+ * Ongoing identity operation.
+ */
+struct GNUNET_IDENTITY_Operation *iop;
+
+/**
* Global return value (for success/failure of gnunet-setup).
*/
static int gret;
@@ -446,15 +509,9 @@ create_qrcode (unsigned int scale)
QRinput * qri;
QRcode *qrc;
char *str;
- const gchar *pseu;
- GtkEntry *entry;
GdkPixbuf *pb;
- unsigned int x;
- unsigned int y;
- unsigned int off;
guchar *pixels;
int n_channels;
- int c;
const char *dir;
char *fn;
unsigned int size;
@@ -467,12 +524,10 @@ create_qrcode (unsigned int scale)
"QRinput_new2");
return NULL;
}
- entry = GTK_ENTRY (get_object ("gnunet_namestore_gtk_pseu_entry"));
- pseu = gtk_entry_get_text (GTK_ENTRY(entry));
GNUNET_asprintf (&str,
"gnunet://gns/%s/%s",
GNUNET_GNSRECORD_z2s (&pubkey),
- pseu);
+ current_pseudonym);
upper = GNUNET_strdup (str);
GNUNET_STRINGS_utf8_toupper (str,
upper);
@@ -521,17 +576,18 @@ create_qrcode (unsigned int scale)
GNUNET_free (fn);
if (NULL == pb)
{
+ QRcode_free (qrc);
QRinput_free (qri);
return NULL;
}
pixels = gdk_pixbuf_get_pixels (pb);
n_channels = gdk_pixbuf_get_n_channels (pb);
- for (x=0;x<size;x++)
- for (y=0;y<size;y++)
+ for (unsigned int x=0;x<size;x++)
+ for (unsigned int y=0;y<size;y++)
{
- off = (x * qrc->width / size) +
+ unsigned int off = (x * qrc->width / size) +
(y * qrc->width / size) * qrc->width;
- for (c = 0; c < n_channels; c++)
+ for (int c = 0; c < n_channels; c++)
pixels[(y * size + x) * n_channels + c] = (0 == (qrc->data[off] & 1)) ?
0xFF : 0;
}
QRcode_free (qrc);
@@ -627,12 +683,8 @@ gnunet_namestore_gtk_qr_saveas_button_clicked_cb
(GtkButton *button,
{
GtkBuilder *builder;
GtkWindow *dialog;
- const gchar *pseu;
- GtkEntry *entry;
char *suggestion;
- entry = GTK_ENTRY (get_object ("gnunet_namestore_gtk_pseu_entry"));
- pseu = gtk_entry_get_text (GTK_ENTRY(entry));
builder =
GNUNET_GTK_get_new_builder ("gnunet_namestore_gtk_qr_save_as_dialog.glade",
NULL);
@@ -643,9 +695,10 @@ gnunet_namestore_gtk_qr_saveas_button_clicked_cb
(GtkButton *button,
}
GNUNET_asprintf (&suggestion,
"%s.png",
- pseu);
+ current_pseudonym);
dialog = GTK_WINDOW (gtk_builder_get_object
- (builder, "gnunet_namestore_gtk_qr_save_as_dialog"));
+ (builder,
+ "gnunet_namestore_gtk_qr_save_as_dialog"));
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog),
suggestion);
GNUNET_free (suggestion);
@@ -667,11 +720,10 @@ check_record_permitted (unsigned int rd_count,
const struct GNUNET_GNSRECORD_Data *rd,
gint n_type)
{
- unsigned int i;
unsigned int nick;
nick = 0;
- for (i=0;i<rd_count;i++)
+ for (unsigned int i=0;i<rd_count;i++)
{
switch (rd[i].record_type)
{
@@ -747,7 +799,7 @@ operation_done_cont (void *cls,
* Release the record info.
*
* @param cls NULL
- * @param key unused
+ * @param key key for @a value in the #n2r map
* @param value a RecordInfo to release
* @return #GNUNET_OK (continue to iterate)
*/
@@ -757,12 +809,15 @@ release_ri (void *cls,
void *value)
{
struct RecordInfo *ri = value;
+ (void) cls;
gtk_tree_row_reference_free (ri->rr);
GNUNET_free_non_null (ri->data);
GNUNET_free (ri->name);
GNUNET_break (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (n2r, key, ri));
+ GNUNET_CONTAINER_multihashmap_remove (n2r,
+ key,
+ ri));
GNUNET_free (ri);
return GNUNET_OK;
}
@@ -774,24 +829,17 @@ release_ri (void *cls,
static void
clear_zone_view ()
{
- GtkEntry *pseu_entry;
-
- pseu_entry = GTK_ENTRY((get_object ("gnunet_namestore_gtk_pseu_entry")));
- gtk_entry_set_text (pseu_entry, "");
- GNUNET_free_non_null (current_zone_option);
- current_zone_option = NULL;
GNUNET_free_non_null (current_pseudonym);
current_pseudonym = NULL;
GNUNET_CONTAINER_multihashmap_iterate (n2r,
&release_ri,
NULL);
- gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_zone_combobox")));
- gtk_widget_show (GTK_WIDGET (get_object
("gnunet_namestore_gtk_status_label")));
+ gtk_widget_hide (GTK_WIDGET (zone_combo_box));
+ gtk_widget_show (GTK_WIDGET (status_label));
gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_scrolledwindow")));
gtk_widget_hide (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_image")));
gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_qr_saveas_button")));
gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_qr_vseparator")));
- gtk_widget_hide (GTK_WIDGET (get_object ("gnunet_namestore_gtk_pseu_hbox")));
gtk_tree_store_clear (ts);
}
@@ -816,7 +864,10 @@ show_error_message (const char *title,
_("%s\n%s\n"),
title,
emsg));
- g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
+ g_signal_connect (dialog,
+ "response",
+ G_CALLBACK (gtk_widget_destroy),
+ NULL);
gtk_widget_show_all (GTK_WIDGET(dialog));
}
@@ -853,9 +904,12 @@ merge_with_existing_records (void *cls,
struct GNUNET_GNSRECORD_Data rd_new[rd_count + 1];
struct OperationContext *oc;
- GNUNET_CONTAINER_DLL_remove (moc_head, moc_tail, moc);
+ GNUNET_CONTAINER_DLL_remove (moc_head,
+ moc_tail,
+ moc);
if (GNUNET_OK !=
- check_record_permitted (rd_count, rd,
+ check_record_permitted (rd_count,
+ rd,
edc->record_type))
{
show_error_message (_("Record combination not permitted"),
@@ -866,17 +920,22 @@ merge_with_existing_records (void *cls,
return;
}
- memcpy (rd_new, rd, rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
+ memcpy (rd_new,
+ rd,
+ rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
rd_new[rd_count] = moc->rd;
/* FIXME: sanity-check merge... */
oc = GNUNET_new (struct OperationContext);
- GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
+ GNUNET_CONTAINER_DLL_insert (oc_head,
+ oc_tail,
+ oc);
oc->qe = GNUNET_NAMESTORE_records_store (namestore,
&moc->pk,
edc->name,
rd_count + 1,
rd_new,
- &operation_done_cont, oc);
+ &operation_done_cont,
+ oc);
GNUNET_free (moc->data);
GNUNET_free (moc);
free_edit_dialog_context (edc);
@@ -910,7 +969,9 @@ handle_records_for_merge (void *cls,
}
GNUNET_NAMESTORE_zone_iteration_stop (moc->it);
moc->it = NULL;
- merge_with_existing_records (moc, rd_count, rd);
+ merge_with_existing_records (moc,
+ rd_count,
+ rd);
}
@@ -1025,12 +1086,17 @@ edit_dialog_continuation (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc,
struct GNUNET_GNSRECORD_Data rd_new[rd_count - 1];
GNUNET_assert (NULL != ri);
- memcpy (rd_new, rd_old, (rd_count - 1) * sizeof (struct
GNUNET_GNSRECORD_Data));
+ memcpy (rd_new,
+ rd_old,
+ (rd_count - 1) * sizeof (struct GNUNET_GNSRECORD_Data));
rd_new[edc->off] = rd_old[rd_count - 1];
oc = GNUNET_new (struct OperationContext);
- GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
+ GNUNET_CONTAINER_DLL_insert (oc_head,
+ oc_tail,
+ oc);
oc->qe = GNUNET_NAMESTORE_records_store (namestore,
- pkey, edc->name,
+ pkey,
+ edc->name,
rd_count - 1,
rd_new,
&operation_done_cont, oc);
@@ -1044,19 +1110,24 @@ edit_dialog_continuation (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc,
case GTK_RESPONSE_OK:
/* update model */
if (0 == strcmp (edc->new_zone_option,
- current_zone_option))
+ current_pseudonym))
{
if (GNUNET_YES == edc->old_record_in_namestore)
{
struct GNUNET_GNSRECORD_Data rd_new[rd_count];
GNUNET_assert (NULL != ri);
- memcpy (rd_new, rd_old, rd_count * sizeof (struct
GNUNET_GNSRECORD_Data));
+ memcpy (rd_new,
+ rd_old,
+ rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
rd_new[edc->off] = rd;
oc = GNUNET_new (struct OperationContext);
- GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
+ GNUNET_CONTAINER_DLL_insert (oc_head,
+ oc_tail,
+ oc);
oc->qe = GNUNET_NAMESTORE_records_store (namestore,
- pkey, edc->name,
+ pkey,
+ edc->name,
rd_count,
rd_new,
&operation_done_cont, oc);
@@ -1065,12 +1136,17 @@ edit_dialog_continuation (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc,
{
struct GNUNET_GNSRECORD_Data rd_new[rd_count + 1];
- memcpy (rd_new, rd_old, rd_count * sizeof (struct
GNUNET_GNSRECORD_Data));
+ memcpy (rd_new,
+ rd_old,
+ rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
rd_new[rd_count] = rd;
oc = GNUNET_new (struct OperationContext);
- GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
+ GNUNET_CONTAINER_DLL_insert (oc_head,
+ oc_tail,
+ oc);
oc->qe = GNUNET_NAMESTORE_records_store (namestore,
- pkey, edc->name,
+ pkey,
+ edc->name,
rd_count + 1,
rd_new,
&operation_done_cont, oc);
@@ -1094,7 +1170,9 @@ edit_dialog_continuation (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc,
moc->rd = rd;
moc->edc = edc;
moc->pk = *pk;
- GNUNET_CONTAINER_DLL_insert (moc_head, moc_tail, moc);
+ GNUNET_CONTAINER_DLL_insert (moc_head,
+ moc_tail,
+ moc);
moc->it = GNUNET_NAMESTORE_zone_iteration_start (namestore,
pk,
&handle_records_for_merge_error,
@@ -1110,12 +1188,17 @@ edit_dialog_continuation (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc,
struct GNUNET_GNSRECORD_Data rd_new[rd_count - 1];
GNUNET_assert (NULL != ri);
- memcpy (rd_new, rd_old, (rd_count - 1) * sizeof (struct
GNUNET_GNSRECORD_Data));
+ memcpy (rd_new,
+ rd_old,
+ (rd_count - 1) * sizeof (struct GNUNET_GNSRECORD_Data));
rd_new[edc->off] = rd_old[rd_count - 1];
oc = GNUNET_new (struct OperationContext);
- GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
+ GNUNET_CONTAINER_DLL_insert (oc_head,
+ oc_tail,
+ oc);
oc->qe = GNUNET_NAMESTORE_records_store (namestore,
- pkey, edc->name,
+ pkey,
+ edc->name,
rd_count - 1,
rd_new,
&operation_done_cont, oc);
@@ -1179,10 +1262,13 @@ check_validity (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder,
"edit_dialog_name_entry"));
name = gtk_editable_get_chars (entry, 0, -1);
- if ( (GNUNET_OK != edc->plugin->validate (edc->plugin->cls,
- edc->builder)) ||
- ( (GNUNET_SYSERR == GNUNET_DNSPARSER_check_label (name)) &&
- (0 != strcmp (name, GNUNET_GNS_MASTERZONE_STR))) )
+ if ( (GNUNET_OK !=
+ edc->plugin->validate (edc->plugin->cls,
+ edc->builder)) ||
+ ( (GNUNET_SYSERR ==
+ GNUNET_DNSPARSER_check_label (name)) &&
+ (0 != strcmp (name,
+ GNUNET_GNS_MASTERZONE_STR))) )
{
edit_dialog_disable_save (edc);
return;
@@ -1298,9 +1384,11 @@ edit_dialog_setup_common_elements (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment
ls = GTK_LIST_STORE (gtk_combo_box_get_model (cb));
gtk_list_store_insert_with_values (ls, &iter,
-1 /* position: append */,
- 0, GNUNET_STRINGS_relative_time_to_string
(rt, GNUNET_NO),
+ 0, GNUNET_STRINGS_relative_time_to_string
(rt,
+
GNUNET_NO),
-1);
- gtk_combo_box_set_active_iter (cb, &iter);
+ gtk_combo_box_set_active_iter (cb,
+ &iter);
if ( (! edc->n_is_relative) &&
(GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us != edc->n_exp_time) )
{
@@ -1378,7 +1466,8 @@ edit_dialog_putes_common_elements (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment
cb = GTK_COMBO_BOX (gtk_builder_get_object (edc->builder,
"edit_dialog_expiration_relative_combobox"));
tm = gtk_combo_box_get_model (cb);
- if (! gtk_combo_box_get_active_iter (cb, &iter))
+ if (! gtk_combo_box_get_active_iter (cb,
+ &iter))
{
GNUNET_break (0);
return;
@@ -1435,7 +1524,8 @@ edit_dialog_putes_common_elements (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment
cb = GTK_COMBO_BOX (gtk_builder_get_object (edc->builder,
"edit_dialog_zone_combobox"));
tm = gtk_combo_box_get_model (cb);
- if (! gtk_combo_box_get_active_iter (cb, &iter))
+ if (! gtk_combo_box_get_active_iter (cb,
+ &iter))
{
GNUNET_break (0);
}
@@ -1512,14 +1602,12 @@ add_symbols (GtkBuilder *builder,
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
- unsigned int i;
GCallback cb;
- GModule *m;
cb = NULL;
if (NULL != edc->plugin->symbols)
{
- for (i=0; NULL != edc->plugin->symbols[i].name; i++)
+ for (unsigned int i=0; NULL != edc->plugin->symbols[i].name; i++)
{
if (0 == strcmp (handler_name,
edc->plugin->symbols[i].name))
@@ -1531,7 +1619,10 @@ add_symbols (GtkBuilder *builder,
}
if (NULL == cb)
{
- m = g_module_open (NULL, 0);
+ GModule *m;
+
+ m = g_module_open (NULL,
+ 0);
if (! g_module_symbol (m,
handler_name,
(void **) &cb))
@@ -1586,7 +1677,7 @@ launch_edit_dialog (gint n_type,
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc;
- if (NULL == current_zone_option)
+ if (NULL == current_pseudonym)
{
GNUNET_break (0);
return;
@@ -1618,7 +1709,7 @@ launch_edit_dialog (gint n_type,
edc->ri = ri;
edc->off = off;
edc->name = GNUNET_strdup (name);
- edc->new_zone_option = g_strdup (current_zone_option);
+ edc->new_zone_option = g_strdup (current_pseudonym);
edc->zone_liststore = zone_liststore;
edc->check_validity = &check_validity;
GNUNET_asprintf (&edc->liblow,
@@ -1707,8 +1798,7 @@ check_permissions (struct RecordInfo *ri,
/**
- * User selected 'edit' in the popup menu. Edit the
- * selected row.
+ * User selected 'edit' in the popup menu. Edit the selected row.
*
* @param widget the GtkTreeView
* @param user_data main window builder
@@ -1726,7 +1816,9 @@ gnunet_namestore_gtk_popup_edit_button_activate_cb
(GtkWidget *widget,
struct GNUNET_HashCode name_hash;
sel = gtk_tree_view_get_selection (tv);
- if (! gtk_tree_selection_get_selected (sel, NULL, &iter))
+ if (! gtk_tree_selection_get_selected (sel,
+ NULL,
+ &iter))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"No row selected\n");
@@ -1785,7 +1877,9 @@ gnunet_namestore_gtk_type_cellrenderercombo_changed_cb
(GtkCellRendererText *tex
GNS_TYPE_TO_NAME_LISTSTORE_COLUMN_TYPE, &type,
-1);
/* check if this is a new record */
- if (! gtk_tree_model_get_iter_from_string (tm, &it, path_string))
+ if (! gtk_tree_model_get_iter_from_string (tm,
+ &it,
+ path_string))
{
GNUNET_break (0);
return;
@@ -1798,11 +1892,18 @@ gnunet_namestore_gtk_type_cellrenderercombo_changed_cb
(GtkCellRendererText *tex
GNUNET_break (0);
return;
}
- GNUNET_CRYPTO_hash (name_str, strlen (name_str), &name_hash);
- ri = GNUNET_CONTAINER_multihashmap_get (n2r, &name_hash);
+ GNUNET_CRYPTO_hash (name_str,
+ strlen (name_str),
+ &name_hash);
+ ri = GNUNET_CONTAINER_multihashmap_get (n2r,
+ &name_hash);
if ( (NULL == ri) ||
- (GNUNET_OK == check_permissions (ri, type)) )
- launch_edit_dialog (type, name_str, ri, UINT_MAX);
+ (GNUNET_OK == check_permissions (ri,
+ type)) )
+ launch_edit_dialog (type,
+ name_str,
+ ri,
+ UINT_MAX);
g_free (name_str);
}
@@ -1831,20 +1932,25 @@ gnunet_namestore_gtk_name_cellrenderertext_edited_cb
(GtkCellRendererText *rende
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"New text for `%s' is `%s'\n",
- path, new_text);
- if ((0 == strcmp (new_text, NEW_NAME_STR)) || (0 == strcmp (new_text, "")))
+ path,
+ new_text);
+ if ((0 == strcmp (new_text,
+ NEW_NAME_STR)) ||
+ (0 == strcmp (new_text,
+ "")))
return;
- if ( (GNUNET_OK !=
- GNUNET_DNSPARSER_check_label (new_text)) &&
- (0 != strcmp (new_text, GNUNET_GNS_MASTERZONE_STR)) )
+ if (GNUNET_OK !=
+ GNUNET_DNSPARSER_check_label (new_text))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Name `%s' invalid for GNS/DNS (too long for a DNS
label?)\n"),
new_text);
- gdk_beep ();
+ gtk_widget_error_bell (GTK_WIDGET (main_window));
return;
}
- if (! gtk_tree_model_get_iter_from_string (tm, &it, path))
+ if (! gtk_tree_model_get_iter_from_string (tm,
+ &it,
+ path))
{
GNUNET_break (0);
return;
@@ -1857,7 +1963,9 @@ gnunet_namestore_gtk_name_cellrenderertext_edited_cb
(GtkCellRendererText *rende
GNUNET_break (0 == strcmp (name, _(NEW_NAME_STR)));
g_free (name);
- GNUNET_CRYPTO_hash (new_text, strlen (new_text), &name_hash);
+ GNUNET_CRYPTO_hash (new_text,
+ strlen (new_text),
+ &name_hash);
ri = GNUNET_CONTAINER_multihashmap_get (n2r,
&name_hash);
if (NULL != ri)
@@ -1874,7 +1982,8 @@ gnunet_namestore_gtk_name_cellrenderertext_edited_cb
(GtkCellRendererText *rende
/* change dummy line to new name, then add new dummy */
ri = GNUNET_new (struct RecordInfo);
- gtk_tree_store_set (ts, &it,
+ gtk_tree_store_set (ts,
+ &it,
GNS_TREESTORE_COL_NAME, new_text,
GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE,
GNS_TREESTORE_COL_RECORD_TYPE, 0,
@@ -1897,7 +2006,10 @@ gnunet_namestore_gtk_name_cellrenderertext_edited_cb
(GtkCellRendererText *rende
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
/* add a new dummy line */
- gtk_tree_store_insert_with_values (ts, &it,NULL, 0,
+ gtk_tree_store_insert_with_values (ts,
+ &it,
+ NULL,
+ 0,
GNS_TREESTORE_COL_NAME, _(NEW_NAME_STR),
GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE,
GNS_TREESTORE_COL_RECORD_TYPE,
GNUNET_DNSPARSER_TYPE_A,
@@ -1927,7 +2039,9 @@ create_popup_menu ()
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Considering creating popup menu...\n");
sel = gtk_tree_view_get_selection (tv);
- if (! gtk_tree_selection_get_selected (sel, NULL, &it))
+ if (! gtk_tree_selection_get_selected (sel,
+ NULL,
+ &it))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"No row selected\n");
@@ -2037,7 +2151,9 @@ gnunet_namestore_gtk_treeview_key_press_event_cb
(GtkWidget *widget,
(GDK_KEY_Delete != event_key->keyval) )
return FALSE;
sel = gtk_tree_view_get_selection (tv);
- if (! gtk_tree_selection_get_selected (sel, NULL, &iter))
+ if (! gtk_tree_selection_get_selected (sel,
+ NULL,
+ &iter))
return TRUE; /* nothing selected */
gtk_tree_model_get (tm, &iter,
GNS_TREESTORE_COL_NOT_DUMMY_ROW, ¬_dummy,
@@ -2048,12 +2164,16 @@ gnunet_namestore_gtk_treeview_key_press_event_cb
(GtkWidget *widget,
g_free (name);
return TRUE; /* do not delete the dummy line */
}
- GNUNET_CRYPTO_hash (name, strlen (name), &name_hash);
+ GNUNET_CRYPTO_hash (name,
+ strlen (name),
+ &name_hash);
ri = GNUNET_CONTAINER_multihashmap_get (n2r,
&name_hash);
GNUNET_assert (NULL != ri);
- if ( (gtk_tree_model_iter_parent (tm, &parent, &iter)) &&
+ if ( (gtk_tree_model_iter_parent (tm,
+ &parent,
+ &iter)) &&
(ri->rd_count > 0) )
{
struct GNUNET_GNSRECORD_Data rd_old[ri->rd_count];
@@ -2096,8 +2216,10 @@ gnunet_namestore_gtk_treeview_key_press_event_cb
(GtkWidget *widget,
rd.record_type = n_type;
rd.expiration_time = n_exp_time;
if (GNUNET_OK !=
- GNUNET_GNSRECORD_string_to_value (n_type, n_value,
- (void**)&rd.data, &rd.data_size))
+ GNUNET_GNSRECORD_string_to_value (n_type,
+ n_value,
+ (void**) &rd.data,
+ &rd.data_size))
{
/* can't remove, value invalid */
GNUNET_assert (0);
@@ -2111,12 +2233,15 @@ gnunet_namestore_gtk_treeview_key_press_event_cb
(GtkWidget *widget,
&rd_old[off]))
break;
GNUNET_assert (off != ri->rd_count);
- memcpy (rd_new, rd_old, (ri->rd_count - 1) * sizeof (struct
GNUNET_GNSRECORD_Data));
+ memcpy (rd_new,
+ rd_old,
+ (ri->rd_count - 1) * sizeof (struct GNUNET_GNSRECORD_Data));
rd_new[off] = rd_old[ri->rd_count - 1];
oc = GNUNET_new (struct OperationContext);
GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
oc->qe = GNUNET_NAMESTORE_records_store (namestore,
- pkey, name,
+ pkey,
+ name,
ri->rd_count - 1,
rd_new,
&operation_done_cont, oc);
@@ -2127,7 +2252,8 @@ gnunet_namestore_gtk_treeview_key_press_event_cb
(GtkWidget *widget,
oc = GNUNET_new (struct OperationContext);
GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
oc->qe = GNUNET_NAMESTORE_records_store (namestore,
- pkey, name,
+ pkey,
+ name,
0, NULL,
&operation_done_cont, oc);
}
@@ -2138,107 +2264,6 @@ gnunet_namestore_gtk_treeview_key_press_event_cb
(GtkWidget *widget,
/**
- * The user edited the preferred name (PSEU) of this namespace.
- * Push the update to the namestore.
- *
- * @param editable the edited widget
- * @param user_data unused
- */
-void
-gnunet_namestore_gtk_pseu_entry_changed_cb (GtkEditable *editable,
- gpointer user_data)
-{
- const gchar *pseu;
- struct RecordInfo *ri;
- struct GNUNET_HashCode hc;
- unsigned int rd_count;
- struct OperationContext *oc;
-
- if (NULL == namestore)
- return; /* during shutdown */
- pseu = gtk_entry_get_text (GTK_ENTRY (editable));
- if ( (NULL != current_pseudonym) &&
- (0 == strcmp (pseu,
- current_pseudonym)) )
- return;
- if (GNUNET_OK !=
- GNUNET_DNSPARSER_check_label (pseu))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Name `%s' invalid for GNS (too long for a DNS label?)\n"),
- pseu);
- gdk_beep ();
- gtk_entry_set_text (GTK_ENTRY (editable),
- current_pseudonym);
- return;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "New Pseudonym is `%s'\n",
- pseu);
- GNUNET_free_non_null (current_pseudonym);
- if ( (NULL != pseu) &&
- (0 != strlen (pseu)) )
- current_pseudonym = GNUNET_strdup (pseu);
- else
- current_pseudonym = NULL;
-
- GNUNET_CRYPTO_hash ("+", 1, &hc);
- ri = GNUNET_CONTAINER_multihashmap_get (n2r, &hc);
- if (NULL == ri)
- rd_count = 0;
- else
- rd_count = ri->rd_count;
-
- /* get old records, append new one or update/remove existing one */
- {
- struct GNUNET_GNSRECORD_Data rd_old[rd_count];
- struct GNUNET_GNSRECORD_Data rd_new[rd_count + 1];
- unsigned int off;
- unsigned int total;
-
- total = rd_count;
- if (NULL != ri)
- GNUNET_break (GNUNET_OK ==
- GNUNET_GNSRECORD_records_deserialize (ri->data_size,
- ri->data,
- rd_count,
- rd_old));
- memcpy (rd_new, rd_old, sizeof (struct GNUNET_GNSRECORD_Data) * rd_count);
- for (off=0;off<rd_count;off++)
- if (GNUNET_GNSRECORD_TYPE_NICK == rd_new[off].record_type)
- break;
- if (off == rd_count)
- total++;
- if ( (NULL == pseu) ||
- (0 == strlen (pseu)) )
- {
- rd_new[off] = rd_new[rd_count - 1];
- total--;
- }
- else
- {
- rd_new[off].record_type = GNUNET_GNSRECORD_TYPE_NICK;
- rd_new[off].expiration_time = nick_expiration_time.rel_value_us;
- rd_new[off].flags = GNUNET_GNSRECORD_RF_PRIVATE |
GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
- rd_new[off].data_size = strlen (pseu) + 1;
- rd_new[off].data = pseu;
- }
- oc = GNUNET_new (struct OperationContext);
- GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
- oc->qe = GNUNET_NAMESTORE_records_store (namestore,
- pkey,
- GNUNET_GNS_MASTERZONE_STR,
- total,
- rd_new,
- &operation_done_cont, oc);
- }
-#if HAVE_QRENCODE_H
- setup_qrcode ();
-#endif
-}
-
-
-/**
* The user clicked on the 'copy' button. Copy the full string
* with the hash of our public key to the clipboard.
*
@@ -2247,7 +2272,7 @@ gnunet_namestore_gtk_pseu_entry_changed_cb (GtkEditable
*editable,
*/
void
gnunet_namestore_gtk_public_key_copy_button_clicked_cb (GtkButton *button,
- gpointer user_data)
+ gpointer user_data)
{
GtkClipboard *cb;
@@ -2269,7 +2294,6 @@ gnunet_namestore_gtk_public_key_copy_button_clicked_cb
(GtkButton *button,
static void
zone_sync_proc (void *cls)
{
- gtk_widget_show (GTK_WIDGET (get_object ("gnunet_namestore_gtk_pseu_hbox")));
#if HAVE_QRENCODE_H
setup_qrcode ();
gtk_widget_show (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_image")));
@@ -2280,9 +2304,9 @@ zone_sync_proc (void *cls)
gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_qr_saveas_button")));
gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_qr_vseparator")));
#endif
- gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_status_label")));
+ gtk_widget_hide (GTK_WIDGET (status_label));
gtk_widget_show (GTK_WIDGET (get_object
("gnunet_namestore_gtk_scrolledwindow")));
- gtk_widget_show (GTK_WIDGET (get_object
("gnunet_namestore_gtk_zone_combobox")));
+ gtk_widget_show (GTK_WIDGET (zone_combo_box));
}
@@ -2296,7 +2320,6 @@ static void
zone_iteration_error (void *cls)
{
clear_zone_view ();
- gtk_widget_hide (GTK_WIDGET (get_object ("gnunet_namestore_gtk_pseu_hbox")));
#if HAVE_QRENCODE_H
setup_qrcode ();
gtk_widget_hide (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_image")));
@@ -2307,9 +2330,38 @@ zone_iteration_error (void *cls)
gtk_widget_show (GTK_WIDGET (get_object
("gnunet_namestore_gtk_qr_saveas_button")));
gtk_widget_show (GTK_WIDGET (get_object
("gnunet_namestore_gtk_qr_vseparator")));
#endif
- gtk_widget_show (GTK_WIDGET (get_object
("gnunet_namestore_gtk_status_label")));
+ gtk_widget_show (GTK_WIDGET (status_label));
gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_scrolledwindow")));
- gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_zone_combobox")));
+ gtk_widget_hide (GTK_WIDGET (zone_combo_box));
+}
+
+
+/**
+ * A set of records is completely empty, remove it
+ * from the hashmap and free associated memory.
+ *
+ * @param ri record info to release
+ */
+static void
+free_ri (struct RecordInfo *ri)
+{
+ GtkTreePath *path;
+ GtkTreeIter iter_name;
+ struct GNUNET_HashCode name_hash;
+
+ path = gtk_tree_row_reference_get_path (ri->rr);
+ GNUNET_assert (gtk_tree_model_get_iter (tm,
+ &iter_name,
+ path));
+ gtk_tree_path_free (path);
+ gtk_tree_store_remove (ts,
+ &iter_name);
+ GNUNET_CRYPTO_hash (ri->name,
+ strlen (ri->name),
+ &name_hash);
+ release_ri (NULL,
+ &name_hash,
+ ri);
}
@@ -2334,7 +2386,6 @@ zone_iteration_proc (void *cls,
GtkTreePath *path;
GtkTreeIter iter_name;
GtkTreeIter iter_record;
- int c;
const char *exp;
char *val;
char *type_str;
@@ -2342,7 +2393,6 @@ zone_iteration_proc (void *cls,
gboolean is_public;
gboolean is_shadow;
guint64 exp_t;
- GtkEntry *pseu_entry;
struct GNUNET_HashCode name_hash;
struct RecordInfo *ri;
GtkTreeSelection *sel;
@@ -2365,11 +2415,14 @@ zone_iteration_proc (void *cls,
strlen (name),
&name_hash);
sel = gtk_tree_view_get_selection (tv);
- if (gtk_tree_selection_get_selected (sel, NULL, &sel_iter))
+ if (gtk_tree_selection_get_selected (sel,
+ NULL,
+ &sel_iter))
sel_path = gtk_tree_model_get_path (tm, &sel_iter);
else
sel_path = NULL;
- ri = GNUNET_CONTAINER_multihashmap_get (n2r, &name_hash);
+ ri = GNUNET_CONTAINER_multihashmap_get (n2r,
+ &name_hash);
if (NULL != ri)
{
rr = ri->rr;
@@ -2379,8 +2432,11 @@ zone_iteration_proc (void *cls,
path));
gtk_tree_path_free (path);
/* remove all records, we'll re-add those that are left next */
- if (gtk_tree_model_iter_children (tm, &iter_record, &iter_name))
- while (gtk_tree_store_remove (ts, &iter_record)) ;
+ if (gtk_tree_model_iter_children (tm,
+ &iter_record,
+ &iter_name))
+ while (gtk_tree_store_remove (ts,
+ &iter_record)) ;
}
else
{
@@ -2415,27 +2471,24 @@ zone_iteration_proc (void *cls,
if (0 == rd_count)
{
/* all records removed, remove name as well */
- gtk_tree_store_remove (ts, &iter_name);
- GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (n2r, &name_hash, ri));
- gtk_tree_row_reference_free (rr);
- GNUNET_free (ri->name);
- GNUNET_free_non_null (ri->data);
- GNUNET_free (ri);
+ free_ri (ri);
return;
}
/* update record info serialized version of the records */
GNUNET_free_non_null (ri->data);
ri->rd_count = rd_count;
- ri->data_size = GNUNET_GNSRECORD_records_get_size (rd_count, rd);
+ ri->data_size = GNUNET_GNSRECORD_records_get_size (rd_count,
+ rd);
if (0 != ri->data_size)
ri->data = GNUNET_malloc (ri->data_size);
GNUNET_break (ri->data_size ==
- GNUNET_GNSRECORD_records_serialize (rd_count, rd,
- ri->data_size, ri->data));
+ GNUNET_GNSRECORD_records_serialize (rd_count,
+ rd,
+ ri->data_size,
+ ri->data));
/* Append elements for records in tree view */
- for (c = 0; c < rd_count; c ++)
+ for (unsigned int c = 0; c < rd_count; c ++)
{
if (GNUNET_GNSRECORD_TYPE_NICK == rd[c].record_type)
continue;
@@ -2480,14 +2533,14 @@ zone_iteration_proc (void *cls,
if (NULL != GNUNET_GNSRECORD_number_to_typename (rd[c].record_type))
type_str = strdup (GNUNET_GNSRECORD_number_to_typename
(rd[c].record_type));
else
- GNUNET_asprintf (&type_str, "%s", EXPIRE_INVALID_STRING);
-
- if ( (0 == strcmp (name, GNUNET_GNS_MASTERZONE_STR)) &&
+ GNUNET_asprintf (&type_str,
+ "%s",
+ EXPIRE_INVALID_STRING);
+ if ( (0 == strcmp (name,
+ GNUNET_GNS_MASTERZONE_STR)) &&
(GNUNET_GNSRECORD_TYPE_NICK == rd[c].record_type) &&
(NULL == current_pseudonym) )
{
- pseu_entry = GTK_ENTRY((get_object ("gnunet_namestore_gtk_pseu_entry")));
- gtk_entry_set_text (pseu_entry, val);
#if HAVE_QRENCODE_H
setup_qrcode ();
#endif
@@ -2523,34 +2576,6 @@ zone_iteration_proc (void *cls,
/**
- * The user has selected a response in the dialog asking him
- * if we should run the import script. If the response was
- * positive, run the import script.
- *
- * @param dialog the dialog object, should be destroyed
- * @param response_id response in the dialog
- * @param user_data NULL
- */
-static void
-handle_import_dialog_response (GtkDialog *dialog,
- gint response_id,
- gpointer user_data)
-{
- gtk_widget_destroy (GTK_WIDGET (dialog));
- switch (response_id)
- {
- case GTK_RESPONSE_YES:
- system ("gnunet-gns-import.sh");
- break;
- default:
- /* nothing */
- break;
- }
- gtk_widget_show (GTK_WIDGET (get_object
("gnunet_namestore_gtk_zone_combobox")));
-}
-
-
-/**
* Method called to switch the model to a new zone.
*
* @param name name of the zone
@@ -2570,36 +2595,16 @@ load_zone (const char *name,
GNUNET_NAMESTORE_zone_monitor_stop (zmon);
zmon = NULL;
}
- if (NULL == ego)
- {
- GtkDialog *diag;
- GtkWidget *dummy;
- GtkWidget *toplevel;
-
- diag = GTK_DIALOG (gtk_message_dialog_new (NULL,
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_YES_NO,
- (NULL == name)
- ? _("No zones found. Should I
run the import script?")
- : _("Zone `%s' not found.
Should I run the import script?"),
- name));
- dummy = GTK_WIDGET (get_object ("gnunet_namestore_gtk_dialog"));
- toplevel = gtk_widget_get_toplevel (dummy);
- if (GTK_IS_WINDOW (toplevel))
- gtk_window_set_transient_for (GTK_WINDOW (diag), GTK_WINDOW (toplevel));
- gtk_window_set_modal (GTK_WINDOW (diag), TRUE);
- g_signal_connect (diag, "response",
- G_CALLBACK (handle_import_dialog_response),
- NULL);
- gtk_window_present (GTK_WINDOW (diag));
- return;
- }
- current_zone_option = GNUNET_strdup (name);
+ GNUNET_free_non_null (current_pseudonym);
+ current_pseudonym = NULL;
+ if (NULL == name)
+ return; /* empty zone */
+ current_pseudonym = GNUNET_strdup (name);
pkey = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey);
*pkey = *GNUNET_IDENTITY_ego_get_private_key (ego);
- GNUNET_CRYPTO_ecdsa_key_get_public (pkey, &pubkey);
- label = g_markup_printf_escaped (_("<b>Editing zone %s</b>"),
+ GNUNET_CRYPTO_ecdsa_key_get_public (pkey,
+ &pubkey);
+ label = g_markup_printf_escaped ("<b>%s</b>",
GNUNET_GNSRECORD_z2s (&pubkey));
gtk_label_set_markup (GTK_LABEL (get_object
("gnunet_namestore_gtk_zone_label")),
label);
@@ -2622,7 +2627,8 @@ load_zone (const char *name,
#if HAVE_QRENCODE_H
setup_qrcode ();
#endif
- zmon = GNUNET_NAMESTORE_zone_monitor_start (cfg, pkey,
+ zmon = GNUNET_NAMESTORE_zone_monitor_start (cfg,
+ pkey,
GNUNET_YES,
&zone_iteration_error,
NULL,
@@ -2634,32 +2640,69 @@ load_zone (const char *name,
/**
- * A different zone was selected in the zone toggle bar. Load the
- * appropriate zone.
+ * Check if @a label is a valid label or is already used for the name
+ * of any of our zones OR configured as a TLD in the configuration.
*
- * @param widget button that was toggled (could be to "on" or "off", we only
react to "on")
- * @param user_data builder, unused
+ * @param label label to check
+ * @return NULL if label is fresh and valid
+ * error message explaining why @a label is not valid
*/
-void
-gnunet_namestore_gtk_zone_combobox_changed_cb (GtkComboBox *widget,
- gpointer user_data)
+static const char *
+fresh_label (const char *label)
{
GtkTreeIter iter;
- struct GNUNET_IDENTITY_Ego *ego;
- char *name;
+ struct GNS_TopLevelDomain *tld;
- if (! gtk_combo_box_get_active_iter (widget,
- &iter))
- {
- load_zone (NULL, NULL);
- return;
- }
- gtk_tree_model_get (GTK_TREE_MODEL (zone_liststore),
- &iter,
- ZONE_LS_NAME, &name,
- ZONE_LS_EGO, &ego,
- -1);
- load_zone (name, ego);
+ if ( (NULL == label) ||
+ (0 == strlen (label)) )
+ return _("Name must not be empty\n");
+ if (GNUNET_OK !=
+ GNUNET_DNSPARSER_check_label (label))
+ return _("Name is not a syntactically valid DNS label\n");
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (zone_liststore),
+ &iter))
+ {
+ do {
+ char *name;
+
+ gtk_tree_model_get (GTK_TREE_MODEL (zone_liststore),
+ &iter,
+ ZONE_LS_NAME, &name,
+ -1);
+ if (0 == strcasecmp (name,
+ label))
+ return _("Name already exists in the list\n");
+ } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (zone_liststore),
+ &iter));
+ }
+ for (tld = tld_head; NULL != tld; tld = tld->next)
+ if (0 == strcasecmp (tld->tld,
+ label))
+ return _("Name is assigned in the configuration file (see [GNS]
section)\n");
+ return NULL;
+}
+
+
+/**
+ * Continuation after identity operation. Makes the
+ * main window sensitive again.
+ *
+ * @param cls NULL
+ * @param emsg error message, used in status bar
+ */
+static void
+iop_cont (void *cls,
+ const char *emsg)
+{
+ GtkEntry *entry;
+
+ iop = NULL;
+ entry = GTK_ENTRY (get_object ("gnunet_namestore_gtk_zone_entry"));
+ gtk_widget_set_sensitive (main_window,
+ TRUE);
+ gtk_label_set_markup (status_label,
+ emsg);
+ gtk_entry_grab_focus_without_selecting (entry);
}
@@ -2673,6 +2716,7 @@ cleanup_task (void *cls)
{
struct OperationContext *oc;
struct MoveOperationContext *moc;
+ struct GNS_TopLevelDomain *tld;
if (NULL == ml)
{
@@ -2680,9 +2724,7 @@ cleanup_task (void *cls)
return;
}
GNUNET_GTK_main_loop_quit (ml);
-
-
- gtk_widget_show (GTK_WIDGET (get_object
("gnunet_namestore_gtk_status_label")));
+ gtk_widget_show (GTK_WIDGET (status_label));
gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_scrolledwindow")));
if (NULL != zmon)
{
@@ -2693,7 +2735,9 @@ cleanup_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("A pending namestore operation was not transmitted to the
namestore.\n"));
- GNUNET_CONTAINER_DLL_remove (oc_head, oc_tail, oc);
+ GNUNET_CONTAINER_DLL_remove (oc_head,
+ oc_tail,
+ oc);
GNUNET_NAMESTORE_cancel (oc->qe);
GNUNET_free (oc);
}
@@ -2701,7 +2745,9 @@ cleanup_task (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("A pending namestore operation was not transmitted to the
namestore.\n"));
- GNUNET_CONTAINER_DLL_remove (moc_head, moc_tail, moc);
+ GNUNET_CONTAINER_DLL_remove (moc_head,
+ moc_tail,
+ moc);
if (NULL != moc->it)
GNUNET_NAMESTORE_zone_iteration_stop (moc->it);
free_edit_dialog_context (moc->edc);
@@ -2724,6 +2770,11 @@ cleanup_task (void *cls)
GNUNET_free (current_pseudonym);
current_pseudonym = NULL;
}
+ if (NULL != iop)
+ {
+ GNUNET_IDENTITY_cancel (iop);
+ iop = NULL;
+ }
if (NULL != identity)
{
GNUNET_IDENTITY_disconnect (identity);
@@ -2737,6 +2788,14 @@ cleanup_task (void *cls)
GNUNET_CONTAINER_multihashmap_destroy (n2r);
n2r = NULL;
}
+ while (NULL != (tld = tld_head))
+ {
+ GNUNET_CONTAINER_DLL_remove (tld_head,
+ tld_tail,
+ tld);
+ GNUNET_free (tld->tld);
+ GNUNET_free (tld);
+ }
}
@@ -2752,6 +2811,180 @@ gnunet_namestore_gtk_quit_cb (GObject * object,
/**
+ * Change the NICK record of the current zone to @a new_name.
+ * Gets the old records, append new one or updates the existing one.
+ *
+ * @param new_name the new name (and hence nick) of the zone
+ */
+static void
+update_nick_record (const char *new_name)
+{
+ struct RecordInfo *ri;
+ struct GNUNET_HashCode hc;
+ unsigned int rd_count;
+ struct OperationContext *oc;
+
+ GNUNET_CRYPTO_hash ("+",
+ 1,
+ &hc);
+ ri = GNUNET_CONTAINER_multihashmap_get (n2r,
+ &hc);
+ if (NULL == ri)
+ rd_count = 0;
+ else
+ rd_count = ri->rd_count;
+
+ {
+ struct GNUNET_GNSRECORD_Data rd_old[rd_count];
+ struct GNUNET_GNSRECORD_Data rd_new[rd_count + 1];
+ unsigned int off;
+ unsigned int total;
+
+ total = rd_count;
+ if (NULL != ri)
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_GNSRECORD_records_deserialize (ri->data_size,
+ ri->data,
+ rd_count,
+ rd_old));
+ memcpy (rd_new,
+ rd_old,
+ sizeof (struct GNUNET_GNSRECORD_Data) * rd_count);
+ for (off=0;off<rd_count;off++)
+ if (GNUNET_GNSRECORD_TYPE_NICK == rd_new[off].record_type)
+ break;
+ if (off == rd_count)
+ total++;
+ if ( (NULL == new_name) ||
+ (0 == strlen (new_name)) )
+ {
+ rd_new[off] = rd_new[rd_count - 1];
+ total--;
+ }
+ else
+ {
+ rd_new[off].record_type = GNUNET_GNSRECORD_TYPE_NICK;
+ rd_new[off].expiration_time = nick_expiration_time.rel_value_us;
+ rd_new[off].flags = GNUNET_GNSRECORD_RF_PRIVATE |
GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
+ rd_new[off].data_size = strlen (new_name) + 1;
+ rd_new[off].data = new_name;
+ }
+ oc = GNUNET_new (struct OperationContext);
+ GNUNET_CONTAINER_DLL_insert (oc_head,
+ oc_tail,
+ oc);
+ oc->qe = GNUNET_NAMESTORE_records_store (namestore,
+ pkey,
+ GNUNET_GNS_MASTERZONE_STR,
+ total,
+ rd_new,
+ &operation_done_cont,
+ oc);
+ }
+}
+
+
+/**
+ * The user has edited the zone's name. Check if the new name is
+ * valid (if not, warn) and update the NICK and rename the zone.
+ */
+static void
+handle_zone_entry_edit ()
+{
+ /* user is editing label, or we removed the last entry in the list */
+ const char *new_name;
+ GtkEntry *entry;
+ const char *emsg;
+
+ entry = GTK_ENTRY (get_object ("gnunet_namestore_gtk_zone_entry"));
+ if (NULL == current_pseudonym)
+ {
+ gtk_entry_set_text (entry,
+ "");
+ return;
+ }
+ new_name = gtk_entry_get_text (entry);
+ if (NULL != (emsg = fresh_label (new_name)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "%s",
+ emsg);
+ gtk_widget_error_bell (GTK_WIDGET (entry));
+ gtk_entry_set_icon_from_icon_name (entry,
+ GTK_ENTRY_ICON_PRIMARY,
+ "error");
+ gtk_entry_set_icon_tooltip_text (entry,
+ GTK_ENTRY_ICON_PRIMARY,
+ emsg);
+ return;
+ }
+ gtk_entry_set_icon_from_icon_name (entry,
+ GTK_ENTRY_ICON_PRIMARY,
+ NULL);
+
+ update_nick_record (new_name);
+#if HAVE_QRENCODE_H
+ setup_qrcode ();
+#endif
+ gtk_list_store_set (GTK_LIST_STORE (zone_liststore),
+ &zone_iter,
+ ZONE_LS_NAME, new_name,
+ -1);
+ gtk_label_set_markup (status_label,
+ _("Renaming zone"));
+ gtk_widget_set_sensitive (main_window,
+ FALSE);
+ GNUNET_assert (NULL == iop);
+ iop = GNUNET_IDENTITY_rename (identity,
+ current_pseudonym,
+ new_name,
+ &iop_cont,
+ NULL);
+ GNUNET_free (current_pseudonym);
+ current_pseudonym = GNUNET_strdup (new_name);
+}
+
+
+/**
+ * The user selected another zone in the combobox. Load it.
+ *
+ * @param widget the combo box where the selection was changed
+ * @param user_data the builder, unused
+ */
+void
+gnunet_namestore_gtk_zone_combobox_changed_cb (GtkComboBox *widget,
+ gpointer user_data)
+{
+ GtkTreeIter iter;
+ struct GNUNET_IDENTITY_Ego *ego;
+ char *name;
+ GtkEntry *entry;
+
+ (void) user_data;
+ if (! gtk_combo_box_get_active_iter (zone_combo_box,
+ &iter))
+ {
+ handle_zone_entry_edit ();
+ return;
+ }
+ zone_iter = iter;
+ entry = GTK_ENTRY (get_object ("gnunet_namestore_gtk_zone_entry"));
+ gtk_entry_set_icon_from_icon_name (entry,
+ GTK_ENTRY_ICON_PRIMARY,
+ NULL);
+ gtk_tree_model_get (GTK_TREE_MODEL (zone_liststore),
+ &iter,
+ ZONE_LS_NAME, &name,
+ ZONE_LS_EGO, &ego,
+ -1);
+ gtk_widget_set_sensitive (GTK_WIDGET (get_object
("gnunet_namestore_gtk_zone_del_button")),
+ TRUE);
+ load_zone (name,
+ ego);
+}
+
+
+/**
* Method called to inform about the egos of this peer. Updates the
* `zone_liststore`.
*
@@ -2798,31 +3031,33 @@ identity_cb (void *cls,
{
/* end of initial iteration, trigger loading selected zone */
gnunet_namestore_gtk_zone_combobox_changed_cb
- (GTK_COMBO_BOX (get_object ("gnunet_namestore_gtk_zone_combobox")),
+ (zone_combo_box,
ml);
return;
}
rr = *ctx;
if (NULL == rr)
{
- /* new zone, add to list */
+ /* new identity, add to list */
GNUNET_assert (NULL != name);
gtk_list_store_insert_with_values (zone_liststore,
- &iter, -1,
+ &iter, 0,
ZONE_LS_NAME, name,
ZONE_LS_EGO, ego,
-1);
+ gtk_combo_box_set_active_iter
+ (zone_combo_box,
+ &iter);
+ gtk_widget_set_sensitive (GTK_WIDGET (zone_combo_box),
+ TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (get_object
("gnunet_namestore_gtk_zone_entry")),
+ TRUE);
path = gtk_tree_model_get_path (GTK_TREE_MODEL (zone_liststore),
&iter);
rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (zone_liststore),
path);
*ctx = rr;
gtk_tree_path_free (path);
- if (0 == strcmp ("master-zone",
- name))
- gtk_combo_box_set_active_iter
- (GTK_COMBO_BOX (get_object ("gnunet_namestore_gtk_zone_combobox")),
- &iter);
return;
}
path = gtk_tree_row_reference_get_path (rr);
@@ -2832,12 +3067,36 @@ identity_cb (void *cls,
gtk_tree_path_free (path);
if (NULL == name)
{
- /* zone was removed, remove from list */
+ GtkTreeIter act_iter;
+
+ /* identity was removed, remove from list */
+ GNUNET_free_non_null (current_pseudonym);
+ current_pseudonym = NULL;
gtk_list_store_remove (zone_liststore,
&iter);
+ if (! gtk_combo_box_get_active_iter (zone_combo_box,
+ &act_iter))
+ {
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (zone_liststore),
+ &act_iter))
+ {
+ /* make sure combo box remains selected if possible */
+ gtk_combo_box_set_active (zone_combo_box,
+ 0);
+ }
+ else
+ {
+ /* make combo box insensitive if nothing can be selected */
+ gtk_widget_set_sensitive (GTK_WIDGET (zone_combo_box),
+ FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (get_object
("gnunet_namestore_gtk_zone_entry")),
+ FALSE);
+ clear_zone_view ();
+ }
+ }
return;
}
- /* zone was renamed, rename in model */
+ /* identity was renamed, rename in model */
gtk_list_store_set (zone_liststore,
&iter,
ZONE_LS_NAME, name,
@@ -2846,6 +3105,165 @@ identity_cb (void *cls,
/**
+ * The user clicked the "add" button for a new zone.
+ * Obtain the label, create the new zone and reset
+ * the entry to empty.
+ *
+ * @param button the "add" button
+ * @param user_data the builder, unused
+ */
+void
+gnunet_namestore_gtk_zone_add_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ const char *label;
+ GtkEntry *entry;
+
+ (void) user_data;
+ entry = GTK_ENTRY (get_object ("gnunet_namestore_gtk_zone_add_entry"));
+ label = gtk_entry_get_text (entry);
+ gtk_label_set_markup (status_label,
+ _("Creating zone"));
+ gtk_widget_set_sensitive (main_window,
+ FALSE);
+ iop = GNUNET_IDENTITY_create (identity,
+ label,
+ &iop_cont,
+ NULL);
+ gtk_entry_set_text (entry,
+ "");
+}
+
+
+/**
+ * Delete all records of the current zone.
+ *
+ * @param cls NULL
+ * @param key key of a record in the map to delete
+ * @param value a `struct RecordInfo` to delete
+ * @return #GNUNET_OK (continue to iterate)
+ */
+static int
+delete_records (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
+{
+ struct RecordInfo *ri = value;
+ struct OperationContext *oc;
+
+ if (0 != ri->rd_count)
+ {
+ oc = GNUNET_new (struct OperationContext);
+ GNUNET_CONTAINER_DLL_insert (oc_head,
+ oc_tail,
+ oc);
+ oc->qe = GNUNET_NAMESTORE_records_store (namestore,
+ pkey,
+ ri->name,
+ 0,
+ NULL,
+ &operation_done_cont,
+ oc);
+ }
+ free_ri (ri);
+ return GNUNET_OK;
+}
+
+
+/**
+ * The user clicked the "del" button for an existing zone.
+ * Obtain the label/ego and delete the zone.
+ *
+ * @param button the "del" button
+ * @param user_data the builder, unused
+ */
+void
+gnunet_namestore_gtk_zone_del_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ char *pseu;
+ (void) user_data;
+
+ pseu = current_pseudonym;
+ current_pseudonym = NULL;
+ GNUNET_CONTAINER_multihashmap_iterate (n2r,
+ &delete_records,
+ NULL);
+ gtk_tree_store_clear (ts);
+ gtk_widget_set_sensitive (GTK_WIDGET (get_object
("gnunet_namestore_gtk_zone_del_button")),
+ FALSE);
+ gtk_widget_set_sensitive (main_window,
+ FALSE);
+ iop = GNUNET_IDENTITY_delete (identity,
+ pseu,
+ &iop_cont,
+ NULL);
+ GNUNET_free (pseu);
+}
+
+
+/**
+ * The user edited the zone label for 'adding' a new zone.
+ * Check if the label is unique and well-formed and update
+ * the sensitivity of the "add" button accordingly.
+ *
+ * @param editable the zone label that was changed
+ * @param user_data the builder, unused
+ */
+void
+gnunet_namestore_gtk_zone_add_entry_changed_cb (GtkEditable *editable,
+ gpointer user_data)
+{
+ const char *label;
+
+ (void) user_data;
+ label = gtk_entry_get_text (GTK_ENTRY (editable));
+ gtk_widget_set_sensitive (GTK_WIDGET (get_object
("gnunet_namestore_gtk_zone_add_button")),
+ NULL == fresh_label (label));
+}
+
+
+/**
+ * Reads the configuration and populates TLDs
+ *
+ * @param cls unused
+ * @param section name of section in config, always "gns"
+ * @param option name of the option, TLDs start with "."
+ * @param value value for the option, public key for TLDs
+ */
+static void
+read_service_conf (void *cls,
+ const char *section,
+ const char *option,
+ const char *value)
+{
+ struct GNUNET_CRYPTO_EddsaPublicKey pk;
+ struct GNS_TopLevelDomain *tld;
+
+ if (option[0] != '.')
+ return;
+ if (GNUNET_OK !=
+ GNUNET_STRINGS_string_to_data (value,
+ strlen (value),
+ &pk,
+ sizeof (pk)))
+ {
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+ section,
+ option,
+ _("Properly base32-encoded public key
required"));
+ return;
+ }
+ tld = GNUNET_new (struct GNS_TopLevelDomain);
+ tld->tld = GNUNET_strdup (&option[1]);
+ tld->pkey = pk;
+ GNUNET_CONTAINER_DLL_insert (tld_head,
+ tld_tail,
+ tld);
+}
+
+
+/**
* Actual main method that sets up the configuration window.
*
* @param cls the main loop handle
@@ -2854,10 +3272,13 @@ static void
run (void *cls)
{
gchar *label;
- GtkLabel *status_label;
ml = cls;
cfg = GNUNET_GTK_main_loop_get_configuration (ml);
+ GNUNET_CONFIGURATION_iterate_section_values (cfg,
+ "gns",
+ &read_service_conf,
+ NULL);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_time (cfg,
"gnunet-namestore-gtk",
@@ -2871,7 +3292,8 @@ run (void *cls)
return;
}
if (GNUNET_OK !=
- GNUNET_GTK_main_loop_build_window (ml, NULL))
+ GNUNET_GTK_main_loop_build_window (ml,
+ NULL))
return;
GNUNET_GTK_set_icon_search_path ();
GNUNET_GTK_setup_nls ();
@@ -2879,13 +3301,14 @@ run (void *cls)
main_window = GTK_WIDGET (get_object ("gnunet_namestore_gtk_dialog"));
main_window = GNUNET_GTK_plug_me ("GNUNET_NAMESTORE_GTK_PLUG",
main_window);
-
+ status_label = GTK_LABEL (get_object ("gnunet_namestore_gtk_status_label"));
+ zone_combo_box = GTK_COMBO_BOX (get_object
("gnunet_namestore_gtk_zone_combobox"));
namestore = GNUNET_NAMESTORE_connect (cfg);
if (NULL == namestore)
{
- status_label = GTK_LABEL (get_object
("gnunet_namestore_gtk_status_label"));
label = g_markup_printf_escaped (_("<b><big>Failed to connect to
namestore</b></big>"));
- gtk_label_set_markup (status_label, label);
+ gtk_label_set_markup (status_label,
+ label);
g_free (label);
return;
}
@@ -2893,13 +3316,15 @@ run (void *cls)
tv = GTK_TREE_VIEW (get_object ("gnunet_namestore_gtk_treeview"));
zone_liststore = GTK_LIST_STORE (get_object ("zone_liststore"));
tm = GTK_TREE_MODEL (ts);
- n2r = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO);
+ n2r = GNUNET_CONTAINER_multihashmap_create (128,
+ GNUNET_NO);
identity = GNUNET_IDENTITY_connect (cfg,
&identity_cb,
NULL);
gtk_widget_show (main_window);
gtk_window_present (GTK_WINDOW (main_window));
- GNUNET_SCHEDULER_add_shutdown (&cleanup_task, NULL);
+ GNUNET_SCHEDULER_add_shutdown (&cleanup_task,
+ NULL);
}
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet-gtk] branch master updated: revising gnunet-namestore-gtk to make TLD==NICK and enable nicer zone editing,
gnunet <=