[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r28453 - in gnunet-gtk: contrib src/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r28453 - in gnunet-gtk: contrib src/fs |
Date: |
Thu, 8 Aug 2013 09:32:07 +0200 |
Author: grothoff
Date: 2013-08-08 09:32:07 +0200 (Thu, 08 Aug 2013)
New Revision: 28453
Modified:
gnunet-gtk/contrib/gnunet_fs_gtk_main_window.glade
gnunet-gtk/src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c
Log:
-minor code cleanup
Modified: gnunet-gtk/contrib/gnunet_fs_gtk_main_window.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_fs_gtk_main_window.glade 2013-08-08 07:19:48 UTC
(rev 28452)
+++ gnunet-gtk/contrib/gnunet_fs_gtk_main_window.glade 2013-08-08 07:32:07 UTC
(rev 28453)
@@ -971,31 +971,6 @@
<property name="can_focus">False</property>
<property name="stock">gtk-index</property>
</object>
- <object class="GtkTreeStore" id="main_window_search_namespace_treestore">
- <columns>
- <!-- column-name Name -->
- <column type="gchararray"/>
- <!-- column-name Key -->
- <column type="gpointer"/>
- <!-- column-name Root -->
- <column type="gchararray"/>
- <!-- column-name Tooltip -->
- <column type="gchararray"/>
- </columns>
- </object>
- <object class="GtkMenu" id="metadata_popup_menu">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkMenuItem" id="Copy selection">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Copy selection</property>
- <property name="use_underline">True</property>
- <signal name="activate"
handler="GNUNET_GTK_FS_metadata_copy_selection_activated" swapped="no"/>
- </object>
- </child>
- </object>
<object class="GtkSizeGroup" id="GNUNET_FS_GTK_download_frame_vsize_group">
<property name="mode">vertical</property>
<property name="ignore_hidden">True</property>
@@ -1017,58 +992,31 @@
<widget name="GNUNET_GTK_search_frame_download_filename_label"/>
</widgets>
</object>
- <object class="GtkSizeGroup" id="enties_and_comboboxes_sizegroup">
- <property name="mode">vertical</property>
- <widgets>
- <widget name="main_window_search_entry"/>
- <widget name="main_window_search_anonymity_combobox"/>
- <widget name="main_window_search_mime_combobox"/>
- </widgets>
- </object>
- <object class="GtkListStore" id="main_window_search_mime_liststore">
+ <object class="GtkTreeStore" id="main_window_search_namespace_treestore">
<columns>
- <!-- column-name MIME -->
+ <!-- column-name Name -->
<column type="gchararray"/>
- <!-- column-name Type -->
+ <!-- column-name Key -->
+ <column type="gpointer"/>
+ <!-- column-name Root -->
<column type="gchararray"/>
- <!-- column-name Extension -->
+ <!-- column-name Tooltip -->
<column type="gchararray"/>
- <!-- column-name Lossyness -->
- <column type="gchararray"/>
- <!-- column-name Freedom -->
- <column type="gchararray"/>
</columns>
- <data>
- <row>
- <col id="0"> </col>
- <col id="1" translatable="yes">Any</col>
- <col id="2" translatable="yes"> </col>
- <col id="3" translatable="yes"> </col>
- <col id="4" translatable="yes"> </col>
- </row>
- <row>
- <col id="0">plain/text</col>
- <col id="1" translatable="yes">Text</col>
- <col id="2">txt</col>
- <col id="3" translatable="yes">N/A</col>
- <col id="4" translatable="yes">N/A</col>
- </row>
- <row>
- <col id="0">application/zip</col>
- <col id="1" translatable="yes">Zip</col>
- <col id="2">zip</col>
- <col id="3" translatable="yes">lossless</col>
- <col id="4" translatable="yes">free</col>
- </row>
- <row>
- <col id="0">audio/mpeg</col>
- <col id="1" translatable="yes">MPEG audio</col>
- <col id="2">mp3, mp2, mpeg</col>
- <col id="3" translatable="yes">lossy</col>
- <col id="4" translatable="yes">non-free</col>
- </row>
- </data>
</object>
+ <object class="GtkMenu" id="metadata_popup_menu">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkMenuItem" id="Copy selection">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Copy selection</property>
+ <property name="use_underline">True</property>
+ <signal name="activate"
handler="GNUNET_GTK_FS_metadata_copy_selection_activated" swapped="no"/>
+ </object>
+ </child>
+ </object>
<object class="GtkWindow" id="namespace_selector_window">
<property name="can_focus">False</property>
<property name="events">GDK_LEAVE_NOTIFY_MASK |
GDK_STRUCTURE_MASK</property>
@@ -1131,20 +1079,6 @@
<property name="position">0</property>
</packing>
</child>
- <child>
- <object class="GtkButton"
id="namespace_selector_manage_namespaces_button">
- <property name="label" translatable="yes">_Manage
namespaces</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <signal name="clicked"
handler="namespace_selector_manage_namespaces_button_clicked_cb" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
</object>
</child>
</object>
@@ -1158,6 +1092,58 @@
<property name="can_focus">False</property>
<property name="stock">gtk-open</property>
</object>
+ <object class="GtkSizeGroup" id="enties_and_comboboxes_sizegroup">
+ <property name="mode">vertical</property>
+ <widgets>
+ <widget name="main_window_search_entry"/>
+ <widget name="main_window_search_anonymity_combobox"/>
+ <widget name="main_window_search_mime_combobox"/>
+ </widgets>
+ </object>
+ <object class="GtkListStore" id="main_window_search_mime_liststore">
+ <columns>
+ <!-- column-name MIME -->
+ <column type="gchararray"/>
+ <!-- column-name Type -->
+ <column type="gchararray"/>
+ <!-- column-name Extension -->
+ <column type="gchararray"/>
+ <!-- column-name Lossyness -->
+ <column type="gchararray"/>
+ <!-- column-name Freedom -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0"> </col>
+ <col id="1" translatable="yes">Any</col>
+ <col id="2" translatable="yes"> </col>
+ <col id="3" translatable="yes"> </col>
+ <col id="4" translatable="yes"> </col>
+ </row>
+ <row>
+ <col id="0">plain/text</col>
+ <col id="1" translatable="yes">Text</col>
+ <col id="2">txt</col>
+ <col id="3" translatable="yes">N/A</col>
+ <col id="4" translatable="yes">N/A</col>
+ </row>
+ <row>
+ <col id="0">application/zip</col>
+ <col id="1" translatable="yes">Zip</col>
+ <col id="2">zip</col>
+ <col id="3" translatable="yes">lossless</col>
+ <col id="4" translatable="yes">free</col>
+ </row>
+ <row>
+ <col id="0">audio/mpeg</col>
+ <col id="1" translatable="yes">MPEG audio</col>
+ <col id="2">mp3, mp2, mpeg</col>
+ <col id="3" translatable="yes">lossy</col>
+ <col id="4" translatable="yes">non-free</col>
+ </row>
+ </data>
+ </object>
<object class="GtkAdjustment" id="priority_adjustment">
<property name="upper">10000000</property>
<property name="value">1000</property>
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c
2013-08-08 07:19:48 UTC (rev 28452)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c
2013-08-08 07:32:07 UTC (rev 28453)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet
- (C) 2011, 2012 Christian Grothoff (and other contributing authors)
+ (C) 2011-2013 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
@@ -301,7 +301,8 @@
{
GtkTreeStore *ts = cls;
char *root;
- char *ns_name, *unique_ns_name;
+ char *ns_name;
+ char *unique_ns_name;
struct GNUNET_CRYPTO_EccPublicKey *nsid;
char *description;
int desc_is_a_dup;
@@ -316,8 +317,8 @@
GNUNET_FS_pseudonym_get_info (GNUNET_FS_GTK_get_configuration (),
pseudonym, NULL, NULL,
&ns_name, NULL);
- unique_ns_name = GNUNET_FS_pseudonym_name_uniquify (
- GNUNET_FS_GTK_get_configuration (), pseudonym, ns_name, NULL);
+ unique_ns_name = GNUNET_FS_pseudonym_name_uniquify
(GNUNET_FS_GTK_get_configuration (),
+ pseudonym, ns_name, NULL);
GNUNET_free (ns_name);
nsid = GNUNET_new (struct GNUNET_CRYPTO_EccPublicKey);
*nsid = *pseudonym;
@@ -355,27 +356,22 @@
{
GtkTreeIter iter;
GtkTreePath *treepath;
- struct GNUNET_CRYPTO_EccPublicKey *key = NULL;
+ GtkTreeModel *model;
+ struct GNUNET_CRYPTO_EccPublicKey *key;
struct GNUNET_CRYPTO_EccPublicKey *selected_ns_id;
-
- gboolean found = FALSE;
- gchar *value = NULL;
+ gboolean found;
+ gchar *value;
+ key = NULL;
if (NULL != main_ctx->selected_ns_row)
{
- GtkTreeModel *model;
treepath = gtk_tree_row_reference_get_path (main_ctx->selected_ns_row);
model = gtk_tree_view_get_model (main_ctx->ns_selector_treeview);
- if (model)
- {
- if (gtk_tree_model_get_iter (model, &iter, treepath))
- {
- gtk_tree_model_get (model, &iter,
- GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY,
- &key,
- -1);
- }
- }
+ if (gtk_tree_model_get_iter (model, &iter, treepath))
+ gtk_tree_model_get (model, &iter,
+ GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY,
+ &key,
+ -1);
gtk_tree_path_free (treepath);
gtk_tree_row_reference_free (main_ctx->selected_ns_row);
main_ctx->selected_ns_row = NULL;
@@ -387,23 +383,20 @@
*selected_ns_id = *key;
}
- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (
- main_ctx->search_ns_treestore), &iter))
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL
(main_ctx->search_ns_treestore),
+ &iter))
{
- while (TRUE)
+ do
{
gtk_tree_model_get (GTK_TREE_MODEL (main_ctx->search_ns_treestore),
&iter,
GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY,
&key,
-1);
GNUNET_free_non_null (key);
- if (TRUE != gtk_tree_model_iter_next (GTK_TREE_MODEL (
- main_ctx->search_ns_treestore), &iter))
- break;
- }
+ } while (gtk_tree_model_iter_next (GTK_TREE_MODEL
(main_ctx->search_ns_treestore),
+ &iter));
}
gtk_tree_store_clear (main_ctx->search_ns_treestore);
-
gtk_tree_store_insert_with_values (main_ctx->search_ns_treestore, &iter,
NULL, G_MAXINT,
GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME,
"Any",
@@ -417,11 +410,15 @@
if (NULL != main_ctx->ns_discovery_handle)
GNUNET_FS_pseudonym_discovery_callback_unregister
(main_ctx->ns_discovery_handle);
- main_ctx->ns_discovery_handle =
GNUNET_FS_pseudonym_discovery_callback_register (main_ctx->cfg,
- add_namespace_to_ts, main_ctx->search_ns_treestore);
+ main_ctx->ns_discovery_handle
+ = GNUNET_FS_pseudonym_discovery_callback_register (main_ctx->cfg,
+ &add_namespace_to_ts,
+
main_ctx->search_ns_treestore);
- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (
- main_ctx->search_ns_treestore), &iter))
+ found = FALSE;
+ value = NULL;
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL
(main_ctx->search_ns_treestore),
+ &iter))
{
while (TRUE)
{
@@ -431,20 +428,21 @@
GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY,
&key,
-1);
- if (selected_ns_id == NULL)
+ if (NULL == selected_ns_id)
found = TRUE;
- else if (key != NULL && memcmp (key, selected_ns_id, sizeof (struct
GNUNET_CRYPTO_EccPublicKey)) == 0)
+ if ( (key != NULL) &&
+ (0 == memcmp (key, selected_ns_id, sizeof (struct
GNUNET_CRYPTO_EccPublicKey))) )
found = TRUE;
- if (found || (TRUE != gtk_tree_model_iter_next (GTK_TREE_MODEL (
- main_ctx->search_ns_treestore), &iter)))
+ if (found ||
+ (! gtk_tree_model_iter_next (GTK_TREE_MODEL
(main_ctx->search_ns_treestore),
+ &iter)))
break;
- else
- g_free (value);
+ g_free (value);
}
}
if ( (!found) &&
- gtk_tree_model_get_iter_first (GTK_TREE_MODEL (
-
main_ctx->search_ns_treestore), &iter))
+ gtk_tree_model_get_iter_first (GTK_TREE_MODEL
(main_ctx->search_ns_treestore),
+ &iter))
{
gtk_tree_model_get (GTK_TREE_MODEL (main_ctx->search_ns_treestore), &iter,
GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME,
@@ -460,7 +458,7 @@
if (value != NULL)
{
gtk_label_set_text (main_ctx->search_ns_label, value);
- g_free(value);
+ g_free (value);
}
GNUNET_free_non_null (selected_ns_id);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r28453 - in gnunet-gtk: contrib src/fs,
gnunet <=