View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001759 | gnunet-gtk | gnunet-fs-gtk | public | 2011-08-15 18:27 | 2011-12-26 22:28 |
| Reporter | Christian Grothoff | Assigned To | LRN | ||
| Priority | low | Severity | minor | Reproducibility | N/A |
| Status | closed | Resolution | fixed | ||
| Product Version | 0.9.0 | ||||
| Target Version | 0.9.1 | Fixed in Version | 0.9.1 | ||
| Summary | 0001759: gtk_dialog_run is bad as it stops the GNUnet scheduler loop as well | ||||
| Description | We should replace all calls to it by non-modal dialogs. As a first step, the globals (builder in particular!) in the respective source files must be de-globalized, since we can then get two windows of the same type open at the same time (!). Additional advantage: ability to have multiple search/publish dialogs open at the same time! | ||||
| Tags | No tags attached. | ||||
| Attached Files | 0001-Starting-to-get-rid-of-gtk_dialog_run-and-more.patch (28,072 bytes)
From 03c7cc02504e2d4db2272ca664d773186e2fdb31 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Wed, 7 Dec 2011 18:03:30 +0400
Subject: [PATCH] Starting to get rid of gtk_dialog_run(), and more
* Call AC_INIT() with different package name and tarball name
* Get version from VCS instead of hard-coding it in configure.ac
* Don't supply version to AM_INIT_AUTOMAKE
* Use silent rules
* Make a few GNUNET_FS_GTK_* AM variables to be used in .glade files
* Add contrib/gnunet_fs_gtk_about_window.glade.in
* GNUNET_GTK_display_about () doesn't take dialog name anymore
(it should always be 'about_window' now)
* GNUNET_GTK_get_new_builder () now passes the builder as a callback
argument
* about.c now implements most of the things that were previously done
by GtkAboutDialog.
---
configure.ac | 10 +-
contrib/Makefile.am | 3 +-
contrib/get_version.sh | 34 +++
contrib/gnunet_fs_gtk_about_window.glade.in | 364 +++++++++++++++++++++++++++
src/fs/gnunet-fs-gtk-about.c | 3 +-
src/include/gnunet_gtk.h | 3 +-
src/lib/about.c | 117 +++++++++-
src/lib/glade.c | 2 +-
src/peerinfo/gnunet-peerinfo-gtk-about.c | 3 +-
9 files changed, 527 insertions(+), 12 deletions(-)
create mode 100644 contrib/get_version.sh
create mode 100644 contrib/gnunet_fs_gtk_about_window.glade.in
diff --git a/configure.ac b/configure.ac
index 4e3e11a..cd64cf4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,8 +20,8 @@
# Process this file with autoconf to produce a configure script.
#
AC_PREREQ(2.61)
-AC_INIT([gnunet-gtk],[0.9.0],[bug-gnunet@gnu.org])
-AM_INIT_AUTOMAKE([gnunet-gtk], [0.9.0])
+AC_INIT([GNUnet GTK],m4_esyscmd([contrib/get_version.sh .version | tr -d '\n']),[bug-gnunet@gnu.org],[gnunet-gtk])
+AM_INIT_AUTOMAKE([silent-rules])
AM_CONFIG_HEADER(gnunet_gtk_config.h)
AH_TOP([#define _GNU_SOURCE 1])
@@ -357,6 +357,11 @@ AC_DEFINE_DIR([PACKAGE_DATA], [datarootdir], [The directory for installing read-
packagesrcdir=`cd $srcdir && pwd`
AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}", [source dir])
+AC_SUBST(GNUNET_FS_GTK_NAME, $PACKAGE_NAME, [name of the program])
+AC_SUBST(GNUNET_FS_GTK_VERSION3, $PACKAGE_VERSION, [version of the program])
+AC_SUBST(GNUNET_FS_GTK_YEARFROM, [2010], [year of the first release])
+AC_SUBST(GNUNET_FS_GTK_YEARTO, [$(date | sed -e 's/.* \([[[:digit:]]]\+\)$/\1/')], [year of the most current release])
+
AC_OUTPUT([
Makefile
contrib/Makefile
@@ -373,4 +378,5 @@ po/Makefile.in
po/Makefile
gnunet-fs-gtk.desktop
gnunet-setup.desktop
+contrib/gnunet_fs_gtk_about_window.glade
])
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index c79d3fd..606eeba 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -34,7 +34,8 @@ pkgdata_DATA = \
gnunet_peerinfo_gtk_main_window.glade \
gnunet_statistics_gtk_about_dialog.glade \
gnunet_statistics_gtk_main_window.glade \
- gnunet_setup_gtk_main_window.glade
+ gnunet_setup_gtk_main_window.glade \
+ gnunet_fs_gtk_about_window.glade
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(pkgpixdir)
diff --git a/contrib/get_version.sh b/contrib/get_version.sh
new file mode 100644
index 0000000..7c64dee
--- /dev/null
+++ b/contrib/get_version.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+# Gets the version number from VCS, or from the contents of the file $1
+version=
+if test -f "$1"
+then
+ version=$(cat $1)
+fi
+if test "x$version" = "x" -a -d "./.git"
+then
+ version=$(git svn info | grep "Revision: [[:digit:]]\+" | sed -e 's/Revision: //')
+ if test "x$version" = "x"
+ then
+ version=$(git log -1 | grep 'commit [a-f0-9]\+' | sed -e 's/commit //')
+ if test ! "x$version" = "x"
+ then
+ version="git-$version"
+ fi
+ else
+ version="r$version"
+ fi
+fi
+if test "x$version" = "x" -a -d "./.svn"
+then
+ version=$(svn info | grep "Revision: [[:digit:]]\+" | sed -e 's/Revision: //')
+ if test ! "x$version" = "x"
+ then
+ version="r$version"
+ fi
+fi
+if test "x$version" = "x"
+then
+ version="unknown"
+fi
+echo $version
diff --git a/contrib/gnunet_fs_gtk_about_window.glade.in b/contrib/gnunet_fs_gtk_about_window.glade.in
new file mode 100644
index 0000000..f214ca9
--- /dev/null
+++ b/contrib/gnunet_fs_gtk_about_window.glade.in
@@ -0,0 +1,364 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <requires lib="gtk+" version="2.24"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkWindow" id="about_window">
+ <property name="can_focus">False</property>
+ <property name="modal">True</property>
+ <property name="destroy_with_parent">True</property>
+ <signal name="destroy-event" handler="GNUNET_GTK_about_window_got_destroy_event" swapped="no"/>
+ <signal name="frame-event" handler="GNUNET_GTK_about_window_got_frame_event" swapped="no"/>
+ <signal name="realize" handler="GNUNET_GTK_about_window_realized" swapped="no"/>
+ <signal name="delete-event" handler="GNUNET_GTK_about_window_got_delete_event" swapped="no"/>
+ <child>
+ <object class="GtkVBox" id="about_main_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">10</property>
+ <child>
+ <object class="GtkImage" id="about_logo_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="pixbuf">gnunet_logo.png</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="about_name_version_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">@GNUNET_FS_GTK_NAME@ @GNUNET_FS_GTK_VERSION3@</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="size" value="200"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="about_copyright_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">(C) @GNUNET_FS_GTK_YEARFROM@-@GNUNET_FS_GTK_YEARTO@ The GNUnet Project</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="about_link_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"><a href="https://gnunet.org/">GNUnet: GNU's Framework for Secure P2P Networking</a></property>
+ <property name="use_markup">True</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkNotebook" id="about_credits_notebook">
+ <property name="can_focus">True</property>
+ <child>
+ <object class="GtkScrolledWindow" id="about_credits_authors_scroller">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <object class="GtkTextView" id="about_credits_authors_textview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="wrap_mode">word</property>
+ <property name="cursor_visible">False</property>
+ <property name="buffer">credits_authors_contents</property>
+ <property name="accepts_tab">False</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="about_credits_authors_tab">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Developed by</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="about_credits_docs_scroller">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <object class="GtkTextView" id="about_credits_docs_textview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="wrap_mode">word</property>
+ <property name="cursor_visible">False</property>
+ <property name="buffer">credits_docs_contents</property>
+ <property name="accepts_tab">False</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="about_credits_docs_tab">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Documented by</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="about_credits_trans_scroller">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <object class="GtkTextView" id="about_credits_trans_textview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="wrap_mode">word</property>
+ <property name="cursor_visible">False</property>
+ <property name="buffer">credits_trans_contents</property>
+ <property name="accepts_tab">False</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="about_credits_trans_tab">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Translated by</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="about_credits_art_scroller">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <object class="GtkTextView" id="about_credits_art_textview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="wrap_mode">word</property>
+ <property name="cursor_visible">False</property>
+ <property name="buffer">credits_art_contents</property>
+ <property name="accepts_tab">False</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="about_credits_art_tab">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Artwork by</property>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="about_license_scroller">
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <object class="GtkTextView" id="about_license_textview">
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="wrap_mode">word</property>
+ <property name="cursor_visible">False</property>
+ <property name="buffer">license_contents</property>
+ <property name="accepts_tab">False</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="about_buttons_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <object class="GtkButton" id="about_credits_button">
+ <property name="label" translatable="yes">Credits</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <signal name="clicked" handler="GNUNET_GTK_about_credits_button_clicked" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="about_license_button">
+ <property name="label" translatable="yes">License</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <signal name="clicked" handler="GNUNET_GTK_about_license_button_clicked" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="about_close_button">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="GNUNET_GTK_about_close_button_clicked" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkTextBuffer" id="credits_art_contents">
+ <property name="text">Jakub 'jimmac' Steiner <jimmac@ximian.org>
+Christian Muellner <chris@flop.de>
+Alex Jones <alexrjones@ntlworld.com>
+Nicklas Larsson <whybill@gmail.com>
+</property>
+ </object>
+ <object class="GtkTextBuffer" id="credits_authors_contents">
+ <property name="text">Juergen Appel <jappel@linux01.gwdg.de>
+Krista Grothoff <krista@grothoff.org>
+James Blackwell <jblack@linuxguru.net>
+Ludovic Courtes <ludo@chbouib.org>
+Nils Durner <durner@gnunet.org>
+Renaldo Ferreira <rf@cs.purdue.edu>
+Christian Grothoff <christian@grothoff.org>
+Eric Haumant
+Tzvetan Horozov <horozov@motorola.com>
+Gerd Knorr <kraxel@bytesex.org>
+Werner Koch <libgcrypt@g10code.com>
+Uli Luckas <luckas@musoft.de>
+Blake Matheny
+Glenn McGrath
+Hendrik Pagenhardt <Hendrik.Pagenhardt@gmx.net>
+Ioana Patrascu <ioanapatrascu@yahoo.com>
+Marko Raeihae
+Paul Ruth <ruth@cs.purdue.edu>
+Risto Saarelma
+Antti Salonen
+Tiberius Stef <tstef@cs.purdue.edu>
+Tuomas Toivonen
+Tomi Tukiainen
+Kevin Vandersloot <kfv101@psu.edu>
+Simo Viitanen
+Larry Waldo
+Igor Wronsky <iwronsky@users.sourceforge.net>
+<january@hushmail.com></property>
+ </object>
+ <object class="GtkTextBuffer" id="credits_docs_contents">
+ <property name="text">Christian Grothoff <christian@grothoff.org>
+Anders Carlsson <andersca@gnu.org>
+Nils Durner <durner@gnunet.org>
+Nicklas Larsson <whybill@gmail.com>
+Milan Bouchet-Valat <nalimilan@club.fr>
+Igor Wronsky <iwronsky@users.sourceforge.net>
+</property>
+ </object>
+ <object class="GtkTextBuffer" id="credits_trans_contents">
+ <property name="text">Di Ma
+Jens Palsberg <palsberg@cs.ucla.edu>
+Christian Grothoff <christian@grothoff.org>
+Nils Durner <durner@gnunet.org>
+Mathieu <mollo@bghflt.org>
+Eric Haumant
+milan@skoid.org
+Hiroshi Yamauchi <yamauchi@cs.purdue.edu>
+Adam Welc <welc@cs.purdue.edu>
+Bogdan Carbunar <carbunar@cs.purdue.edu>
+Steven Michael Murphy <murf@e-tools.com>
+Phan Vinh Thinh <teppi82@gmail.com>
+Daniel Nylander <po@danielnylander.se>
+</property>
+ </object>
+ <object class="GtkTextBuffer" id="license_contents">
+ <property name="text" translatable="yes">License should be loaded here at runtime from the license file (no need to copy the whole GPL in here...).</property>
+ </object>
+</interface>
diff --git a/src/fs/gnunet-fs-gtk-about.c b/src/fs/gnunet-fs-gtk-about.c
index 1ffdcca..4c7701b 100644
--- a/src/fs/gnunet-fs-gtk-about.c
+++ b/src/fs/gnunet-fs-gtk-about.c
@@ -34,8 +34,7 @@
void
GNUNET_GTK_main_menu_help_about_activate_cb (GtkWidget * dummy, gpointer data)
{
- GNUNET_GTK_display_about ("gnunet_fs_gtk_about_dialog.glade",
- "GNUNET_FS_GTK_about_dialog");
+ GNUNET_GTK_display_about ("gnunet_fs_gtk_about_window.glade");
}
diff --git a/src/include/gnunet_gtk.h b/src/include/gnunet_gtk.h
index c567efb..a38e5d9 100644
--- a/src/include/gnunet_gtk.h
+++ b/src/include/gnunet_gtk.h
@@ -93,10 +93,9 @@ GNUNET_GTK_get_new_builder (const char *filename);
* This displays an about dialog.
*
* @param dialogfile name of the glade file containing the dialog
- * @param dialogname name of the about dialog in the file
*/
void
-GNUNET_GTK_display_about (const char *dialogfile, const char *dialogname);
+GNUNET_GTK_display_about (const char *dialogfile);
diff --git a/src/lib/about.c b/src/lib/about.c
index 095ce21..a41f6d0 100644
--- a/src/lib/about.c
+++ b/src/lib/about.c
@@ -26,6 +26,115 @@
*/
#include "gnunet_gtk.h"
+static void
+destroy_about_dialog (GtkBuilder *builder)
+{
+ GtkWidget *ad;
+ ad = GTK_WIDGET (gtk_builder_get_object (builder, "about_window"));
+ gtk_widget_destroy (ad);
+ g_object_unref (G_OBJECT (builder));
+}
+
+static void
+about_window_show_exclusively (GtkBuilder *builder, gchar *name)
+{
+ GtkWidget *about_credits_notebook;
+ GtkWidget *about_license_textview;
+ GtkWidget *about_license_scroller;
+ about_credits_notebook = GTK_WIDGET (gtk_builder_get_object (builder, "about_credits_notebook"));
+ about_license_textview = GTK_WIDGET (gtk_builder_get_object (builder, "about_license_textview"));
+ about_license_scroller = GTK_WIDGET (gtk_builder_get_object (builder, "about_license_scroller"));
+ if (name == NULL)
+ {
+ gtk_widget_hide (about_credits_notebook);
+ gtk_widget_hide (about_license_textview);
+ gtk_widget_hide (about_license_scroller);
+ }
+ else if (strcmp ("about_credits_notebook", name) == 0)
+ {
+ gtk_widget_show (about_credits_notebook);
+ gtk_widget_hide (about_license_textview);
+ gtk_widget_hide (about_license_scroller);
+ }
+ else if (strcmp ("about_license_textview", name) == 0)
+ {
+ gtk_widget_show (about_license_textview);
+ gtk_widget_show (about_license_scroller);
+ gtk_widget_hide (about_credits_notebook);
+ }
+}
+
+G_MODULE_EXPORT gboolean
+GNUNET_GTK_about_window_got_frame_event (GtkWindow *window, GdkEvent *event,
+ gpointer user_data)
+{
+ GtkBuilder *builder = GTK_BUILDER (user_data);
+
+ switch (event->type)
+ {
+ case GDK_DELETE:
+ destroy_about_dialog (builder);
+ return TRUE;
+ break;
+ default:
+ return FALSE;
+ }
+}
+
+G_MODULE_EXPORT void
+GNUNET_GTK_about_window_realized (GtkWidget *widget, gpointer user_data)
+{
+ GtkBuilder *builder = GTK_BUILDER (user_data);
+ GtkTextBuffer *license_contents;
+ gchar *license = NULL;
+ license_contents = GTK_TEXT_BUFFER (gtk_builder_get_object (builder, "license_contents"));
+ if (g_file_get_contents ("COPYING", &license, NULL, NULL) && license != NULL)
+ {
+ gtk_text_buffer_set_text (license_contents, license, -1);
+ g_free (license);
+ }
+ about_window_show_exclusively (builder, NULL);
+}
+
+G_MODULE_EXPORT void
+GNUNET_GTK_about_close_button_clicked (GtkButton *widget, gpointer user_data)
+{
+ GtkBuilder *builder = GTK_BUILDER (user_data);
+ destroy_about_dialog (builder);
+}
+
+G_MODULE_EXPORT gboolean
+GNUNET_GTK_about_window_got_delete_event (GtkWidget *widget, GdkEvent *event,
+ gpointer user_data)
+{
+ GtkBuilder *builder = GTK_BUILDER (user_data);
+ destroy_about_dialog (builder);
+ return FALSE;
+}
+
+G_MODULE_EXPORT gboolean
+GNUNET_GTK_about_window_got_destroy_event (GtkWidget *widget, GdkEvent *event,
+ gpointer user_data)
+{
+ GtkBuilder *builder = GTK_BUILDER (user_data);
+ destroy_about_dialog (builder);
+ return FALSE;
+}
+
+G_MODULE_EXPORT void
+GNUNET_GTK_about_credits_button_clicked (GtkButton *widget, gpointer user_data)
+{
+ GtkBuilder *builder = GTK_BUILDER (user_data);
+ about_window_show_exclusively (builder, "about_credits_notebook");
+}
+
+G_MODULE_EXPORT void
+GNUNET_GTK_about_license_button_clicked (GtkButton *widget, gpointer user_data)
+{
+ GtkBuilder *builder = GTK_BUILDER (user_data);
+ about_window_show_exclusively (builder, "about_license_textview");
+}
+
/**
* This displays an about dialog.
*
@@ -33,7 +142,7 @@
* @param dialogname name of the about dialog in the file
*/
void
-GNUNET_GTK_display_about (const char *dialogfile, const char *dialogname)
+GNUNET_GTK_display_about (const char *dialogfile)
{
GtkBuilder *builder;
GtkWidget *ad;
@@ -41,10 +150,14 @@ GNUNET_GTK_display_about (const char *dialogfile, const char *dialogname)
builder = GNUNET_GTK_get_new_builder (dialogfile);
if (builder == NULL)
return;
- ad = GTK_WIDGET (gtk_builder_get_object (builder, dialogname));
+ ad = GTK_WIDGET (gtk_builder_get_object (builder, "about_window"));
+ g_object_set_data (G_OBJECT (ad), "gnunet-gtk-builder", builder);
+ gtk_widget_show (ad);
+ /*
gtk_dialog_run (GTK_DIALOG (ad));
gtk_widget_destroy (ad);
g_object_unref (G_OBJECT (builder));
+ */
}
diff --git a/src/lib/glade.c b/src/lib/glade.c
index 90c4649..4e5957c 100644
--- a/src/lib/glade.c
+++ b/src/lib/glade.c
@@ -84,7 +84,7 @@ GNUNET_GTK_get_new_builder (const char *filename)
GNUNET_free (glade_path);
return NULL;
}
- gtk_builder_connect_signals (ret, NULL);
+ gtk_builder_connect_signals (ret, ret);
GNUNET_free (glade_path);
return ret;
}
diff --git a/src/peerinfo/gnunet-peerinfo-gtk-about.c b/src/peerinfo/gnunet-peerinfo-gtk-about.c
index 6899442..5eb9b40 100644
--- a/src/peerinfo/gnunet-peerinfo-gtk-about.c
+++ b/src/peerinfo/gnunet-peerinfo-gtk-about.c
@@ -35,8 +35,7 @@ void
GNUNET_PEERINFO_GTK_main_menu_help_about_activate_cb (GtkWidget * dummy,
gpointer data)
{
- GNUNET_GTK_display_about ("gnunet_peerinfo_gtk_about_dialog.glade",
- "GNUNET_PEERINFO_GTK_about_dialog");
+ GNUNET_GTK_display_about ("gnunet_peerinfo_gtk_about_window.glade");
}
--
1.7.4
0004-New-search-bar-in-the-main-window.patch (66,445 bytes)
From d044af68ba86eb0df8b8279242cc80a02d5f5e25 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Sun, 11 Dec 2011 05:52:19 +0400
Subject: [PATCH 4/6] New search bar in the main window
---
contrib/gnunet_fs_gtk_main_window.glade | 496 ++++++++++++++++++++---
contrib/gnunet_fs_gtk_search_tab.glade | 202 +++++----
src/fs/gnunet-fs-gtk-main_window_view_toggles.c | 9 +
src/fs/gnunet-fs-gtk.c | 323 +++++++++++++++
4 files changed, 883 insertions(+), 147 deletions(-)
diff --git a/contrib/gnunet_fs_gtk_main_window.glade b/contrib/gnunet_fs_gtk_main_window.glade
index cb0b276..799c1b1 100644
--- a/contrib/gnunet_fs_gtk_main_window.glade
+++ b/contrib/gnunet_fs_gtk_main_window.glade
@@ -1,55 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.20"/>
+ <requires lib="gtk+" version="2.24"/>
<!-- interface-naming-policy project-wide -->
- <object class="GtkImage" id="image5">
+ <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store">
+ <columns>
+ <!-- column-name extractor_meta_type -->
+ <column type="guint"/>
+ <!-- column-name extractor_meta_format -->
+ <column type="guint"/>
+ <!-- column-name extractor_meta_type_string -->
+ <column type="gchararray"/>
+ <!-- column-name extracotr_meta_value -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkImage" id="image2">
<property name="visible">True</property>
- <property name="stock">gtk-go-down</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-go-up</property>
+ </object>
+ <object class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-new</property>
</object>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="stock">gtk-find</property>
</object>
- <object class="GtkImage" id="image1">
+ <object class="GtkImage" id="image5">
<property name="visible">True</property>
- <property name="stock">gtk-open</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-go-down</property>
</object>
- <object class="GtkImage" id="image3">
+ <object class="GtkImage" id="image6">
<property name="visible">True</property>
- <property name="stock">gtk-new</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-index</property>
</object>
- <object class="GtkImage" id="image2">
- <property name="visible">True</property>
- <property name="stock">gtk-go-up</property>
+ <object class="GtkListStore" id="main_window_search_anonymity_liststore">
+ <columns>
+ <!-- column-name Name -->
+ <column type="gchararray"/>
+ <!-- column-name Level -->
+ <column type="guint"/>
+ <!-- column-name Color -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">None</col>
+ <col id="1">0</col>
+ <col id="2" translatable="yes">#AAAA00000000</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Normal</col>
+ <col id="1">1</col>
+ <col id="2" translatable="yes">#000000000000</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Paranoid</col>
+ <col id="1">10</col>
+ <col id="2" translatable="yes">#0000AAAA0000</col>
+ </row>
+ </data>
</object>
<object class="GtkWindow" id="GNUNET_GTK_main_window">
+ <property name="can_focus">False</property>
<property name="title" translatable="yes">gnunet-fs-gtk</property>
<property name="window_position">center</property>
<property name="default_width">700</property>
<property name="default_height">500</property>
<property name="icon_name">gnunet-gtk</property>
<signal name="delete-event" handler="GNUNET_GTK_quit_cb" after="yes" swapped="no"/>
+ <signal name="realize" handler="GNUNET_GTK_main_window_realize_cb" swapped="no"/>
<child>
<object class="GtkVBox" id="GNUNET_GTK_main_window_vbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkStatusbar" id="GNUNET_GTK_status_bar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
<object class="GtkMenuBar" id="GNUNET_GTK_main_menu">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkMenuItem" id="GNUNET_GTK_main_menu_file_sharing">
- <property name="visible">True</property>
<property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">_File sharing</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu" id="GNUNET_GTK_main_menu_file_sharing_box">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_create_pseudonym">
<property name="label" translatable="yes">_Create pseudonym</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Create a pseudonym for publishing content. Note that you can also publish content anonymously (without using a pseudonym).</property>
- <property name="use_action_appearance">False</property>
<property name="accel_path"><gnunet-fs-gtk>/File sharing/Create pseudonym</property>
<property name="use_underline">True</property>
<property name="image">image3</property>
@@ -61,8 +125,9 @@
<child>
<object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_advertise_pseudonym">
<property name="label" translatable="yes">_Advertise Pseudonym</property>
- <property name="visible">True</property>
<property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="image">image6</property>
<property name="use_stock">False</property>
@@ -72,9 +137,10 @@
<child>
<object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_publish">
<property name="label" translatable="yes">_Publish</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Publish files or directories on GNUnet</property>
- <property name="use_action_appearance">False</property>
<property name="accel_path"><gnunet-fs-gtk>/File sharing/Publish</property>
<property name="use_underline">True</property>
<property name="image">image2</property>
@@ -85,16 +151,18 @@
</child>
<child>
<object class="GtkSeparatorMenuItem" id="GNUNET_GTK_main_menu_file_sep1">
- <property name="visible">True</property>
<property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_search">
<property name="label" translatable="yes">_Search</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Search GNUnet for files</property>
- <property name="use_action_appearance">False</property>
<property name="accel_path"><gnunet-fs-gtk>/File sharing/Search</property>
<property name="use_underline">True</property>
<property name="image">image4</property>
@@ -105,16 +173,18 @@
</child>
<child>
<object class="GtkSeparatorMenuItem" id="GNUNET_GTK_main_menu_file_sep2">
- <property name="visible">True</property>
<property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_download_uri">
<property name="label" translatable="yes">_Download</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Download a file or directory with a known URI.</property>
- <property name="use_action_appearance">False</property>
<property name="accel_path"><gnunet-fs-gtk>/File sharing/Download</property>
<property name="use_underline">True</property>
<property name="image">image5</property>
@@ -126,9 +196,10 @@
<child>
<object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_open_gnunet_directory">
<property name="label" translatable="yes">_Open GNUnet directory</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Use this option to browse a GNUnet directory file that has been previously downloaded.</property>
- <property name="use_action_appearance">False</property>
<property name="accel_path"><gnunet-fs-gtk>/File sharing/Open directory</property>
<property name="use_underline">True</property>
<property name="image">image1</property>
@@ -139,16 +210,18 @@
</child>
<child>
<object class="GtkSeparatorMenuItem" id="GNUNET_GTK_main_menu_file_sep3">
- <property name="visible">True</property>
<property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_quit">
<property name="label">gtk-quit</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Exit gnunet-fs-gtk. Active file-sharing operations will resume upon restart.</property>
- <property name="use_action_appearance">False</property>
<property name="accel_path"><gnunet-fs-gtk>/Quit</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
@@ -163,17 +236,20 @@
<child>
<object class="GtkMenuItem" id="GNUNET_GTK_main_menu_edit">
<property name="use_action_appearance">False</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">_Edit</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu" id="GNUNET_GTK_main_menu_edit_box">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_edit_preferences">
<property name="label">gtk-preferences</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Edit the system configuration.</property>
- <property name="use_action_appearance">False</property>
<property name="accel_path"><gnunet-fs-gtk>/Edit/Preferences</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
@@ -185,18 +261,21 @@
</child>
<child>
<object class="GtkMenuItem" id="GNUNET_GTK_main_menu_view">
- <property name="visible">True</property>
<property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">_View</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu" id="GNUNET_GTK_main_menu_view_box">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkCheckMenuItem" id="GNUNET_GTK_main_menu_view_metadata">
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Show meta data in main window</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">Metadata</property>
<property name="use_underline">True</property>
<property name="active">True</property>
@@ -205,34 +284,50 @@
</child>
<child>
<object class="GtkCheckMenuItem" id="GNUNET_GTK_main_menu_view_preview">
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Show preview (when available)</property>
- <property name="use_action_appearance">False</property>
<property name="label" translatable="yes">Preview</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<signal name="toggled" handler="GNUNET_GTK_main_menu_view_preview_toggled_cb" swapped="no"/>
</object>
</child>
+ <child>
+ <object class="GtkCheckMenuItem" id="GNUNET_GTK_main_menu_search_preview">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes">Show search box in main window</property>
+ <property name="label" translatable="yes">Search</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <signal name="toggled" handler="GNUNET_GTK_main_menu_view_search_toggled_cb" swapped="no"/>
+ </object>
+ </child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem" id="GNUNET_GTK_main_menu_help">
- <property name="visible">True</property>
<property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">_Help</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu" id="GNUNET_GTK_main_menu_help_abou">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_help_about">
<property name="label">gtk-about</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Display information about this version of gnunet-fs-gtk</property>
- <property name="use_action_appearance">False</property>
<property name="accel_path"><gnunet-fs-gtk>/Help/About</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
@@ -252,11 +347,13 @@
</child>
<child>
<object class="GtkToolbar" id="GNUNET_GTK_main_window_toolbar">
+ <property name="can_focus">False</property>
<property name="toolbar_style">icons</property>
<child>
<object class="GtkToolButton" id="GNUNET_GTK_toolbar_search">
- <property name="visible">True</property>
<property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">_Search</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-find</property>
@@ -274,8 +371,203 @@
</packing>
</child>
<child>
+ <object class="GtkHBox" id="main_window_search_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">3</property>
+ <property name="spacing">4</property>
+ <child>
+ <object class="GtkLabel" id="main_window_search_namespace_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Namespace:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="main_window_search_namespace_combobox_alignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yscale">0</property>
+ <child>
+ <object class="GtkToggleButton" id="main_window_search_namespace_dropdown_button">
+ <property name="label" translatable="yes"><none></property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="events">GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>
+ <property name="image">image10</property>
+ <property name="image_position">right</property>
+ <signal name="toggled" handler="main_window_search_namespace_dropdown_button_toggled_cb" swapped="no"/>
+ <signal name="enter-notify-event" handler="main_window_search_namespace_dropdown_button_enter_notify_event_cb" swapped="no"/>
+ <signal name="leave-notify-event" handler="namespace_selector_window_leave_notify_event_cb" swapped="no"/>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="main_window_search_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Query:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="main_window_search_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="invisible_char_set">True</property>
+ <property name="primary_icon_stock">gtk-find</property>
+ <property name="primary_icon_activatable">True</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="main_window_search_anonymity_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Anonymity:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="main_window_search_anonymity_combobox_alignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yscale">0</property>
+ <child>
+ <object class="GtkComboBox" id="main_window_search_anonymity_combobox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="model">main_window_search_anonymity_liststore</property>
+ <property name="active">1</property>
+ <child>
+ <object class="GtkCellRendererText" id="main_window_search_anonymity_combobox_renderer"/>
+ <attributes>
+ <attribute name="foreground">2</attribute>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="main_window_search_anonymity_combobox_renerer_level"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="main_window_search_mime_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Type:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="main_window_search_mime_combobox_alignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <object class="GtkComboBox" id="main_window_search_mime_combobox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="model">main_window_search_mime_liststore</property>
+ <property name="active">0</property>
+ <child>
+ <object class="GtkCellRendererText" id="main_window_search_mime_renderer_description"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="main_window_search_mime_renderer_type"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="main_window_search_button_alignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yscale">0</property>
+ <child>
+ <object class="GtkButton" id="main_window_search_button">
+ <property name="label" translatable="yes">Find!</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="main_window_search_button_clicked_cb" swapped="no"/>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">8</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkHBox" id="GNUNET_GTK_main_window_hbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkNotebook" id="GNUNET_GTK_main_window_notebook">
<property name="visible">True</property>
@@ -292,6 +584,7 @@
<child>
<object class="GtkVSeparator" id="GNUNET_GTK_main_window_separator">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
@@ -302,12 +595,14 @@
<child>
<object class="GtkVBox" id="GNUNET_GTK_main_window_extras_vbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkImage" id="GNUNET_GTK_main_window_preview_image">
<property name="width_request">128</property>
<property name="height_request">128</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
+ <property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Thumbnail associated with the currently selected content</property>
<property name="pixel_size">256</property>
@@ -389,36 +684,12 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkStatusbar" id="GNUNET_GTK_status_bar">
- <property name="visible">True</property>
- <property name="spacing">2</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
+ <property name="position">4</property>
</packing>
</child>
</object>
</child>
</object>
- <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store">
- <columns>
- <!-- column-name extractor_meta_type -->
- <column type="guint"/>
- <!-- column-name extractor_meta_format -->
- <column type="guint"/>
- <!-- column-name extractor_meta_type_string -->
- <column type="gchararray"/>
- <!-- column-name extracotr_meta_value -->
- <column type="gchararray"/>
- </columns>
- </object>
<object class="GtkListStore" id="GNUNET_GTK_peer_info_list_store">
<columns>
<!-- column-name peer_identity -->
@@ -433,10 +704,6 @@
<column type="guint64"/>
</columns>
</object>
- <object class="GtkImage" id="image6">
- <property name="visible">True</property>
- <property name="stock">gtk-index</property>
- </object>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
<property name="step_increment">1</property>
@@ -461,4 +728,119 @@
<property name="page_increment">10</property>
<property name="page_size">10</property>
</object>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-open</property>
+ </object>
+ <object class="GtkImage" id="image10">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-index</property>
+ </object>
+ <object class="GtkImage" id="image7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-index</property>
+ </object>
+ <object class="GtkImage" id="image8">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-index</property>
+ </object>
+ <object class="GtkImage" id="image9">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-index</property>
+ </object>
+ <object class="GtkListStore" id="main_window_search_mime_liststore">
+ <columns>
+ <!-- column-name MIME -->
+ <column type="gchararray"/>
+ <!-- column-name Type -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0"> </col>
+ <col id="1" translatable="yes">Any</col>
+ </row>
+ <row>
+ <col id="0">plain/text</col>
+ <col id="1" translatable="yes">Text</col>
+ </row>
+ <row>
+ <col id="0">application/zip</col>
+ <col id="1" translatable="yes">Zip</col>
+ </row>
+ <row>
+ <col id="0">audio/mpeg</col>
+ <col id="1" translatable="yes">MPEG audio</col>
+ </row>
+ </data>
+ </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 KeyTextual -->
+ <column type="gchararray"/>
+ <!-- column-name Tooltip -->
+ <column type="gchararray"/>
+ </columns>
+ </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>
+ <property name="type">popup</property>
+ <property name="resizable">False</property>
+ <property name="type_hint">dropdown-menu</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="urgency_hint">True</property>
+ <property name="decorated">False</property>
+ <property name="deletable">False</property>
+ <property name="transient_for">GNUNET_GTK_main_window</property>
+ <property name="mnemonics_visible">False</property>
+ <signal name="leave-notify-event" handler="namespace_selector_window_leave_notify_event_cb" swapped="no"/>
+ <signal name="enter-notify-event" handler="main_window_search_namespace_dropdown_button_enter_notify_event_cb" swapped="no"/>
+ <child>
+ <object class="GtkTreeView" id="namespace_selector_treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">main_window_search_namespace_treestore</property>
+ <property name="headers_clickable">False</property>
+ <property name="search_column">0</property>
+ <property name="hover_expand">True</property>
+ <property name="tooltip_column">3</property>
+ <signal name="cursor-changed" handler="namespace_selector_treeview_cursor_changed_cb" swapped="no"/>
+ <child>
+ <object class="GtkTreeViewColumn" id="name_column">
+ <property name="sizing">autosize</property>
+ <property name="title" translatable="yes">Name</property>
+ <child>
+ <object class="GtkCellRendererText" id="namespace_selector_name_column_text_cell"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="key_column">
+ <property name="sizing">autosize</property>
+ <property name="title" translatable="yes">Key</property>
+ <child>
+ <object class="GtkCellRendererText" id="namespace_selector_key_column_text_cell"/>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
</interface>
diff --git a/contrib/gnunet_fs_gtk_search_tab.glade b/contrib/gnunet_fs_gtk_search_tab.glade
index 38c0c38..9a8fa61 100644
--- a/contrib/gnunet_fs_gtk_search_tab.glade
+++ b/contrib/gnunet_fs_gtk_search_tab.glade
@@ -35,125 +35,143 @@
</columns>
</object>
<object class="GtkWindow" id="_search_result_frame_window">
+ <property name="can_focus">False</property>
+ <property name="type">popup</property>
<property name="title">You should never see this</property>
- <child>
- <object class="GtkScrolledWindow" id="_search_frame_scrolled_window">
- <property name="height_request">100</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">automatic</property>
-
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="focus_on_map">False</property>
+ <property name="decorated">False</property>
+ <property name="deletable">False</property>
<child>
- <object class="GtkTreeView" id="_search_result_frame">
+ <object class="GtkScrolledWindow" id="_search_frame_scrolled_window">
+ <property name="height_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="model">GNUNET_GTK_file_sharing_result_tree_store</property>
- <property name="reorderable">True</property>
- <property name="enable_grid_lines">horizontal</property>
- <property name="enable_tree_lines">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
<child>
- <object class="GtkTreeViewColumn" id="search_result_description_column">
- <property name="resizable">True</property>
- <property name="sizing">autosize</property>
- <property name="title" translatable="yes">Description</property>
- <property name="expand">True</property>
- <property name="clickable">True</property>
+ <object class="GtkTreeView" id="_search_result_frame">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">GNUNET_GTK_file_sharing_result_tree_store</property>
<property name="reorderable">True</property>
- <property name="sort_indicator">True</property>
- <property name="sort_column_id">6</property>
+ <property name="enable_grid_lines">horizontal</property>
+ <property name="enable_tree_lines">True</property>
<child>
- <object class="GtkCellRendererProgress" id="search_result_description_renderer"/>
- <attributes>
- <attribute name="cell-background">8</attribute>
- <attribute name="text">6</attribute>
- <attribute name="value">5</attribute>
- </attributes>
+ <object class="GtkTreeViewColumn" id="search_result_description_column">
+ <property name="resizable">True</property>
+ <property name="sizing">autosize</property>
+ <property name="title" translatable="yes">Description</property>
+ <property name="expand">True</property>
+ <property name="clickable">True</property>
+ <property name="reorderable">True</property>
+ <property name="sort_indicator">True</property>
+ <property name="sort_column_id">6</property>
+ <child>
+ <object class="GtkCellRendererProgress" id="search_result_description_renderer"/>
+ <attributes>
+ <attribute name="cell-background">8</attribute>
+ <attribute name="text">6</attribute>
+ <attribute name="value">5</attribute>
+ </attributes>
+ </child>
+ </object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="search_result_mime_column">
- <property name="sizing">autosize</property>
- <property name="title" translatable="yes">Format</property>
- <property name="clickable">True</property>
- <property name="reorderable">True</property>
- <property name="sort_indicator">True</property>
- <property name="sort_column_id">10</property>
<child>
- <object class="GtkCellRendererText" id="search_result_mime_renderer"/>
- <attributes>
- <attribute name="background">8</attribute>
- <attribute name="text">10</attribute>
- </attributes>
+ <object class="GtkTreeViewColumn" id="search_result_mime_column">
+ <property name="sizing">autosize</property>
+ <property name="title" translatable="yes">Format</property>
+ <property name="clickable">True</property>
+ <property name="reorderable">True</property>
+ <property name="sort_indicator">True</property>
+ <property name="sort_column_id">10</property>
+ <child>
+ <object class="GtkCellRendererText" id="search_result_mime_renderer"/>
+ <attributes>
+ <attribute name="background">8</attribute>
+ <attribute name="text">10</attribute>
+ </attributes>
+ </child>
+ </object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="search_result_size_column">
- <property name="sizing">autosize</property>
- <property name="title" translatable="yes">Size</property>
- <property name="reorderable">True</property>
- <property name="sort_indicator">True</property>
- <property name="sort_column_id">2</property>
<child>
- <object class="GtkCellRendererProgress" id="search_result_size_renderer"/>
- <attributes>
- <attribute name="cell-background">8</attribute>
- <attribute name="text">2</attribute>
- <attribute name="value">4</attribute>
- </attributes>
+ <object class="GtkTreeViewColumn" id="search_result_size_column">
+ <property name="sizing">autosize</property>
+ <property name="title" translatable="yes">Size</property>
+ <property name="reorderable">True</property>
+ <property name="sort_indicator">True</property>
+ <property name="sort_column_id">2</property>
+ <child>
+ <object class="GtkCellRendererProgress" id="search_result_size_renderer"/>
+ <attributes>
+ <attribute name="cell-background">8</attribute>
+ <attribute name="text">2</attribute>
+ <attribute name="value">4</attribute>
+ </attributes>
+ </child>
+ </object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="search_result_applicability_column">
- <property name="sizing">autosize</property>
- <property name="title">#</property>
- <property name="reorderable">True</property>
- <property name="sort_indicator">True</property>
- <property name="sort_order">descending</property>
- <property name="sort_column_id">11</property>
<child>
- <object class="GtkCellRendererText" id="search_result_applicability_renderer"/>
- <attributes>
- <attribute name="background">8</attribute>
- <attribute name="text">11</attribute>
- </attributes>
+ <object class="GtkTreeViewColumn" id="search_result_applicability_column">
+ <property name="sizing">autosize</property>
+ <property name="title">#</property>
+ <property name="reorderable">True</property>
+ <property name="sort_indicator">True</property>
+ <property name="sort_order">descending</property>
+ <property name="sort_column_id">11</property>
+ <child>
+ <object class="GtkCellRendererText" id="search_result_applicability_renderer"/>
+ <attributes>
+ <attribute name="background">8</attribute>
+ <attribute name="text">11</attribute>
+ </attributes>
+ </child>
+ </object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="search_result_preview_column">
- <property name="min_width">128</property>
- <property name="max_width">128</property>
- <property name="title" translatable="yes">Preview</property>
- <property name="reorderable">True</property>
<child>
- <object class="GtkCellRendererPixbuf" id="search_result_preview_renderer"/>
- <attributes>
- <attribute name="pixbuf">3</attribute>
- </attributes>
+ <object class="GtkTreeViewColumn" id="search_result_preview_column">
+ <property name="min_width">128</property>
+ <property name="max_width">128</property>
+ <property name="title" translatable="yes">Preview</property>
+ <property name="reorderable">True</property>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="search_result_preview_renderer"/>
+ <attributes>
+ <attribute name="pixbuf">3</attribute>
+ </attributes>
+ </child>
+ </object>
</child>
</object>
</child>
</object>
</child>
</object>
- </child>
- </object>
<object class="GtkWindow" id="_search_result_label_window">
+ <property name="can_focus">False</property>
+ <property name="type">popup</property>
+ <property name="title" translatable="yes">You shouldn't see this also</property>
+ <property name="type_hint">dock</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="focus_on_map">False</property>
+ <property name="decorated">False</property>
+ <property name="deletable">False</property>
<child>
<object class="GtkHBox" id="_search_result_label_hbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="border_width">5</property>
<child>
<object class="GtkLabel" id="_search_result_label_window_label">
<property name="height_request">30</property>
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">query</property>
</object>
<packing>
+ <property name="expand">True</property>
<property name="fill">False</property>
<property name="padding">5</property>
<property name="position">0</property>
@@ -161,12 +179,13 @@
</child>
<child>
<object class="GtkButton" id="_search_result_label_play_button">
+ <property name="use_action_appearance">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<child>
<object class="GtkImage" id="play_icon_stock_image">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="stock">gtk-media-play</property>
<property name="icon-size">2</property>
</object>
@@ -180,13 +199,14 @@
</child>
<child>
<object class="GtkButton" id="_search_result_label_pause_button">
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<child>
<object class="GtkImage" id="pause_icon_stock_image">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="stock">gtk-media-pause</property>
<property name="icon-size">2</property>
</object>
@@ -200,13 +220,14 @@
</child>
<child>
<object class="GtkButton" id="_search_result_label_clear_button">
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<child>
<object class="GtkImage" id="clear_icon_stock_image">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="stock">gtk-clear</property>
</object>
</child>
@@ -220,14 +241,15 @@
</child>
<child>
<object class="GtkButton" id="_search_result_label_close_button">
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="relief">half</property>
<child>
<object class="GtkImage" id="close_icon_stock_image">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="stock">gtk-close</property>
<property name="icon-size">2</property>
</object>
diff --git a/src/fs/gnunet-fs-gtk-main_window_view_toggles.c b/src/fs/gnunet-fs-gtk-main_window_view_toggles.c
index 975a1be..9b73cac 100644
--- a/src/fs/gnunet-fs-gtk-main_window_view_toggles.c
+++ b/src/fs/gnunet-fs-gtk-main_window_view_toggles.c
@@ -71,5 +71,14 @@ GNUNET_GTK_main_menu_view_metadata_toggled_cb (GtkWidget * dummy, gpointer data)
"GNUNET_GTK_main_menu_view_metadata");
}
+/**
+ * Preview view is toggled.
+ */
+void
+GNUNET_GTK_main_menu_view_search_toggled_cb (GtkWidget * dummy, gpointer data)
+{
+ toggle_view ("main_window_search_hbox",
+ "GNUNET_GTK_main_menu_search_preview");
+}
/* end of gnunet-fs-gtk-main_window_view_toggles.c */
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index 67a7059..68c6be6 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -46,6 +46,7 @@ static struct GNUNET_FS_Handle *fs;
*/
static struct EXTRACTOR_PluginList *plugins;
+guint namespace_selector_window_leave_timeout_source = 0;
/**
* Return handle for file-sharing operations.
@@ -167,6 +168,328 @@ add_new_tab ()
gtk_widget_show (GTK_WIDGET (notebook));
}
+void
+main_window_search_namespace_dropdown_button_toggled_cb (GtkToggleButton *togglebutton,
+ gpointer user_data)
+{
+ gboolean active;
+ GtkBuilder *builder = GTK_BUILDER (user_data);
+ GtkWidget *namespace_selector_window;
+ namespace_selector_window = GTK_WIDGET (gtk_builder_get_object (builder, "namespace_selector_window"));
+ g_object_get (G_OBJECT (togglebutton), "active", &active, NULL);
+ if (active)
+ {
+ GtkAllocation togglebutton_allocation;
+ GdkWindow *main_window_gdk;
+ gint mwg_x, mwg_y, tgb_x, tgb_y, popup_x, popup_y;
+
+ gtk_widget_get_allocation (GTK_WIDGET (togglebutton), &togglebutton_allocation);
+
+ main_window_gdk = gtk_widget_get_window (GTK_WIDGET (togglebutton));
+
+ gdk_window_get_origin (main_window_gdk, &mwg_x, &mwg_y);
+
+ /* FIXME: this might become a problem in other window managers,
+ * where reference point is not in the top-left corner.
+ * We want to show the window below the button.
+ */
+ tgb_x = mwg_x + togglebutton_allocation.x;
+ tgb_y = mwg_y + togglebutton_allocation.y;
+ popup_x = tgb_x;
+ popup_y = tgb_y + togglebutton_allocation.height;
+
+ gtk_window_move (GTK_WINDOW (namespace_selector_window), popup_x, popup_y);
+
+ gtk_widget_show (namespace_selector_window);
+ }
+ else
+ gtk_widget_hide (namespace_selector_window);
+}
+
+gboolean
+namespace_selector_window_leave_timeout_cb (gpointer user_data)
+{
+ GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (user_data);
+ /* This will eventually hide the namespace selector */
+ gtk_toggle_button_set_active (toggle_button, FALSE);
+ return FALSE;
+}
+
+gboolean
+main_window_search_namespace_dropdown_button_enter_notify_event_cb (
+ GtkWidget *widget, GdkEvent *event, gpointer user_data)
+{
+ if (namespace_selector_window_leave_timeout_source > 0)
+ g_source_remove (namespace_selector_window_leave_timeout_source);
+ return FALSE;
+}
+
+
+gboolean
+namespace_selector_window_leave_notify_event_cb (GtkWidget *widget,
+ GdkEvent *event, gpointer user_data)
+{
+ GtkBuilder *builder;
+ GtkToggleButton *toggle_button;
+ guint timeout_id;
+
+ builder = GTK_BUILDER (user_data);
+
+ toggle_button = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "main_window_search_namespace_dropdown_button"));
+
+ /* Place a timeout to hide the window. It will be cancelled if the cursor
+ * enters the namespace selector window or the toggle button within 100ms.
+ */
+ timeout_id = g_timeout_add (100, &namespace_selector_window_leave_timeout_cb, toggle_button);
+ if (namespace_selector_window_leave_timeout_source > 0)
+ g_source_remove (namespace_selector_window_leave_timeout_source);
+ namespace_selector_window_leave_timeout_source = timeout_id;
+
+ return FALSE;
+}
+
+gboolean
+GNUNET_GTK_get_tree_string (GtkTreeView *treeview, GtkTreePath *treepath,
+ guint column, gchar **value)
+{
+ gboolean ok;
+ GtkTreeModel *model;
+
+ model = gtk_tree_view_get_model (treeview);
+ if (!model)
+ return FALSE;
+
+ GtkTreeIter iter;
+ ok = gtk_tree_model_get_iter (model, &iter, treepath);
+ if (!ok)
+ return FALSE;
+
+ *value = NULL;
+ gtk_tree_model_get (model, &iter, column, value, -1);
+ if (*value == NULL)
+ return FALSE;
+ return TRUE;
+}
+
+gboolean
+get_selected_anonymity_level (GtkBuilder *builder, guint *p_level)
+{
+ GtkComboBox *combo;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+ guint level;
+
+ combo = GTK_COMBO_BOX(gtk_builder_get_object (builder,
+ "main_window_search_anonymity_combobox"));
+ if (!combo)
+ return FALSE;
+
+ if (!gtk_combo_box_get_active_iter (combo, &iter))
+ return FALSE;
+
+ model = gtk_combo_box_get_model (combo);
+ if (!model)
+ return FALSE;
+
+ gtk_tree_model_get (model, &iter, 1, &level, -1);
+ if (p_level)
+ *p_level = level;
+ return TRUE;
+}
+
+gboolean
+get_selected_namespace_treepath_iter_model_widget (GtkBuilder *builder,
+ GtkTreePath **p_treepath, GtkTreeIter *p_iter, GtkTreeModel **p_model,
+ GtkWidget **p_widget)
+{
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GList *selected;
+ GtkTreePath *treepath;
+ GtkWidget *widget;
+
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "namespace_selector_treeview"));
+ if (!widget)
+ return FALSE;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
+ if (!selection || !model)
+ return FALSE;
+
+ selected = gtk_tree_selection_get_selected_rows (selection, NULL);
+ if (!selected)
+ return FALSE;
+ if (selected->data == NULL)
+ {
+ g_list_foreach (selected, (GFunc) gtk_tree_path_free, NULL);
+ g_list_free (selected);
+ return FALSE;
+ }
+ /* Free everything except the first path, keep it */
+ treepath = (GtkTreePath *) selected->data;
+ selected = g_list_remove (selected, selected->data);
+ g_list_foreach (selected, (GFunc) gtk_tree_path_free, NULL);
+ g_list_free (selected);
+
+ if (p_iter && !gtk_tree_model_get_iter (model, p_iter, treepath))
+ {
+ gtk_tree_path_free (treepath);
+ return FALSE;
+ }
+ *p_treepath = treepath;
+ if (p_model)
+ *p_model = model;
+ if (p_widget)
+ *p_widget = widget;
+ return TRUE;
+}
+
+void
+namespace_selector_treeview_cursor_changed_cb (GtkWidget *widget,
+ gpointer user_data)
+{
+ GtkBuilder *builder;
+ GtkToggleButton *toggle_button;
+ gchar *value;
+ GtkTreePath *treepath;
+
+ builder = GTK_BUILDER (user_data);
+
+ if (!get_selected_namespace_treepath_iter_model_widget (builder, &treepath, NULL, NULL, NULL))
+ return;
+
+ toggle_button = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "main_window_search_namespace_dropdown_button"));
+ if (!toggle_button)
+ return;
+
+ if (GNUNET_GTK_get_tree_string (GTK_TREE_VIEW (widget), treepath, 0,
+ &value))
+ gtk_button_set_label (GTK_BUTTON (toggle_button), value);
+
+ gtk_tree_path_free (treepath);
+
+ /* This will eventually hide the namespace selector */
+ gtk_toggle_button_set_active (toggle_button, FALSE);
+}
+
+void
+main_window_search_button_clicked_cb (GtkButton *button, gpointer user_data)
+{
+ GtkBuilder *builder;
+ GtkTreePath *namespace_treepath = NULL;
+ GtkTreeModel *namespace_model = NULL;
+ GtkComboBox *mime_combo;
+ GtkTreeModel *mime_model;
+ GtkEntry *query_entry;
+ guint anonymity_level;
+ GtkTreeIter iter;
+ const char *entry_keywords;
+ gchar *keywords;
+ gchar *mime_keyword;
+
+ GNUNET_HashCode *nsid = NULL;
+ struct GNUNET_FS_Uri *uri;
+ char *emsg;
+
+ builder = GTK_BUILDER (user_data);
+
+ if (!get_selected_anonymity_level (builder, &anonymity_level))
+ return;
+
+ mime_combo = GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object
+ ("main_window_search_mime_combobox"));
+ mime_model = gtk_combo_box_get_model (mime_combo);
+ if (mime_model && gtk_combo_box_get_active_iter (mime_combo, &iter))
+ {
+ mime_keyword = NULL;
+ gtk_tree_model_get (mime_model, &iter, 0, &mime_keyword, -1);
+ }
+
+ get_selected_namespace_treepath_iter_model_widget (builder,
+ &namespace_treepath, &iter, &namespace_model, NULL);
+
+ query_entry = GTK_ENTRY (gtk_builder_get_object (builder,
+ "main_window_search_entry"));
+
+ entry_keywords = gtk_entry_get_text (query_entry);
+ if (mime_keyword != NULL)
+ {
+ keywords = g_strdup_printf ("%s %s", entry_keywords, mime_keyword);
+ g_free (mime_keyword);
+ }
+ else
+ keywords = g_strdup (entry_keywords);
+ if (namespace_treepath != NULL)
+ gtk_tree_model_get (namespace_model, &iter, 1, &nsid, -1);
+ if (nsid != NULL)
+ {
+ uri = GNUNET_FS_uri_sks_create_from_nsid (nsid, keywords);
+ GNUNET_assert (uri != NULL);
+ }
+ else
+ {
+ emsg = NULL;
+ uri = GNUNET_FS_uri_ksk_create (keywords, &emsg);
+ if (uri == NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Invalid keyword string `%s': %s"), keywords, emsg);
+ GNUNET_free_non_null (emsg);
+ return;
+ }
+ }
+ GNUNET_FS_search_start (GNUNET_FS_GTK_get_fs_handle (), uri,
+ anonymity_level, GNUNET_FS_SEARCH_OPTION_NONE, NULL);
+
+ g_free (keywords);
+ GNUNET_FS_uri_destroy (uri);
+}
+
+void
+GNUNET_GTK_main_window_realize_cb (GtkWidget *widget, gpointer user_data)
+{
+ GtkTreeIter iter;
+ GtkTreeView *namespace_tree;
+ GtkTreeStore *namespace_treestore;
+ GtkBuilder *builder;
+ GtkToggleButton *toggle_button;
+ GtkWidget *namespace_selector_window;
+
+ builder = GTK_BUILDER (user_data);
+
+ namespace_treestore = GTK_TREE_STORE (GNUNET_FS_GTK_get_main_window_object
+ ("main_window_search_namespace_treestore"));
+ namespace_tree = GTK_TREE_VIEW (GNUNET_FS_GTK_get_main_window_object
+ ("namespace_selector_treeview"));
+
+ /* TODO: fetch real values from somewhere instead of filling the store with dummies */
+ gtk_tree_store_insert_with_values (namespace_treestore, &iter, NULL, 0, 0, "Any", 1, NULL, 2, "", 3, "Do not search in any particular namespace", -1);
+ gtk_tree_store_insert_with_values (namespace_treestore, &iter, NULL, 1, 0, "foo", 1, NULL, 2, "IAMTHEBESTOBEYMENOCARRIER", 3, "Tooltip1", -1);
+ gtk_tree_store_insert_with_values (namespace_treestore, &iter, NULL, 2, 0, "bar", 1, NULL, 2, "NOONEWILLKNOWTHISIDBECAUSEITSSECRET", 3, "Tooltip2", -1);
+ gtk_tree_store_insert_with_values (namespace_treestore, &iter, NULL, 3, 0, "baz", 1, NULL, 2, "SSLOPENSSHGNUGTKGNUNETFTWYAYA", 3, "Tooltip3", -1);
+
+ /* FIXME: read currently selected namespace from somewhere instead of selecting 0th item */
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (namespace_treestore), &iter))
+ {
+ gchar *value;
+ GtkTreePath *treepath = gtk_tree_path_new_first ();
+ gtk_tree_selection_select_iter (gtk_tree_view_get_selection (
+ namespace_tree), &iter);
+ toggle_button = GTK_TOGGLE_BUTTON (GNUNET_FS_GTK_get_main_window_object
+ ("main_window_search_namespace_dropdown_button"));
+ if (GNUNET_GTK_get_tree_string (namespace_tree,
+ treepath, 0, &value))
+ gtk_button_set_label (GTK_BUTTON (toggle_button), value);
+ gtk_tree_path_free (treepath);
+ }
+
+ /* How the window (to trigger certain events) and immediately hide it */
+ namespace_selector_window = GTK_WIDGET (gtk_builder_get_object (builder, "namespace_selector_window"));
+ gtk_widget_show (namespace_selector_window);
+ gtk_widget_hide (namespace_selector_window);
+
+}
/**
* Actual main function run right after GNUnet's scheduler
--
1.7.4
0001-A-lump-of-GUI-changes-and-tweaks.patch (23,765 bytes)
From 37ddf86b521f1655724bd895849905fd023c7915 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Mon, 12 Dec 2011 00:43:48 +0400
Subject: [PATCH 1/2] A lump of GUI changes and tweaks
* Real namespaces are now fetched from FS instead of dummies
* Used Size Group to make entries and combobox in search bar have the same height
* Reworked namespace selection toggle button - now it consists of separate label and
button. Could have made it to look more comboboxy, but there seems to be no pressing
need for that.
* Removed some unneded widgets.
* MIME type selector now has more columns, and got an entry to input arbitrary MIME type.
---
contrib/gnunet_fs_gtk_main_window.glade | 237 +++++++++++++++++++-----------
src/fs/gnunet-fs-gtk.c | 85 ++++++++++--
2 files changed, 223 insertions(+), 99 deletions(-)
diff --git a/contrib/gnunet_fs_gtk_main_window.glade b/contrib/gnunet_fs_gtk_main_window.glade
index 799c1b1..4fdc888 100644
--- a/contrib/gnunet_fs_gtk_main_window.glade
+++ b/contrib/gnunet_fs_gtk_main_window.glade
@@ -2,70 +2,6 @@
<interface>
<requires lib="gtk+" version="2.24"/>
<!-- interface-naming-policy project-wide -->
- <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store">
- <columns>
- <!-- column-name extractor_meta_type -->
- <column type="guint"/>
- <!-- column-name extractor_meta_format -->
- <column type="guint"/>
- <!-- column-name extractor_meta_type_string -->
- <column type="gchararray"/>
- <!-- column-name extracotr_meta_value -->
- <column type="gchararray"/>
- </columns>
- </object>
- <object class="GtkImage" id="image2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-go-up</property>
- </object>
- <object class="GtkImage" id="image3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-new</property>
- </object>
- <object class="GtkImage" id="image4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-find</property>
- </object>
- <object class="GtkImage" id="image5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-go-down</property>
- </object>
- <object class="GtkImage" id="image6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-index</property>
- </object>
- <object class="GtkListStore" id="main_window_search_anonymity_liststore">
- <columns>
- <!-- column-name Name -->
- <column type="gchararray"/>
- <!-- column-name Level -->
- <column type="guint"/>
- <!-- column-name Color -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">None</col>
- <col id="1">0</col>
- <col id="2" translatable="yes">#AAAA00000000</col>
- </row>
- <row>
- <col id="0" translatable="yes">Normal</col>
- <col id="1">1</col>
- <col id="2" translatable="yes">#000000000000</col>
- </row>
- <row>
- <col id="0" translatable="yes">Paranoid</col>
- <col id="1">10</col>
- <col id="2" translatable="yes">#0000AAAA0000</col>
- </row>
- </data>
- </object>
<object class="GtkWindow" id="GNUNET_GTK_main_window">
<property name="can_focus">False</property>
<property name="title" translatable="yes">gnunet-fs-gtk</property>
@@ -389,30 +325,51 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="main_window_search_selected_namespace_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"><none></property>
+ <property name="single_line_mode">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkAlignment" id="main_window_search_namespace_combobox_alignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<object class="GtkToggleButton" id="main_window_search_namespace_dropdown_button">
- <property name="label" translatable="yes"><none></property>
<property name="use_action_appearance">False</property>
+ <property name="width_request">21</property>
+ <property name="height_request">21</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>
- <property name="image">image10</property>
<property name="image_position">right</property>
<signal name="toggled" handler="main_window_search_namespace_dropdown_button_toggled_cb" swapped="no"/>
<signal name="enter-notify-event" handler="main_window_search_namespace_dropdown_button_enter_notify_event_cb" swapped="no"/>
<signal name="leave-notify-event" handler="namespace_selector_window_leave_notify_event_cb" swapped="no"/>
+ <child>
+ <object class="GtkArrow" id="arrow1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="arrow_type">down</property>
+ </object>
+ </child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -424,7 +381,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
@@ -442,7 +399,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
<child>
@@ -454,7 +411,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">4</property>
+ <property name="position">5</property>
</packing>
</child>
<child>
@@ -487,7 +444,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">5</property>
+ <property name="position">6</property>
</packing>
</child>
<child>
@@ -499,14 +456,13 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">6</property>
+ <property name="position">7</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="main_window_search_mime_combobox_alignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<object class="GtkComboBox" id="main_window_search_mime_combobox">
@@ -514,16 +470,38 @@
<property name="can_focus">False</property>
<property name="model">main_window_search_mime_liststore</property>
<property name="active">0</property>
+ <property name="has_entry">True</property>
+ <property name="entry_text_column">0</property>
+ <signal name="popdown" handler="main_window_search_mime_combobox_popdown_cb" swapped="no"/>
+ <signal name="popup" handler="main_window_search_mime_combobox_popup_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="main_window_search_mime_renderer_description"/>
<attributes>
- <attribute name="text">0</attribute>
+ <attribute name="text">1</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="main_window_search_mime_renderer_type"/>
<attributes>
- <attribute name="text">1</attribute>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="main_window_search_mime_renderer_extension"/>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="main_window_search_mime_renderer_lossyness"/>
+ <attributes>
+ <attribute name="text">3</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="main_window_search_mime_renderer_freedom"/>
+ <attributes>
+ <attribute name="text">4</attribute>
</attributes>
</child>
</object>
@@ -532,7 +510,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">7</property>
+ <property name="position">8</property>
</packing>
</child>
<child>
@@ -554,7 +532,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">8</property>
+ <property name="position">9</property>
</packing>
</child>
</object>
@@ -690,18 +668,16 @@
</object>
</child>
</object>
- <object class="GtkListStore" id="GNUNET_GTK_peer_info_list_store">
+ <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store">
<columns>
- <!-- column-name peer_identity -->
- <column type="gchararray"/>
- <!-- column-name number_of_known_addresses -->
+ <!-- column-name extractor_meta_type -->
<column type="guint"/>
- <!-- column-name country_name -->
+ <!-- column-name extractor_meta_format -->
+ <column type="guint"/>
+ <!-- column-name extractor_meta_type_string -->
+ <column type="gchararray"/>
+ <!-- column-name extracotr_meta_value -->
<column type="gchararray"/>
- <!-- column-name country_flag -->
- <column type="GdkPixbuf"/>
- <!-- column-name bandwidth -->
- <column type="guint64"/>
</columns>
</object>
<object class="GtkAdjustment" id="adjustment1">
@@ -716,6 +692,20 @@
<property name="page_increment">10</property>
<property name="page_size">10</property>
</object>
+ <object class="GtkListStore" id="GNUNET_GTK_peer_info_list_store">
+ <columns>
+ <!-- column-name peer_identity -->
+ <column type="gchararray"/>
+ <!-- column-name number_of_known_addresses -->
+ <column type="guint"/>
+ <!-- column-name country_name -->
+ <column type="gchararray"/>
+ <!-- column-name country_flag -->
+ <column type="GdkPixbuf"/>
+ <!-- column-name bandwidth -->
+ <column type="guint64"/>
+ </columns>
+ </object>
<object class="GtkAdjustment" id="adjustment3">
<property name="upper">100</property>
<property name="step_increment">1</property>
@@ -733,7 +723,27 @@
<property name="can_focus">False</property>
<property name="stock">gtk-open</property>
</object>
- <object class="GtkImage" id="image10">
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-go-up</property>
+ </object>
+ <object class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-new</property>
+ </object>
+ <object class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-find</property>
+ </object>
+ <object class="GtkImage" id="image5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-go-down</property>
+ </object>
+ <object class="GtkImage" id="image6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-index</property>
@@ -753,29 +763,74 @@
<property name="can_focus">False</property>
<property name="stock">gtk-index</property>
</object>
+ <object class="GtkListStore" id="main_window_search_anonymity_liststore">
+ <columns>
+ <!-- column-name Name -->
+ <column type="gchararray"/>
+ <!-- column-name Level -->
+ <column type="guint"/>
+ <!-- column-name Color -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">None</col>
+ <col id="1">0</col>
+ <col id="2" translatable="yes">#AAAA00000000</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Normal</col>
+ <col id="1">1</col>
+ <col id="2" translatable="yes">#000000000000</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Paranoid</col>
+ <col id="1">10</col>
+ <col id="2" translatable="yes">#0000AAAA0000</col>
+ </row>
+ </data>
+ </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>
@@ -791,6 +846,14 @@
<column type="gchararray"/>
</columns>
</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="GtkWindow" id="namespace_selector_window">
<property name="can_focus">False</property>
<property name="events">GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index 68c6be6..6833783 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -351,6 +351,7 @@ namespace_selector_treeview_cursor_changed_cb (GtkWidget *widget,
{
GtkBuilder *builder;
GtkToggleButton *toggle_button;
+ GtkLabel *sel_namespace_label;
gchar *value;
GtkTreePath *treepath;
@@ -363,9 +364,13 @@ namespace_selector_treeview_cursor_changed_cb (GtkWidget *widget,
if (!toggle_button)
return;
+ sel_namespace_label = GTK_LABEL (gtk_builder_get_object (builder, "main_window_search_selected_namespace_label"));
+ if (sel_namespace_label)
+ return;
+
if (GNUNET_GTK_get_tree_string (GTK_TREE_VIEW (widget), treepath, 0,
&value))
- gtk_button_set_label (GTK_BUTTON (toggle_button), value);
+ gtk_label_set_text (sel_namespace_label, value);
gtk_tree_path_free (treepath);
@@ -446,6 +451,64 @@ main_window_search_button_clicked_cb (GtkButton *button, gpointer user_data)
GNUNET_FS_uri_destroy (uri);
}
+/**
+ * Add pseudonym data to tree store
+ *
+ * @param cls closure (the 'GtkListStore')
+ * @param pseudonym hash code of public key of pseudonym
+ * @param md meta data known about the pseudonym
+ * @param rating the local rating of the pseudonym
+ * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort
+ */
+static int
+add_namespace_to_ts (void *cls, const GNUNET_HashCode * pseudonym,
+ const struct GNUNET_CONTAINER_MetaData *md, int rating)
+{
+ GtkTreeStore *ts = cls;
+ char *root;
+ char *ns_name;
+ GNUNET_HashCode *nsid;
+ char *description;
+ char *uris;
+ char *emsg;
+ struct GNUNET_FS_Uri *uri;
+ GtkTreeIter iter;
+
+ ns_name =
+ GNUNET_PSEUDONYM_id_to_name (GNUNET_FS_GTK_get_configuration (),
+ pseudonym);
+ nsid = GNUNET_malloc (sizeof (GNUNET_HashCode));
+ *nsid = *pseudonym;
+ root = NULL;
+ uris = GNUNET_CONTAINER_meta_data_get_by_type (md, EXTRACTOR_METATYPE_URI);
+ if (uris != NULL)
+ {
+ emsg = NULL;
+ uri = GNUNET_FS_uri_parse (uris, &emsg);
+ if (uri == NULL)
+ GNUNET_free (emsg);
+ root = GNUNET_FS_uri_sks_get_content_id (uri);
+ GNUNET_FS_uri_destroy (uri);
+ }
+ description =
+ GNUNET_CONTAINER_meta_data_get_first_by_types (md,
+ EXTRACTOR_METATYPE_TITLE,
+ EXTRACTOR_METATYPE_BOOK_TITLE,
+ EXTRACTOR_METATYPE_DESCRIPTION,
+ EXTRACTOR_METATYPE_SUMMARY,
+ EXTRACTOR_METATYPE_ALBUM,
+ EXTRACTOR_METATYPE_COMMENT,
+ EXTRACTOR_METATYPE_SUBJECT,
+ EXTRACTOR_METATYPE_KEYWORDS,
+ -1);
+ gtk_tree_store_insert_with_values (ts, &iter, NULL, G_MAXINT, 0, ns_name, 1,
+ nsid, 2, root, 3, description, -1);
+ GNUNET_free (ns_name);
+ GNUNET_free_non_null (root);
+ GNUNET_free_non_null (description);
+ return GNUNET_OK;
+}
+
void
GNUNET_GTK_main_window_realize_cb (GtkWidget *widget, gpointer user_data)
{
@@ -453,7 +516,6 @@ GNUNET_GTK_main_window_realize_cb (GtkWidget *widget, gpointer user_data)
GtkTreeView *namespace_tree;
GtkTreeStore *namespace_treestore;
GtkBuilder *builder;
- GtkToggleButton *toggle_button;
GtkWidget *namespace_selector_window;
builder = GTK_BUILDER (user_data);
@@ -463,24 +525,23 @@ GNUNET_GTK_main_window_realize_cb (GtkWidget *widget, gpointer user_data)
namespace_tree = GTK_TREE_VIEW (GNUNET_FS_GTK_get_main_window_object
("namespace_selector_treeview"));
- /* TODO: fetch real values from somewhere instead of filling the store with dummies */
- gtk_tree_store_insert_with_values (namespace_treestore, &iter, NULL, 0, 0, "Any", 1, NULL, 2, "", 3, "Do not search in any particular namespace", -1);
- gtk_tree_store_insert_with_values (namespace_treestore, &iter, NULL, 1, 0, "foo", 1, NULL, 2, "IAMTHEBESTOBEYMENOCARRIER", 3, "Tooltip1", -1);
- gtk_tree_store_insert_with_values (namespace_treestore, &iter, NULL, 2, 0, "bar", 1, NULL, 2, "NOONEWILLKNOWTHISIDBECAUSEITSSECRET", 3, "Tooltip2", -1);
- gtk_tree_store_insert_with_values (namespace_treestore, &iter, NULL, 3, 0, "baz", 1, NULL, 2, "SSLOPENSSHGNUGTKGNUNETFTWYAYA", 3, "Tooltip3", -1);
+ gtk_tree_store_insert_with_values (namespace_treestore, &iter, NULL,
+ G_MAXINT, 0, "Any", 1, NULL, 2, "", 3,
+ "Do not search in any particular namespace", -1);
+ GNUNET_PSEUDONYM_list_all (GNUNET_FS_GTK_get_configuration (),
+ &add_namespace_to_ts, namespace_treestore);
/* FIXME: read currently selected namespace from somewhere instead of selecting 0th item */
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (namespace_treestore), &iter))
{
gchar *value;
+ GtkLabel *sel_namespace_label;
GtkTreePath *treepath = gtk_tree_path_new_first ();
gtk_tree_selection_select_iter (gtk_tree_view_get_selection (
namespace_tree), &iter);
- toggle_button = GTK_TOGGLE_BUTTON (GNUNET_FS_GTK_get_main_window_object
- ("main_window_search_namespace_dropdown_button"));
- if (GNUNET_GTK_get_tree_string (namespace_tree,
- treepath, 0, &value))
- gtk_button_set_label (GTK_BUTTON (toggle_button), value);
+ sel_namespace_label = GTK_LABEL (gtk_builder_get_object (builder, "main_window_search_selected_namespace_label"));
+ if (GNUNET_GTK_get_tree_string (namespace_tree, treepath, 0, &value))
+ gtk_label_set_text (sel_namespace_label, value);
gtk_tree_path_free (treepath);
}
--
1.7.4
0002-Get-text-from-the-combobox-entry.patch (2,054 bytes)
From 05631c692809b68c3bdba2939818bbe52b1b5b09 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Mon, 12 Dec 2011 00:47:28 +0400
Subject: [PATCH 2/2] Get text from the combobox entry
---
src/fs/gnunet-fs-gtk.c | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index 6833783..766241e 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -385,13 +385,14 @@ main_window_search_button_clicked_cb (GtkButton *button, gpointer user_data)
GtkTreePath *namespace_treepath = NULL;
GtkTreeModel *namespace_model = NULL;
GtkComboBox *mime_combo;
+ GtkEntry *mime_entry;
GtkTreeModel *mime_model;
GtkEntry *query_entry;
guint anonymity_level;
GtkTreeIter iter;
const char *entry_keywords;
gchar *keywords;
- gchar *mime_keyword;
+ const gchar *mime_keyword;
GNUNET_HashCode *nsid = NULL;
struct GNUNET_FS_Uri *uri;
@@ -404,12 +405,8 @@ main_window_search_button_clicked_cb (GtkButton *button, gpointer user_data)
mime_combo = GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object
("main_window_search_mime_combobox"));
- mime_model = gtk_combo_box_get_model (mime_combo);
- if (mime_model && gtk_combo_box_get_active_iter (mime_combo, &iter))
- {
- mime_keyword = NULL;
- gtk_tree_model_get (mime_model, &iter, 0, &mime_keyword, -1);
- }
+ mime_entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (mime_combo)));
+ mime_keyword = gtk_entry_get_text (mime_entry);
get_selected_namespace_treepath_iter_model_widget (builder,
&namespace_treepath, &iter, &namespace_model, NULL);
@@ -421,7 +418,6 @@ main_window_search_button_clicked_cb (GtkButton *button, gpointer user_data)
if (mime_keyword != NULL)
{
keywords = g_strdup_printf ("%s %s", entry_keywords, mime_keyword);
- g_free (mime_keyword);
}
else
keywords = g_strdup (entry_keywords);
--
1.7.4
0003-Do-not-use-the-new-search-tab-keep-the-code-for-now.patch (861 bytes)
From 8bee62674ccc6797ae4a23562183477051142690 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Mon, 12 Dec 2011 03:11:25 +0400
Subject: [PATCH 3/4] Do not use the 'new search' tab (keep the code for now)
---
src/fs/gnunet-fs-gtk.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index 766241e..f292a33 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -581,7 +581,8 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
GNUNET_FS_OPTIONS_END);
if (fs != NULL)
{
- add_new_tab ();
+ /* Searches are now started from the search bar */
+ /* add_new_tab (); */
}
else
{
--
1.7.4
0004-Fix-search-tab-label.patch (8,639 bytes)
From 03c29618313af80978396693ffcddbab4ace5285 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Mon, 12 Dec 2011 03:24:47 +0400
Subject: [PATCH 4/4] Fix search tab label
* Put all buttons into alignments with 0 scale, to prevent them from
scaling vertically every time tab gets bigger due to being focused
* Put all buttons into a size group to force them to have the same size
I'm still not happy with the way labels are resized (or rather NOT
resized)
---
contrib/gnunet_fs_gtk_search_tab.glade | 109 ++++++++++++++++++++++----------
1 files changed, 75 insertions(+), 34 deletions(-)
diff --git a/contrib/gnunet_fs_gtk_search_tab.glade b/contrib/gnunet_fs_gtk_search_tab.glade
index 9a8fa61..196a60d 100644
--- a/contrib/gnunet_fs_gtk_search_tab.glade
+++ b/contrib/gnunet_fs_gtk_search_tab.glade
@@ -172,22 +172,30 @@
</object>
<packing>
<property name="expand">True</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="GtkButton" id="_search_result_label_play_button">
- <property name="use_action_appearance">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
+ <object class="GtkAlignment" id="_search_result_label_play_button_alignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
<child>
- <object class="GtkImage" id="play_icon_stock_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-media-play</property>
- <property name="icon-size">2</property>
+ <object class="GtkButton" id="_search_result_label_play_button">
+ <property name="use_action_appearance">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <object class="GtkImage" id="play_icon_stock_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-media-play</property>
+ <property name="icon-size">2</property>
+ </object>
+ </child>
</object>
</child>
</object>
@@ -198,17 +206,25 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="_search_result_label_pause_button">
- <property name="use_action_appearance">False</property>
+ <object class="GtkAlignment" id="_search_result_label_pause_button_alignment">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
+ <property name="can_focus">False</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
<child>
- <object class="GtkImage" id="pause_icon_stock_image">
+ <object class="GtkButton" id="_search_result_label_pause_button">
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-media-pause</property>
- <property name="icon-size">2</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <object class="GtkImage" id="pause_icon_stock_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-media-pause</property>
+ <property name="icon-size">2</property>
+ </object>
+ </child>
</object>
</child>
</object>
@@ -219,16 +235,24 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="_search_result_label_clear_button">
- <property name="use_action_appearance">False</property>
+ <object class="GtkAlignment" id="_search_result_label_clear_button_alignment">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
+ <property name="can_focus">False</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
<child>
- <object class="GtkImage" id="clear_icon_stock_image">
+ <object class="GtkButton" id="_search_result_label_clear_button">
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-clear</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <object class="GtkImage" id="clear_icon_stock_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-clear</property>
+ </object>
+ </child>
</object>
</child>
</object>
@@ -240,18 +264,26 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="_search_result_label_close_button">
- <property name="use_action_appearance">False</property>
+ <object class="GtkAlignment" id="_search_result_label_close_button_alignment">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="relief">half</property>
+ <property name="can_focus">False</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
<child>
- <object class="GtkImage" id="close_icon_stock_image">
+ <object class="GtkButton" id="_search_result_label_close_button">
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-close</property>
- <property name="icon-size">2</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">half</property>
+ <child>
+ <object class="GtkImage" id="close_icon_stock_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-close</property>
+ <property name="icon-size">2</property>
+ </object>
+ </child>
</object>
</child>
</object>
@@ -264,4 +296,13 @@
</object>
</child>
</object>
+ <object class="GtkSizeGroup" id="_search_result_label_buttons_size_group">
+ <property name="mode">both</property>
+ <widgets>
+ <widget name="_search_result_label_play_button"/>
+ <widget name="_search_result_label_pause_button"/>
+ <widget name="_search_result_label_clear_button"/>
+ <widget name="_search_result_label_close_button"/>
+ </widgets>
+ </object>
</interface>
--
1.7.4
0001-Make-tabs-smaller.patch (4,467 bytes)
From b1130434bb178966522adfd2f69695153312c475 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Mon, 12 Dec 2011 18:18:10 +0400
Subject: [PATCH 1/3] Make tabs smaller
---
contrib/gnunet_fs_gtk_main_window.glade | 71 ++++++++++++++++---------------
1 files changed, 37 insertions(+), 34 deletions(-)
diff --git a/contrib/gnunet_fs_gtk_main_window.glade b/contrib/gnunet_fs_gtk_main_window.glade
index 4fdc888..209cc51 100644
--- a/contrib/gnunet_fs_gtk_main_window.glade
+++ b/contrib/gnunet_fs_gtk_main_window.glade
@@ -551,6 +551,9 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="scrollable">True</property>
+ <property name="tab_border">0</property>
+ <property name="tab_hborder">0</property>
+ <property name="tab_vborder">0</property>
<signal name="switch-page" handler="GNUNET_GTK_main_window_notebook_switch_page_cb" after="yes" swapped="no"/>
</object>
<packing>
@@ -668,6 +671,20 @@
</object>
</child>
</object>
+ <object class="GtkListStore" id="GNUNET_GTK_peer_info_list_store">
+ <columns>
+ <!-- column-name peer_identity -->
+ <column type="gchararray"/>
+ <!-- column-name number_of_known_addresses -->
+ <column type="guint"/>
+ <!-- column-name country_name -->
+ <column type="gchararray"/>
+ <!-- column-name country_flag -->
+ <column type="GdkPixbuf"/>
+ <!-- column-name bandwidth -->
+ <column type="guint64"/>
+ </columns>
+ </object>
<object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store">
<columns>
<!-- column-name extractor_meta_type -->
@@ -692,20 +709,6 @@
<property name="page_increment">10</property>
<property name="page_size">10</property>
</object>
- <object class="GtkListStore" id="GNUNET_GTK_peer_info_list_store">
- <columns>
- <!-- column-name peer_identity -->
- <column type="gchararray"/>
- <!-- column-name number_of_known_addresses -->
- <column type="guint"/>
- <!-- column-name country_name -->
- <column type="gchararray"/>
- <!-- column-name country_flag -->
- <column type="GdkPixbuf"/>
- <!-- column-name bandwidth -->
- <column type="guint64"/>
- </columns>
- </object>
<object class="GtkAdjustment" id="adjustment3">
<property name="upper">100</property>
<property name="step_increment">1</property>
@@ -834,26 +837,6 @@
</row>
</data>
</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 KeyTextual -->
- <column type="gchararray"/>
- <!-- column-name Tooltip -->
- <column type="gchararray"/>
- </columns>
- </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="GtkWindow" id="namespace_selector_window">
<property name="can_focus">False</property>
<property name="events">GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>
@@ -906,4 +889,24 @@
</object>
</child>
</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="GtkTreeStore" id="main_window_search_namespace_treestore">
+ <columns>
+ <!-- column-name Name -->
+ <column type="gchararray"/>
+ <!-- column-name Key -->
+ <column type="gpointer"/>
+ <!-- column-name KeyTextual -->
+ <column type="gchararray"/>
+ <!-- column-name Tooltip -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
</interface>
--
1.7.4
0002-Remove-has-entry-hide-columns-del-signals.patch (9,157 bytes)
From 92e1436f0e2592cb6c80a87eb7f758d5cb6d90c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Mon, 12 Dec 2011 18:37:24 +0400
Subject: [PATCH 2/3] Remove has-entry, hide columns, del signals
---
contrib/gnunet_fs_gtk_main_window.glade | 144 ++++++++++++++++---------------
1 files changed, 73 insertions(+), 71 deletions(-)
diff --git a/contrib/gnunet_fs_gtk_main_window.glade b/contrib/gnunet_fs_gtk_main_window.glade
index 209cc51..dadb2e1 100644
--- a/contrib/gnunet_fs_gtk_main_window.glade
+++ b/contrib/gnunet_fs_gtk_main_window.glade
@@ -2,6 +2,50 @@
<interface>
<requires lib="gtk+" version="2.24"/>
<!-- interface-naming-policy project-wide -->
+ <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store">
+ <columns>
+ <!-- column-name extractor_meta_type -->
+ <column type="guint"/>
+ <!-- column-name extractor_meta_format -->
+ <column type="guint"/>
+ <!-- column-name extractor_meta_type_string -->
+ <column type="gchararray"/>
+ <!-- column-name extracotr_meta_value -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkAdjustment" id="adjustment1">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ <property name="page_size">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment2">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ <property name="page_size">10</property>
+ </object>
+ <object class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-new</property>
+ </object>
+ <object class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-find</property>
+ </object>
+ <object class="GtkImage" id="image5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-go-down</property>
+ </object>
+ <object class="GtkImage" id="image6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-index</property>
+ </object>
<object class="GtkWindow" id="GNUNET_GTK_main_window">
<property name="can_focus">False</property>
<property name="title" translatable="yes">gnunet-fs-gtk</property>
@@ -470,10 +514,6 @@
<property name="can_focus">False</property>
<property name="model">main_window_search_mime_liststore</property>
<property name="active">0</property>
- <property name="has_entry">True</property>
- <property name="entry_text_column">0</property>
- <signal name="popdown" handler="main_window_search_mime_combobox_popdown_cb" swapped="no"/>
- <signal name="popup" handler="main_window_search_mime_combobox_popup_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="main_window_search_mime_renderer_description"/>
<attributes>
@@ -481,7 +521,9 @@
</attributes>
</child>
<child>
- <object class="GtkCellRendererText" id="main_window_search_mime_renderer_type"/>
+ <object class="GtkCellRendererText" id="main_window_search_mime_renderer_type">
+ <property name="visible">False</property>
+ </object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
@@ -493,13 +535,17 @@
</attributes>
</child>
<child>
- <object class="GtkCellRendererText" id="main_window_search_mime_renderer_lossyness"/>
+ <object class="GtkCellRendererText" id="main_window_search_mime_renderer_lossyness">
+ <property name="visible">False</property>
+ </object>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
<child>
- <object class="GtkCellRendererText" id="main_window_search_mime_renderer_freedom"/>
+ <object class="GtkCellRendererText" id="main_window_search_mime_renderer_freedom">
+ <property name="visible">False</property>
+ </object>
<attributes>
<attribute name="text">4</attribute>
</attributes>
@@ -685,30 +731,6 @@
<column type="guint64"/>
</columns>
</object>
- <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store">
- <columns>
- <!-- column-name extractor_meta_type -->
- <column type="guint"/>
- <!-- column-name extractor_meta_format -->
- <column type="guint"/>
- <!-- column-name extractor_meta_type_string -->
- <column type="gchararray"/>
- <!-- column-name extracotr_meta_value -->
- <column type="gchararray"/>
- </columns>
- </object>
- <object class="GtkAdjustment" id="adjustment1">
- <property name="upper">100</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- <property name="page_size">10</property>
- </object>
- <object class="GtkAdjustment" id="adjustment2">
- <property name="upper">100</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- <property name="page_size">10</property>
- </object>
<object class="GtkAdjustment" id="adjustment3">
<property name="upper">100</property>
<property name="step_increment">1</property>
@@ -731,26 +753,6 @@
<property name="can_focus">False</property>
<property name="stock">gtk-go-up</property>
</object>
- <object class="GtkImage" id="image3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-new</property>
- </object>
- <object class="GtkImage" id="image4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-find</property>
- </object>
- <object class="GtkImage" id="image5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-go-down</property>
- </object>
- <object class="GtkImage" id="image6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-index</property>
- </object>
<object class="GtkImage" id="image7">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -837,6 +839,26 @@
</row>
</data>
</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="GtkTreeStore" id="main_window_search_namespace_treestore">
+ <columns>
+ <!-- column-name Name -->
+ <column type="gchararray"/>
+ <!-- column-name Key -->
+ <column type="gpointer"/>
+ <!-- column-name KeyTextual -->
+ <column type="gchararray"/>
+ <!-- column-name Tooltip -->
+ <column type="gchararray"/>
+ </columns>
+ </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>
@@ -889,24 +911,4 @@
</object>
</child>
</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="GtkTreeStore" id="main_window_search_namespace_treestore">
- <columns>
- <!-- column-name Name -->
- <column type="gchararray"/>
- <!-- column-name Key -->
- <column type="gpointer"/>
- <!-- column-name KeyTextual -->
- <column type="gchararray"/>
- <!-- column-name Tooltip -->
- <column type="gchararray"/>
- </columns>
- </object>
</interface>
--
1.7.4
0003-Revert-Get-text-from-the-combobox-entry.patch (2,125 bytes)
From f072e6e8fe72da876d3ea9b53c2f8718742ba1b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Mon, 12 Dec 2011 18:38:38 +0400
Subject: [PATCH 3/3] Revert "Get text from the combobox entry"
This reverts commit 05631c692809b68c3bdba2939818bbe52b1b5b09.
---
src/fs/gnunet-fs-gtk.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index f292a33..971775c 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -385,14 +385,13 @@ main_window_search_button_clicked_cb (GtkButton *button, gpointer user_data)
GtkTreePath *namespace_treepath = NULL;
GtkTreeModel *namespace_model = NULL;
GtkComboBox *mime_combo;
- GtkEntry *mime_entry;
GtkTreeModel *mime_model;
GtkEntry *query_entry;
guint anonymity_level;
GtkTreeIter iter;
const char *entry_keywords;
gchar *keywords;
- const gchar *mime_keyword;
+ gchar *mime_keyword;
GNUNET_HashCode *nsid = NULL;
struct GNUNET_FS_Uri *uri;
@@ -405,8 +404,12 @@ main_window_search_button_clicked_cb (GtkButton *button, gpointer user_data)
mime_combo = GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object
("main_window_search_mime_combobox"));
- mime_entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (mime_combo)));
- mime_keyword = gtk_entry_get_text (mime_entry);
+ mime_model = gtk_combo_box_get_model (mime_combo);
+ if (mime_model && gtk_combo_box_get_active_iter (mime_combo, &iter))
+ {
+ mime_keyword = NULL;
+ gtk_tree_model_get (mime_model, &iter, 0, &mime_keyword, -1);
+ }
get_selected_namespace_treepath_iter_model_widget (builder,
&namespace_treepath, &iter, &namespace_model, NULL);
@@ -418,6 +421,7 @@ main_window_search_button_clicked_cb (GtkButton *button, gpointer user_data)
if (mime_keyword != NULL)
{
keywords = g_strdup_printf ("%s %s", entry_keywords, mime_keyword);
+ g_free (mime_keyword);
}
else
keywords = g_strdup (entry_keywords);
--
1.7.4
0001-Multiple-GUI-changes.patch (18,187 bytes)
From 4633e223d98298d0cf1ac88e2747542e72db8c06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Mon, 12 Dec 2011 22:36:28 +0400
Subject: [PATCH 1/2] Multiple GUI changes
* Rename "Key" column to "Root"
* Make namespace selector focusable
* Namespace selector now tracks mouse pointer
* Namespace is chosen by a single click
* Namespace list is populated by namespace descovery callback
instead of namespace list callback
(adds found namespaces on the fly)
* Normalized cell background for search results
Now rows look like they have uniform background
* Add tooltips with full query text to search tab
* Root is added to the query when a search in namespace is made
---
contrib/gnunet_fs_gtk_main_window.glade | 90 ++++++++++----------
contrib/gnunet_fs_gtk_search_tab.glade | 5 +-
src/fs/gnunet-fs-gtk-event_handler.c | 1 +
src/fs/gnunet-fs-gtk.c | 138 +++++++++++++++++++++++++++----
4 files changed, 172 insertions(+), 62 deletions(-)
diff --git a/contrib/gnunet_fs_gtk_main_window.glade b/contrib/gnunet_fs_gtk_main_window.glade
index ac572bb..5183ba9 100644
--- a/contrib/gnunet_fs_gtk_main_window.glade
+++ b/contrib/gnunet_fs_gtk_main_window.glade
@@ -676,38 +676,6 @@
<column type="gchararray"/>
</columns>
</object>
- <object class="GtkAdjustment" id="adjustment1">
- <property name="upper">100</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- <property name="page_size">10</property>
- </object>
- <object class="GtkAdjustment" id="adjustment2">
- <property name="upper">100</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- <property name="page_size">10</property>
- </object>
- <object class="GtkImage" id="image3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-new</property>
- </object>
- <object class="GtkImage" id="image4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-find</property>
- </object>
- <object class="GtkImage" id="image5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-go-down</property>
- </object>
- <object class="GtkImage" id="image6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-index</property>
- </object>
<object class="GtkListStore" id="GNUNET_GTK_peer_info_list_store">
<columns>
<!-- column-name peer_identity -->
@@ -722,6 +690,18 @@
<column type="guint64"/>
</columns>
</object>
+ <object class="GtkAdjustment" id="adjustment1">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ <property name="page_size">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment2">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ <property name="page_size">10</property>
+ </object>
<object class="GtkAdjustment" id="adjustment3">
<property name="upper">100</property>
<property name="step_increment">1</property>
@@ -744,6 +724,26 @@
<property name="can_focus">False</property>
<property name="stock">gtk-go-up</property>
</object>
+ <object class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-new</property>
+ </object>
+ <object class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-find</property>
+ </object>
+ <object class="GtkImage" id="image5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-go-down</property>
+ </object>
+ <object class="GtkImage" id="image6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-index</property>
+ </object>
<object class="GtkImage" id="image7">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -786,6 +786,14 @@
</row>
</data>
</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 -->
@@ -830,21 +838,13 @@
</row>
</data>
</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="GtkTreeStore" id="main_window_search_namespace_treestore">
<columns>
<!-- column-name Name -->
<column type="gchararray"/>
<!-- column-name Key -->
<column type="gpointer"/>
- <!-- column-name KeyTextual -->
+ <!-- column-name Root -->
<column type="gchararray"/>
<!-- column-name Tooltip -->
<column type="gchararray"/>
@@ -853,7 +853,6 @@
<object class="GtkWindow" id="namespace_selector_window">
<property name="can_focus">False</property>
<property name="events">GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>
- <property name="type">popup</property>
<property name="resizable">False</property>
<property name="type_hint">dropdown-menu</property>
<property name="skip_taskbar_hint">True</property>
@@ -869,12 +868,15 @@
<object class="GtkTreeView" id="namespace_selector_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="is_focus">True</property>
<property name="model">main_window_search_namespace_treestore</property>
<property name="headers_clickable">False</property>
<property name="search_column">0</property>
+ <property name="hover_selection">True</property>
<property name="hover_expand">True</property>
<property name="tooltip_column">3</property>
- <signal name="cursor-changed" handler="namespace_selector_treeview_cursor_changed_cb" swapped="no"/>
+ <signal name="button-press-event" handler="namespace_selector_treeview_button_press_event_cb" swapped="no"/>
+ <signal name="button-release-event" handler="namespace_selector_treeview_button_release_event_cb" swapped="no"/>
<child>
<object class="GtkTreeViewColumn" id="name_column">
<property name="sizing">autosize</property>
@@ -890,7 +892,7 @@
<child>
<object class="GtkTreeViewColumn" id="key_column">
<property name="sizing">autosize</property>
- <property name="title" translatable="yes">Key</property>
+ <property name="title" translatable="yes">Root</property>
<child>
<object class="GtkCellRendererText" id="namespace_selector_key_column_text_cell"/>
<attributes>
diff --git a/contrib/gnunet_fs_gtk_search_tab.glade b/contrib/gnunet_fs_gtk_search_tab.glade
index 196a60d..93e5deb 100644
--- a/contrib/gnunet_fs_gtk_search_tab.glade
+++ b/contrib/gnunet_fs_gtk_search_tab.glade
@@ -89,7 +89,7 @@
<child>
<object class="GtkCellRendererText" id="search_result_mime_renderer"/>
<attributes>
- <attribute name="background">8</attribute>
+ <attribute name="cell-background">8</attribute>
<attribute name="text">10</attribute>
</attributes>
</child>
@@ -123,7 +123,7 @@
<child>
<object class="GtkCellRendererText" id="search_result_applicability_renderer"/>
<attributes>
- <attribute name="background">8</attribute>
+ <attribute name="cell-background">8</attribute>
<attribute name="text">11</attribute>
</attributes>
</child>
@@ -138,6 +138,7 @@
<child>
<object class="GtkCellRendererPixbuf" id="search_result_preview_renderer"/>
<attributes>
+ <attribute name="cell-background">8</attribute>
<attribute name="pixbuf">3</attribute>
</attributes>
</child>
diff --git a/src/fs/gnunet-fs-gtk-event_handler.c b/src/fs/gnunet-fs-gtk-event_handler.c
index 7520c48..2a3d754 100644
--- a/src/fs/gnunet-fs-gtk-event_handler.c
+++ b/src/fs/gnunet-fs-gtk-event_handler.c
@@ -882,6 +882,7 @@ update_search_label (struct SearchTab *tab)
GNUNET_asprintf (&name, "%.*s%s", 20, tab->query_txt,
strlen (tab->query_txt) > 20 ? "..." : "");
gtk_label_set_text (tab->label, name);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (tab->label), tab->query_txt);
GNUNET_free (name);
}
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index 3223ec7..d5a6cb5 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -137,7 +137,9 @@ main_window_search_namespace_dropdown_button_toggled_cb (GtkToggleButton *toggle
gboolean active;
GtkBuilder *builder = GTK_BUILDER (user_data);
GtkWidget *namespace_selector_window;
+ GtkWidget *namespace_selector_treeview;
namespace_selector_window = GTK_WIDGET (gtk_builder_get_object (builder, "namespace_selector_window"));
+ namespace_selector_treeview = GTK_WIDGET (gtk_builder_get_object (builder, "namespace_selector_treeview"));
g_object_get (G_OBJECT (togglebutton), "active", &active, NULL);
if (active)
{
@@ -162,10 +164,14 @@ main_window_search_namespace_dropdown_button_toggled_cb (GtkToggleButton *toggle
gtk_window_move (GTK_WINDOW (namespace_selector_window), popup_x, popup_y);
- gtk_widget_show (namespace_selector_window);
+ gtk_widget_show_all (namespace_selector_window);
+ gtk_widget_grab_focus (namespace_selector_treeview);
}
else
+ {
gtk_widget_hide (namespace_selector_window);
+ gtk_widget_grab_focus (GTK_WIDGET (togglebutton));
+ }
}
gboolean
@@ -314,18 +320,26 @@ namespace_selector_treeview_cursor_changed_cb (GtkWidget *widget,
GtkBuilder *builder;
GtkToggleButton *toggle_button;
GtkLabel *sel_namespace_label;
+ GtkTreeModel *model;
gchar *value;
GtkTreePath *treepath;
+ GtkTreeRowReference *ref, *old;
builder = GTK_BUILDER (user_data);
- if (!get_selected_namespace_treepath_iter_model_widget (builder, &treepath, NULL, NULL, NULL))
- return;
-
toggle_button = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "main_window_search_namespace_dropdown_button"));
if (!toggle_button)
return;
+ if (!get_selected_namespace_treepath_iter_model_widget (builder, &treepath, NULL, &model, NULL))
+ return;
+ ref = gtk_tree_row_reference_new (model, treepath);
+ old = g_object_get_data (G_OBJECT (toggle_button), "selected-row-reference");
+ if (old)
+ gtk_tree_row_reference_free (old);
+ g_object_set_data (G_OBJECT (toggle_button), "selected-row-reference", ref);
+
+
sel_namespace_label = GTK_LABEL (gtk_builder_get_object (builder, "main_window_search_selected_namespace_label"));
if (!sel_namespace_label)
return;
@@ -340,6 +354,72 @@ namespace_selector_treeview_cursor_changed_cb (GtkWidget *widget,
gtk_toggle_button_set_active (toggle_button, FALSE);
}
+GtkTreeRowReference *
+get_ns_selected_row (GtkTreeView *tree)
+{
+ GtkTreeSelection *sel;
+ GList *rows, *row;
+ GtkTreeModel *model;
+ GtkTreeRowReference *ref = NULL;
+
+ sel = gtk_tree_view_get_selection (tree);
+ rows = gtk_tree_selection_get_selected_rows (sel, &model);
+ for (row = rows; row; row = row->next)
+ {
+ ref = gtk_tree_row_reference_new (model, row->data);
+ if (ref != NULL)
+ break;
+ }
+ g_list_foreach (rows, (GFunc) gtk_tree_path_free, NULL);
+ g_list_free (rows);
+ return ref;
+}
+
+gboolean
+namespace_selector_treeview_button_press_event_cb (GtkWidget *widget,
+ GdkEvent *event, gpointer user_data)
+{
+ GtkTreeRowReference *ref = NULL;
+
+ ref = get_ns_selected_row (GTK_TREE_VIEW (widget));
+ if (ref != NULL)
+ {
+ gpointer old = g_object_get_data (G_OBJECT (widget), "pushed-rowreference");
+ if (old)
+ gtk_tree_row_reference_free (old);
+ g_object_set_data (G_OBJECT (widget), "pushed-rowreference", ref);
+ }
+ return FALSE;
+}
+
+gboolean
+namespace_selector_treeview_button_release_event_cb (GtkWidget *widget,
+ GdkEvent *event, gpointer user_data)
+{
+ GtkTreeRowReference *ref = NULL;
+ gpointer old = g_object_get_data (G_OBJECT (widget), "pushed-rowreference");
+
+ ref = get_ns_selected_row (GTK_TREE_VIEW (widget));
+ if (ref && old)
+ {
+ GtkTreePath *path_ref, *path_old;
+ path_ref = gtk_tree_row_reference_get_path (ref);
+ path_old = gtk_tree_row_reference_get_path (old);
+ if (gtk_tree_path_compare (path_ref, path_old) == 0)
+ namespace_selector_treeview_cursor_changed_cb (widget, user_data);
+ if (path_ref)
+ gtk_tree_path_free (path_ref);
+ if (path_old)
+ gtk_tree_path_free (path_old);
+ }
+ if (ref)
+ gtk_tree_row_reference_free (ref);
+ if (old)
+ gtk_tree_row_reference_free (old);
+ g_object_set_data (G_OBJECT (widget), "pushed-rowreference", NULL);
+ return FALSE;
+}
+
void
main_window_search_button_clicked_cb (GtkButton *button, gpointer user_data)
{
@@ -350,17 +430,23 @@ main_window_search_button_clicked_cb (GtkButton *button, gpointer user_data)
GtkTreeModel *mime_model;
GtkEntry *query_entry;
guint anonymity_level;
+ GtkTreeRowReference *ref = NULL;
GtkTreeIter iter;
+ GtkToggleButton *toggle_button;
const char *entry_keywords;
gchar *keywords;
gchar *mime_keyword;
GNUNET_HashCode *nsid = NULL;
struct GNUNET_FS_Uri *uri;
+ gchar *root = NULL;
char *emsg;
builder = GTK_BUILDER (user_data);
+ toggle_button = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder,
+ "main_window_search_namespace_dropdown_button"));
+
if (!get_selected_anonymity_level (builder, &anonymity_level))
return;
@@ -372,23 +458,30 @@ main_window_search_button_clicked_cb (GtkButton *button, gpointer user_data)
mime_keyword = NULL;
gtk_tree_model_get (mime_model, &iter, 0, &mime_keyword, -1);
}
+ if (mime_keyword == NULL)
+ mime_keyword = g_strdup ("");
- get_selected_namespace_treepath_iter_model_widget (builder,
- &namespace_treepath, &iter, &namespace_model, NULL);
+ ref = g_object_get_data (G_OBJECT (toggle_button), "selected-row-reference");
+ if (ref)
+ {
+ namespace_model = gtk_tree_row_reference_get_model (ref);
+ namespace_treepath = gtk_tree_row_reference_get_path (ref);
+ gtk_tree_model_get_iter (namespace_model, &iter, namespace_treepath);
+ }
query_entry = GTK_ENTRY (gtk_builder_get_object (builder,
"main_window_search_entry"));
- entry_keywords = gtk_entry_get_text (query_entry);
- if (mime_keyword != NULL)
- {
- keywords = g_strdup_printf ("%s %s", entry_keywords, mime_keyword);
- g_free (mime_keyword);
- }
- else
- keywords = g_strdup (entry_keywords);
if (namespace_treepath != NULL)
- gtk_tree_model_get (namespace_model, &iter, 1, &nsid, -1);
+ gtk_tree_model_get (namespace_model, &iter, 1, &nsid, 2, &root, -1);
+ if (root == NULL)
+ root = g_strdup ("");
+
+ entry_keywords = gtk_entry_get_text (query_entry);
+
+ keywords = g_strdup_printf ("%s %s %s", entry_keywords, mime_keyword, root);
+ g_free (mime_keyword);
+ g_free (root);
if (nsid != NULL)
{
uri = GNUNET_FS_uri_sks_create_from_nsid (nsid, keywords);
@@ -487,11 +580,25 @@ GNUNET_GTK_main_window_realize_cb (GtkWidget *widget, gpointer user_data)
namespace_tree = GTK_TREE_VIEW (GNUNET_FS_GTK_get_main_window_object
("namespace_selector_treeview"));
+ /* FIXME: find a way to manage pseudonyms.
+ * Right now the list will be filled with ALL and ANY pseudonyms that we
+ * find, these are held as files in a special directory.
+ * I don't see an easy way to ignore certain pseudonyms in that directory,
+ * and that require for pseudonym management. Also, pseudonyms are presented
+ * in arbitrary order. We must either sort them (by name?) or let the user
+ * drag them around to change the order in which they appear in the list.
+ * All that is not possible with a simple "files in a directory" concept.
+ */
gtk_tree_store_insert_with_values (namespace_treestore, &iter, NULL,
G_MAXINT, 0, "Any", 1, NULL, 2, "", 3,
"Do not search in any particular namespace", -1);
+ /*
GNUNET_PSEUDONYM_list_all (GNUNET_FS_GTK_get_configuration (),
&add_namespace_to_ts, namespace_treestore);
+ */
+ GNUNET_PSEUDONYM_discovery_callback_register (
+ GNUNET_FS_GTK_get_configuration (),
+ &add_namespace_to_ts, namespace_treestore);
/* FIXME: read currently selected namespace from somewhere instead of selecting 0th item */
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (namespace_treestore), &iter))
@@ -581,7 +688,6 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
}
-
int
main (int argc, char *const *argv)
{
--
1.7.4
0002-Change-required-GTK-to-2.20.patch (956 bytes)
From 9cb80da26c0f253f87d0cd14ba7dd21d7357d31d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Mon, 12 Dec 2011 23:06:36 +0400
Subject: [PATCH 2/2] Change required GTK to 2.20
---
contrib/gnunet_fs_gtk_about_window.glade.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/contrib/gnunet_fs_gtk_about_window.glade.in b/contrib/gnunet_fs_gtk_about_window.glade.in
index ad94075..eab81bd 100644
--- a/contrib/gnunet_fs_gtk_about_window.glade.in
+++ b/contrib/gnunet_fs_gtk_about_window.glade.in
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.24"/>
+ <requires lib="gtk+" version="2.20"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkWindow" id="about_window">
<property name="can_focus">False</property>
--
1.7.4
0002-Various-changes.patch (18,269 bytes)
From b9995d7f7363fcf22ec3f1240105d99bef581e95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Tue, 13 Dec 2011 16:02:39 +0400
Subject: [PATCH 2/3] Various changes
* Make preview sensitive (prevent graying-out)
* Enable fs persistence and probes (crashes, but who said it was going
to be easy?
* Make Save File dialog non-blocking
---
contrib/gnunet_fs_gtk_download_as_dialog.glade | 106 +++++++++-------
contrib/gnunet_fs_gtk_main_window.glade | 17 ++--
src/fs/gnunet-fs-gtk-download.c | 154 +++++++++++++++++------
src/fs/gnunet-fs-gtk.c | 5 +-
4 files changed, 184 insertions(+), 98 deletions(-)
diff --git a/contrib/gnunet_fs_gtk_download_as_dialog.glade b/contrib/gnunet_fs_gtk_download_as_dialog.glade
index 74aa83f..d15ca72 100644
--- a/contrib/gnunet_fs_gtk_download_as_dialog.glade
+++ b/contrib/gnunet_fs_gtk_download_as_dialog.glade
@@ -9,6 +9,7 @@
<property name="page_increment">10</property>
</object>
<object class="GtkFileChooserDialog" id="GNUNET_GTK_save_as_dialog">
+ <property name="can_focus">False</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="border_width">5</property>
@@ -17,26 +18,78 @@
<property name="destroy_with_parent">True</property>
<property name="icon_name">document-save-as</property>
<property name="type_hint">dialog</property>
- <property name="has_separator">False</property>
- <property name="use_preview_label">False</property>
<property name="action">save</property>
<property name="preview_widget_active">False</property>
+ <property name="use_preview_label">False</property>
+ <signal name="response" handler="GNUNET_GTK_save_as_dialog_response_cb" swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox4">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_save_as_dialog_cancel_button">
+ <property name="label">gtk-cancel</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="GNUNET_GTK_save_as_dialog_cancel_button_clicked_cb" swapped="no"/>
+ </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_GTK_save_as_dialog_ok_button">
+ <property name="label">gtk-save</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="GNUNET_GTK_save_as_dialog_ok_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>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="GNUNET_GTK_save_as_dialog_anonymity_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">_Anonymity:</property>
<property name="use_underline">True</property>
<property name="selectable">True</property>
<property name="mnemonic_widget">GNUNET_GTK_save_as_dialog_anonymity_spin_button</property>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
@@ -46,6 +99,10 @@
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="caps_lock_warning">False</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
<property name="adjustment">GNUNET_GTK_anonymity_adjustment</property>
<property name="numeric">True</property>
<signal name="value-changed" handler="GNUNET_GTK_anonymity_spin_button_value_changed_cb" after="yes" swapped="no"/>
@@ -59,11 +116,11 @@
<child>
<object class="GtkCheckButton" id="GNUNET_GTK_save_as_recursive_check_button">
<property name="label" translatable="yes">_recursive</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
@@ -81,49 +138,6 @@
<property name="position">2</property>
</packing>
</child>
- <child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area5">
- <property name="visible">True</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="GNUNET_GTK_save_as_dialog_cancel_button">
- <property name="label">gtk-cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</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_GTK_save_as_dialog_ok_button">
- <property name="label">gtk-save</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
</object>
</child>
<action-widgets>
diff --git a/contrib/gnunet_fs_gtk_main_window.glade b/contrib/gnunet_fs_gtk_main_window.glade
index 5183ba9..37dab80 100644
--- a/contrib/gnunet_fs_gtk_main_window.glade
+++ b/contrib/gnunet_fs_gtk_main_window.glade
@@ -575,7 +575,6 @@
<property name="width_request">128</property>
<property name="height_request">128</property>
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes">Thumbnail associated with the currently selected content</property>
@@ -759,6 +758,14 @@
<property name="can_focus">False</property>
<property name="stock">gtk-index</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_anonymity_liststore">
<columns>
<!-- column-name Name -->
@@ -786,14 +793,6 @@
</row>
</data>
</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 -->
diff --git a/src/fs/gnunet-fs-gtk-download.c b/src/fs/gnunet-fs-gtk-download.c
index fe239e5..d9451e1 100644
--- a/src/fs/gnunet-fs-gtk-download.c
+++ b/src/fs/gnunet-fs-gtk-download.c
@@ -27,65 +27,74 @@
#include "gnunet-fs-gtk.h"
#include "gnunet-fs-gtk-event_handler.h"
+struct dialog_context
+{
+ GtkBuilder *builder;
+ GtkWidget *dialog;
+ gint response;
+ struct DownloadContext *dc;
+};
void
-GNUNET_FS_GTK_open_download_as_dialog (struct DownloadContext *dc)
+GNUNET_GTK_save_as_dialog_ok_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
{
- GtkWidget *ad;
- GtkBuilder *builder;
- struct GNUNET_FS_Handle *fs;
- uint64_t len;
+ return;
+ struct dialog_context *dlc = NULL;
+ dlc = g_object_get_data (G_OBJECT (button), "dialog-context");
+ if (dlc != NULL)
+ dlc->response = 1;
+}
+
+void
+GNUNET_GTK_save_as_dialog_cancel_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ return;
+ struct dialog_context *dlc = NULL;
+ dlc = g_object_get_data (G_OBJECT (button), "dialog-context");
+ if (dlc != NULL)
+ dlc->response = 2;
+}
+
+gboolean
+GNUNET_GTK_save_as_dialog_delete_event_cb (GtkWidget *widget, GdkEvent *event,
+ gpointer user_data)
+{
+ GtkBuilder *builder = NULL;
+ struct dialog_context *dlc = NULL;
+ struct DownloadContext *dc = NULL;
enum GNUNET_FS_DownloadOptions opt;
- uint32_t anonymity;
+ struct GNUNET_FS_Handle *fs;
struct DownloadEntry *de;
GtkWidget *cb;
+ uint32_t anonymity;
+ uint64_t len;
- builder =
- GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_download_as_dialog.glade");
- if (builder == NULL)
+ builder = GTK_BUILDER (user_data);
+ dlc = g_object_get_data (G_OBJECT (widget), "dialog-context");
+ if (dlc == NULL)
{
- if (dc->rr != NULL)
- gtk_tree_row_reference_free (dc->rr);
- GNUNET_free_non_null (dc->mime);
- GNUNET_free_non_null (dc->filename);
- GNUNET_FS_uri_destroy (dc->uri);
- GNUNET_free (dc);
- return;
+ g_object_unref (G_OBJECT (builder));
+ return FALSE;
}
+ dc = dlc->dc;
cb = GTK_WIDGET (gtk_builder_get_object
(builder, "GNUNET_GTK_save_as_recursive_check_button"));
- if (GNUNET_FS_meta_data_test_for_directory (dc->meta))
- gtk_widget_set_sensitive (cb, TRUE);
- ad = GTK_WIDGET (gtk_builder_get_object
- (builder, "GNUNET_GTK_save_as_dialog"));
- if (dc->filename != NULL)
- {
- char buf[1024];
-
- if (NULL != getcwd (buf, sizeof (buf)))
- {
- if (strlen (buf) + strlen (dc->filename) + 2 < sizeof (buf))
- {
- strcat (buf, DIR_SEPARATOR_STR);
- strcat (buf, dc->filename);
- }
- gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (ad), buf);
- }
- }
- if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad)))
+ if (GTK_RESPONSE_OK != dlc->response)
{
- gtk_widget_destroy (ad);
- g_object_unref (G_OBJECT (builder));
+ g_object_unref (G_OBJECT (dlc->builder));
if (dc->rr != NULL)
gtk_tree_row_reference_free (dc->rr);
GNUNET_free_non_null (dc->mime);
GNUNET_free_non_null (dc->filename);
GNUNET_FS_uri_destroy (dc->uri);
GNUNET_free (dc);
- return;
+ g_free (dlc);
+ return FALSE;
}
GNUNET_free_non_null (dc->filename);
- dc->filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (ad));
+ dc->filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dlc->dialog));
dc->is_recursive =
(TRUE ==
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cb))) ? GNUNET_YES :
@@ -100,7 +109,6 @@ GNUNET_FS_GTK_open_download_as_dialog (struct DownloadContext *dc)
(builder,
"GNUNET_GTK_save_as_dialog_anonymity_spin_button")));
len = GNUNET_FS_uri_chk_get_file_size (dc->uri);
- gtk_widget_destroy (ad);
g_object_unref (G_OBJECT (builder));
de = GNUNET_malloc (sizeof (struct DownloadEntry));
de->uri = dc->uri;
@@ -130,6 +138,72 @@ GNUNET_FS_GTK_open_download_as_dialog (struct DownloadContext *dc)
NULL /* parent download ctx */ ));
}
GNUNET_free (dc);
+ GNUNET_free (dlc);
+ return FALSE;
+}
+
+void
+GNUNET_GTK_save_as_dialog_response_cb (GtkDialog *dialog,
+ gint response_id, gpointer user_data)
+{
+ struct dialog_context *dlc = NULL;
+ dlc = g_object_get_data (G_OBJECT (dialog), "dialog-context");
+ if (dlc != NULL)
+ dlc->response = response_id;
+ /* dialogs don't get delete-event the way normal windows do,
+ * call the handler manually
+ */
+ GNUNET_GTK_save_as_dialog_delete_event_cb (GTK_WIDGET (dialog), NULL, user_data);
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+void
+GNUNET_FS_GTK_open_download_as_dialog (struct DownloadContext *dc)
+{
+ GtkWidget *ad;
+ GtkBuilder *builder;
+ GtkWidget *cb;
+ struct dialog_context *dlc;
+
+ builder =
+ GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_download_as_dialog.glade");
+ if (builder == NULL)
+ {
+ if (dc->rr != NULL)
+ gtk_tree_row_reference_free (dc->rr);
+ GNUNET_free_non_null (dc->mime);
+ GNUNET_free_non_null (dc->filename);
+ GNUNET_FS_uri_destroy (dc->uri);
+ GNUNET_free (dc);
+ return;
+ }
+ cb = GTK_WIDGET (gtk_builder_get_object
+ (builder, "GNUNET_GTK_save_as_recursive_check_button"));
+ if (GNUNET_FS_meta_data_test_for_directory (dc->meta))
+ gtk_widget_set_sensitive (cb, TRUE);
+ ad = GTK_WIDGET (gtk_builder_get_object
+ (builder, "GNUNET_GTK_save_as_dialog"));
+ if (dc->filename != NULL)
+ {
+ char buf[1024];
+
+ if (NULL != getcwd (buf, sizeof (buf)))
+ {
+ if (strlen (buf) + strlen (dc->filename) + 2 < sizeof (buf))
+ {
+ strcat (buf, DIR_SEPARATOR_STR);
+ strcat (buf, dc->filename);
+ }
+ gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (ad), buf);
+ }
+ }
+ dlc = g_new0 (struct dialog_context, 1);
+ dlc->builder = builder;
+ dlc->dialog = ad;
+ dlc->response = 0;
+ dlc->dc = dc;
+ g_object_set_data (G_OBJECT (ad), "dialog-context", dlc);
+ gtk_widget_show_all (ad);
}
/* end of gnunet-fs-gtk-download.c */
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index d5a6cb5..aa8d97b 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -648,9 +648,8 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
plugins = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY);
fs = GNUNET_FS_start (GNUNET_GTK_main_loop_get_configuration (ml),
"gnunet-gtk", &GNUNET_GTK_fs_event_handler, NULL,
- GNUNET_FS_FLAGS_NONE
- /* fixme later for persistence/probes */ ,
- /* set other options here later! */
+ GNUNET_FS_FLAGS_PERSISTENCE |
+ GNUNET_FS_FLAGS_DO_PROBES,
GNUNET_FS_OPTIONS_END);
if (fs != NULL)
{
--
1.7.4
0003-Disable-propes-and-persistence-they-are-broken.patch (1,198 bytes)
From 9aa3ad8c10e5f188ce3db4fe11afe171c741f3bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Tue, 13 Dec 2011 22:19:37 +0400
Subject: [PATCH 3/3] Disable propes and persistence - they are broken
---
src/fs/gnunet-fs-gtk.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index aa8d97b..e115395 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -648,8 +648,8 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
plugins = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY);
fs = GNUNET_FS_start (GNUNET_GTK_main_loop_get_configuration (ml),
"gnunet-gtk", &GNUNET_GTK_fs_event_handler, NULL,
- GNUNET_FS_FLAGS_PERSISTENCE |
- GNUNET_FS_FLAGS_DO_PROBES,
+ GNUNET_FS_FLAGS_NONE /* | GNUNET_FS_FLAGS_PERSISTENCE |
+ GNUNET_FS_FLAGS_DO_PROBES*/,
GNUNET_FS_OPTIONS_END);
if (fs != NULL)
{
--
1.7.4
0001-Make-metadata-list-items-selectable.patch (1,675 bytes)
From 3bc7326564618dee481770f9afe489063c03e858 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Fri, 16 Dec 2011 11:24:30 +0400
Subject: [PATCH 1/3] Make metadata list items selectable
---
contrib/gnunet_fs_gtk_main_window.glade | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/contrib/gnunet_fs_gtk_main_window.glade b/contrib/gnunet_fs_gtk_main_window.glade
index 37dab80..c741281 100644
--- a/contrib/gnunet_fs_gtk_main_window.glade
+++ b/contrib/gnunet_fs_gtk_main_window.glade
@@ -602,6 +602,7 @@
<property name="hadjustment">adjustment1</property>
<property name="vadjustment">adjustment2</property>
<property name="search_column">0</property>
+ <property name="rubber_banding">True</property>
<property name="enable_grid_lines">both</property>
<child>
<object class="GtkTreeViewColumn" id="GNUNET_GTK_main_window_metadata_type_column">
@@ -628,7 +629,6 @@
<property name="sort_indicator">True</property>
<child>
<object class="GtkCellRendererText" id="GNUNET_GTK_main_window_metadata_value_renderer">
- <property name="sensitive">False</property>
<property name="wrap_mode">word</property>
</object>
<attributes>
--
1.7.4
0002-Make-metadata-copyable.patch (8,281 bytes)
From cb10c6d3c4ee7c568575870d627f3b707d79b3f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Fri, 16 Dec 2011 13:13:59 +0400
Subject: [PATCH 2/3] Make metadata copyable
---
contrib/gnunet_fs_gtk_main_window.glade | 16 +++
src/fs/gnunet-fs-gtk-event_handler.c | 176 +++++++++++++++++++++++++++++++
src/fs/gnunet-fs-gtk.c | 6 +
3 files changed, 198 insertions(+), 0 deletions(-)
diff --git a/contrib/gnunet_fs_gtk_main_window.glade b/contrib/gnunet_fs_gtk_main_window.glade
index c741281..a47a445 100644
--- a/contrib/gnunet_fs_gtk_main_window.glade
+++ b/contrib/gnunet_fs_gtk_main_window.glade
@@ -604,6 +604,8 @@
<property name="search_column">0</property>
<property name="rubber_banding">True</property>
<property name="enable_grid_lines">both</property>
+ <signal name="button-press-event" handler="GNUNET_GTK_main_window_metadata_treeview_button_press_event_cb" swapped="no"/>
+ <signal name="popup-menu" handler="GNUNET_GTK_main_window_metadata_treeview_popup_menu_cb" swapped="no"/>
<child>
<object class="GtkTreeViewColumn" id="GNUNET_GTK_main_window_metadata_type_column">
<property name="sizing">autosize</property>
@@ -849,6 +851,20 @@
<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="use_action_appearance">False</property>
+ <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="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>
diff --git a/src/fs/gnunet-fs-gtk-event_handler.c b/src/fs/gnunet-fs-gtk-event_handler.c
index 74c3ab5..8565bd0 100644
--- a/src/fs/gnunet-fs-gtk-event_handler.c
+++ b/src/fs/gnunet-fs-gtk-event_handler.c
@@ -1934,6 +1934,182 @@ GNUNET_GTK_main_window_notebook_switch_page_cb (GtkWidget * dummy,
gtk_list_store_clear (ms);
}
+static void
+copy_metadata_to_clipboard (GtkTreeModel *model, GtkTreePath *path,
+ GtkTreeIter *iter, gpointer user_data)
+{
+ gchar *type, *value;
+ GList **l = (GList **) user_data;
+
+ gtk_tree_model_get (model, iter, 2, &type, 3, &value, -1);
+
+ *l = g_list_prepend (*l, type);
+ *l = g_list_prepend (*l, value);
+}
+
+void
+metadata_copy_selection_activated (GtkMenuItem *menuitem, gpointer user_data)
+{
+ GtkBuilder *builder;
+ GtkTreeView *tree;
+ GtkClipboard *cb;
+ GList *pairs = NULL, *l, *next, *value, *type;
+ guint total_len;
+ gchar *s, *p;
+
+ builder = GTK_BUILDER (user_data);
+ tree = GTK_TREE_VIEW (gtk_builder_get_object (builder,
+ "GNUNET_GTK_main_window_metadata_treeview"));
+
+ gtk_tree_selection_selected_foreach (gtk_tree_view_get_selection (tree),
+ copy_metadata_to_clipboard, &pairs);
+
+ total_len = 0;
+ pairs = g_list_reverse (pairs);
+ for (l = pairs; l; l = next)
+ {
+ type = l;
+ value = l->next;
+ if (!value)
+ break;
+ next = value->next;
+ total_len += strlen ((gchar *) type->data)
+ + strlen ((gchar *) value->data) + 2 /* ": " */ + (next ? 1 : 0) /* "\n" */;
+ }
+ if (total_len > 0)
+ {
+ total_len += 1; /* "\0" */
+ s = g_new0 (gchar, total_len);
+ p = s;
+ for (l = pairs; l; l = next)
+ {
+ type = l;
+ value = l->next;
+ if (value)
+ {
+ next = value->next;
+ p = g_stpcpy (p, (gchar *) type->data);
+ p = g_stpcpy (p, ": ");
+ p = g_stpcpy (p, (gchar *) value->data);
+ if (next)
+ p = g_stpcpy (p, "\n");
+ }
+ else
+ next = NULL;
+ }
+ }
+ g_list_foreach (pairs, (GFunc) g_free, NULL);
+ g_list_free (pairs);
+ pairs = NULL;
+
+ if (total_len > 0)
+ {
+ cb = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+ gtk_clipboard_set_text (cb, s, -1);
+ gtk_clipboard_store (cb);
+ g_free (s);
+ }
+}
+
+void
+metadata_menu_popup_position (GtkMenu *menu, gint *x, gint *y, gboolean *push_in,
+ gpointer user_data)
+{
+ GtkBuilder *builder;
+ GtkTreeView *tree;
+ GtkTreeSelection *sel;
+ GList *rows;
+ GtkTreePath *p;
+ GtkAllocation tree_allocation;
+ GdkWindow *main_window_gdk;
+ gint mwg_x, mwg_y, t_x, t_y, popup_x, popup_y;
+
+ builder = GTK_BUILDER (user_data);
+
+ tree = GTK_TREE_VIEW (gtk_builder_get_object (builder,
+ "GNUNET_GTK_main_window_metadata_treeview"));
+
+ gtk_widget_get_allocation (GTK_WIDGET (tree), &tree_allocation);
+
+ main_window_gdk = gtk_widget_get_window (GTK_WIDGET (tree));
+
+ gdk_window_get_origin (main_window_gdk, &mwg_x, &mwg_y);
+
+ t_x = mwg_x + tree_allocation.x;
+ t_y = mwg_y + tree_allocation.y;
+ popup_x = t_x;
+ popup_y = t_y;
+
+ sel = gtk_tree_view_get_selection (tree);
+
+ rows = gtk_tree_selection_get_selected_rows (sel, NULL);
+
+ if (rows->data)
+ {
+ GdkRectangle r;
+ p = (GtkTreePath *) rows->data;
+ gtk_tree_view_get_cell_area (tree, p, NULL, &r);
+ popup_x += r.x;
+ popup_y += r.y;
+ }
+
+ g_list_foreach (rows, (GFunc) gtk_tree_path_free, NULL);
+ g_list_free (rows);
+ *x = popup_x;
+ *y = popup_y;
+ *push_in = FALSE;
+}
+
+static void
+do_metadata_popup_menu (GtkWidget *widget, GdkEventButton *event,
+ gpointer user_data)
+{
+ GtkMenu *menu;
+ GtkBuilder *builder;
+ int button, event_time;
+ GtkMenuPositionFunc mpf = NULL;
+
+ builder = GTK_BUILDER (user_data);
+
+ menu = GTK_MENU (gtk_builder_get_object (builder, "metadata_popup_menu"));
+
+ if (event)
+ {
+ button = event->button;
+ event_time = event->time;
+ }
+ else
+ {
+ button = 0;
+ event_time = gtk_get_current_event_time ();
+ }
+
+ gtk_menu_attach_to_widget (menu, widget, NULL);
+ gtk_menu_popup (menu, NULL, NULL, mpf, user_data,
+ button, event_time);
+}
+
+gboolean
+GNUNET_GTK_main_window_metadata_treeview_button_press_event_cb (GtkWidget *widget,
+ GdkEventButton *event, gpointer user_data)
+{
+ /* Ignore double-clicks and triple-clicks */
+ if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
+ {
+ do_metadata_popup_menu (widget, event, user_data);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+gboolean
+GNUNET_GTK_main_window_metadata_treeview_popup_menu_cb (GtkWidget *widget,
+ gpointer user_data)
+{
+ do_metadata_popup_menu (widget, NULL, user_data);
+ return TRUE;
+}
/* end of gnunet-fs-gtk-event_handler.c */
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index e115395..dd4c951 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -572,6 +572,7 @@ GNUNET_GTK_main_window_realize_cb (GtkWidget *widget, gpointer user_data)
GtkTreeStore *namespace_treestore;
GtkBuilder *builder;
GtkWidget *namespace_selector_window;
+ GtkTreeView *metadata_tree;
builder = GTK_BUILDER (user_data);
@@ -579,6 +580,11 @@ GNUNET_GTK_main_window_realize_cb (GtkWidget *widget, gpointer user_data)
("main_window_search_namespace_treestore"));
namespace_tree = GTK_TREE_VIEW (GNUNET_FS_GTK_get_main_window_object
("namespace_selector_treeview"));
+ metadata_tree = GTK_TREE_VIEW (GNUNET_FS_GTK_get_main_window_object
+ ("GNUNET_GTK_main_window_metadata_treeview"));
+
+ /* Allow multiple selection in metadata view */
+ gtk_tree_selection_set_mode (gtk_tree_view_get_selection (metadata_tree), GTK_SELECTION_MULTIPLE);
/* FIXME: find a way to manage pseudonyms.
* Right now the list will be filled with ALL and ANY pseudonyms that we
--
1.7.4
0003-Be-more-careful-with-strings.patch (1,893 bytes)
From 2b26c349c9146543e8813eba3c06f2d1a763e210 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Fri, 16 Dec 2011 13:42:49 +0400
Subject: [PATCH 3/3] Be more careful with strings
TODO: validate EVERY UTF-8 string we get from the net! And convert C ones.
---
src/fs/gnunet-fs-gtk-common.c | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/src/fs/gnunet-fs-gtk-common.c b/src/fs/gnunet-fs-gtk-common.c
index e7cb07f..1a250c6 100644
--- a/src/fs/gnunet-fs-gtk-common.c
+++ b/src/fs/gnunet-fs-gtk-common.c
@@ -48,13 +48,32 @@ GNUNET_FS_GTK_add_meta_data_to_list_store (void *cls, const char *plugin_name,
const char *data_mime_type,
const char *data, size_t data_len)
{
+ gchar *data_to_insert = NULL;
+ gboolean freedata = FALSE;
GtkListStore *ls = GTK_LIST_STORE (cls);
- if ((format == EXTRACTOR_METAFORMAT_UTF8) ||
- (format == EXTRACTOR_METAFORMAT_C_STRING))
+ if (format == EXTRACTOR_METAFORMAT_UTF8)
+ {
+ if (g_utf8_validate (data, data_len, NULL))
+ data_to_insert = data;
+ else
+ format = EXTRACTOR_METAFORMAT_C_STRING;
+ }
+ if (format == EXTRACTOR_METAFORMAT_C_STRING)
+ {
+ gsize rd, wr;
+ data_to_insert = g_locale_to_utf8 (data, data_len, &rd, &wr, NULL);
+ freedata = TRUE;
+ }
+
+ if (data_to_insert)
+ {
gtk_list_store_insert_with_values (ls, NULL, G_MAXINT, 0, type, 1, format,
2, EXTRACTOR_metatype_to_string (type),
- 3, data, -1);
+ 3, data_to_insert, -1);
+ if (freedata)
+ g_free (data_to_insert);
+ }
return 0;
}
--
1.7.4
0001-Don-t-re-attach-the-menu.patch (912 bytes)
From 0a4ec6d7862710ab3aeaa07228917ae50dd0efc5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Fri, 16 Dec 2011 13:57:40 +0400
Subject: [PATCH] Don't re-attach the menu
---
src/fs/gnunet-fs-gtk-event_handler.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/src/fs/gnunet-fs-gtk-event_handler.c b/src/fs/gnunet-fs-gtk-event_handler.c
index 8565bd0..f9d1779 100644
--- a/src/fs/gnunet-fs-gtk-event_handler.c
+++ b/src/fs/gnunet-fs-gtk-event_handler.c
@@ -2084,7 +2084,6 @@ do_metadata_popup_menu (GtkWidget *widget, GdkEventButton *event,
event_time = gtk_get_current_event_time ();
}
- gtk_menu_attach_to_widget (menu, widget, NULL);
gtk_menu_popup (menu, NULL, NULL, mpf, user_data,
button, event_time);
}
--
1.7.4
0001-Remove-old-commented-out-code.patch (884 bytes)
From 85991274d203551e1eee5c462a29d621ef968199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?= =?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com> Date: Sat, 17 Dec 2011 11:50:43 +0400 Subject: [PATCH 1/2] Remove old commented-out code --- src/lib/about.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-) diff --git a/src/lib/about.c b/src/lib/about.c index 52a0145..6e2b80f 100644 --- a/src/lib/about.c +++ b/src/lib/about.c @@ -121,11 +121,6 @@ GNUNET_GTK_display_about (const char *dialogfile) ad = GTK_WIDGET (gtk_builder_get_object (builder, "about_window")); g_object_set_data (G_OBJECT (ad), "gnunet-gtk-builder", builder); gtk_widget_show (ad); - /* - gtk_dialog_run (GTK_DIALOG (ad)); - gtk_widget_destroy (ad); - g_object_unref (G_OBJECT (builder)); - */ } -- 1.7.4 0002-Make-download-by-uri-dialogue-less.patch (20,833 bytes)
From 95be8f054616beb31d8ae77e947c18e15bc91ed8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Sun, 18 Dec 2011 06:56:58 +0400
Subject: [PATCH 2/2] Make download-by-uri dialogue-less
---
contrib/gnunet_fs_gtk_main_window.glade | 198 ++++++++++++++++++++++
src/fs/gnunet-fs-gtk-main_window_file_download.c | 182 +++++++++++++-------
src/fs/gnunet-fs-gtk.c | 8 +-
src/fs/gnunet-fs-gtk.h | 12 ++
4 files changed, 330 insertions(+), 70 deletions(-)
diff --git a/contrib/gnunet_fs_gtk_main_window.glade b/contrib/gnunet_fs_gtk_main_window.glade
index a47a445..d8b4d10 100644
--- a/contrib/gnunet_fs_gtk_main_window.glade
+++ b/contrib/gnunet_fs_gtk_main_window.glade
@@ -677,6 +677,189 @@
<column type="gchararray"/>
</columns>
</object>
+ <object class="GtkTextBuffer" id="GNUNET_GTK_open_url_dialog_url_textview_buffer">
+ <signal name="changed" handler="GNUNET_GTK_open_url_dialog_url_textview_buffer_changed_cb" swapped="no"/>
+ </object>
+ <object class="GtkWindow" id="GNUNET_GTK_open_url_window">
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">Enter the URI to be downloaded</property>
+ <property name="modal">True</property>
+ <property name="default_width">640</property>
+ <property name="default_height">240</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="deletable">False</property>
+ <property name="transient_for">GNUNET_GTK_main_window</property>
+ <child>
+ <object class="GtkVBox" id="GNUNET_GTK_open_url_dialog_main_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkHBox" id="GNUNET_GTK_open_url_dialog_query_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="GNUNET_GTK_open_url_dialog_url_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_URI:</property>
+ <property name="use_underline">True</property>
+ <property name="selectable">True</property>
+ <property name="mnemonic_widget">GNUNET_GTK_open_url_dialog_url_textview</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkTextView" id="GNUNET_GTK_open_url_dialog_url_textview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_KEY_PRESS_MASK | GDK_STRUCTURE_MASK</property>
+ <property name="wrap_mode">char</property>
+ <property name="indent">20</property>
+ <property name="buffer">GNUNET_GTK_open_url_dialog_url_textview_buffer</property>
+ <property name="accepts_tab">False</property>
+ <signal name="key-press-event" handler="GNUNET_GTK_open_url_dialog_url_textview_key_press_event_cb" swapped="no"/>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label_item">
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="GNUNET_GTK_open_url_dialog_anonymity_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_Anonymity:</property>
+ <property name="use_underline">True</property>
+ <property name="selectable">True</property>
+ <property name="mnemonic_widget">GNUNET_GTK_open_url_dialog_anonymity_combobox</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="GNUNET_GTK_open_url_dialog_anonymity_combobox_alignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yscale">0</property>
+ <child>
+ <object class="GtkComboBox" id="GNUNET_GTK_open_url_dialog_anonymity_combobox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="model">main_window_search_anonymity_liststore</property>
+ <property name="active">1</property>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_open_url_dialog_anonymity_combobox_renderer"/>
+ <attributes>
+ <attribute name="foreground">2</attribute>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_open_url_dialog_anonymity_combobox_renerer_level"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </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="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_open_url_dialog_execute_button">
+ <property name="label">_Execute</property>
+ <property name="use_action_appearance">False</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="image">execute_stock_image2</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="GNUNET_GTK_open_url_dialog_execute_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_open_url_dialog_cancel_button">
+ <property name="label">gtk-cancel</property>
+ <property name="use_action_appearance">False</property>
+ <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_GTK_open_url_dialog_cancel_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
<object class="GtkListStore" id="GNUNET_GTK_peer_info_list_store">
<columns>
<!-- column-name peer_identity -->
@@ -715,6 +898,21 @@
<property name="page_increment">10</property>
<property name="page_size">10</property>
</object>
+ <object class="GtkImage" id="execute_stock_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-execute</property>
+ </object>
+ <object class="GtkImage" id="execute_stock_image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-execute</property>
+ </object>
+ <object class="GtkImage" id="execute_stock_image2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-execute</property>
+ </object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
diff --git a/src/fs/gnunet-fs-gtk-main_window_file_download.c b/src/fs/gnunet-fs-gtk-main_window_file_download.c
index 19f7817..0d1114a 100644
--- a/src/fs/gnunet-fs-gtk-main_window_file_download.c
+++ b/src/fs/gnunet-fs-gtk-main_window_file_download.c
@@ -25,82 +25,66 @@
#include "gnunet-fs-gtk-common.h"
#include "gnunet-fs-gtk-download.h"
#include "gnunet-fs-gtk.h"
+#include <gdk/gdkkeysyms.h>
-static GtkBuilder *builder;
-
+/**
+ * User selected "Open URI" in main window.
+ */
void
-GNUNET_GTK_open_url_dialog_url_entry_changed_cb (GtkEditable * editable,
- gpointer user_data)
+GNUNET_GTK_main_menu_file_download_uri_activate_cb (GtkWidget * dummy,
+ gpointer user_data)
{
- struct GNUNET_FS_Uri *uri;
- char *perr;
- const char *uris;
+ GtkBuilder *builder;
+ GtkWidget *dialog;
+ GtkTextBuffer *tb;
+ GtkTextIter ti_start, ti_end;
- perr = NULL;
- uris =
- gtk_entry_get_text (GTK_ENTRY
- (gtk_builder_get_object
- (builder, "GNUNET_GTK_open_url_dialog_url_entry")));
- if (uris != NULL)
- uri = GNUNET_FS_uri_parse (uris, &perr);
- else
- uri = NULL;
- gtk_widget_set_sensitive (GTK_WIDGET
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_open_url_dialog_execute_button")),
- (uri == NULL) ? FALSE : TRUE);
- if (uri != NULL)
- GNUNET_FS_uri_destroy (uri);
- else
- GNUNET_free_non_null (perr);
-}
+ builder = GTK_BUILDER (user_data);
+ dialog = GTK_WIDGET (gtk_builder_get_object (builder, "GNUNET_GTK_open_url_window"));
+
+ tb = GTK_TEXT_BUFFER (gtk_builder_get_object (builder, "GNUNET_GTK_open_url_dialog_url_textview_buffer"));
+ gtk_text_buffer_get_iter_at_offset (tb, &ti_start, 0);
+ gtk_text_buffer_get_iter_at_offset (tb, &ti_end, -1);
+ gtk_text_buffer_delete (tb, &ti_start, &ti_end);
+
+ /* TODO: queue the clipboard, maybe there's valid URI in there?
+ * If so, get it. */
+
+ gtk_widget_show (dialog);
+}
-/**
- * User selected "Open URI" in main window.
- */
void
-GNUNET_GTK_main_menu_file_download_uri_activate_cb (GtkWidget * dummy,
- gpointer data)
+GNUNET_GTK_open_url_dialog_execute_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
{
- GtkWidget *ad;
- const char *uris;
- uint32_t anonymity;
- struct GNUNET_FS_Uri *uri;
+ GtkBuilder *builder;
+ GtkWidget *dialog;
+ GtkTextBuffer *tb;
+ GtkTextIter ti_start, ti_end;
+ guint anonymity_level;
char *perr;
- struct DownloadContext *dc;
+ char *uris;
+ struct GNUNET_FS_Uri *uri;
- GNUNET_assert (builder == NULL);
- builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_open_url_dialog.glade");
- if (builder == NULL)
- {
- GNUNET_break (0);
- return;
- }
- ad = GTK_WIDGET (gtk_builder_get_object
- (builder, "GNUNET_GTK_open_url_dialog"));
- if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad)))
- {
- gtk_widget_destroy (ad);
- g_object_unref (G_OBJECT (builder));
- builder = NULL;
- fprintf (stderr, "Dialog closed!\n");
+ builder = GTK_BUILDER (user_data);
+
+ dialog = GTK_WIDGET (gtk_builder_get_object (builder, "GNUNET_GTK_open_url_window"));
+
+ gtk_widget_hide (dialog);
+
+ tb = GTK_TEXT_BUFFER (gtk_builder_get_object (builder, "GNUNET_GTK_open_url_dialog_url_textview_buffer"));
+ gtk_text_buffer_get_iter_at_offset (tb, &ti_start, 0);
+ gtk_text_buffer_get_iter_at_offset (tb, &ti_end, -1);
+
+ uris = gtk_text_buffer_get_text (tb, &ti_start, &ti_end, FALSE);
+
+ if (!GNUNET_GTK_get_selected_anonymity_level (builder,
+ "main_window_search_anonymity_combobox", &anonymity_level))
return;
- }
- uris =
- gtk_entry_get_text (GTK_ENTRY
- (gtk_builder_get_object
- (builder, "GNUNET_GTK_open_url_dialog_url_entry")));
- anonymity =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_open_url_dialog_anonymity_spin_button")));
+
uri = GNUNET_FS_uri_parse (uris, &perr);
- gtk_widget_destroy (ad);
- g_object_unref (G_OBJECT (builder));
- builder = NULL;
+ g_free (uris);
if (uri == NULL)
{
GNUNET_free (perr);
@@ -113,16 +97,17 @@ GNUNET_GTK_main_menu_file_download_uri_activate_cb (GtkWidget * dummy,
fprintf (stderr, "Starting search!\n");
GNUNET_break (NULL !=
GNUNET_FS_search_start (GNUNET_FS_GTK_get_fs_handle (), uri,
- anonymity,
+ anonymity_level,
GNUNET_FS_SEARCH_OPTION_NONE, NULL));
GNUNET_FS_uri_destroy (uri);
return;
}
if (GNUNET_FS_uri_test_chk (uri) || GNUNET_FS_uri_test_loc (uri))
{
+ struct DownloadContext *dc;
dc = GNUNET_malloc (sizeof (struct DownloadContext));
dc->uri = uri;
- dc->anonymity = anonymity;
+ dc->anonymity = anonymity_level;
GNUNET_FS_GTK_open_download_as_dialog (dc);
return;
}
@@ -130,4 +115,69 @@ GNUNET_GTK_main_menu_file_download_uri_activate_cb (GtkWidget * dummy,
GNUNET_FS_uri_destroy (uri);
}
+void
+GNUNET_GTK_open_url_dialog_cancel_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ GtkBuilder *builder;
+ builder = GTK_BUILDER (user_data);
+
+ gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, "GNUNET_GTK_open_url_window")));
+ return;
+}
+
+gboolean
+GNUNET_GTK_open_url_dialog_url_textview_key_press_event_cb (GtkWidget *widget,
+ GdkEventKey *event, gpointer user_data)
+{
+ GtkBuilder *builder;
+ builder = GTK_BUILDER (user_data);
+
+ if (event->keyval == GDK_KEY_Return)
+ {
+ GtkWidget *execute = GTK_WIDGET (gtk_builder_get_object (builder,
+ "GNUNET_GTK_open_url_dialog_execute_button"));
+ if (gtk_widget_get_sensitive (execute))
+ GNUNET_GTK_open_url_dialog_execute_button_clicked_cb (
+ GTK_BUTTON (execute), user_data);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void
+GNUNET_GTK_open_url_dialog_url_textview_buffer_changed_cb (
+ GtkTextBuffer *textbuffer, gpointer user_data)
+{
+ struct GNUNET_FS_Uri *uri;
+ GtkTextBuffer *tb;
+ GtkTextIter ti_start, ti_end;
+ GtkBuilder *builder;
+ char *perr;
+ char *uris;
+
+ builder = GTK_BUILDER (user_data);
+
+ perr = NULL;
+ tb = GTK_TEXT_BUFFER (gtk_builder_get_object (builder, "GNUNET_GTK_open_url_dialog_url_textview_buffer"));
+ gtk_text_buffer_get_iter_at_offset (tb, &ti_start, 0);
+ gtk_text_buffer_get_iter_at_offset (tb, &ti_end, -1);
+
+ uris = gtk_text_buffer_get_text (tb, &ti_start, &ti_end, FALSE);
+ if (uris != NULL)
+ uri = GNUNET_FS_uri_parse (uris, &perr);
+ else
+ uri = NULL;
+ g_free (uris);
+ gtk_widget_set_sensitive (GTK_WIDGET
+ (gtk_builder_get_object
+ (builder,
+ "GNUNET_GTK_open_url_dialog_execute_button")),
+ (uri == NULL) ? FALSE : TRUE);
+ if (uri != NULL)
+ GNUNET_FS_uri_destroy (uri);
+ else
+ GNUNET_free_non_null (perr);
+}
+
/* end of gnunet-fs-gtk-main_window_file_download.c */
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index dd4c951..2e0f299 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -240,15 +240,14 @@ GNUNET_GTK_get_tree_string (GtkTreeView *treeview, GtkTreePath *treepath,
}
gboolean
-get_selected_anonymity_level (GtkBuilder *builder, guint *p_level)
+GNUNET_GTK_get_selected_anonymity_level (GtkBuilder *builder, gchar *combo_name, guint *p_level)
{
GtkComboBox *combo;
GtkTreeIter iter;
GtkTreeModel *model;
guint level;
- combo = GTK_COMBO_BOX(gtk_builder_get_object (builder,
- "main_window_search_anonymity_combobox"));
+ combo = GTK_COMBO_BOX(gtk_builder_get_object (builder, combo_name));
if (!combo)
return FALSE;
@@ -447,7 +446,8 @@ main_window_search_button_clicked_cb (GtkButton *button, gpointer user_data)
toggle_button = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder,
"main_window_search_namespace_dropdown_button"));
- if (!get_selected_anonymity_level (builder, &anonymity_level))
+ if (!GNUNET_GTK_get_selected_anonymity_level (builder,
+ "main_window_search_anonymity_combobox", &anonymity_level))
return;
mime_combo = GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object
diff --git a/src/fs/gnunet-fs-gtk.h b/src/fs/gnunet-fs-gtk.h
index 3b3228f..4cd76de 100644
--- a/src/fs/gnunet-fs-gtk.h
+++ b/src/fs/gnunet-fs-gtk.h
@@ -63,6 +63,18 @@ GObject *
GNUNET_FS_GTK_get_main_window_object (const char *name);
+/**
+ * Get the selected anonymity level.
+ *
+ * @param builder builder object for the window
+ * @param combo_name name of the combobox widget to get anonymity from
+ * @param p_level pointer to a guint to receive the level value
+ * @return TRUE on success, FALSE on error
+ */
+gboolean
+GNUNET_GTK_get_selected_anonymity_level (GtkBuilder *builder,
+ gchar *combo_name, guint *p_level);
+
#endif
/* end of gnunet-fs-gtk.h */
--
1.7.4
0001-Finally-got-rid-of-gtk_dialog_run-.-Completely.patch (261,567 bytes)
From 6f8f555a1b6eefd0d67cbf2d251cb6ec036fa049 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
=?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Fri, 23 Dec 2011 01:22:26 +0400
Subject: [PATCH] Finally got rid of gtk_dialog_run(). Completely.
---
.../gnunet_fs_gtk_create_namespace_dialog.glade | 19 +-
contrib/gnunet_fs_gtk_main_window.glade | 2202 ++++++++++++++++++--
contrib/gnunet_fs_gtk_open_directory_dialog.glade | 18 +-
.../gnunet_fs_gtk_select_pseudonym_dialog.glade | 111 +-
src/fs/gnunet-fs-gtk-download.c | 2 +-
src/fs/gnunet-fs-gtk-edit_publish_dialog.c | 1074 ++++++----
src/fs/gnunet-fs-gtk-edit_publish_dialog.h | 16 +-
src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c | 631 ++-----
.../gnunet-fs-gtk-main_window_create_pseudonym.c | 49 +-
src/fs/gnunet-fs-gtk-main_window_file_publish.c | 516 +++--
src/fs/gnunet-fs-gtk-main_window_open_directory.c | 50 +-
src/fs/gnunet-fs-gtk.c | 34 +-
src/fs/gnunet-fs-gtk.h | 13 +
13 files changed, 3441 insertions(+), 1294 deletions(-)
diff --git a/contrib/gnunet_fs_gtk_create_namespace_dialog.glade b/contrib/gnunet_fs_gtk_create_namespace_dialog.glade
index 025d41c..3557705 100644
--- a/contrib/gnunet_fs_gtk_create_namespace_dialog.glade
+++ b/contrib/gnunet_fs_gtk_create_namespace_dialog.glade
@@ -4,6 +4,7 @@
<!-- interface-naming-policy project-wide -->
<object class="GtkDialog" id="GNUNET_GTK_create_namespace_dialog">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="can_default">True</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Create namespace</property>
@@ -13,17 +14,20 @@
<property name="icon_name">folder-new</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
- <property name="has_separator">False</property>
+ <signal name="response" handler="GNUNET_GTK_create_namespace_dialog_response_cb" swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="GNUNET_GTK_create_namespace_vbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">2</property>
<child>
<object class="GtkHBox" id="GNUNET_GTK_create_namespace_value_hbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="GNUNET_GTK_create_namespace_name_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">_Name:</property>
<property name="use_underline">True</property>
</object>
@@ -40,8 +44,14 @@
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="activates_default">True</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@@ -56,14 +66,15 @@
<child internal-child="action_area">
<object class="GtkHButtonBox" id="GNUNET_GTK_create_namespace_dialog-action_area">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="GNUNET_GTK_create_namespace_cancel_button">
<property name="label">gtk-cancel</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -75,12 +86,12 @@
<child>
<object class="GtkButton" id="GNUNET_GTK_create_namespace_ok_button">
<property name="label">gtk-ok</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -92,6 +103,8 @@
</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>
diff --git a/contrib/gnunet_fs_gtk_main_window.glade b/contrib/gnunet_fs_gtk_main_window.glade
index d8b4d10..2a5c4f5 100644
--- a/contrib/gnunet_fs_gtk_main_window.glade
+++ b/contrib/gnunet_fs_gtk_main_window.glade
@@ -2,6 +2,823 @@
<interface>
<requires lib="gtk+" version="2.20"/>
<!-- interface-naming-policy project-wide -->
+ <object class="GtkAdjustment" id="GNUNET_GTK_edit_publication_metadata_preview_image_horizontal_adjustment">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="GNUNET_GTK_edit_publication_metadata_preview_image_verticall_adjustment">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkWindow" id="GNUNET_GTK_edit_publication_window">
+ <property name="can_focus">False</property>
+ <property name="border_width">4</property>
+ <property name="modal">True</property>
+ <property name="window_position">center-on-parent</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="deletable">False</property>
+ <property name="transient_for">GNUNET_GTK_main_window</property>
+ <signal name="realize" handler="GNUNET_GTK_edit_publication_window_realize_cb" swapped="no"/>
+ <child>
+ <object class="GtkVBox" id="GNUNET_GTK_edit_publication_master_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkVPaned" id="GNUNET_GTK_edit_publication_main_vpaned">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <object class="GtkHPaned" id="GNUNET_GTK_edit_publication_top_hpaned">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="position_set">True</property>
+ <child>
+ <object class="GtkVBox" id="GNUNET_GTK_edit_publication_metadata_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkHBox" id="GNUNET_GTK_edit_publication_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="GNUNET_GTK_edit_publication_type_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_Publication type:</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="_GNUNET_GTK_edit_publication_type_combo">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="model">GNUNET_GTK_publication_types_liststore</property>
+ <property name="active">0</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext2"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </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_GTK_edit_publication_add_button">
+ <property name="label">gtk-add</property>
+ <property name="use_action_appearance">False</property>
+ <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_GTK_edit_publication_add_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_edit_publication_delete_button">
+ <property name="label">gtk-delete</property>
+ <property name="use_action_appearance">False</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_GTK_edit_publication_delete_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">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="GNUNET_GTK_edit_publication_metadata_scrolled_window">
+ <property name="width_request">400</property>
+ <property name="height_request">120</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="GNUNET_GTK_edit_publication_metadata_tree_view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">GNUNET_GTK_publication_metadata_liststore</property>
+ <property name="enable_search">False</property>
+ <property name="search_column">0</property>
+ <property name="tooltip_column">4</property>
+ <child>
+ <object class="GtkTreeViewColumn" id="GNUNET_GTK_edit_publication_metadata_tree_view_type_column">
+ <property name="resizable">True</property>
+ <property name="title" translatable="yes">Type</property>
+ <property name="clickable">True</property>
+ <property name="sort_column_id">1</property>
+ <child>
+ <object class="GtkCellRendererCombo" id="GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer">
+ <property name="editable">True</property>
+ <property name="has_entry">False</property>
+ <property name="model">GNUNET_GTK_publication_metadata_types_liststore</property>
+ <property name="text_column">2</property>
+ <signal name="changed" handler="GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_changed_cb" swapped="no"/>
+ <signal name="edited" handler="GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_edited_cb" swapped="no"/>
+ </object>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="GNUNET_GTK_edit_publication_metadata_tree_view_description_column">
+ <property name="sizing">autosize</property>
+ <property name="title" translatable="yes">Value</property>
+ <property name="expand">True</property>
+ <property name="clickable">True</property>
+ <property name="sort_column_id">2</property>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer">
+ <property name="editable">True</property>
+ <signal name="edited" handler="GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb" swapped="no"/>
+ </object>
+ <attributes>
+ <attribute name="text">3</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="resize">True</property>
+ <property name="shrink">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="GNUNET_GTK_edit_publication_metadata_preview_frame">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <child>
+ <object class="GtkAlignment" id="GNUNET_GTK_edit_publication_metadata_preview_alignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkVBox" id="GNUNET_GTK_edit_publication_metadata_preview_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkFileChooserButton" id="GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="create_folders">False</property>
+ <property name="title" translatable="yes">Select file</property>
+ <signal name="file-set" handler="GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button_file_set_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="GNUNET_GTK_edit_publication_metadata_preview_image_scrolled_window">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hadjustment">GNUNET_GTK_edit_publication_metadata_preview_image_horizontal_adjustment</property>
+ <property name="vadjustment">GNUNET_GTK_edit_publication_metadata_preview_image_verticall_adjustment</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <object class="GtkViewport" id="GNUNET_GTK_edit_publication_metadata_preview_image_viewport">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hadjustment">GNUNET_GTK_edit_publication_metadata_preview_image_horizontal_adjustment</property>
+ <property name="vadjustment">GNUNET_GTK_edit_publication_metadata_preview_image_verticall_adjustment</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkImage" id="GNUNET_GTK_edit_publication_metadata_preview_image">
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-missing-image</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <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="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Preview:</property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="resize">True</property>
+ <property name="shrink">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="resize">True</property>
+ <property name="shrink">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="GNUNET_GTK_edit_publication_secondary_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkHBox" id="GNUNET_GTK_edit_publication_keyword_list_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="GNUNET_GTK_edit_publication_keyword_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_Keyword:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">GNUNET_GTK_edit_publication_keyword_entry</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="GNUNET_GTK_edit_publication_keyword_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="invisible_char_set">True</property>
+ <property name="caps_lock_warning">False</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ <signal name="key-press-event" handler="GNUNET_GTK_edit_publication_keyword_entry_key_press_event_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="GNUNET_GTK_edit_publication_keyword_scrolled_window">
+ <property name="width_request">400</property>
+ <property name="height_request">120</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="GNUNET_GTK_edit_publication_keyword_list_tree_view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">GNUNET_GTK_publication_keywords_liststore</property>
+ <property name="search_column">0</property>
+ <child>
+ <object class="GtkTreeViewColumn" id="GNUNET_GTK_edit_publication_keyword_list_tree_view_column">
+ <property name="title" translatable="yes">Keywords</property>
+ <property name="clickable">True</property>
+ <property name="reorderable">True</property>
+ <property name="sort_column_id">0</property>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_edit_publication_keyword_list_tree_view_renderer"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="GNUNET_GTK_edit_publication_normalization_checkbox">
+ <property name="label" translatable="yes">Normalize all keywords a_utomatically after "OK" is pressed</property>
+ <property name="use_action_appearance">False</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="GNUNET_GTK_edit_publication_normalization_checkbox_toggled_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="GNUNET_GTK_edit_publication_keyword_list_button_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_edit_publication_keyword_list_add_button">
+ <property name="label">Add key_word</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">add_stock_image</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="GNUNET_GTK_edit_publication_keyword_list_add_button_clicked_cb" swapped="no"/>
+ </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_GTK_edit_publication_keyword_list_normalize_button">
+ <property name="label" translatable="yes">_Normalize selected</property>
+ <property name="use_action_appearance">False</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="GNUNET_GTK_edit_publication_keyword_list_normalize_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_edit_publication_keyword_list_del_button">
+ <property name="label">Delete _selected</property>
+ <property name="use_action_appearance">False</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_underline">True</property>
+ <signal name="clicked" handler="GNUNET_GTK_edit_publication_keyword_list_del_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">5</property>
+ <property name="pack_type">end</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">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="padding">4</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <child>
+ <object class="GtkAlignment" id="alignment3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yalign">0</property>
+ <property name="yscale">0</property>
+ <property name="left_padding">4</property>
+ <property name="right_padding">4</property>
+ <child>
+ <object class="GtkVBox" id="GNUNET_GTK_edit_publication_misc_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkHBox" id="GNUNET_GTK_edit_publication_anonymity_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="GNUNET_GTK_edit_publication_anonymity_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">A_nonymity:</property>
+ <property name="use_underline">True</property>
+ </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="GtkAlignment" id="GNUNET_GTK_edit_publication_anonymity_combobox_alignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yscale">0</property>
+ <child>
+ <object class="GtkComboBox" id="GNUNET_GTK_edit_publication_anonymity_combobox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="model">main_window_search_anonymity_liststore</property>
+ <property name="active">1</property>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_edit_publication_anonymity_combobox_renderer"/>
+ <attributes>
+ <attribute name="foreground">2</attribute>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_edit_publication_anonymity_combobox_renerer_level"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="GNUNET_GTK_edit_publication_priority_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="GNUNET_GTK_edit_publication_priority_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Priority:</property>
+ <property name="use_underline">True</property>
+ </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="GtkSpinButton" id="GNUNET_GTK_edit_publication_priority_spin_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="invisible_char_set">True</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ <property name="adjustment">priority_adjustment</property>
+ <property name="numeric">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="GNUNET_GTK_edit_publication_root_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="GNUNET_GTK_edit_publication_root_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Root keyword:</property>
+ <property name="use_underline">True</property>
+ </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_GTK_edit_publication_root_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">•</property>
+ <property name="text">root</property>
+ <property name="invisible_char_set">True</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="GNUNET_GTK_edit_publication_expiration_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Expriation year:</property>
+ <property name="use_underline">True</property>
+ </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="GtkSpinButton" id="GNUNET_GTK_edit_publication_expiration_year_spin_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="max_length">4</property>
+ <property name="invisible_char">•</property>
+ <property name="invisible_char_set">True</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ <property name="adjustment">expiration_year_adjustment</property>
+ <property name="climb_rate">1</property>
+ <property name="numeric">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="GNUNET_GTK_edit_publication_index_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="GNUNET_GTK_edit_publication_index_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Index file:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">GNUNET_GTK_edit_publication_index_checkbutton</property>
+ </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="GtkCheckButton" id="GNUNET_GTK_edit_publication_index_checkbutton">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Publication options:</property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="resize">True</property>
+ <property name="shrink">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="GNUNET_GTK_edit_publication_buttons_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_edit_publication_confirm_button">
+ <property name="label">gtk-ok</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="GNUNET_GTK_edit_publication_confirm_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_edit_publication_cancel_button">
+ <property name="label">gtk-cancel</property>
+ <property name="use_action_appearance">False</property>
+ <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_GTK_edit_publication_cancel_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">1</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkTreeStore" id="GNUNET_GTK_file_sharing_publishing_tree_store">
+ <columns>
+ <!-- column-name filesize -->
+ <column type="gchararray"/>
+ <!-- column-name do_index -->
+ <column type="gboolean"/>
+ <!-- column-name filename -->
+ <column type="gchararray"/>
+ <!-- column-name anonymity_level -->
+ <column type="guint"/>
+ <!-- column-name priority -->
+ <column type="guint"/>
+ <!-- column-name file_information_struct -->
+ <column type="gpointer"/>
+ </columns>
+ </object>
<object class="GtkWindow" id="GNUNET_GTK_main_window">
<property name="can_focus">False</property>
<property name="title" translatable="yes">gnunet-fs-gtk</property>
@@ -41,7 +858,6 @@
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu" id="GNUNET_GTK_main_menu_file_sharing_box">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_create_pseudonym">
@@ -52,7 +868,7 @@
<property name="tooltip_text" translatable="yes">Create a pseudonym for publishing content. Note that you can also publish content anonymously (without using a pseudonym).</property>
<property name="accel_path"><gnunet-fs-gtk>/File sharing/Create pseudonym</property>
<property name="use_underline">True</property>
- <property name="image">image3</property>
+ <property name="image">new_stock_imag</property>
<property name="use_stock">False</property>
<accelerator key="n" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<signal name="activate" handler="GNUNET_GTK_main_menu_create_pseudonym_activate_cb" swapped="no"/>
@@ -65,7 +881,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
- <property name="image">image6</property>
+ <property name="image">index_stock_image</property>
<property name="use_stock">False</property>
<signal name="activate" handler="GNUNET_GTK_main_menu_file_advertise_pseudonym_activate_cb" swapped="no"/>
</object>
@@ -79,7 +895,7 @@
<property name="tooltip_text" translatable="yes">Publish files or directories on GNUnet</property>
<property name="accel_path"><gnunet-fs-gtk>/File sharing/Publish</property>
<property name="use_underline">True</property>
- <property name="image">image2</property>
+ <property name="image">up_stock_image</property>
<property name="use_stock">False</property>
<accelerator key="a" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<signal name="activate" handler="GNUNET_GTK_main_menu_file_publish_activate_cb" swapped="no"/>
@@ -88,7 +904,6 @@
<child>
<object class="GtkSeparatorMenuItem" id="GNUNET_GTK_main_menu_file_sep1">
<property name="use_action_appearance">False</property>
- <property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
@@ -96,12 +911,10 @@
<object class="GtkImageMenuItem" id="GNUNET_GTK_main_menu_file_search">
<property name="label" translatable="yes">_Search</property>
<property name="use_action_appearance">False</property>
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Search GNUnet for files</property>
<property name="accel_path"><gnunet-fs-gtk>/File sharing/Search</property>
<property name="use_underline">True</property>
- <property name="image">image4</property>
<property name="use_stock">False</property>
<accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<signal name="activate" handler="GNUNET_GTK_main_menu_file_search_activate_cb" swapped="no"/>
@@ -123,7 +936,7 @@
<property name="tooltip_text" translatable="yes">Download a file or directory with a known URI.</property>
<property name="accel_path"><gnunet-fs-gtk>/File sharing/Download</property>
<property name="use_underline">True</property>
- <property name="image">image5</property>
+ <property name="image">down_stock_image</property>
<property name="use_stock">False</property>
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<signal name="activate" handler="GNUNET_GTK_main_menu_file_download_uri_activate_cb" swapped="no"/>
@@ -138,7 +951,7 @@
<property name="tooltip_text" translatable="yes">Use this option to browse a GNUnet directory file that has been previously downloaded.</property>
<property name="accel_path"><gnunet-fs-gtk>/File sharing/Open directory</property>
<property name="use_underline">True</property>
- <property name="image">image1</property>
+ <property name="image">open_stock_image</property>
<property name="use_stock">False</property>
<accelerator key="F3" signal="activate"/>
<signal name="activate" handler="GNUNET_GTK_main_menu_file_open_gnunet_directory_activate_cb" swapped="no"/>
@@ -387,6 +1200,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="image">find_stock_image</property>
<signal name="clicked" handler="main_window_search_button_clicked_cb" swapped="no"/>
</object>
</child>
@@ -403,8 +1217,7 @@
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
- <property name="primary_icon_stock">gtk-find</property>
- <property name="primary_icon_activatable">True</property>
+ <property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
@@ -665,11 +1478,412 @@
</object>
</child>
</object>
- <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store">
- <columns>
- <!-- column-name extractor_meta_type -->
- <column type="guint"/>
- <!-- column-name extractor_meta_format -->
+ <object class="GtkWindow" id="GNUNET_GTK_master_publish_dialog">
+ <property name="height_request">500</property>
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">Publish content on GNUnet</property>
+ <property name="window_position">center-on-parent</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="deletable">False</property>
+ <property name="transient_for">GNUNET_GTK_main_window</property>
+ <signal name="realize" handler="GNUNET_GTK_master_publish_dialog_realize_cb" swapped="no"/>
+ <signal name="delete-event" handler="GNUNET_GTK_master_publish_dialog_delete_event_cb" swapped="no"/>
+ <child>
+ <object class="GtkVBox" id="GNUNET_GTK_master_publish_dialog_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">4</property>
+ <property name="spacing">7</property>
+ <child>
+ <object class="GtkScrolledWindow" id="GNUNET_GTK_master_publish_dialog_file_information_scrolled_window">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hadjustment">adjustment5</property>
+ <property name="vadjustment">adjustment6</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="GNUNET_GTK_master_publish_dialog_file_information_tree_view">
+ <property name="height_request">100</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">GNUNET_GTK_file_sharing_publishing_tree_store</property>
+ <property name="hadjustment">adjustment5</property>
+ <property name="vadjustment">adjustment6</property>
+ <property name="enable_tree_lines">True</property>
+ <child>
+ <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_file_information_filesize_column">
+ <property name="sizing">autosize</property>
+ <property name="title" translatable="yes">Size</property>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_file_information_filesize_renderer"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_file_information_filename_column">
+ <property name="resizable">True</property>
+ <property name="sizing">autosize</property>
+ <property name="title" translatable="yes">Filename</property>
+ <property name="expand">True</property>
+ <property name="clickable">True</property>
+ <property name="reorderable">True</property>
+ <property name="sort_indicator">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_file_information_filename_renderer"/>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </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="GtkHBox" id="GNUNET_GTK_master_dialog_modification_button_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkTable" id="GNUNET_GTK_master_publish_dialog_action_table">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">3</property>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_add_button">
+ <property name="label" translatable="yes">Add _File</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_add_button_clicked_cb" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_new_button">
+ <property name="label" translatable="yes">_Create empty directory</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">new_stock_image</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_new_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_open_button">
+ <property name="label" translatable="yes">Add _Directory</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_open_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_edit_button">
+ <property name="label">gtk-edit</property>
+ <property name="use_action_appearance">False</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_GTK_master_publish_dialog_edit_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_delete_button">
+ <property name="label">gtk-delete</property>
+ <property name="use_action_appearance">False</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_GTK_master_publish_dialog_delete_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">25</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="GNUNET_GTK_master_publish_dialog_arrow_table">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">3</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_up_button">
+ <property name="label">gtk-go-up</property>
+ <property name="use_action_appearance">False</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_GTK_master_publish_dialog_up_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_left_button">
+ <property name="label" translatable="yes">_Left</property>
+ <property name="use_action_appearance">False</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="image">left_stock_image</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_left_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_down_button">
+ <property name="label">gtk-go-down</property>
+ <property name="use_action_appearance">False</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_GTK_master_publish_dialog_down_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_right_button">
+ <property name="label" translatable="yes">_Right</property>
+ <property name="use_action_appearance">False</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="image">right_stock_image</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_right_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">25</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="GNUNET_GTK_master_publish_dialog_pseudonym_scrolled_window">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hadjustment">adjustment7</property>
+ <property name="vadjustment">adjustment8</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="GNUNET_GTK_master_publish_dialog_pseudonym_tree_view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">GNUNET_GTK_pseudonym_tree_store</property>
+ <property name="hadjustment">adjustment7</property>
+ <property name="vadjustment">adjustment8</property>
+ <property name="reorderable">True</property>
+ <property name="rubber_banding">True</property>
+ <property name="enable_grid_lines">both</property>
+ <child>
+ <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_name_column">
+ <property name="resizable">True</property>
+ <property name="title" translatable="yes">Pseudonym</property>
+ <property name="clickable">True</property>
+ <property name="reorderable">True</property>
+ <property name="sort_indicator">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_name_renderer"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_identifier_column">
+ <property name="resizable">True</property>
+ <property name="sizing">autosize</property>
+ <property name="title" translatable="yes">Current identifier</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_identifier_renderer"/>
+ <attributes>
+ <attribute name="editable">8</attribute>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_updates_column">
+ <property name="resizable">True</property>
+ <property name="sizing">autosize</property>
+ <property name="fixed_width">5</property>
+ <property name="title" translatable="yes">Update identifier</property>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_updates_renderer"/>
+ <attributes>
+ <attribute name="editable">7</attribute>
+ <attribute name="text">5</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="GNUNET_GTK_master_publish_dialog_pseudonym_description_column">
+ <property name="title" translatable="yes">Description (of existing content)</property>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_master_publish_dialog_pseudonym_description_renderer">
+ <property name="wrap_mode">word</property>
+ </object>
+ <attributes>
+ <attribute name="text">6</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="GNUNET_GTK_master_publish_dialog_master_buttons_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_execute_button">
+ <property name="label" translatable="yes">_Execute</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_master_publish_dialog_cancel_button">
+ <property name="label" translatable="yes">_Cancel</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="GNUNET_GTK_master_publish_dialog_cancel_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store">
+ <columns>
+ <!-- column-name extractor_meta_type -->
+ <column type="guint"/>
+ <!-- column-name extractor_meta_format -->
<column type="guint"/>
<!-- column-name extractor_meta_type_string -->
<column type="gchararray"/>
@@ -706,7 +1920,6 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes">_URI:</property>
<property name="use_underline">True</property>
- <property name="selectable">True</property>
<property name="mnemonic_widget">GNUNET_GTK_open_url_dialog_url_textview</property>
</object>
<packing>
@@ -756,7 +1969,6 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Anonymity:</property>
<property name="use_underline">True</property>
- <property name="selectable">True</property>
<property name="mnemonic_widget">GNUNET_GTK_open_url_dialog_anonymity_combobox</property>
</object>
<packing>
@@ -767,112 +1979,816 @@
</packing>
</child>
<child>
- <object class="GtkAlignment" id="GNUNET_GTK_open_url_dialog_anonymity_combobox_alignment">
+ <object class="GtkAlignment" id="GNUNET_GTK_open_url_dialog_anonymity_combobox_alignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yscale">0</property>
+ <child>
+ <object class="GtkComboBox" id="GNUNET_GTK_open_url_dialog_anonymity_combobox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="model">main_window_search_anonymity_liststore</property>
+ <property name="active">1</property>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_open_url_dialog_anonymity_combobox_renderer"/>
+ <attributes>
+ <attribute name="foreground">2</attribute>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_open_url_dialog_anonymity_combobox_renerer_level"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </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="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_open_url_dialog_execute_button">
+ <property name="label">_Execute</property>
+ <property name="use_action_appearance">False</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="image">execute_stock_image</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="GNUNET_GTK_open_url_dialog_execute_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_open_url_dialog_cancel_button">
+ <property name="label">gtk-cancel</property>
+ <property name="use_action_appearance">False</property>
+ <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_GTK_open_url_dialog_cancel_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">4</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkListStore" id="GNUNET_GTK_peer_info_list_store">
+ <columns>
+ <!-- column-name peer_identity -->
+ <column type="gchararray"/>
+ <!-- column-name number_of_known_addresses -->
+ <column type="guint"/>
+ <!-- column-name country_name -->
+ <column type="gchararray"/>
+ <!-- column-name country_flag -->
+ <column type="GdkPixbuf"/>
+ <!-- column-name bandwidth -->
+ <column type="guint64"/>
+ </columns>
+ </object>
+ <object class="GtkTreeStore" id="GNUNET_GTK_pseudonym_tree_store">
+ <columns>
+ <!-- column-name local_name -->
+ <column type="gchararray"/>
+ <!-- column-name namespace_handle -->
+ <column type="gpointer"/>
+ <!-- column-name last_id -->
+ <column type="gchararray"/>
+ <!-- column-name last_uri -->
+ <column type="gchararray"/>
+ <!-- column-name last_meta -->
+ <column type="gpointer"/>
+ <!-- column-name next_id -->
+ <column type="gchararray"/>
+ <!-- column-name last_description_from_meta -->
+ <column type="gchararray"/>
+ <!-- column-name next_id_editable -->
+ <column type="gboolean"/>
+ <!-- column-name current_id_editable -->
+ <column type="gboolean"/>
+ </columns>
+ </object>
+ <object class="GtkListStore" id="GNUNET_GTK_publication_keywords_liststore">
+ <columns>
+ <!-- column-name Keyword -->
+ <column type="gchararray"/>
+ <!-- column-name Added -->
+ <column type="gboolean"/>
+ </columns>
+ </object>
+ <object class="GtkListStore" id="GNUNET_GTK_publication_metadata_liststore">
+ <columns>
+ <!-- column-name Type -->
+ <column type="gint"/>
+ <!-- column-name Format -->
+ <column type="gint"/>
+ <!-- column-name Type1 -->
+ <column type="gchararray"/>
+ <!-- column-name Value -->
+ <column type="gchararray"/>
+ <!-- column-name Description -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkListStore" id="GNUNET_GTK_publication_metadata_types_liststore">
+ <columns>
+ <!-- column-name Type -->
+ <column type="gint"/>
+ <!-- column-name Format -->
+ <column type="gint"/>
+ <!-- column-name Type1 -->
+ <column type="gchararray"/>
+ <!-- column-name Description -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkListStore" id="GNUNET_GTK_publication_types_liststore">
+ <columns>
+ <!-- column-name Type -->
+ <column type="gint"/>
+ <!-- column-name Type1 -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0">-1</col>
+ <col id="1" translatable="yes">Generic</col>
+ </row>
+ <row>
+ <col id="0">1</col>
+ <col id="1" translatable="yes">Text</col>
+ </row>
+ <row>
+ <col id="0">2</col>
+ <col id="1" translatable="yes">Music</col>
+ </row>
+ <row>
+ <col id="0">3</col>
+ <col id="1" translatable="yes">Video</col>
+ </row>
+ <row>
+ <col id="0">4</col>
+ <col id="1" translatable="yes">Image</col>
+ </row>
+ <row>
+ <col id="0">5</col>
+ <col id="1" translatable="yes">Namespace</col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkFileChooserDialog" id="GNUNET_GTK_publish_directory_dialog">
+ <property name="can_focus">False</property>
+ <property name="can_default">True</property>
+ <property name="events">GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK</property>
+ <property name="border_width">5</property>
+ <property name="modal">True</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="type_hint">dialog</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="transient_for">GNUNET_GTK_main_window</property>
+ <property name="action">select-folder</property>
+ <property name="create_folders">False</property>
+ <property name="select_multiple">True</property>
+ <signal name="response" handler="GNUNET_GTK_publish_directory_dialog_response_cb" swapped="no"/>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_publish_dialog_cancel_button">
+ <property name="label">gtk-cancel</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</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_GTK_publish_directory_dialog_ok_button">
+ <property name="label">gtk-ok</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">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>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkHBox" id="hbox6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkCheckButton" id="GNUNET_GTK_publish_directory_dialog_do_index_checkbutton">
+ <property name="label" translatable="yes">Index files</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">20</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkLabel" id="GNUNET_GTK_publish_directory_dialog_priority_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Priority:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">13</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="GNUNET_GTK_publish_directory_dialog_priority_spin_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">•</property>
+ <property name="invisible_char_set">True</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ <property name="adjustment">priority_adjustment</property>
+ <property name="numeric">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">20</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="GNUNET_GTK_publish_directory_dialog_expiration_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Expiration year:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">20</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="GNUNET_GTK_publish_directory_dialog_expiration_year_spin_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">•</property>
+ <property name="invisible_char_set">True</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ <property name="adjustment">expiration_year_adjustment</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="GNUNET_GTK_publish_directory_dialog_anonymity_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Anonymity:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">5</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="GNUNET_GTK_publish_directory_dialog_anonymity_combobox_alignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yscale">0</property>
+ <child>
+ <object class="GtkComboBox" id="GNUNET_GTK_publish_directory_dialog_anonymity_combobox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="model">main_window_search_anonymity_liststore</property>
+ <property name="active">1</property>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_publish_directory_dialog_anonymity_combobox_renderer"/>
+ <attributes>
+ <attribute name="foreground">2</attribute>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_publish_directory_dialog_anonymity_combobox_renerer_level"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">GNUNET_GTK_publish_dialog_cancel_button</action-widget>
+ <action-widget response="-5">GNUNET_GTK_publish_directory_dialog_ok_button</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkFileChooserDialog" id="GNUNET_GTK_publish_file_dialog">
+ <property name="can_focus">False</property>
+ <property name="can_default">True</property>
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Publish file...</property>
+ <property name="modal">True</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="type_hint">normal</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="transient_for">GNUNET_GTK_main_window</property>
+ <property name="create_folders">False</property>
+ <property name="select_multiple">True</property>
+ <signal name="delete-event" handler="gtk_widget_hide_on_delete" swapped="no"/>
+ <signal name="response" handler="GNUNET_GTK_publish_file_dialog_response_cb" swapped="no"/>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_publish_file_dialog_cancel_button">
+ <property name="label">gtk-cancel</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</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_GTK_publish_file_dialog_ok_button">
+ <property name="label">gtk-ok</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">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>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkCheckButton" id="GNUNET_GTK_publish_file_dialog_do_index_checkbutton">
+ <property name="label" translatable="yes">Index file</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">20</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkLabel" id="GNUNET_GTK_publish_file_dialog_priority_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Priority:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">13</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="GNUNET_GTK_publish_file_dialog_priority_spin_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">•</property>
+ <property name="invisible_char_set">True</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ <property name="adjustment">priority_adjustment</property>
+ <property name="numeric">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">20</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox5">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="yscale">0</property>
<child>
- <object class="GtkComboBox" id="GNUNET_GTK_open_url_dialog_anonymity_combobox">
+ <object class="GtkLabel" id="GNUNET_GTK_publish_file_dialog_expiration_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="model">main_window_search_anonymity_liststore</property>
- <property name="active">1</property>
- <child>
- <object class="GtkCellRendererText" id="GNUNET_GTK_open_url_dialog_anonymity_combobox_renderer"/>
- <attributes>
- <attribute name="foreground">2</attribute>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
+ <property name="label" translatable="yes">Expiration year:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">20</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="GNUNET_GTK_publish_file_dialog_expiration_year_spin_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">•</property>
+ <property name="invisible_char_set">True</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ <property name="adjustment">expiration_year_adjustment</property>
+ <property name="numeric">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="GNUNET_GTK_publish_file_dialog_anonymity_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Anonymity:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">5</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="GNUNET_GTK_publish_file_dialog_anonymity_combobox_alignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yscale">0</property>
<child>
- <object class="GtkCellRendererText" id="GNUNET_GTK_open_url_dialog_anonymity_combobox_renerer_level"/>
- <attributes>
- <attribute name="text">1</attribute>
- </attributes>
+ <object class="GtkComboBox" id="GNUNET_GTK_publish_file_dialog_anonymity_combobox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="model">main_window_search_anonymity_liststore</property>
+ <property name="active">1</property>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_publish_file_dialog_anonymity_combobox_renderer"/>
+ <attributes>
+ <attribute name="foreground">2</attribute>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="GNUNET_GTK_publish_file_dialog_anonymity_combobox_renerer_level"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="padding">5</property>
- <property name="position">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
</packing>
</child>
- <child>
- <object class="GtkHBox" id="hbox1">
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">GNUNET_GTK_publish_file_dialog_cancel_button</action-widget>
+ <action-widget response="-5">GNUNET_GTK_publish_file_dialog_ok_button</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkListStore" id="GNUNET_GTK_publish_file_dialog_expiration_list_store">
+ <columns>
+ <!-- column-name human_readable_time -->
+ <column type="gchararray"/>
+ <!-- column-name time_in_ms -->
+ <column type="guint64"/>
+ </columns>
+ </object>
+ <object class="GtkListStore" id="GNUNET_GTK_select_pseudonym_liststore">
+ <columns>
+ <!-- column-name namespace_name -->
+ <column type="gchararray"/>
+ <!-- column-name namespace_handle -->
+ <column type="gpointer"/>
+ </columns>
+ </object>
+ <object class="GtkAdjustment" id="adjustment3">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment4">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkDialog" id="GNUNET_GTK_select_pseudonym_dialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Select pseudonym...</property>
+ <property name="modal">True</property>
+ <property name="default_width">400</property>
+ <property name="default_height">300</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="type_hint">normal</property>
+ <signal name="realize" handler="GNUNET_GTK_select_pseudonym_dialog_realize_cb" swapped="no"/>
+ <signal name="response" handler="GNUNET_GTK_select_pseudonym_dialog_response_cb" swapped="no"/>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area3">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="layout_style">end</property>
<child>
- <object class="GtkButton" id="GNUNET_GTK_open_url_dialog_execute_button">
- <property name="label">_Execute</property>
+ <object class="GtkButton" id="GNUNET_GTK_select_pseudonym_cancel_button">
+ <property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</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="image">execute_stock_image2</property>
- <property name="use_underline">True</property>
- <signal name="clicked" handler="GNUNET_GTK_open_url_dialog_execute_button_clicked_cb" swapped="no"/>
+ <property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="padding">4</property>
- <property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="GNUNET_GTK_open_url_dialog_cancel_button">
- <property name="label">gtk-cancel</property>
+ <object class="GtkButton" id="GNUNET_GTK_select_pseudonym_ok_button">
+ <property name="label">gtk-ok</property>
<property name="use_action_appearance">False</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_GTK_open_url_dialog_cancel_button_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="padding">4</property>
- <property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
- <property name="padding">4</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="GNUNET_GTK_select_pseudonym_scrolledwindow">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hadjustment">adjustment3</property>
+ <property name="vadjustment">adjustment4</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="GNUNET_GTK_select_pseudonym_tree_view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">GNUNET_GTK_select_pseudonym_liststore</property>
+ <property name="hadjustment">adjustment3</property>
+ <property name="vadjustment">adjustment4</property>
+ <property name="search_column">0</property>
+ <child>
+ <object class="GtkTreeViewColumn" id="GNUNET_GTK_select_pseudonym_tree_view_column">
+ <property name="title" translatable="yes">Name</property>
+ <property name="expand">True</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_GTK_select_pseudonym_name_renderer"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</child>
+ <action-widgets>
+ <action-widget response="-6">GNUNET_GTK_select_pseudonym_cancel_button</action-widget>
+ <action-widget response="-5">GNUNET_GTK_select_pseudonym_ok_button</action-widget>
+ </action-widgets>
</object>
- <object class="GtkListStore" id="GNUNET_GTK_peer_info_list_store">
- <columns>
- <!-- column-name peer_identity -->
- <column type="gchararray"/>
- <!-- column-name number_of_known_addresses -->
- <column type="guint"/>
- <!-- column-name country_name -->
- <column type="gchararray"/>
- <!-- column-name country_flag -->
- <column type="GdkPixbuf"/>
- <!-- column-name bandwidth -->
- <column type="guint64"/>
- </columns>
+ <object class="GtkImage" id="add_stock_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-add</property>
</object>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
@@ -886,85 +2802,50 @@
<property name="page_increment">10</property>
<property name="page_size">10</property>
</object>
- <object class="GtkAdjustment" id="adjustment3">
+ <object class="GtkAdjustment" id="adjustment5">
<property name="upper">100</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
- <property name="page_size">10</property>
</object>
- <object class="GtkAdjustment" id="adjustment4">
+ <object class="GtkAdjustment" id="adjustment6">
<property name="upper">100</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
- <property name="page_size">10</property>
- </object>
- <object class="GtkImage" id="execute_stock_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-execute</property>
- </object>
- <object class="GtkImage" id="execute_stock_image1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-execute</property>
- </object>
- <object class="GtkImage" id="execute_stock_image2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-execute</property>
</object>
- <object class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-open</property>
- </object>
- <object class="GtkImage" id="image2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-go-up</property>
- </object>
- <object class="GtkImage" id="image3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-new</property>
+ <object class="GtkAdjustment" id="adjustment7">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
</object>
- <object class="GtkImage" id="image4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-find</property>
+ <object class="GtkAdjustment" id="adjustment8">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
</object>
- <object class="GtkImage" id="image5">
+ <object class="GtkImage" id="down_stock_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-go-down</property>
</object>
- <object class="GtkImage" id="image6">
+ <object class="GtkImage" id="execute_stock_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="stock">gtk-index</property>
+ <property name="stock">gtk-execute</property>
</object>
- <object class="GtkImage" id="image7">
+ <object class="GtkImage" id="find_stock_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="stock">gtk-index</property>
+ <property name="stock">gtk-find</property>
</object>
- <object class="GtkImage" id="image8">
+ <object class="GtkImage" id="index_stock_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-index</property>
</object>
- <object class="GtkImage" id="image9">
+ <object class="GtkImage" id="left_stock_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="stock">gtk-index</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>
+ <property name="stock">gtk-go-back</property>
</object>
<object class="GtkListStore" id="main_window_search_anonymity_liststore">
<columns>
@@ -1067,6 +2948,7 @@
<property name="can_focus">False</property>
<property name="events">GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>
<property name="resizable">False</property>
+ <property name="destroy_with_parent">True</property>
<property name="type_hint">dropdown-menu</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
@@ -1117,4 +2999,78 @@
</object>
</child>
</object>
+ <object class="GtkImage" id="new_stock_imag">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-new</property>
+ </object>
+ <object class="GtkImage" id="new_stock_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-new</property>
+ </object>
+ <object class="GtkImage" id="open_stock_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-open</property>
+ </object>
+ <object class="GtkAdjustment" id="priority_adjustment">
+ <property name="upper">10000000</property>
+ <property name="value">1000</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkImage" id="right_stock_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-go-forward</property>
+ </object>
+ <object class="GtkImage" id="up_stock_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-go-up</property>
+ </object>
+ <object class="GtkSizeGroup" id="edit_publication_options_input_widgets_sizegroup">
+ <widgets>
+ <widget name="GNUNET_GTK_edit_publication_anonymity_combobox_alignment"/>
+ <widget name="GNUNET_GTK_edit_publication_priority_spin_button"/>
+ <widget name="GNUNET_GTK_edit_publication_root_entry"/>
+ <widget name="GNUNET_GTK_edit_publication_expiration_year_spin_button"/>
+ <widget name="GNUNET_GTK_edit_publication_index_checkbutton"/>
+ </widgets>
+ </object>
+ <object class="GtkSizeGroup" id="edit_publication_options_labels_sizegroup">
+ <widgets>
+ <widget name="GNUNET_GTK_edit_publication_anonymity_label"/>
+ <widget name="GNUNET_GTK_edit_publication_priority_label"/>
+ <widget name="GNUNET_GTK_edit_publication_root_label"/>
+ <widget name="GNUNET_GTK_edit_publication_expiration_label"/>
+ <widget name="GNUNET_GTK_edit_publication_index_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="GtkAdjustment" id="expiration_year_adjustment">
+ <property name="upper">9999</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkSizeGroup" id="sizegroup4">
+ <widgets>
+ <widget name="GNUNET_GTK_master_publish_dialog_cancel_button"/>
+ <widget name="GNUNET_GTK_master_publish_dialog_execute_button"/>
+ </widgets>
+ </object>
+ <object class="GtkSizeGroup" id="sizegroup5">
+ <widgets>
+ <widget name="GNUNET_GTK_edit_publication_confirm_button"/>
+ <widget name="GNUNET_GTK_edit_publication_cancel_button"/>
+ </widgets>
+ </object>
</interface>
diff --git a/contrib/gnunet_fs_gtk_open_directory_dialog.glade b/contrib/gnunet_fs_gtk_open_directory_dialog.glade
index d55c0b0..a807742 100644
--- a/contrib/gnunet_fs_gtk_open_directory_dialog.glade
+++ b/contrib/gnunet_fs_gtk_open_directory_dialog.glade
@@ -4,30 +4,30 @@
<!-- interface-naming-policy project-wide -->
<object class="GtkFileFilter" id="gnunet_directory_filter"/>
<object class="GtkFileChooserDialog" id="GNUNET_GTK_open_directory_dialog">
+ <property name="can_focus">False</property>
<property name="can_default">True</property>
<property name="border_width">5</property>
<property name="type_hint">normal</property>
- <property name="has_separator">False</property>
- <property name="filter">gnunet_directory_filter</property>
<property name="create_folders">False</property>
+ <property name="filter">gnunet_directory_filter</property>
+ <signal name="response" handler="GNUNET_GTK_open_directory_dialog_response_cb" swapped="no"/>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">2</property>
- <child>
- <placeholder/>
- </child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="GNUNET_GTK_open_directory_dialog_cancel_button">
<property name="label">gtk-cancel</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -39,11 +39,11 @@
<child>
<object class="GtkButton" id="GNUNET_GTK_open_directory_dialog_ok_button">
<property name="label">gtk-ok</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -55,10 +55,14 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</child>
<action-widgets>
diff --git a/contrib/gnunet_fs_gtk_select_pseudonym_dialog.glade b/contrib/gnunet_fs_gtk_select_pseudonym_dialog.glade
index ea50fa4..418231d 100644
--- a/contrib/gnunet_fs_gtk_select_pseudonym_dialog.glade
+++ b/contrib/gnunet_fs_gtk_select_pseudonym_dialog.glade
@@ -2,28 +2,81 @@
<interface>
<requires lib="gtk+" version="2.20"/>
<!-- interface-naming-policy project-wide -->
- <object class="GtkAdjustment" id="adjustment2">
+ <object class="GtkListStore" id="GNUNET_GTK_select_pseudonym_liststore">
+ <columns>
+ <!-- column-name namespace_name -->
+ <column type="gchararray"/>
+ <!-- column-name namespace_handle -->
+ <column type="gpointer"/>
+ </columns>
+ </object>
+ <object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
<property name="page_size">10</property>
</object>
- <object class="GtkAdjustment" id="adjustment1">
+ <object class="GtkAdjustment" id="adjustment2">
<property name="upper">100</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
<property name="page_size">10</property>
</object>
<object class="GtkDialog" id="GNUNET_GTK_select_pseudonym_dialog">
+ <property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Select pseudonym...</property>
<property name="modal">True</property>
<property name="type_hint">normal</property>
- <property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="GNUNET_GTK_select_pseudonym_dialog_vbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="GNUNET_GTK_select_pseudonym_dialog_action_area">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="GNUNET_GTK_select_pseudonym_cancel_button">
+ <property name="label">gtk-cancel</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</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_GTK_select_pseudonym_ok_button">
+ <property name="label">gtk-ok</property>
+ <property name="use_action_appearance">False</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>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
<object class="GtkScrolledWindow" id="GNUNET_GTK_select_pseudonym_scrolledwindow">
<property name="visible">True</property>
@@ -59,54 +112,14 @@
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
- <child internal-child="action_area">
- <object class="GtkHButtonBox" id="GNUNET_GTK_select_pseudonym_dialog_action_area">
- <property name="visible">True</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="GNUNET_GTK_select_pseudonym_cancel_button">
- <property name="label">gtk-cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_action_appearance">False</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_GTK_select_pseudonym_ok_button">
- <property name="label">gtk-ok</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_action_appearance">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
</object>
</child>
<action-widgets>
@@ -114,12 +127,4 @@
<action-widget response="-5">GNUNET_GTK_select_pseudonym_ok_button</action-widget>
</action-widgets>
</object>
- <object class="GtkListStore" id="GNUNET_GTK_select_pseudonym_liststore">
- <columns>
- <!-- column-name namespace_name -->
- <column type="gchararray"/>
- <!-- column-name namespace_handle -->
- <column type="gpointer"/>
- </columns>
- </object>
</interface>
diff --git a/src/fs/gnunet-fs-gtk-download.c b/src/fs/gnunet-fs-gtk-download.c
index d9451e1..1a7ff30 100644
--- a/src/fs/gnunet-fs-gtk-download.c
+++ b/src/fs/gnunet-fs-gtk-download.c
@@ -203,7 +203,7 @@ GNUNET_FS_GTK_open_download_as_dialog (struct DownloadContext *dc)
dlc->response = 0;
dlc->dc = dc;
g_object_set_data (G_OBJECT (ad), "dialog-context", dlc);
- gtk_widget_show_all (ad);
+ gtk_window_present (GTK_WINDOW (ad));
}
/* end of gnunet-fs-gtk-download.c */
diff --git a/src/fs/gnunet-fs-gtk-edit_publish_dialog.c b/src/fs/gnunet-fs-gtk-edit_publish_dialog.c
index 2465e6a..37fe1a2 100644
--- a/src/fs/gnunet-fs-gtk-edit_publish_dialog.c
+++ b/src/fs/gnunet-fs-gtk-edit_publish_dialog.c
@@ -24,87 +24,26 @@
*/
#include "gnunet-fs-gtk-common.h"
#include "gnunet-fs-gtk-edit_publish_dialog.h"
+#include "gnunet-fs-gtk.h"
#include <gnunet/gnunet_util_lib.h>
+#include <gdk/gdkkeysyms.h>
-/**
- * Builder for the current dialog.
- */
-static GtkBuilder *builder;
-
-/**
- * Are we editing metadata for a directory?
- */
-static int is_directory;
-
-/**
- * Set to YES if the preview was changed.
- */
-static int preview_changed;
-
-void
-GNUNET_GTK_edit_file_information_keyword_list_normalize_button_clicked_cb ()
-{
- GNUNET_break (0);
-}
-
-void
-GNUNET_GTK_edit_file_information_keyword_list_del_button_clicked_cb ()
-{
- GtkTreeView *tv;
- GtkTreeSelection *sel;
- GtkTreeModel *tm;
- GtkTreeIter iter;
-
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_keyword_list_tree_view"));
- sel = gtk_tree_view_get_selection (tv);
- if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
- {
- GNUNET_break (0);
- return;
- }
- gtk_list_store_remove (GTK_LIST_STORE (tm), &iter);
-}
-
-void
-GNUNET_GTK_edit_file_information_keyword_list_add_button_clicked_cb ()
-{
- const char *keyword;
- GtkEntry *entry;
- GtkListStore *ls;
- GtkTreeIter iter;
-
- ls = GTK_LIST_STORE (gtk_builder_get_object
- (builder, "GNUNET_GTK_keyword_list_store"));
- entry =
- GTK_ENTRY (gtk_builder_get_object
- (builder, "GNUNET_GTK_edit_file_information_keyword_entry"));
- keyword = gtk_entry_get_text (entry);
- if (strlen (keyword) > 0)
- gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, keyword, -1);
- gtk_entry_set_text (entry, "");
-}
+#define PUBSTATE "edit-publication-state"
-
-void
-GNUNET_GTK_edit_file_information_keyword_entry_changed_cb ()
+struct edit_publication_state
{
- const char *keyword;
- GtkEntry *entry;
- GtkWidget *button;
-
- button =
- GTK_WIDGET (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_keyword_list_add_button"));
- entry =
- GTK_ENTRY (gtk_builder_get_object
- (builder, "GNUNET_GTK_edit_file_information_keyword_entry"));
- keyword = gtk_entry_get_text (entry);
- gtk_widget_set_sensitive (button, (strlen (keyword) > 0) ? TRUE : FALSE);
-}
-
+ int *do_index;
+ char **short_fn;
+ guint *anonymity_level;
+ guint *priority;
+ struct GNUNET_FS_FileInformation *fip;
+ gint preview_changed;
+ gboolean allow_no_keywords;
+ gboolean is_directory;
+ GNUNET_FS_GTK_edit_publish_dialog_cb cb;
+ gchar *root;
+ gpointer cls;
+};
static void
metadata_selection_changed_cb (GtkTreeSelection * ts, gpointer user_data)
@@ -112,165 +51,222 @@ metadata_selection_changed_cb (GtkTreeSelection * ts, gpointer user_data)
GtkTreeView *tv;
GtkTreeSelection *sel;
GtkWidget *button;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (user_data);
tv = GTK_TREE_VIEW (gtk_builder_get_object
(builder,
- "GNUNET_GTK_edit_file_information_metadata_tree_view"));
+ "GNUNET_GTK_edit_publication_metadata_tree_view"));
sel = gtk_tree_view_get_selection (tv);
button =
GTK_WIDGET (gtk_builder_get_object
(builder,
- "GNUNET_GTK_edit_file_information_metadata_delete_button"));
+ "GNUNET_GTK_edit_publication_delete_button"));
gtk_widget_set_sensitive (button,
gtk_tree_selection_get_selected (sel, NULL, NULL));
}
-
static void
-keyword_selection_changed_cb (GtkTreeSelection * ts, gpointer user_data)
+keywords_selection_changed_cb (GtkTreeSelection * ts, gpointer user_data)
{
GtkTreeView *tv;
GtkTreeSelection *sel;
GtkWidget *button;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (user_data);
+
tv = GTK_TREE_VIEW (gtk_builder_get_object
(builder,
- "GNUNET_GTK_edit_file_information_keyword_list_tree_view"));
+ "GNUNET_GTK_edit_publication_keyword_list_tree_view"));
sel = gtk_tree_view_get_selection (tv);
button =
GTK_WIDGET (gtk_builder_get_object
(builder,
- "GNUNET_GTK_edit_file_information_keyword_list_del_button"));
+ "GNUNET_GTK_edit_publication_keyword_list_del_button"));
gtk_widget_set_sensitive (button,
gtk_tree_selection_get_selected (sel, NULL, NULL));
button =
GTK_WIDGET (gtk_builder_get_object
(builder,
- "GNUNET_GTK_edit_file_information_keyword_list_normalize_button"));
+ "GNUNET_GTK_edit_publication_keyword_list_normalize_button"));
gtk_widget_set_sensitive (button,
gtk_tree_selection_get_selected (sel, NULL, NULL));
}
void
-GNUNET_GTK_edit_file_information_metadata_value_entry_changed_cb ()
+GNUNET_GTK_edit_publication_window_realize_cb (GtkWidget *widget,
+ gpointer user_data)
{
+ GtkBuilder *builder;
+ GtkListStore *metatypes_list;
+ GtkTreeIter iter;
GtkTreeView *tv;
GtkTreeSelection *sel;
- const char *value;
- GtkEntry *entry;
- GtkWidget *button;
+ guint type;
+ guint max_type;
- entry =
- GTK_ENTRY (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_metadata_value_entry"));
- value = gtk_entry_get_text (entry);
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_metadata_type_tree_view"));
+ builder = GTK_BUILDER (user_data);
+ metatypes_list = GTK_LIST_STORE (gtk_builder_get_object (builder,
+ "GNUNET_GTK_publication_metadata_types_liststore"));
+
+ tv = GTK_TREE_VIEW (gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_metadata_tree_view"));
sel = gtk_tree_view_get_selection (tv);
- button =
- GTK_WIDGET (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_metadata_add_button"));
- gtk_widget_set_sensitive (button,
- (strlen (value) >
- 0) ? gtk_tree_selection_get_selected (sel, NULL,
- NULL) :
- FALSE);
-}
+ g_signal_connect (G_OBJECT (sel), "changed",
+ G_CALLBACK (metadata_selection_changed_cb), builder);
+ tv = GTK_TREE_VIEW (gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_keyword_list_tree_view"));
+ sel = gtk_tree_view_get_selection (tv);
+ g_signal_connect (G_OBJECT (sel), "changed",
+ G_CALLBACK (keywords_selection_changed_cb), builder);
-void
-GNUNET_GTK_edit_file_information_keyword_entry_activate_cb ()
-{
- GNUNET_GTK_edit_file_information_keyword_list_add_button_clicked_cb ();
+ max_type = EXTRACTOR_metatype_get_max ();
+ for (type = 1; type < max_type - 1; type++)
+ gtk_list_store_insert_with_values (metatypes_list, &iter, G_MAXINT,
+ 0, type,
+ 1, EXTRACTOR_METAFORMAT_UTF8,
+ 2, EXTRACTOR_metatype_to_string (type),
+ 3, EXTRACTOR_metatype_to_description (type), -1);
}
-
void
-GNUNET_GTK_edit_file_information_metadata_preview_file_chooser_button_file_set_cb
- (GtkFileChooserButton * widget, gpointer user_data)
+GNUNET_GTK_edit_publication_add_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
{
- gchar *fn;
- GtkImage *image;
+ GtkBuilder *builder;
+ GtkTreeView *meta_tree;
+ GtkListStore *meta_list;
+ GtkTreeIter iter;
- fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
- image =
- GTK_IMAGE (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_metadata_preview_image"));
- gtk_image_set_from_file (image, fn);
- preview_changed = GNUNET_YES;
+ builder = GTK_BUILDER (user_data);
+ meta_tree = GTK_TREE_VIEW (gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_metadata_tree_view"));
+ meta_list = GTK_LIST_STORE (gtk_tree_view_get_model (meta_tree));
+
+ gtk_list_store_insert (meta_list, &iter, 0);
+ /* type == -1 means "not set" */
+ gtk_list_store_set (meta_list, &iter, 0, -1, 1, EXTRACTOR_METAFORMAT_UTF8,
+ 2, _("Select a type"), 3, _("Specify a value"), 4, NULL, -1);
}
+gboolean
+GNUNET_GTK_edit_publication_keyword_entry_key_press_event_cb (GtkWidget *widget,
+ GdkEventKey *event, gpointer user_data)
+{
+ GtkBuilder *builder;
+ GtkButton *add_button;
+ builder = GTK_BUILDER (user_data);
+
+ if (event->keyval == GDK_KEY_Return)
+ {
+ add_button = GTK_BUTTON (gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_add_button"));
+ GNUNET_GTK_edit_publication_add_button_clicked_cb (add_button, user_data);
+ return TRUE;
+ }
+ return FALSE;
+}
void
-GNUNET_GTK_edit_file_information_metadata_delete_button_clicked_cb ()
+GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_edited_cb (
+ GtkCellRendererText *renderer, gchar *path, gchar *new_text,
+ gpointer user_data)
{
- GtkTreeView *tv;
- GtkTreeSelection *sel;
- GtkTreeModel *tm;
+ GtkBuilder *builder;
+ GtkTreeView *meta_tree;
+ GtkListStore *meta_list;
+ GtkCellRendererCombo *combo;
+ GtkTreeModel *combo_model;
GtkTreeIter iter;
+ gint type_id;
+ gchar *description = NULL;
+ GtkTreeIter *pass_data = NULL;
+
+ builder = GTK_BUILDER (user_data);
+ meta_tree = GTK_TREE_VIEW (gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_metadata_tree_view"));
+ meta_list = GTK_LIST_STORE (gtk_tree_view_get_model (meta_tree));
+ if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (meta_list), &iter, path))
+ return;
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_metadata_tree_view"));
- sel = gtk_tree_view_get_selection (tv);
- if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
- {
- GNUNET_break (0);
+ combo = GTK_CELL_RENDERER_COMBO (gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer"));
+
+ pass_data = g_object_get_data (G_OBJECT (combo), "selected-type");
+ if (!pass_data)
return;
- }
- gtk_list_store_remove (GTK_LIST_STORE (tm), &iter);
+ g_object_get (combo, "model", &combo_model, NULL);
+ gtk_tree_model_get (combo_model, pass_data, 0, &type_id, 2, &description, -1);
+ g_free (combo_model);
+ g_free (pass_data);
+ g_object_set_data (G_OBJECT (combo), "selected-type", NULL);
+
+ gtk_list_store_set (meta_list, &iter, 0, type_id, 1,
+ EXTRACTOR_METAFORMAT_UTF8, 2, new_text, 4, description, -1);
+ g_free (description);
}
+void
+GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_changed_cb (
+ GtkCellRendererCombo *combo, gchar *path_string, GtkTreeIter *new_iter,
+ gpointer user_data)
+{
+ GtkTreeIter *pass_data;
+
+ pass_data = g_object_get_data (G_OBJECT (combo), "selected-type");
+ if (pass_data)
+ g_free (pass_data);
+ pass_data = g_new0 (GtkTreeIter, 1);
+ *pass_data = *new_iter;
+ g_object_set_data (G_OBJECT (combo), "selected-type", pass_data);
+}
void
-GNUNET_GTK_edit_file_information_metadata_add_button_clicked_cb ()
+GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb (
+ GtkCellRendererText *renderer, gchar *path, gchar *new_text,
+ gpointer user_data)
{
- const char *value;
+ GtkBuilder *builder;
+ GtkTreeView *meta_tree;
+ GtkListStore *meta_list;
+ GtkTreeIter iter;
+ gint metatype;
char *avalue;
const char *ivalue;
- GtkEntry *entry;
- GtkListStore *ls;
- GtkTreeModel *tm;
- GtkTreeView *tv;
- GtkTreeSelection *sel;
- GtkTreeIter iter;
- guint type;
size_t slen;
char *pos;
- entry =
- GTK_ENTRY (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_metadata_value_entry"));
- value = gtk_entry_get_text (entry);
- if ((value == NULL) || (strlen (value) == 0))
- {
- GNUNET_break (0);
+ GObject *pubwindow;
+ struct edit_publication_state *state = NULL;
+
+ builder = GTK_BUILDER (user_data);
+ meta_tree = GTK_TREE_VIEW (gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_metadata_tree_view"));
+ meta_list = GTK_LIST_STORE (gtk_tree_view_get_model (meta_tree));
+ if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (meta_list), &iter, path))
return;
- }
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_metadata_type_tree_view"));
- tm = gtk_tree_view_get_model (tv);
- sel = gtk_tree_view_get_selection (tv);
- if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
+
+ pubwindow = gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_window");
+ state = g_object_get_data (pubwindow, PUBSTATE);
+ if (!state)
{
GNUNET_break (0);
return;
}
- gtk_tree_model_get (tm, &iter, 1, &type, -1);
- ls = GTK_LIST_STORE (gtk_builder_get_object
- (builder, "GNUNET_GTK_meta_data_list_store"));
- if ((type == EXTRACTOR_METATYPE_FILENAME) &&
- (value[strlen (value) - 1] != '/') && (is_directory))
+
+ gtk_tree_model_get (GTK_TREE_MODEL (meta_list), &iter, 0, &metatype, -1);
+ if (metatype == EXTRACTOR_METATYPE_FILENAME
+ && new_text[strlen (new_text) - 1] != '/'
+ && state->is_directory)
{
- GNUNET_asprintf (&avalue, "%s/", value);
+ GNUNET_asprintf (&avalue, "%s/", new_text);
/* if user typed '\' instead of '/', change it! */
slen = strlen (avalue);
while ((slen > 1) && (avalue[slen - 2] == '\\'))
@@ -281,7 +277,7 @@ GNUNET_GTK_edit_file_information_metadata_add_button_clicked_cb ()
}
while (NULL != (pos = strstr (avalue, "\\")))
*pos = '/';
- /* remove '../' everywhere */
+ // remove '../' everywhere
while (NULL != (pos = strstr (avalue, "../")))
{
pos[0] = '_';
@@ -292,158 +288,260 @@ GNUNET_GTK_edit_file_information_metadata_add_button_clicked_cb ()
}
else
{
- ivalue = value;
+ ivalue = new_text;
avalue = NULL;
}
- gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, type, 1,
- (guint) EXTRACTOR_METAFORMAT_UTF8, 2,
- EXTRACTOR_metatype_to_string (type), 3,
- ivalue, -1);
+ gtk_list_store_set (meta_list, &iter, 3, ivalue, -1);
GNUNET_free_non_null (avalue);
- gtk_entry_set_text (GTK_ENTRY (entry), "");
}
+void
+GNUNET_GTK_edit_publication_delete_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ GtkTreeView *tv;
+ GtkTreeSelection *sel;
+ GtkTreeModel *tm;
+ GtkTreeIter iter;
+ GtkBuilder *builder = GTK_BUILDER (user_data);
-/**
- * Add each of the keywords to the keyword list store.
- *
- * @param cls closure
- * @param keyword the keyword
- * @param is_mandatory is the keyword mandatory (in a search)
- * @return GNUNET_OK to continue to iterate
- */
-static int
-add_keyword (void *cls, const char *keyword, int is_mandatory)
+ tv = GTK_TREE_VIEW (gtk_builder_get_object
+ (builder,
+ "GNUNET_GTK_edit_publication_metadata_tree_view"));
+ sel = gtk_tree_view_get_selection (tv);
+ if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
+ {
+ GNUNET_break (0);
+ return;
+ }
+ if (gtk_list_store_remove (GTK_LIST_STORE (tm), &iter))
+ gtk_tree_selection_select_iter (sel, &iter);
+}
+
+void
+GNUNET_GTK_edit_publication_keyword_list_add_button_clicked_cb (
+ GtkButton *button, gpointer user_data)
{
+ const char *keyword;
+ GtkEntry *entry;
GtkListStore *ls;
GtkTreeIter iter;
+ GtkBuilder *builder;
+ GtkWidget *ok;
+
+ builder = GTK_BUILDER (user_data);
ls = GTK_LIST_STORE (gtk_builder_get_object
- (builder, "GNUNET_GTK_keyword_list_store"));
- gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, keyword, -1);
- return GNUNET_OK;
+ (builder, "GNUNET_GTK_publication_keywords_liststore"));
+ entry =
+ GTK_ENTRY (gtk_builder_get_object
+ (builder, "GNUNET_GTK_edit_publication_keyword_entry"));
+ keyword = gtk_entry_get_text (entry);
+ if (strlen (keyword) > 0)
+ {
+ gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, keyword, 1, TRUE, -1);
+ ok = GTK_WIDGET (gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_confirm_button"));
+ gtk_widget_set_sensitive (ok, TRUE);
+ }
+ gtk_entry_set_text (entry, "");
}
+gboolean
+gtk_tree_model_get_item_count_cb (GtkTreeModel *model, GtkTreePath *path,
+ GtkTreeIter *iter, gpointer data)
+{
+ gint *counter = (gint *) data;
+ *counter += 1;
+ return FALSE;
+}
-/**
- * Add the given meta data to the model (or make it the preview
- * image if it is an image).
- *
- * @param cls closure, NULL
- * @param plugin_name name of the plugin that produced this value;
- * special values can be used (i.e. '<zlib>' for zlib being
- * used in the main libextractor library and yielding
- * meta data).
- * @param type libextractor-type describing the meta data
- * @param format basic format information about data
- * @param data_mime_type mime-type of data (not of the original file);
- * can be NULL (if mime-type is not known)
- * @param data actual meta-data found
- * @param data_len number of bytes in data
- * @return 0 to continue extracting
- */
-static int
-add_meta_item (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type,
- enum EXTRACTOR_MetaFormat format, const char *data_mime_type,
- const char *data, size_t data_len)
+void
+GNUNET_GTK_edit_publication_keyword_entry_changed_cb (GtkEditable *editable,
+ gpointer user_data)
{
- GtkListStore *ls;
+ const char *keyword;
+ GtkEntry *entry;
+ GtkWidget *button;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (user_data);
+
+ button =
+ GTK_WIDGET (gtk_builder_get_object
+ (builder,
+ "GNUNET_GTK_edit_publication_keyword_list_add_button"));
+ entry =
+ GTK_ENTRY (gtk_builder_get_object
+ (builder, "GNUNET_GTK_edit_publication_keyword_entry"));
+ keyword = gtk_entry_get_text (entry);
+ gtk_widget_set_sensitive (button, (strlen (keyword) > 0) ? TRUE : FALSE);
+}
+
+
+gint
+gtk_tree_model_get_item_count (GtkTreeModel *model)
+{
+ gint c = 0;
+ gtk_tree_model_foreach (model, >k_tree_model_get_item_count_cb, &c);
+ return c;
+}
+
+gboolean
+gtk_tree_model_has_items_cb (GtkTreeModel *model, GtkTreePath *path,
+ GtkTreeIter *iter, gpointer data)
+{
+ gboolean *val = (gboolean *) data;
+ *val = TRUE;
+ return TRUE;
+}
+
+gboolean
+gtk_tree_model_has_items (GtkTreeModel *model)
+{
+ gboolean b = FALSE;
+ gtk_tree_model_foreach (model, >k_tree_model_has_items_cb, &b);
+ return b;
+}
+
+void
+GNUNET_GTK_edit_publication_keyword_list_del_button_clicked_cb (
+ GtkButton *button, gpointer user_data)
+{
+ GtkTreeView *tv;
+ GtkTreeSelection *sel;
+ GtkTreeModel *tm;
GtkTreeIter iter;
+ GtkBuilder *builder;
+ GtkWidget *ok;
+ GObject *pubwindow;
+ struct edit_publication_state *state = NULL;
+ builder = GTK_BUILDER (user_data);
- switch (format)
+ tv = GTK_TREE_VIEW (gtk_builder_get_object
+ (builder,
+ "GNUNET_GTK_edit_publication_keyword_list_tree_view"));
+
+ sel = gtk_tree_view_get_selection (tv);
+ if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
{
- case EXTRACTOR_METAFORMAT_UTF8:
- case EXTRACTOR_METAFORMAT_C_STRING:
- ls = GTK_LIST_STORE (gtk_builder_get_object
- (builder, "GNUNET_GTK_meta_data_list_store"));
- gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, (guint) type, 1,
- (guint) format, 2,
- EXTRACTOR_metatype_to_string (type), 3,
- data, -1);
- break;
- case EXTRACTOR_METAFORMAT_UNKNOWN:
- break;
- case EXTRACTOR_METAFORMAT_BINARY:
- break;
- default:
GNUNET_break (0);
+ return;
}
- return 0;
+ if (gtk_list_store_remove (GTK_LIST_STORE (tm), &iter))
+ gtk_tree_selection_select_iter (sel, &iter);
+
+ ok = GTK_WIDGET (gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_confirm_button"));
+
+ pubwindow = gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_window");
+ state = g_object_get_data (pubwindow, PUBSTATE);
+ if (!state)
+ {
+ GNUNET_break (0);
+ return;
+ }
+
+ if (!state->allow_no_keywords && !gtk_tree_model_has_items (tm))
+ gtk_widget_set_sensitive (ok, FALSE);
}
+void
+GNUNET_GTK_edit_publication_keyword_list_normalize_button_clicked_cb (
+ GtkButton *button, gpointer user_data)
+{
+ GtkTreeView *tv;
+ GtkTreeSelection *sel;
+ GtkTreeModel *tm;
+ GtkTreeIter iter, inserted;
+ gchar *value;
+ struct GNUNET_FS_Uri *uri;
+ struct GNUNET_FS_Uri *nuri;
+ char *nvalue;
+ char *emsg;
+ GtkBuilder *builder;
+ builder = GTK_BUILDER (user_data);
-/**
- * Function called to extract the information from FI.
- *
- * @param cls closure
- * @param fi the entry in the publish-structure
- * @param length length of the file or directory
- * @param meta metadata for the file or directory (can be modified)
- * @param uri pointer to the keywords that will be used for this entry (can be modified)
- * @param bo block options
- * @param do_index should we index (can be modified)
- * @param client_info pointer to client context set upon creation (can be modified)
- * @return GNUNET_SYSERR (aborts after first call)
- */
-static int
-file_information_extract (void *cls, struct GNUNET_FS_FileInformation *fi,
- uint64_t length,
- struct GNUNET_CONTAINER_MetaData *meta,
- struct GNUNET_FS_Uri **uri,
- struct GNUNET_FS_BlockOptions *bo, int *do_index,
- void **client_info)
+ tv = GTK_TREE_VIEW (gtk_builder_get_object
+ (builder,
+ "GNUNET_GTK_edit_publication_keyword_list_tree_view"));
+ sel = gtk_tree_view_get_selection (tv);
+ if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
+ return;
+ gtk_tree_model_get (tm, &iter, 0, &value, -1);
+ emsg = NULL;
+ uri = GNUNET_FS_uri_ksk_create (value, &emsg);
+ if (uri == NULL)
+ {
+ GNUNET_break (0);
+ GNUNET_free (emsg);
+ g_free (value);
+ return;
+ }
+ nuri = GNUNET_FS_uri_ksk_canonicalize (uri);
+ nvalue = GNUNET_FS_uri_ksk_to_string_fancy (nuri);
+
+ if (strcmp (value, nvalue) != 0)
+ {
+ gtk_list_store_insert_after (GTK_LIST_STORE (tm), &inserted, &iter);
+ gtk_list_store_set (GTK_LIST_STORE (tm), &inserted, 0, nvalue, -1);
+ }
+ GNUNET_FS_uri_destroy (nuri);
+ GNUNET_FS_uri_destroy (uri);
+ GNUNET_free (nvalue);
+ g_free (value);
+}
+
+void
+GNUNET_GTK_edit_publication_normalization_checkbox_toggled_cb (
+ GtkToggleButton *button, gpointer user_data)
{
- GtkImage *img;
- GdkPixbuf *pixbuf;
- struct tm *t;
- int year;
- time_t tp;
+ GtkBuilder *builder;
+ GtkToggleButton *norm_button;
+ builder = GTK_BUILDER (user_data);
+ norm_button = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_keyword_list_normalize_button"));
+ gtk_widget_set_sensitive (GTK_WIDGET (norm_button),
+ !gtk_toggle_button_get_active (norm_button));
+}
- if (NULL != *uri)
- GNUNET_FS_uri_ksk_get_keywords (*uri, &add_keyword, NULL);
- if (NULL != meta)
+void
+GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button_file_set_cb (
+ GtkFileChooserButton *widget, gpointer user_data)
+{
+ gchar *fn;
+ GtkImage *image;
+ GObject *pubwindow;
+ GtkBuilder *builder = GTK_BUILDER (user_data);
+ struct edit_publication_state *state = NULL;
+
+ pubwindow = gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_window");
+ state = g_object_get_data (pubwindow, PUBSTATE);
+ if (!state)
{
- GNUNET_CONTAINER_meta_data_iterate (meta, &add_meta_item, NULL);
- pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta);
- if (pixbuf != NULL)
- {
- img =
- GTK_IMAGE (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_metadata_preview_image"));
- gtk_image_set_from_pixbuf (img, pixbuf);
- }
+ GNUNET_break (0);
+ return;
}
- tp = bo->expiration_time.abs_value / 1000; /* ms to seconds */
- t = gmtime (&tp);
- if (t == NULL)
- year = 0;
- else
- year = t->tm_year + 1900;
- gtk_spin_button_set_value (GTK_SPIN_BUTTON
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_expiration_year_spin_button")),
- year);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_anonymity_spin_button")),
- bo->anonymity_level);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_priority_spin_button")),
- bo->content_priority);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_index_check_button")),
- *do_index);
- return GNUNET_SYSERR; /* only visit top-level item */
+
+ fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
+ image =
+ GTK_IMAGE (gtk_builder_get_object
+ (builder,
+ "GNUNET_GTK_edit_publication_metadata_preview_image"));
+ gtk_image_set_from_file (image, fn);
+ state->preview_changed = GNUNET_YES;
}
+struct fiu_context
+{
+ GtkBuilder *builder;
+ char **short_fn;
+ gchar *root;
+ struct GNUNET_CONTAINER_MetaData *md;
+};
/**
* Copy binary meta data from to the new container and also
@@ -469,7 +567,9 @@ preserve_meta_items (void *cls, const char *plugin_name,
const char *data_mime_type, const char *data,
size_t data_len)
{
- struct GNUNET_CONTAINER_MetaData *md = cls;
+ struct fiu_context *context = (struct fiu_context *) cls;
+ GtkBuilder *builder = context->builder;
+ struct GNUNET_CONTAINER_MetaData *md = context->md;
GtkTreeModel *tm;
GtkTreeIter iter;
gchar *value;
@@ -477,13 +577,25 @@ preserve_meta_items (void *cls, const char *plugin_name,
guint nformat;
int keep;
+ GObject *pubwindow;
+ struct edit_publication_state *state = NULL;
+
+ pubwindow = gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_window");
+ state = g_object_get_data (pubwindow, PUBSTATE);
+ if (!state)
+ {
+ GNUNET_break (0);
+ return 0;
+ }
+
keep = GNUNET_NO;
switch (format)
{
case EXTRACTOR_METAFORMAT_UTF8:
case EXTRACTOR_METAFORMAT_C_STRING:
tm = GTK_TREE_MODEL (gtk_builder_get_object
- (builder, "GNUNET_GTK_meta_data_list_store"));
+ (builder, "GNUNET_GTK_publication_metadata_liststore"));
if (TRUE == gtk_tree_model_get_iter_first (tm, &iter))
{
do
@@ -505,7 +617,7 @@ preserve_meta_items (void *cls, const char *plugin_name,
case EXTRACTOR_METAFORMAT_UNKNOWN:
break;
case EXTRACTOR_METAFORMAT_BINARY:
- if (preview_changed == GNUNET_NO)
+ if (state->preview_changed == GNUNET_NO)
keep = GNUNET_YES;
break;
default:
@@ -542,7 +654,9 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi,
struct GNUNET_FS_BlockOptions *bo, int *do_index,
void **client_info)
{
- char **short_fn = cls;
+ struct fiu_context *context = (struct fiu_context *) cls;
+ char **short_fn = context->short_fn;
+ GtkBuilder *builder = context->builder;
struct GNUNET_CONTAINER_MetaData *nm;
GtkTreeModel *tm;
GtkTreeIter iter;
@@ -558,26 +672,49 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi,
const char *mime;
GFile *f;
GFileInfo *finfo;
+ gboolean auto_normalize = FALSE;
- bo->anonymity_level =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_anonymity_spin_button")));
+ GObject *pubwindow;
+ struct edit_publication_state *state = NULL;
+
+ pubwindow = gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_window");
+ state = g_object_get_data (pubwindow, PUBSTATE);
+ if (!state)
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
+
+ if (!GNUNET_GTK_get_selected_anonymity_level (builder,
+ "GNUNET_GTK_edit_publication_anonymity_combobox", &bo->anonymity_level))
+ return GNUNET_SYSERR;
bo->content_priority =
gtk_spin_button_get_value (GTK_SPIN_BUTTON
(gtk_builder_get_object
(builder,
- "GNUNET_GTK_edit_file_information_priority_spin_button")));
+ "GNUNET_GTK_edit_publication_priority_spin_button")));
*do_index =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(gtk_builder_get_object
(builder,
- "GNUNET_GTK_edit_file_information_index_check_button")));
+ "GNUNET_GTK_edit_publication_index_checkbutton")));
+ auto_normalize = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
+ (gtk_builder_get_object
+ (builder,
+ "GNUNET_GTK_edit_publication_normalization_checkbox")));
sb = GTK_SPIN_BUTTON (gtk_builder_get_object
(builder,
- "GNUNET_GTK_edit_file_information_expiration_year_spin_button"));
+ "GNUNET_GTK_edit_publication_expiration_year_spin_button"));
bo->expiration_time = GNUNET_FS_GTK_get_expiration_time (sb);
+
+ g_free (context->root);
+ context->root =
+ g_strdup (gtk_entry_get_text (GTK_ENTRY
+ (gtk_builder_get_object
+ (builder,
+ "GNUNET_GTK_edit_publication_root_entry"))));
+
/* update URI */
if (NULL != (*uri))
GNUNET_FS_uri_destroy (*uri);
@@ -586,7 +723,7 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi,
mrg = NULL;
tm = GTK_TREE_MODEL (gtk_builder_get_object
- (builder, "GNUNET_GTK_keyword_list_store"));
+ (builder, "GNUNET_GTK_publication_keywords_liststore"));
if (TRUE == gtk_tree_model_get_iter_first (tm, &iter))
{
do
@@ -598,6 +735,24 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi,
if (NULL != *uri)
GNUNET_FS_uri_destroy (*uri);
*uri = mrg;
+ if (auto_normalize)
+ {
+ char *emsg = NULL;
+ struct GNUNET_FS_Uri *nuri;
+
+ nuri = GNUNET_FS_uri_ksk_create (value, &emsg);
+ if (nuri == NULL)
+ GNUNET_free_non_null (emsg);
+ else
+ {
+ nxt = GNUNET_FS_uri_ksk_canonicalize (nuri);
+ mrg = GNUNET_FS_uri_ksk_merge (nxt, *uri);
+ GNUNET_FS_uri_destroy (nxt);
+ if (NULL != *uri)
+ GNUNET_FS_uri_destroy (*uri);
+ *uri = mrg;
+ }
+ }
g_free (value);
}
while (TRUE == gtk_tree_model_iter_next (tm, &iter));
@@ -605,30 +760,31 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi,
/* update meta */
nm = GNUNET_CONTAINER_meta_data_create ();
- GNUNET_CONTAINER_meta_data_iterate (meta, &preserve_meta_items, nm);
+ context->md = nm;
+ GNUNET_CONTAINER_meta_data_iterate (meta, &preserve_meta_items, context);
GNUNET_CONTAINER_meta_data_clear (meta);
tm = GTK_TREE_MODEL (gtk_builder_get_object
- (builder, "GNUNET_GTK_meta_data_list_store"));
+ (builder, "GNUNET_GTK_publication_metadata_liststore"));
if (TRUE == gtk_tree_model_get_iter_first (tm, &iter))
{
do
{
gtk_tree_model_get (tm, &iter, 0, &ntype, 1, &nformat, 3, &value, -1);
- GNUNET_CONTAINER_meta_data_insert (nm, "<user>", ntype, nformat,
- "text/plain", value,
- strlen (value) + 1);
+ if (ntype >= 0)
+ GNUNET_CONTAINER_meta_data_insert (nm, "<user>", ntype, nformat,
+ "text/plain", value, strlen (value) + 1);
g_free (value);
}
while (TRUE == gtk_tree_model_iter_next (tm, &iter));
}
GNUNET_CONTAINER_meta_data_merge (meta, nm);
- if (preview_changed == GNUNET_YES)
+ if (state->preview_changed == GNUNET_YES)
{
fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER
(gtk_builder_get_object
(builder,
- "GNUNET_GTK_edit_file_information_metadata_preview_file_chooser_button")));
+ "GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button")));
f = g_file_new_for_path (fn);
finfo =
g_file_query_info (f, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, 0, NULL,
@@ -663,32 +819,190 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi,
return GNUNET_SYSERR; /* only visit top-level item */
}
+void
+GNUNET_GTK_edit_publication_cancel_button_clicked_cb (
+ GtkButton *button, gpointer user_data)
+{
+ GtkBuilder *builder;
+ GObject *pubwindow;
+ struct edit_publication_state *state = NULL;
+
+ builder = GTK_BUILDER (user_data);
+
+ pubwindow = gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_window");
+ state = g_object_get_data (pubwindow, PUBSTATE);
+ if (!state)
+ {
+ GNUNET_break (0);
+ return;
+ }
+
+ state->cb (state->cls, state->do_index, state->short_fn,
+ state->anonymity_level, state->priority, NULL, state->fip, GTK_RESPONSE_CANCEL);
+ g_free (state);
+ g_object_set_data (pubwindow, PUBSTATE, NULL);
+ gtk_widget_hide (GTK_WIDGET (pubwindow));
+}
+
+void
+GNUNET_GTK_edit_publication_confirm_button_clicked_cb (
+ GtkButton *button, gpointer user_data)
+{
+ GtkBuilder *builder;
+ GObject *pubwindow;
+ struct edit_publication_state *state = NULL;
+ struct fiu_context ctx;
+
+ builder = GTK_BUILDER (user_data);
+
+ pubwindow = gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_window");
+ state = g_object_get_data (pubwindow, PUBSTATE);
+ if (!state)
+ {
+ GNUNET_break (0);
+ return;
+ }
+
+ ctx.builder = builder;
+ ctx.short_fn = state->short_fn;
+ ctx.root = NULL;
+ ctx.md = NULL;
+
+ GNUNET_FS_file_information_inspect (state->fip, &file_information_update, &ctx);
+ if (!GNUNET_GTK_get_selected_anonymity_level (builder,
+ "GNUNET_GTK_edit_publication_anonymity_combobox", state->anonymity_level))
+ *state->priority =
+ gtk_spin_button_get_value (GTK_SPIN_BUTTON
+ (gtk_builder_get_object
+ (builder,
+ "GNUNET_GTK_edit_publication_priority_spin_button")));
+ *state->do_index =
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
+ (gtk_builder_get_object
+ (builder,
+ "GNUNET_GTK_edit_publication_index_checkbutton")));
+
+
+ state->cb (state->cls, state->do_index, state->short_fn,
+ state->anonymity_level, state->priority, ctx.root, state->fip,
+ GTK_RESPONSE_OK);
+ g_free (state);
+ g_object_set_data (pubwindow, PUBSTATE, NULL);
+ gtk_widget_hide (GTK_WIDGET (pubwindow));
+}
/**
- * Open the dialog to edit file information data.
+ * Add each of the keywords to the keyword list store.
+ *
+ * @param cls closure
+ * @param keyword the keyword
+ * @param is_mandatory is the keyword mandatory (in a search)
+ * @return GNUNET_OK to continue to iterate
*/
-void
-GNUNET_FS_GTK_edit_publish_dialog (int *do_index, char **short_fn,
- guint * anonymity_level, guint * priority,
- struct GNUNET_FS_FileInformation *fip)
+static int
+add_keyword (void *cls, const char *keyword, int is_mandatory)
{
- GtkWidget *ad;
GtkListStore *ls;
GtkTreeIter iter;
- guint type;
- guint max_type;
- GtkTreeView *tv;
- GtkTreeSelection *sel;
- GNUNET_assert (builder == NULL);
- builder =
- GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_edit_dialog.glade");
- if (builder == NULL)
+ ls = GTK_LIST_STORE (cls);
+ gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, keyword, 1, FALSE, -1);
+ return GNUNET_OK;
+}
+
+/**
+ * Function called to extract the information from FI.
+ *
+ * @param cls closure
+ * @param fi the entry in the publish-structure
+ * @param length length of the file or directory
+ * @param meta metadata for the file or directory (can be modified)
+ * @param uri pointer to the keywords that will be used for this entry (can be modified)
+ * @param bo block options
+ * @param do_index should we index (can be modified)
+ * @param client_info pointer to client context set upon creation (can be modified)
+ * @return GNUNET_SYSERR (aborts after first call)
+ */
+static int
+file_information_extract (void *cls, struct GNUNET_FS_FileInformation *fi,
+ uint64_t length,
+ struct GNUNET_CONTAINER_MetaData *meta,
+ struct GNUNET_FS_Uri **uri,
+ struct GNUNET_FS_BlockOptions *bo, int *do_index,
+ void **client_info)
+{
+ GtkBuilder *builder = GTK_BUILDER (cls);
+ GtkImage *img;
+ GdkPixbuf *pixbuf;
+ struct tm *t;
+ int year;
+ time_t tp;
+ GtkListStore *ls;
+
+ ls = GTK_LIST_STORE (gtk_builder_get_object
+ (builder, "GNUNET_GTK_publication_keywords_liststore"));
+
+ if (NULL != *uri)
+ GNUNET_FS_uri_ksk_get_keywords (*uri, &add_keyword, ls);
+ if (NULL != meta)
{
- GNUNET_break (0);
- return;
+ ls = GTK_LIST_STORE (gtk_builder_get_object (builder,
+ "GNUNET_GTK_publication_metadata_liststore"));
+ GNUNET_CONTAINER_meta_data_iterate (meta, &GNUNET_FS_GTK_add_meta_data_to_list_store, ls);
+ pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta);
+ if (pixbuf != NULL)
+ {
+ img =
+ GTK_IMAGE (gtk_builder_get_object
+ (builder,
+ "GNUNET_GTK_publication_metadata_preview_image"));
+ gtk_image_set_from_pixbuf (img, pixbuf);
+ }
}
- preview_changed = GNUNET_NO;
+ tp = bo->expiration_time.abs_value / 1000; /* ms to seconds */
+ t = gmtime (&tp);
+ if (t == NULL)
+ year = 0;
+ else
+ year = t->tm_year + 1900;
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON
+ (gtk_builder_get_object
+ (builder,
+ "GNUNET_GTK_edit_publication_expiration_year_spin_button")),
+ year);
+ GNUNET_GTK_select_anonymity_level (builder,
+ "GNUNET_GTK_edit_publication_anonymity_combobox", bo->anonymity_level);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON
+ (gtk_builder_get_object
+ (builder,
+ "GNUNET_GTK_edit_publication_priority_spin_button")),
+ bo->content_priority);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (gtk_builder_get_object
+ (builder,
+ "GNUNET_GTK_edit_publication_index_checkbutton")),
+ *do_index);
+ return GNUNET_SYSERR; /* only visit top-level item */
+}
+
+
+/**
+ * Open the dialog to edit file information data.
+ */
+void
+GNUNET_FS_GTK_edit_publish_dialog (GtkBuilder *builder, GtkWindow *parent, int *do_index,
+ char **short_fn, guint *anonymity_level, guint *priority,
+ struct GNUNET_FS_FileInformation *fip, gboolean allow_no_keywords,
+ GNUNET_FS_GTK_edit_publish_dialog_cb cb, gpointer cls)
+{
+ GtkWidget *dialog;
+ GObject *pubwindow;
+ GtkEntry *entry;
+ GtkWidget *ok;
+ struct edit_publication_state *state;
+
GNUNET_FS_GTK_setup_expiration_year_adjustment (builder);
if (GNUNET_FS_file_information_is_directory (fip))
{
@@ -696,80 +1010,60 @@ GNUNET_FS_GTK_edit_publish_dialog (int *do_index, char **short_fn,
gtk_widget_hide (GTK_WIDGET
(gtk_builder_get_object
(builder,
- "GNUNET_GTK_edit_file_information_index_check_button")));
+ "GNUNET_GTK_edit_publication_index_checkbutton")));
gtk_widget_hide (GTK_WIDGET
(gtk_builder_get_object
(builder,
- "GNUNET_GTK_edit_file_information_index_label")));
-
+ "GNUNET_GTK_edit_publication_index_label")));
}
-
- ad = GTK_WIDGET (gtk_builder_get_object
- (builder, "GNUNET_GTK_edit_file_information_dialog"));
- ls = GTK_LIST_STORE (gtk_builder_get_object
- (builder, "GNUNET_GTK_metatype_list_store"));
- max_type = EXTRACTOR_metatype_get_max ();
- type = 1;
- while (type < max_type - 1)
+ if (allow_no_keywords)
{
- gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0,
- EXTRACTOR_metatype_to_string (type), 1,
- type, 2,
- EXTRACTOR_metatype_to_description (type),
- -1);
- type++;
+ gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_root_entry")));
+ gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_root_label")));
}
+ gtk_list_store_clear (GTK_LIST_STORE (gtk_builder_get_object (
+ builder, "GNUNET_GTK_publication_keywords_liststore")));
+ gtk_list_store_clear (GTK_LIST_STORE (gtk_builder_get_object (
+ builder, "GNUNET_GTK_publication_metadata_liststore")));
+
+ GNUNET_FS_file_information_inspect (fip, &file_information_extract, builder);
+
+ dialog = GTK_WIDGET (gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_window"));
+
+ gtk_window_set_title (GTK_WINDOW (dialog), *short_fn);
+
+ state = g_new0 (struct edit_publication_state, 1);
+ state->do_index = do_index;
+ state->short_fn = short_fn;
+ state->root = NULL;
+ state->anonymity_level = anonymity_level;
+ state->priority = priority;
+ state->fip = fip;
+ state->preview_changed = GNUNET_NO;
+ state->allow_no_keywords = allow_no_keywords;
+ state->is_directory = GNUNET_FS_file_information_is_directory (fip);
+ state->cb = cb;
+ state->cls = cls;
- GNUNET_FS_file_information_inspect (fip, &file_information_extract, NULL);
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_metadata_type_tree_view"));
- sel = gtk_tree_view_get_selection (tv);
- g_signal_connect (G_OBJECT (sel), "changed",
- G_CALLBACK
- (GNUNET_GTK_edit_file_information_metadata_value_entry_changed_cb),
- NULL);
+ entry =
+ GTK_ENTRY (gtk_builder_get_object
+ (builder, "GNUNET_GTK_edit_publication_keyword_entry"));
+ gtk_entry_set_text (entry, "");
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_metadata_tree_view"));
- sel = gtk_tree_view_get_selection (tv);
- g_signal_connect (G_OBJECT (sel), "changed",
- G_CALLBACK (metadata_selection_changed_cb), NULL);
+ pubwindow = gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_window");
+ g_object_set_data (pubwindow, PUBSTATE, state);
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_keyword_list_tree_view"));
- sel = gtk_tree_view_get_selection (tv);
- g_signal_connect (G_OBJECT (sel), "changed",
- G_CALLBACK (keyword_selection_changed_cb), NULL);
- gtk_window_set_title (GTK_WINDOW (ad), *short_fn);
- if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad)))
- {
- gtk_widget_destroy (ad);
- g_object_unref (G_OBJECT (builder));
- builder = NULL;
- return;
- }
- GNUNET_FS_file_information_inspect (fip, &file_information_update, short_fn);
- *anonymity_level =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_anonymity_spin_button")));
- *priority =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_priority_spin_button")));
- *do_index =
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_edit_file_information_index_check_button")));
- gtk_widget_destroy (ad);
- g_object_unref (G_OBJECT (builder));
- builder = NULL;
+ ok = GTK_WIDGET (gtk_builder_get_object (builder,
+ "GNUNET_GTK_edit_publication_confirm_button"));
+ gtk_widget_set_sensitive (ok, allow_no_keywords ? TRUE : FALSE);
+
+ gtk_window_set_transient_for (GTK_WINDOW (pubwindow), parent);
+
+ gtk_window_present (GTK_WINDOW (dialog));
}
/* end of gnunet-fs-gtk-edit_publish_dialog.c */
diff --git a/src/fs/gnunet-fs-gtk-edit_publish_dialog.h b/src/fs/gnunet-fs-gtk-edit_publish_dialog.h
index 6363521..5473cb4 100644
--- a/src/fs/gnunet-fs-gtk-edit_publish_dialog.h
+++ b/src/fs/gnunet-fs-gtk-edit_publish_dialog.h
@@ -30,10 +30,20 @@
#include <gnunet/gnunet_fs_service.h>
+typedef void
+(*GNUNET_FS_GTK_edit_publish_dialog_cb) (gpointer cls, int *do_index, char **short_fn,
+ guint * anonymity_level, guint * priority, gchar *root,
+ struct GNUNET_FS_FileInformation *fip, gint ret);
+
+
+/**
+ * Open the dialog to edit file information data.
+ */
void
-GNUNET_FS_GTK_edit_publish_dialog (int *do_index, char **short_fn,
- guint * anonymity_level, guint * priority,
- struct GNUNET_FS_FileInformation *fip);
+GNUNET_FS_GTK_edit_publish_dialog (GtkBuilder *builder, GtkWindow *parent, int *do_index,
+ char **short_fn, guint * anonymity_level, guint * priority,
+ struct GNUNET_FS_FileInformation *fip, gboolean allow_no_keywords,
+ GNUNET_FS_GTK_edit_publish_dialog_cb cb, gpointer cls);
#endif
/* end of gnunet-fs-gtk-edit_publish_dialog.h */
diff --git a/src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c b/src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c
index bb3265e..9b76f2a 100644
--- a/src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c
+++ b/src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c
@@ -24,343 +24,7 @@
*/
#include "gnunet-fs-gtk-common.h"
#include "gnunet-fs-gtk.h"
-
-static GtkBuilder *builder;
-
-
-/**
- * Canonicalize spelling of currently selected keyword.
- */
-void
-GNUNET_GTK_advertise_pseudonym_keyword_list_normalize_button_clicked_cb ()
-{
- GtkTreeView *tv;
- GtkTreeSelection *sel;
- GtkTreeModel *tm;
- GtkTreeIter iter;
- gchar *value;
- struct GNUNET_FS_Uri *uri;
- struct GNUNET_FS_Uri *nuri;
- char *nvalue;
- char *emsg;
-
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_keyword_list_tree_view"));
- sel = gtk_tree_view_get_selection (tv);
- if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
- {
- GNUNET_break (0);
- return;
- }
- gtk_tree_model_get (tm, &iter, 0, &value, -1);
- emsg = NULL;
- uri = GNUNET_FS_uri_ksk_create (value, &emsg);
- if (uri == NULL)
- {
- GNUNET_break (0);
- GNUNET_free (emsg);
- g_free (value);
- return;
- }
- nuri = GNUNET_FS_uri_ksk_canonicalize (uri);
- nvalue = GNUNET_FS_uri_ksk_to_string_fancy (nuri);
- gtk_list_store_set (GTK_LIST_STORE (tm), &iter, 0, nvalue, -1);
- GNUNET_FS_uri_destroy (nuri);
- GNUNET_FS_uri_destroy (uri);
- GNUNET_free (nvalue);
- g_free (value);
-}
-
-
-/**
- * Remove the currently selected keyword from the list.
- */
-void
-GNUNET_GTK_advertise_pseudonym_keyword_list_del_button_clicked_cb ()
-{
- GtkTreeView *tv;
- GtkTreeSelection *sel;
- GtkTreeModel *tm;
- GtkTreeIter iter;
- GtkWidget *w;
-
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_keyword_list_tree_view"));
- sel = gtk_tree_view_get_selection (tv);
- if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
- {
- GNUNET_break (0);
- return;
- }
- gtk_list_store_remove (GTK_LIST_STORE (tm), &iter);
- if (TRUE != gtk_tree_model_get_iter_first (tm, &iter))
- {
- /* keyword list now empty, disable 'Ok' button! */
- w = GTK_WIDGET (gtk_builder_get_object (builder,
- "GNUNET_GTK_advertise_pseudonym_confirm_button"));
- gtk_widget_set_sensitive (w, FALSE);
- }
-}
-
-
-/**
- * Add keyword from entry line to keyword list.
- */
-void
-GNUNET_GTK_advertise_pseudonym_keyword_list_add_button_clicked_cb ()
-{
- const char *keyword;
- GtkEntry *entry;
- GtkListStore *ls;
- GtkTreeIter iter;
- GtkWidget *w;
-
- ls = GTK_LIST_STORE (gtk_builder_get_object
- (builder, "GNUNET_GTK_keyword_list_store"));
- entry =
- GTK_ENTRY (gtk_builder_get_object
- (builder, "GNUNET_GTK_advertise_pseudonym_keyword_entry"));
- keyword = gtk_entry_get_text (entry);
- if (strlen (keyword) > 0)
- {
- gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, keyword, -1);
- /* enable OK button */
- w = GTK_WIDGET (gtk_builder_get_object (builder, "GNUNET_GTK_advertise_pseudonym_confirm_button"));
- gtk_widget_set_sensitive (w, TRUE);
- }
- gtk_entry_set_text (entry, "");
-}
-
-
-/**
- * Update sensitivity of keyword add button.
- */
-void
-GNUNET_GTK_advertise_pseudonym_keyword_entry_changed_cb ()
-{
- const char *keyword;
- GtkEntry *entry;
- GtkWidget *button;
-
- button =
- GTK_WIDGET (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_keyword_list_add_button"));
- entry =
- GTK_ENTRY (gtk_builder_get_object
- (builder, "GNUNET_GTK_advertise_pseudonym_keyword_entry"));
- keyword = gtk_entry_get_text (entry);
- gtk_widget_set_sensitive (button, (strlen (keyword) > 0) ? TRUE : FALSE);
-}
-
-/**
- * Update sensitivity of metadata delete button.
- */
-static void
-metadata_selection_changed_cb (GtkTreeSelection * ts, gpointer user_data)
-{
- GtkTreeView *tv;
- GtkTreeSelection *sel;
- GtkWidget *button;
-
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_metadata_tree_view"));
- sel = gtk_tree_view_get_selection (tv);
- button =
- GTK_WIDGET (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_metadata_delete_button"));
- gtk_widget_set_sensitive (button,
- gtk_tree_selection_get_selected (sel, NULL, NULL));
-}
-
-
-/**
- * Update sensitivity of keyword delete and normalize button.
- */
-static void
-keyword_selection_changed_cb (GtkTreeSelection * ts, gpointer user_data)
-{
- GtkTreeView *tv;
- GtkTreeSelection *sel;
- GtkWidget *button;
-
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_keyword_list_tree_view"));
- sel = gtk_tree_view_get_selection (tv);
- button =
- GTK_WIDGET (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_keyword_list_del_button"));
-
- gtk_widget_set_sensitive (button,
- gtk_tree_selection_get_selected (sel, NULL, NULL));
- button =
- GTK_WIDGET (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_keyword_list_normalize_button"));
- gtk_widget_set_sensitive (button,
- gtk_tree_selection_get_selected (sel, NULL, NULL));
-}
-
-
-/**
- * Update sensitivity of metadata add button.
- */
-void
-GNUNET_GTK_advertise_pseudonym_metadata_value_entry_changed_cb ()
-{
- GtkTreeView *tv;
- GtkTreeSelection *sel;
- const char *value;
- GtkEntry *entry;
- GtkWidget *button;
-
- entry =
- GTK_ENTRY (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_metadata_value_entry"));
- value = gtk_entry_get_text (entry);
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_metadata_type_tree_view"));
- sel = gtk_tree_view_get_selection (tv);
- button =
- GTK_WIDGET (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_metadata_add_button"));
- gtk_widget_set_sensitive (button,
- (strlen (value) >
- 0) ? gtk_tree_selection_get_selected (sel, NULL,
- NULL) :
- FALSE);
-}
-
-
-/**
- * Add keyword to keyword list.
- */
-void
-GNUNET_GTK_advertise_pseudonym_keyword_entry_activate_cb ()
-{
- GNUNET_GTK_advertise_pseudonym_keyword_list_add_button_clicked_cb ();
-}
-
-
-void
-GNUNET_GTK_advertise_pseudonym_metadata_preview_file_chooser_button_file_set_cb
- ()
-{
- GNUNET_break (0);
-}
-
-/**
- * Delete currently selected item from meta data list.
- */
-void
-GNUNET_GTK_advertise_pseudonym_metadata_delete_button_clicked_cb ()
-{
- GtkTreeView *tv;
- GtkTreeSelection *sel;
- GtkTreeModel *tm;
- GtkTreeIter iter;
-
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_metadata_tree_view"));
- sel = gtk_tree_view_get_selection (tv);
- if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
- {
- GNUNET_break (0);
- return;
- }
- gtk_list_store_remove (GTK_LIST_STORE (tm), &iter);
-}
-
-
-/**
- * Add metadata to metadata list.
- */
-void
-GNUNET_GTK_advertise_pseudonym_metadata_add_button_clicked_cb ()
-{
- const char *value;
- char *avalue;
- const char *ivalue;
- GtkEntry *entry;
- GtkListStore *ls;
- GtkTreeModel *tm;
- GtkTreeView *tv;
- GtkTreeSelection *sel;
- GtkTreeIter iter;
- guint type;
- size_t slen;
- char *pos;
-
- entry =
- GTK_ENTRY (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_metadata_value_entry"));
- value = gtk_entry_get_text (entry);
- if ((value == NULL) || (strlen (value) == 0))
- {
- GNUNET_break (0);
- return;
- }
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_metadata_type_tree_view"));
- tm = gtk_tree_view_get_model (tv);
- sel = gtk_tree_view_get_selection (tv);
- if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
- {
- GNUNET_break (0);
- return;
- }
- gtk_tree_model_get (tm, &iter, 1, &type, -1);
- ls = GTK_LIST_STORE (gtk_builder_get_object
- (builder, "GNUNET_GTK_meta_data_list_store"));
- if ((type == EXTRACTOR_METATYPE_FILENAME) &&
- (value[strlen (value) - 1] != '/'))
- {
- GNUNET_asprintf (&avalue, "%s/", value);
- /* if user typed '\' instead of '/', change it! */
- slen = strlen (avalue);
- while ((slen > 1) && (avalue[slen - 2] == '\\'))
- {
- avalue[slen - 2] = '/';
- avalue[slen - 1] = '\0';
- slen--;
- }
- while (NULL != (pos = strstr (avalue, "\\")))
- *pos = '/';
- /* remove '../' everywhere */
- while (NULL != (pos = strstr (avalue, "../")))
- {
- pos[0] = '_';
- pos[1] = '_';
- pos[2] = '_';
- }
- ivalue = avalue;
- }
- else
- {
- ivalue = value;
- avalue = NULL;
- }
-
- gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, type, 1,
- (guint) EXTRACTOR_METAFORMAT_UTF8, 2,
- EXTRACTOR_metatype_to_string (type), 3,
- ivalue, -1);
- GNUNET_free_non_null (avalue);
- gtk_entry_set_text (GTK_ENTRY (entry), "");
-}
-
+#include "gnunet-fs-gtk-edit_publish_dialog.h"
/**
* Callback with information about local (!) namespaces.
@@ -390,6 +54,8 @@ selection_changed_cb (GtkTreeSelection * ts, gpointer user_data)
{
GtkTreeIter iter;
GtkWidget *ok_button;
+ GtkBuilder *builder;
+ builder = GTK_BUILDER (user_data);
ok_button =
GTK_WIDGET (gtk_builder_get_object
@@ -400,60 +66,100 @@ selection_changed_cb (GtkTreeSelection * ts, gpointer user_data)
gtk_widget_set_sensitive (ok_button, FALSE);
}
+struct namespace_data_struct
+{
+ struct GNUNET_FS_Namespace *ns;
+ int do_index;
+ char *short_fn;
+ guint anonymity_level;
+ guint priority;
+ gchar *root;
+};
/**
- * Advertise pseudonym selected.
+ * Function called on entries in a GNUNET_FS_FileInformation publish-structure.
+ *
+ * @param cls closure
+ * @param fi the entry in the publish-structure
+ * @param length length of the file or directory
+ * @param meta metadata for the file or directory (can be modified)
+ * @param uri pointer to the keywords that will be used for this entry (can be modified)
+ * @param bo block options (can be modified)
+ * @param do_index should we index (can be modified)
+ * @param client_info pointer to client context set upon creation (can be modified)
+ * @return GNUNET_OK to continue, GNUNET_NO to remove
+ * this entry from the directory, GNUNET_SYSERR
+ * to abort the iteration
*/
+int
+advertise_namespace (void *cls, struct GNUNET_FS_FileInformation *fi,
+ uint64_t length, struct GNUNET_CONTAINER_MetaData *meta,
+ struct GNUNET_FS_Uri **uri, struct GNUNET_FS_BlockOptions *bo,
+ int *do_index, void **client_info)
+{
+ struct namespace_data_struct *nds;
+ nds = (struct namespace_data_struct *) cls;
+ GNUNET_FS_namespace_advertise (GNUNET_FS_GTK_get_fs_handle (), *uri,
+ nds->ns, meta, bo, nds->root, NULL, NULL);
+ return GNUNET_SYSERR;
+}
+
void
-GNUNET_GTK_main_menu_file_advertise_pseudonym_activate_cb (GtkWidget * dummy,
- gpointer data)
+adv_pseudonym_edit_publish_dialog_cb (gpointer cls, int *do_index, char **short_fn,
+ guint * anonymity_level, guint * priority, gchar *root,
+ struct GNUNET_FS_FileInformation *fip, gint ret)
+{
+ struct namespace_data_struct *nds;
+ nds = (struct namespace_data_struct *) cls;
+
+ if (ret == GTK_RESPONSE_OK)
+ {
+ nds->do_index = *do_index;
+ nds->short_fn = *short_fn;
+ nds->anonymity_level = *anonymity_level;
+ nds->priority = *priority;
+ nds->root = root;
+ GNUNET_FS_file_information_inspect (fip,
+ advertise_namespace, nds);
+ }
+ g_free (nds->root);
+ GNUNET_FS_namespace_delete (nds->ns, GNUNET_NO);
+ g_free (nds);
+ GNUNET_FS_file_information_destroy (fip, NULL, NULL);
+}
+
+void
+GNUNET_GTK_select_pseudonym_dialog_response_cb (GtkDialog *dialog,
+ gint response_id, gpointer user_data)
{
+ GtkBuilder *builder;
GtkWidget *ad;
- struct GNUNET_FS_Namespace *ns;
- struct GNUNET_FS_Namespace *nso;
- GtkListStore *ls;
GtkTreeView *tv;
- GtkTreeIter iter;
GtkTreeSelection *sel;
GtkTreeModel *tm;
- GtkSpinButton *sb;
+ GtkTreeIter iter;
+ struct GNUNET_FS_Namespace *ns;
+ struct GNUNET_FS_Namespace *nso;
+ GtkWindow *transient;
+ struct namespace_data_struct *nds;
+ struct GNUNET_FS_FileInformation *fip;
+ struct GNUNET_CONTAINER_MetaData *meta;
+ builder = GTK_BUILDER (user_data);
struct GNUNET_FS_BlockOptions bo;
- struct GNUNET_FS_Uri *nxt;
- struct GNUNET_FS_Uri *mrg;
- struct GNUNET_FS_Uri *uri;
- struct GNUNET_CONTAINER_MetaData *nm;
- const char *root;
- char *value;
- guint ntype;
- guint nformat;
- guint type;
- guint max_type;
- builder =
- GNUNET_GTK_get_new_builder
- ("gnunet_fs_gtk_select_pseudonym_dialog.glade");
- if (builder == NULL)
- {
- GNUNET_break (0);
- return;
- }
ad = GTK_WIDGET (gtk_builder_get_object
(builder, "GNUNET_GTK_select_pseudonym_dialog"));
- ls = GTK_LIST_STORE (gtk_builder_get_object
- (builder, "GNUNET_GTK_select_pseudonym_liststore"));
- GNUNET_FS_namespace_list (GNUNET_FS_GTK_get_fs_handle (), &add_to_list, ls);
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder, "GNUNET_GTK_select_pseudonym_tree_view"));
- sel = gtk_tree_view_get_selection (tv);
- g_signal_connect (G_OBJECT (sel), "changed",
- G_CALLBACK (selection_changed_cb), NULL);
- if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad)))
+
+ if (response_id != -5)
{
- gtk_widget_destroy (ad);
- g_object_unref (G_OBJECT (builder));
- builder = NULL;
+ gtk_widget_hide (ad);
return;
}
+ tv = GTK_TREE_VIEW (gtk_builder_get_object
+ (builder,
+ "GNUNET_GTK_select_pseudonym_tree_view"));
+ sel = gtk_tree_view_get_selection (tv);
+
GNUNET_assert (TRUE == gtk_tree_selection_get_selected (sel, &tm, &iter));
gtk_tree_model_get (tm, &iter, 1, &ns, -1);
/* free all namespaces from list store except "ns" */
@@ -467,129 +173,72 @@ GNUNET_GTK_main_menu_file_advertise_pseudonym_activate_cb (GtkWidget * dummy,
}
while (TRUE == gtk_tree_model_iter_next (tm, &iter));
}
- gtk_widget_destroy (ad);
- g_object_unref (G_OBJECT (builder));
- builder = NULL;
+ transient = gtk_window_get_transient_for (GTK_WINDOW (ad));
+ gtk_widget_hide (ad);
+
+ meta = GNUNET_CONTAINER_meta_data_create ();
+
+ nds = g_new0 (struct namespace_data_struct, 1);
+ nds->ns = ns;
+ nds->do_index = FALSE;
+ nds->short_fn = NULL;
+ nds->anonymity_level = 1;
+ nds->priority = 1000;
+ nds->root = NULL;
+ /* This is a bogus fileinfo. It's needed because edit_publish_dialog
+ * was written to work with fileinfo, and return a fileinfo.
+ */
+ memset (&bo, 0, sizeof (bo));
+ fip = GNUNET_FS_file_information_create_empty_directory (NULL, NULL,
+ NULL, meta, &bo);
+ GNUNET_CONTAINER_meta_data_destroy (meta);
+
+ GNUNET_FS_GTK_edit_publish_dialog (builder, transient, &nds->do_index,
+ &nds->short_fn, &nds->anonymity_level, &nds->priority,
+ fip, FALSE, &adv_pseudonym_edit_publish_dialog_cb, nds);
+}
+void
+GNUNET_GTK_select_pseudonym_dialog_realize_cb (GtkWidget *widget,
+ gpointer user_data)
+{
+ GtkTreeView *tv;
+ GtkTreeSelection *sel;
+ GtkBuilder *builder;
- builder =
- GNUNET_GTK_get_new_builder
- ("gnunet_fs_gtk_advertise_pseudonym_dialog.glade");
- if (builder == NULL)
- {
- GNUNET_break (0);
- return;
- }
- GNUNET_FS_GTK_setup_expiration_year_adjustment (builder);
- ad = GTK_WIDGET (gtk_builder_get_object
- (builder, "GNUNET_GTK_advertise_pseudonym_dialog"));
- ls = GTK_LIST_STORE (gtk_builder_get_object
- (builder, "GNUNET_GTK_metatype_list_store"));
- max_type = EXTRACTOR_metatype_get_max ();
- type = 1;
- while (type < max_type - 1)
- {
- gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0,
- EXTRACTOR_metatype_to_string (type), 1,
- type, 2,
- EXTRACTOR_metatype_to_description (type),
- -1);
- type++;
- }
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_metadata_type_tree_view"));
- sel = gtk_tree_view_get_selection (tv);
- g_signal_connect (G_OBJECT (sel), "changed",
- G_CALLBACK
- (GNUNET_GTK_advertise_pseudonym_metadata_value_entry_changed_cb),
- NULL);
+ builder = GTK_BUILDER (user_data);
tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_metadata_tree_view"));
+ (builder, "GNUNET_GTK_select_pseudonym_tree_view"));
sel = gtk_tree_view_get_selection (tv);
g_signal_connect (G_OBJECT (sel), "changed",
- G_CALLBACK (metadata_selection_changed_cb), NULL);
+ G_CALLBACK (selection_changed_cb), user_data);
+}
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_keyword_list_tree_view"));
- sel = gtk_tree_view_get_selection (tv);
- g_signal_connect (G_OBJECT (sel), "changed",
- G_CALLBACK (keyword_selection_changed_cb), NULL);
- if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad)))
- {
- gtk_widget_destroy (ad);
- g_object_unref (G_OBJECT (builder));
- builder = NULL;
- return;
- }
- /* get keywords from list store */
- nxt = NULL;
- mrg = NULL;
- uri = NULL;
- tm = GTK_TREE_MODEL (gtk_builder_get_object
- (builder, "GNUNET_GTK_keyword_list_store"));
- if (TRUE == gtk_tree_model_get_iter_first (tm, &iter))
- {
- do
- {
- gtk_tree_model_get (tm, &iter, 0, &value, -1);
- nxt = GNUNET_FS_uri_ksk_create_from_args (1, (const char **) &value);
- mrg = GNUNET_FS_uri_ksk_merge (nxt, uri);
- GNUNET_FS_uri_destroy (nxt);
- if (NULL != uri)
- GNUNET_FS_uri_destroy (uri);
- uri = mrg;
- g_free (value);
- }
- while (TRUE == gtk_tree_model_iter_next (tm, &iter));
- }
- /* get meta */
- nm = GNUNET_CONTAINER_meta_data_create ();
- tm = GTK_TREE_MODEL (gtk_builder_get_object
- (builder, "GNUNET_GTK_meta_data_list_store"));
- if (TRUE == gtk_tree_model_get_iter_first (tm, &iter))
- {
- do
- {
- gtk_tree_model_get (tm, &iter, 0, &ntype, 1, &nformat, 3, &value, -1);
- GNUNET_CONTAINER_meta_data_insert (nm, "<user>", ntype, nformat,
- "text/plain", value,
- strlen (value) + 1);
- g_free (value);
- }
- while (TRUE == gtk_tree_model_iter_next (tm, &iter));
- }
- bo.anonymity_level =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_anonymity_spin_button")));
- bo.content_priority =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_priority_spin_button")));
- sb = GTK_SPIN_BUTTON (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_expiration_year_spin_button"));
- bo.expiration_time = GNUNET_FS_GTK_get_expiration_time (sb);
- root =
- gtk_entry_get_text (GTK_ENTRY
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_advertise_pseudonym_root_entry")));
- GNUNET_FS_namespace_advertise (GNUNET_FS_GTK_get_fs_handle (), uri, ns, nm,
- &bo, root, NULL, NULL);
- GNUNET_FS_namespace_delete (ns, GNUNET_NO);
- GNUNET_CONTAINER_meta_data_destroy (nm);
- if (NULL != uri)
- GNUNET_FS_uri_destroy (uri);
- gtk_widget_destroy (ad);
- g_object_unref (G_OBJECT (builder));
- builder = NULL;
+/**
+ * Advertise pseudonym selected.
+ */
+void
+GNUNET_GTK_main_menu_file_advertise_pseudonym_activate_cb (GtkWidget * dummy,
+ gpointer data)
+{
+ GtkWidget *ad;
+ GtkListStore *ls;
+ GtkWidget *toplevel;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (data);
+
+ ad = GTK_WIDGET (gtk_builder_get_object
+ (builder, "GNUNET_GTK_select_pseudonym_dialog"));
+ ls = GTK_LIST_STORE (gtk_builder_get_object
+ (builder, "GNUNET_GTK_select_pseudonym_liststore"));
+ gtk_list_store_clear (ls);
+ GNUNET_FS_namespace_list (GNUNET_FS_GTK_get_fs_handle (), &add_to_list, ls);
+ toplevel = gtk_widget_get_toplevel (dummy);
+ if (GTK_IS_WINDOW (toplevel))
+ gtk_window_set_transient_for (GTK_WINDOW (ad), GTK_WINDOW (toplevel));
+ gtk_window_present (GTK_WINDOW (ad));
}
diff --git a/src/fs/gnunet-fs-gtk-main_window_create_pseudonym.c b/src/fs/gnunet-fs-gtk-main_window_create_pseudonym.c
index 05094a1..e0a8b0e 100644
--- a/src/fs/gnunet-fs-gtk-main_window_create_pseudonym.c
+++ b/src/fs/gnunet-fs-gtk-main_window_create_pseudonym.c
@@ -26,28 +26,20 @@
#include "gnunet-fs-gtk-common.h"
#include "gnunet-fs-gtk.h"
-/**
- */
void
-GNUNET_GTK_main_menu_create_pseudonym_activate_cb (GtkWidget * dummy,
- gpointer data)
+GNUNET_GTK_create_namespace_dialog_response_cb (GtkDialog *dialog,
+ gint response_id, gpointer user_data)
{
- GtkWidget *ad;
- GtkBuilder *builder;
const char *name;
struct GNUNET_FS_Namespace *ns;
+ GtkWidget *ad;
+ GtkBuilder *builder;
- builder =
- GNUNET_GTK_get_new_builder
- ("gnunet_fs_gtk_create_namespace_dialog.glade");
- if (builder == NULL)
- {
- GNUNET_break (0);
- return;
- }
+ builder = GTK_BUILDER (user_data);
ad = GTK_WIDGET (gtk_builder_get_object
(builder, "GNUNET_GTK_create_namespace_dialog"));
- if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad)))
+
+ if (response_id != -5)
{
gtk_widget_destroy (ad);
g_object_unref (G_OBJECT (builder));
@@ -65,5 +57,32 @@ GNUNET_GTK_main_menu_create_pseudonym_activate_cb (GtkWidget * dummy,
g_object_unref (G_OBJECT (builder));
}
+/**
+ */
+void
+GNUNET_GTK_main_menu_create_pseudonym_activate_cb (GtkWidget * dummy,
+ gpointer data)
+{
+ GtkWidget *ad;
+ GtkWidget *toplevel;
+ GtkBuilder *builder;
+
+ builder =
+ GNUNET_GTK_get_new_builder
+ ("gnunet_fs_gtk_create_namespace_dialog.glade");
+ if (builder == NULL)
+ {
+ GNUNET_break (0);
+ return;
+ }
+ ad = GTK_WIDGET (gtk_builder_get_object
+ (builder, "GNUNET_GTK_create_namespace_dialog"));
+
+ toplevel = gtk_widget_get_toplevel (dummy);
+ if (GTK_IS_WINDOW (toplevel))
+ gtk_window_set_transient_for (GTK_WINDOW (ad), GTK_WINDOW (toplevel));
+ gtk_window_present (GTK_WINDOW (ad));
+}
+
/* end of gnunet-fs-gtk-main_window_create_pseudonym.c */
diff --git a/src/fs/gnunet-fs-gtk-main_window_file_publish.c b/src/fs/gnunet-fs-gtk-main_window_file_publish.c
index c4ad511..7291504 100644
--- a/src/fs/gnunet-fs-gtk-main_window_file_publish.c
+++ b/src/fs/gnunet-fs-gtk-main_window_file_publish.c
@@ -26,16 +26,11 @@
#include "gnunet-fs-gtk.h"
#include "gnunet-fs-gtk-edit_publish_dialog.h"
#include <gnunet/gnunet_util_lib.h>
+#include <gnunet/gnunet_fs_service.h>
#define MARKER_DIR_FILE_SIZE "-"
/**
- * Builder used for the master publish dialog.
- */
-static GtkBuilder *master_builder;
-
-
-/**
* Check if two GtkTreeIters refer to the same element.
*
* @param tm tree model of the iterators
@@ -63,7 +58,7 @@ gtk_tree_iter_equals (GtkTreeModel * tm, GtkTreeIter * i1, GtkTreeIter * i2)
* Update selectivity in the master dialog.
*/
static void
-update_selectivity ()
+update_selectivity (gpointer data)
{
GtkTreeView *tv;
GtkTreeModel *tm;
@@ -83,12 +78,15 @@ update_selectivity ()
struct GNUNET_FS_FileInformation *fip;
int ns_ok;
gchar *namespace_id;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (data);
tm = GTK_TREE_MODEL (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_file_sharing_publishing_tree_store"));
tv = GTK_TREE_VIEW (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_pseudonym_tree_view"));
sel = gtk_tree_view_get_selection (tv);
ns_ok = GNUNET_YES;
@@ -102,34 +100,34 @@ update_selectivity ()
}
up_button =
GTK_WIDGET (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_up_button"));
down_button =
GTK_WIDGET (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_down_button"));
left_button =
GTK_WIDGET (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_left_button"));
right_button =
GTK_WIDGET (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_right_button"));
delete_button =
GTK_WIDGET (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_delete_button"));
edit_button =
GTK_WIDGET (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_edit_button"));
execute_button =
GTK_WIDGET (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_execute_button"));
tv = GTK_TREE_VIEW (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
sel = gtk_tree_view_get_selection (tv);
tm = gtk_tree_view_get_model (tv);
@@ -208,7 +206,7 @@ update_selectivity ()
* @param iter parent entry, or NULL for top-level addition
*/
static void
-add_file_at_iter (const char *filename, const struct GNUNET_FS_BlockOptions *bo,
+add_file_at_iter (gpointer data, const char *filename, const struct GNUNET_FS_BlockOptions *bo,
int do_index, GtkTreeIter * iter)
{
struct GNUNET_FS_FileInformation *fi;
@@ -223,6 +221,9 @@ add_file_at_iter (const char *filename, const struct GNUNET_FS_BlockOptions *bo,
char *file_size_fancy;
const char *ss;
struct stat sbuf;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (data);
if (0 != STAT (filename, &sbuf))
return;
@@ -239,7 +240,7 @@ add_file_at_iter (const char *filename, const struct GNUNET_FS_BlockOptions *bo,
}
}
ts = GTK_TREE_STORE (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_file_sharing_publishing_tree_store"));
meta = GNUNET_CONTAINER_meta_data_create ();
@@ -273,7 +274,7 @@ add_file_at_iter (const char *filename, const struct GNUNET_FS_BlockOptions *bo,
short_fn, 3, (guint) bo->anonymity_level, 4,
(guint) bo->content_priority, 5, fi, -1);
GNUNET_free (file_size_fancy);
- update_selectivity ();
+ update_selectivity (data);
}
@@ -287,7 +288,7 @@ add_file_at_iter (const char *filename, const struct GNUNET_FS_BlockOptions *bo,
* @param pos iterator to set to the location of the new element
*/
static void
-create_dir_at_iter (const char *name, const struct GNUNET_FS_BlockOptions *bo,
+create_dir_at_iter (gpointer data, const char *name, const struct GNUNET_FS_BlockOptions *bo,
GtkTreeIter * iter, GtkTreeIter * pos)
{
struct GNUNET_FS_FileInformation *fi;
@@ -295,9 +296,12 @@ create_dir_at_iter (const char *name, const struct GNUNET_FS_BlockOptions *bo,
GtkTreePath *path;
struct GNUNET_CONTAINER_MetaData *meta;
GtkTreeStore *ts;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (data);
ts = GTK_TREE_STORE (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_file_sharing_publishing_tree_store"));
meta = GNUNET_CONTAINER_meta_data_create ();
GNUNET_FS_meta_data_make_directory (meta);
@@ -315,7 +319,7 @@ create_dir_at_iter (const char *name, const struct GNUNET_FS_BlockOptions *bo,
gtk_tree_store_set (ts, pos, 0, MARKER_DIR_FILE_SIZE, 1, (gboolean) GNUNET_NO,
2, name, 3, (guint) bo->anonymity_level, 4,
(guint) bo->content_priority, 5, fi, -1);
- update_selectivity ();
+ update_selectivity (data);
}
@@ -797,11 +801,14 @@ scan_directory (void *cls, const char *filename)
* @param do_index should we index?
*/
static void
-add_dir (const char *filename, const struct GNUNET_FS_BlockOptions *bo,
+add_dir (gpointer data, const char *filename, const struct GNUNET_FS_BlockOptions *bo,
int do_index)
{
struct stat sbuf;
struct AddDirContext scan_ctx;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (data);
if (0 != STAT (filename, &sbuf))
return;
@@ -815,7 +822,7 @@ add_dir (const char *filename, const struct GNUNET_FS_BlockOptions *bo,
scan_ctx.do_index = do_index;
scan_ctx.ts =
GTK_TREE_STORE (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_file_sharing_publishing_tree_store"));
scan_directory (&scan_ctx, filename);
}
@@ -827,7 +834,7 @@ add_dir (const char *filename, const struct GNUNET_FS_BlockOptions *bo,
static void
selection_changed_cb (GtkTreeSelection * ts, gpointer user_data)
{
- update_selectivity ();
+ update_selectivity (user_data);
}
@@ -847,7 +854,7 @@ remove_old_entry (GtkTreeStore * ts, GtkTreeIter * root)
* Move an entry in the tree.
*/
static void
-move_entry (GtkTreeModel * tm, GtkTreeIter * old, GtkTreeIter * newpos,
+move_entry (gpointer data, GtkTreeModel * tm, GtkTreeIter * old, GtkTreeIter * newpos,
int dsel)
{
struct GNUNET_FS_FileInformation *fip;
@@ -863,6 +870,9 @@ move_entry (GtkTreeModel * tm, GtkTreeIter * old, GtkTreeIter * newpos,
GtkTreeIter cnewpos;
GtkTreeRowReference *rr;
GtkTreeRowReference *rr2;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (data);
gtk_tree_model_get (tm, old, 0, &fsf, 1, &do_index, 2, &short_fn, 3,
&anonymity_level, 4, &priority, 5, &fip, -1);
@@ -874,7 +884,7 @@ move_entry (GtkTreeModel * tm, GtkTreeIter * old, GtkTreeIter * newpos,
if (dsel == GNUNET_YES)
{
tv = GTK_TREE_VIEW (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
sel = gtk_tree_view_get_selection (tv);
path = gtk_tree_model_get_path (tm, newpos);
@@ -894,7 +904,7 @@ move_entry (GtkTreeModel * tm, GtkTreeIter * old, GtkTreeIter * newpos,
gtk_tree_path_free (path);
gtk_tree_store_insert_before (GTK_TREE_STORE (tm), &cnewpos, newpos,
NULL);
- move_entry (tm, &child, &cnewpos, GNUNET_NO);
+ move_entry (data, tm, &child, &cnewpos, GNUNET_NO);
path = gtk_tree_row_reference_get_path (rr2);
gtk_tree_row_reference_free (rr2);
GNUNET_assert (TRUE == gtk_tree_model_get_iter (tm, &child, path));
@@ -913,7 +923,7 @@ move_entry (GtkTreeModel * tm, GtkTreeIter * old, GtkTreeIter * newpos,
gtk_tree_path_free (path);
gtk_tree_selection_select_iter (sel, newpos);
}
- update_selectivity ();
+ update_selectivity (data);
}
/**
@@ -926,9 +936,12 @@ void GNUNET_GTK_master_publish_dialog_pseudonym_updates_renderer_edited_cb
{
GtkTreeIter iter;
GtkTreeStore *ts;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (user_data);
ts = GTK_TREE_STORE (gtk_builder_get_object
- (master_builder, "GNUNET_GTK_pseudonym_tree_store"));
+ (builder, "GNUNET_GTK_pseudonym_tree_store"));
if (TRUE !=
gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ts), &iter, cpath))
@@ -937,7 +950,7 @@ void GNUNET_GTK_master_publish_dialog_pseudonym_updates_renderer_edited_cb
return;
}
gtk_tree_store_set (ts, &iter, 5, new_text, -1);
- update_selectivity ();
+ update_selectivity (user_data);
}
@@ -951,9 +964,12 @@ void GNUNET_GTK_master_publish_dialog_pseudonym_identifier_renderer_edited_cb
{
GtkTreeIter iter;
GtkTreeStore *ts;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (user_data);
ts = GTK_TREE_STORE (gtk_builder_get_object
- (master_builder, "GNUNET_GTK_pseudonym_tree_store"));
+ (builder, "GNUNET_GTK_pseudonym_tree_store"));
if (TRUE !=
gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ts), &iter, cpath))
@@ -962,7 +978,7 @@ void GNUNET_GTK_master_publish_dialog_pseudonym_identifier_renderer_edited_cb
return;
}
gtk_tree_store_set (ts, &iter, 2, new_text, -1);
- update_selectivity ();
+ update_selectivity (user_data);
}
@@ -978,9 +994,12 @@ GNUNET_GTK_master_publish_dialog_right_button_clicked_cb (GtkWidget * dummy,
GtkTreeIter pred;
GtkTreeIter prev;
GtkTreeIter pos;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (data);
tv = GTK_TREE_VIEW (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
sel = gtk_tree_view_get_selection (tv);
if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
@@ -1010,7 +1029,7 @@ GNUNET_GTK_master_publish_dialog_right_button_clicked_cb (GtkWidget * dummy,
GNUNET_break (0);
return;
}
- move_entry (tm, &iter, &pos, GNUNET_YES);
+ move_entry (data, tm, &iter, &pos, GNUNET_YES);
remove_old_entry (GTK_TREE_STORE (tm), &iter);
}
@@ -1025,9 +1044,12 @@ GNUNET_GTK_master_publish_dialog_left_button_clicked_cb (GtkWidget * dummy,
GtkTreeIter iter;
GtkTreeIter parent;
GtkTreeIter pos;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (data);
tv = GTK_TREE_VIEW (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
sel = gtk_tree_view_get_selection (tv);
if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
@@ -1046,7 +1068,7 @@ GNUNET_GTK_master_publish_dialog_left_button_clicked_cb (GtkWidget * dummy,
GNUNET_break (0);
return;
}
- move_entry (tm, &iter, &pos, GNUNET_YES);
+ move_entry (data, tm, &iter, &pos, GNUNET_YES);
remove_old_entry (GTK_TREE_STORE (tm), &iter);
}
@@ -1064,9 +1086,12 @@ GNUNET_GTK_master_publish_dialog_up_button_clicked_cb (GtkWidget * dummy,
GtkTreeIter prev;
GtkTreeIter *pprev;
GtkTreeIter pos;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (data);
tv = GTK_TREE_VIEW (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
sel = gtk_tree_view_get_selection (tv);
if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
@@ -1101,7 +1126,7 @@ GNUNET_GTK_master_publish_dialog_up_button_clicked_cb (GtkWidget * dummy,
GNUNET_break (0);
return;
}
- move_entry (tm, &iter, &pos, GNUNET_YES);
+ move_entry (data, tm, &iter, &pos, GNUNET_YES);
remove_old_entry (GTK_TREE_STORE (tm), &iter);
}
@@ -1116,9 +1141,12 @@ GNUNET_GTK_master_publish_dialog_down_button_clicked_cb (GtkWidget * dummy,
GtkTreeIter iter;
GtkTreeIter next;
GtkTreeIter pos;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (data);
tv = GTK_TREE_VIEW (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
sel = gtk_tree_view_get_selection (tv);
if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
@@ -1138,7 +1166,7 @@ GNUNET_GTK_master_publish_dialog_down_button_clicked_cb (GtkWidget * dummy,
GNUNET_break (0);
return;
}
- move_entry (tm, &iter, &pos, GNUNET_YES);
+ move_entry (data, tm, &iter, &pos, GNUNET_YES);
remove_old_entry (GTK_TREE_STORE (tm), &iter);
}
@@ -1152,9 +1180,12 @@ GNUNET_GTK_master_publish_dialog_new_button_clicked_cb (GtkWidget * dummy,
GtkTreeIter iter;
GtkTreeIter pos;
struct GNUNET_FS_BlockOptions bo;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (data);
tv = GTK_TREE_VIEW (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
sel = gtk_tree_view_get_selection (tv);
/* FIXME: consider opening a dialog to get
@@ -1169,10 +1200,10 @@ GNUNET_GTK_master_publish_dialog_new_button_clicked_cb (GtkWidget * dummy,
bo.replication_level = 1;
if (TRUE != gtk_tree_selection_get_selected (sel, NULL, &iter))
{
- create_dir_at_iter ("unnamed/", &bo, NULL, &pos);
+ create_dir_at_iter (data, "unnamed/", &bo, NULL, &pos);
return;
}
- create_dir_at_iter ("unnamed/", &bo, &iter, &pos);
+ create_dir_at_iter (data, "unnamed/", &bo, &iter, &pos);
}
@@ -1182,55 +1213,49 @@ GNUNET_GTK_master_publish_dialog_add_button_clicked_cb (GtkWidget * dummy,
{
GtkWidget *ad;
GtkBuilder *builder;
- char *filename;
- struct GNUNET_FS_BlockOptions bo;
- int do_index;
- GtkSpinButton *sb;
+ GtkWindow *master_pubdialog;
+
+ builder = GTK_BUILDER (data);
- builder =
- GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_file_dialog.glade");
- if (builder == NULL)
- {
- GNUNET_break (0);
- return;
- }
ad = GTK_WIDGET (gtk_builder_get_object
(builder, "GNUNET_GTK_publish_file_dialog"));
GNUNET_FS_GTK_setup_expiration_year_adjustment (builder);
- if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad)))
- {
- gtk_widget_destroy (ad);
- g_object_unref (G_OBJECT (builder));
- return;
- }
- filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (ad));
- sb = GTK_SPIN_BUTTON (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_publish_file_dialog_expiration_year_spin_button"));
- bo.anonymity_level =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_publish_file_dialog_anonymity_spin_button")));
- bo.content_priority =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_publish_file_dialog_priority_spin_button")));
- bo.expiration_time = GNUNET_FS_GTK_get_expiration_time (sb);
- bo.replication_level = 1; /* FIXME... */
- do_index =
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_publish_file_dialog_do_index_checkbutton")));
- add_file_at_iter (filename, &bo, do_index, NULL);
- gtk_widget_destroy (ad);
- g_object_unref (G_OBJECT (builder));
- g_free (filename);
- update_selectivity ();
+
+ master_pubdialog = GTK_WINDOW (gtk_builder_get_object (builder,
+ "GNUNET_GTK_master_publish_dialog"));
+ gtk_window_set_transient_for (GTK_WINDOW (ad), master_pubdialog);
+
+ gtk_window_present (GTK_WINDOW (ad));
}
+struct edit_pub_cb_args
+{
+ GtkTreeModel *tm;
+ GtkTreeIter iter;
+ /* FIXME: this indirection madness is not really required any longer.
+ * we only need to pass over *tm and iter, everything else can be
+ * copied.
+ */
+ gchar *short_fn;
+ struct GNUNET_FS_FileInformation *fip;
+ int do_index;
+ guint anonymity_level;
+ guint priority;
+};
+
+void
+master_publish_edit_publish_dialog_cb (gpointer cls, int *do_index, char **short_fn,
+ guint * anonymity_level, guint * priority, gchar *root,
+ struct GNUNET_FS_FileInformation *fip, gint ret)
+{
+ struct edit_pub_cb_args *cbargs = (struct edit_pub_cb_args *) cls;
+ if (ret == GTK_RESPONSE_OK)
+ gtk_tree_store_set (GTK_TREE_STORE (cbargs->tm), &cbargs->iter,
+ 1, *do_index, 2, *short_fn, 3, *anonymity_level, 4, *priority, -1);
+ g_free (root);
+ g_free (short_fn);
+ g_free (cbargs);
+}
void
GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb (GtkWidget * dummy,
@@ -1239,29 +1264,36 @@ GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb (GtkWidget * dummy,
GtkTreeView *tv;
GtkTreeModel *tm;
GtkTreeSelection *sel;
- GtkTreeIter iter;
- int do_index;
- guint anonymity_level;
- guint priority;
- gchar *short_fn;
- struct GNUNET_FS_FileInformation *fip;
+ struct edit_pub_cb_args *cbargs;
+ GtkBuilder *builder;
+ GtkWindow *master_pubdialog;
+
+ builder = GTK_BUILDER (data);
tv = GTK_TREE_VIEW (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
+
+ cbargs = g_new0 (struct edit_pub_cb_args, 1);
+ cbargs->tm = gtk_tree_view_get_model (tv);
+
+ master_pubdialog = GTK_WINDOW (gtk_builder_get_object (builder,
+ "GNUNET_GTK_master_publish_dialog"));
sel = gtk_tree_view_get_selection (tv);
- if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
+ if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &cbargs->iter))
{
GNUNET_break (0);
+ g_free (cbargs);
return;
}
- gtk_tree_model_get (tm, &iter, 1, &do_index, 2, &short_fn, 3,
- &anonymity_level, 4, &priority, 5, &fip, -1);
- GNUNET_FS_GTK_edit_publish_dialog (&do_index, &short_fn, &anonymity_level,
- &priority, fip);
- gtk_tree_store_set (GTK_TREE_STORE (tm), &iter, 1, do_index, 2, short_fn, 3,
- anonymity_level, 4, priority, -1);
- g_free (short_fn);
+
+ gtk_tree_model_get (tm, &cbargs->iter, 1, &cbargs->do_index, 2,
+ &cbargs->short_fn, 3, &cbargs->anonymity_level, 4, &cbargs->priority,
+ 5, &cbargs->fip, -1);
+
+ GNUNET_FS_GTK_edit_publish_dialog (builder, master_pubdialog, &cbargs->do_index,
+ &cbargs->short_fn, &cbargs->anonymity_level, &cbargs->priority,
+ cbargs->fip, TRUE, &master_publish_edit_publish_dialog_cb, cbargs);
}
@@ -1298,9 +1330,12 @@ GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb (GtkWidget * dummy,
GtkTreeSelection *sel;
GtkTreeIter iter;
struct GNUNET_FS_FileInformation *fip;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (data);
tv = GTK_TREE_VIEW (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
sel = gtk_tree_view_get_selection (tv);
if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
@@ -1311,65 +1346,69 @@ GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb (GtkWidget * dummy,
gtk_tree_model_get (tm, &iter, 5, &fip, -1);
GNUNET_FS_file_information_destroy (fip, &free_fi_row_reference, NULL);
gtk_tree_store_remove (GTK_TREE_STORE (tm), &iter);
- update_selectivity ();
+ update_selectivity (data);
}
-
void
-GNUNET_GTK_master_publish_dialog_open_button_clicked_cb (GtkWidget * dummy,
- gpointer data)
+GNUNET_GTK_publish_directory_dialog_response_cb (GtkDialog *dialog,
+ gint response_id, gpointer user_data)
{
- GtkWidget *ad;
- GtkBuilder *builder;
char *filename;
int do_index;
GtkSpinButton *sb;
struct GNUNET_FS_BlockOptions bo;
+ GtkWidget *ad;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (user_data);
- builder =
- GNUNET_GTK_get_new_builder
- ("gnunet_fs_gtk_publish_directory_dialog.glade");
- if (builder == NULL)
+ ad = GTK_WIDGET (gtk_builder_get_object (builder,
+ "GNUNET_GTK_publish_directory_dialog"));
+
+ if (response_id == -5)
{
- GNUNET_break (0);
- return;
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (ad));
+ sb = GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
+ "GNUNET_GTK_publish_directory_dialog_expiration_year_spin_button"));
+ if (!GNUNET_GTK_get_selected_anonymity_level (builder,
+ "GNUNET_GTK_publish_directory_dialog_anonymity_combobox",
+ &bo.anonymity_level))
+ bo.anonymity_level = 1;
+ bo.content_priority = gtk_spin_button_get_value (GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder,
+ "GNUNET_GTK_publish_directory_dialog_priority_spin_button")));
+ bo.expiration_time = GNUNET_FS_GTK_get_expiration_time (sb);
+ do_index = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (builder,
+ "GNUNET_GTK_publish_directory_dialog_do_index_checkbutton")));
+
+ /* FIXME: open progress dialog here... */
+ add_dir (user_data, filename, &bo, do_index);
+ g_free (filename);
+ update_selectivity (user_data);
}
+ gtk_widget_hide (ad);
+}
+
+
+void
+GNUNET_GTK_master_publish_dialog_open_button_clicked_cb (GtkWidget * dummy,
+ gpointer data)
+{
+ GtkWidget *ad;
+ GtkBuilder *builder;
+ GtkWindow *master_pubdialog;
+
+ builder = GTK_BUILDER (data);
GNUNET_FS_GTK_setup_expiration_year_adjustment (builder);
ad = GTK_WIDGET (gtk_builder_get_object
(builder, "GNUNET_GTK_publish_directory_dialog"));
- if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad)))
- {
- gtk_widget_destroy (ad);
- g_object_unref (G_OBJECT (builder));
- return;
- }
- filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (ad));
- sb = GTK_SPIN_BUTTON (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_publish_directory_dialog_expiration_year_spin_button"));
- bo.anonymity_level =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_publish_directory_dialog_anonymity_spin_button")));
- bo.content_priority =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_publish_directory_dialog_priority_spin_button")));
- bo.expiration_time = GNUNET_FS_GTK_get_expiration_time (sb);
- do_index =
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
- (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_publish_directory_dialog_do_index_checkbutton")));
-
- gtk_widget_destroy (ad);
- g_object_unref (G_OBJECT (builder));
- /* FIXME: open progress dialog here... */
- add_dir (filename, &bo, do_index);
- g_free (filename);
- update_selectivity ();
+
+ master_pubdialog = GTK_WINDOW (gtk_builder_get_object (builder,
+ "GNUNET_GTK_master_publish_dialog"));
+ gtk_window_set_transient_for (GTK_WINDOW (ad), master_pubdialog);
+
+ gtk_window_present (GTK_WINDOW (ad));
}
@@ -1598,52 +1637,58 @@ free_file_information_tree_store (GtkTreeModel * tm, GtkTreeIter * iter)
}
}
-
-/**
- */
void
-GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, gpointer data)
+GNUNET_GTK_master_publish_dialog_realize_cb (GtkWidget *widget,
+ gpointer user_data)
{
- GtkWidget *ad;
- GtkTreeStore *ts;
- gint ret;
GtkTreeView *tv;
GtkTreeSelection *sel;
- GtkTreeIter iter;
- struct GNUNET_FS_FileInformation *fi;
- GtkTreeModel *tm;
- GtkTreeModel *ptm;
- struct GNUNET_FS_Namespace *namespace;
- gchar *namespace_id;
- gchar *namespace_uid;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (user_data);
- GNUNET_assert (master_builder == NULL);
- master_builder =
- GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_dialog.glade");
- if (master_builder == NULL)
- return;
tv = GTK_TREE_VIEW (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
sel = gtk_tree_view_get_selection (tv);
g_signal_connect (G_OBJECT (sel), "changed",
- G_CALLBACK (selection_changed_cb), NULL);
- ad = GTK_WIDGET (gtk_builder_get_object
- (master_builder, "GNUNET_GTK_master_publish_dialog"));
- ts = GTK_TREE_STORE (gtk_builder_get_object
- (master_builder, "GNUNET_GTK_pseudonym_tree_store"));
- GNUNET_FS_namespace_list (GNUNET_FS_GTK_get_fs_handle (),
- &add_namespace_to_ts, ts);
- tm = GTK_TREE_MODEL (gtk_builder_get_object
- (master_builder,
- "GNUNET_GTK_file_sharing_publishing_tree_store"));
+ G_CALLBACK (selection_changed_cb), user_data);
tv = GTK_TREE_VIEW (gtk_builder_get_object
- (master_builder,
+ (builder,
"GNUNET_GTK_master_publish_dialog_pseudonym_tree_view"));
sel = gtk_tree_view_get_selection (tv);
g_signal_connect (G_OBJECT (sel), "changed",
- G_CALLBACK (selection_changed_cb), NULL);
- ret = gtk_dialog_run (GTK_DIALOG (ad));
+ G_CALLBACK (selection_changed_cb), user_data);
+}
+
+void
+hide_master_publish_dialog (gpointer user_data, gint ret)
+{
+ GtkTreeView *tv, *ptv;
+ GtkTreeSelection *sel;
+ GtkTreeModel *tm, *ptm;
+ GtkTreeIter iter;
+ gpointer namespace;
+ gchar *namespace_id;
+ gchar *namespace_uid;
+ struct GNUNET_FS_FileInformation *fi;
+ GtkWidget *ad;
+ GtkBuilder *builder = GTK_BUILDER (user_data);
+
+ ad = GTK_WIDGET (gtk_builder_get_object
+ (builder, "GNUNET_GTK_master_publish_dialog"));
+
+ ptv = GTK_TREE_VIEW (gtk_builder_get_object
+ (builder,
+ "GNUNET_GTK_master_publish_dialog_pseudonym_tree_view"));
+ sel = gtk_tree_view_get_selection (ptv);
+ ptm = gtk_tree_view_get_model (ptv);
+
+ tv = GTK_TREE_VIEW (gtk_builder_get_object
+ (builder,
+ "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
+ tm = gtk_tree_view_get_model (tv);
+
if (ret == GTK_RESPONSE_OK)
{
if (TRUE == gtk_tree_selection_get_selected (sel, &ptm, &iter))
@@ -1666,14 +1711,10 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, gpointer data)
GNUNET_FS_PUBLISH_OPTION_NONE);
}
while (gtk_tree_model_iter_next (tm, &iter));
- if (namespace_id != NULL)
- g_free (namespace_id);
- if (namespace_uid != NULL)
- g_free (namespace_uid);
+ g_free (namespace_id);
+ g_free (namespace_uid);
}
- ptm =
- GTK_TREE_MODEL (gtk_builder_get_object
- (master_builder, "GNUNET_GTK_pseudonym_tree_store"));
+
/* free state from 'ptm' */
if (TRUE == gtk_tree_model_get_iter_first (ptm, &iter))
do
@@ -1681,6 +1722,7 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, gpointer data)
free_pseudonym_tree_store (ptm, &iter);
}
while (TRUE == gtk_tree_model_iter_next (ptm, &iter));
+ gtk_tree_store_clear (GTK_TREE_STORE (ptm));
/* free state from 'tm' */
if (TRUE == gtk_tree_model_get_iter_first (tm, &iter))
@@ -1689,10 +1731,100 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, gpointer data)
free_file_information_tree_store (tm, &iter);
}
while (TRUE == gtk_tree_model_iter_next (tm, &iter));
+ gtk_tree_store_clear (GTK_TREE_STORE (tm));
+
+ gtk_widget_hide (ad);
+}
+
+void
+GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ hide_master_publish_dialog (user_data, GTK_RESPONSE_OK);
+}
+
+void
+GNUNET_GTK_master_publish_dialog_cancel_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ hide_master_publish_dialog (user_data, GTK_RESPONSE_CANCEL);
+}
+
+gboolean
+GNUNET_GTK_master_publish_dialog_delete_event_cb (GtkWidget *widget,
+ GdkEvent *event, gpointer user_data)
+{
+ hide_master_publish_dialog (user_data, GTK_RESPONSE_CANCEL);
+ return TRUE;
+}
+
+void
+GNUNET_GTK_publish_file_dialog_response_cb (GtkDialog *dialog,
+ gint response_id, gpointer user_data)
+{
+ char *filename;
+ struct GNUNET_FS_BlockOptions bo;
+ int do_index;
+ GtkSpinButton *sb;
+ GtkWidget *ad;
+
+ GtkBuilder *builder = GTK_BUILDER (user_data);
+
+ ad = GTK_WIDGET (gtk_builder_get_object (builder,
+ "GNUNET_GTK_publish_file_dialog"));
+
+ if (response_id == -5)
+ {
+ /* OK */
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (ad));
+ sb = GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
+ "GNUNET_GTK_publish_file_dialog_expiration_year_spin_button"));
+
+ if (!GNUNET_GTK_get_selected_anonymity_level (builder,
+ "GNUNET_GTK_publish_file_dialog_anonymity_combobox", &bo.anonymity_level))
+ bo.anonymity_level = 1;
+ bo.content_priority = gtk_spin_button_get_value (GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder,
+ "GNUNET_GTK_publish_file_dialog_priority_spin_button")));
+ bo.expiration_time = GNUNET_FS_GTK_get_expiration_time (sb);
+ bo.replication_level = 1; /* FIXME... */
+ do_index = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (builder,
+ "GNUNET_GTK_publish_file_dialog_do_index_checkbutton")));
+ add_file_at_iter (user_data, filename, &bo, do_index, NULL);
+ g_free (filename);
+ update_selectivity (user_data);
+ }
+ else
+ {
+ /* Cancel/Escape/close/etc */
+ }
+ gtk_widget_hide (ad);
+}
+
+/**
+ */
+void
+GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, gpointer data)
+{
+ GtkWidget *ad;
+ GtkTreeStore *ts;
+ GtkBuilder *builder;
+
+ builder = GTK_BUILDER (data);
+
+ ad = GTK_WIDGET (gtk_builder_get_object
+ (builder, "GNUNET_GTK_master_publish_dialog"));
+
+ if (!gtk_widget_get_visible (ad))
+ {
+ ts = GTK_TREE_STORE (gtk_builder_get_object (builder,
+ "GNUNET_GTK_pseudonym_tree_store"));
+ GNUNET_FS_namespace_list (GNUNET_FS_GTK_get_fs_handle (),
+ &add_namespace_to_ts, ts);
+ }
- gtk_widget_destroy (ad);
- g_object_unref (G_OBJECT (master_builder));
- master_builder = NULL;
+ gtk_window_present (GTK_WINDOW (ad));
}
diff --git a/src/fs/gnunet-fs-gtk-main_window_open_directory.c b/src/fs/gnunet-fs-gtk-main_window_open_directory.c
index ae3b7d0..23e71fc 100644
--- a/src/fs/gnunet-fs-gtk-main_window_open_directory.c
+++ b/src/fs/gnunet-fs-gtk-main_window_open_directory.c
@@ -85,6 +85,34 @@ add_child (void *cls, const char *filename, const struct GNUNET_FS_Uri *uri,
meta, NULL, 0));
}
+void
+GNUNET_GTK_open_directory_dialog_response_cb (GtkDialog *dialog,
+ gint response_id, gpointer user_data)
+{
+ GtkBuilder *builder;
+ GtkWidget *ad;
+ char *filename;
+ struct AddChildContext acc;
+
+ builder = GTK_BUILDER (user_data);
+ ad = GTK_WIDGET (gtk_builder_get_object
+ (builder, "GNUNET_GTK_open_directory_dialog"));
+
+ if (response_id != -5)
+ {
+ gtk_widget_destroy (ad);
+ g_object_unref (G_OBJECT (builder));
+ return;
+ }
+
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (ad));
+ gtk_widget_destroy (ad);
+ g_object_unref (G_OBJECT (builder));
+ acc.filename = filename;
+ acc.ts = NULL;
+ GNUNET_FS_GTK_mmap_and_scan (filename, &add_child, &acc);
+ g_free (filename);
+}
/**
* User selected "Open directory" in menu. Display dialog, open
@@ -94,12 +122,12 @@ void
GNUNET_GTK_main_menu_file_open_gnunet_directory_activate_cb (GtkWidget * dummy,
gpointer data)
{
- struct AddChildContext acc;
GtkWidget *ad;
GtkBuilder *builder;
- char *filename;
+ GtkWidget *toplevel;
GtkFileFilter *ff;
+
builder =
GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_open_directory_dialog.glade");
if (builder == NULL)
@@ -113,19 +141,11 @@ GNUNET_GTK_main_menu_file_open_gnunet_directory_activate_cb (GtkWidget * dummy,
(builder, "gnunet_directory_filter"));
/* FIXME: some day, write a custom file filter for gnunet-directories... */
gtk_file_filter_add_pattern (ff, "*" GNUNET_FS_DIRECTORY_EXT);
- if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad)))
- {
- gtk_widget_destroy (ad);
- g_object_unref (G_OBJECT (builder));
- return;
- }
- filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (ad));
- gtk_widget_destroy (ad);
- g_object_unref (G_OBJECT (builder));
- acc.filename = filename;
- acc.ts = NULL;
- GNUNET_FS_GTK_mmap_and_scan (filename, &add_child, &acc);
- g_free (filename);
+
+ toplevel = gtk_widget_get_toplevel (dummy);
+ if (GTK_IS_WINDOW (toplevel))
+ gtk_window_set_transient_for (GTK_WINDOW (ad), GTK_WINDOW (toplevel));
+ gtk_window_present (GTK_WINDOW (ad));
}
/* end of gnunet-fs-gtk-main_window_open_directory.c */
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index 2e0f299..3c48512 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -247,7 +247,7 @@ GNUNET_GTK_get_selected_anonymity_level (GtkBuilder *builder, gchar *combo_name,
GtkTreeModel *model;
guint level;
- combo = GTK_COMBO_BOX(gtk_builder_get_object (builder, combo_name));
+ combo = GTK_COMBO_BOX (gtk_builder_get_object (builder, combo_name));
if (!combo)
return FALSE;
@@ -265,6 +265,38 @@ GNUNET_GTK_get_selected_anonymity_level (GtkBuilder *builder, gchar *combo_name,
}
gboolean
+GNUNET_GTK_select_anonymity_level (GtkBuilder *builder, gchar *combo_name, guint sel_level)
+{
+ GtkComboBox *combo;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+ guint level;
+ gboolean go_on;
+
+ combo = GTK_COMBO_BOX (gtk_builder_get_object (builder, combo_name));
+ if (!combo)
+ return FALSE;
+
+ model = gtk_combo_box_get_model (combo);
+ if (!model)
+ return FALSE;
+
+ for (go_on = gtk_tree_model_get_iter_first (model, &iter);
+ go_on;
+ go_on = gtk_tree_model_iter_next (model, &iter))
+ {
+ gboolean is_it = FALSE;
+ gtk_tree_model_get (model, &iter, 1, &level, -1);
+ if (level == sel_level)
+ {
+ gtk_combo_box_set_active_iter (combo, &iter);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+gboolean
get_selected_namespace_treepath_iter_model_widget (GtkBuilder *builder,
GtkTreePath **p_treepath, GtkTreeIter *p_iter, GtkTreeModel **p_model,
GtkWidget **p_widget)
diff --git a/src/fs/gnunet-fs-gtk.h b/src/fs/gnunet-fs-gtk.h
index 4cd76de..114be04 100644
--- a/src/fs/gnunet-fs-gtk.h
+++ b/src/fs/gnunet-fs-gtk.h
@@ -76,5 +76,18 @@ GNUNET_GTK_get_selected_anonymity_level (GtkBuilder *builder,
gchar *combo_name, guint *p_level);
+/**
+ * Set the selected anonymity level.
+ * For dialogue initialization.
+ *
+ * @param builder builder object for the window
+ * @param combo_name name of the combobox widget to get anonymity from
+ * @param sel_level the level value to select
+ * @return TRUE on success, FALSE on error (no item with such level)
+ */
+gboolean
+GNUNET_GTK_select_anonymity_level (GtkBuilder *builder,
+ gchar *combo_name, guint sel_level);
+
#endif
/* end of gnunet-fs-gtk.h */
--
1.7.4
| ||||
|
|
Attached 0001-Starting-to-get-rid-of-gtk_dialog_run-and-more.patch It re-implements GtkAboutDialog (or something that looks very much like it) without using gtk_dialog_run() I also took the opportunity to make some changes in the buildsystem, such as pre-processing .glade files to put versions/dates/names into them, enabling silent rules and using non-deprecated automake macros. Also, license text should now loaded at runtime (TODO: use absolute path to COPYING; it works for me only because i have COPYING in `bin' subdirectory) instead of being hard-coded into .glade file. |
|
|
I'm not sure your get_version.sh script is a good idea. What was wrong with having the version in configure.ac? Also, why do we need this G_MODULE_EXPORT stuff? Worked fine without before (at least on GNU/Linux...) |
|
|
G_MODULE_EXPORT is recommended by gtk - http://developer.gnome.org/gtk/2.24/GtkBuilder.html#gtk-builder-connect-signals (actually, it's not required, even on W32, unless we're doing some special .def-related magic, which we don't) get_version.sh - well, i thought it would be cool to make nightly or beta builds and have them have precise svn revision instead of 0.9.x . Several pieces of software i knew do that. Obviously, since this is a patch attached to a Mantis issue, i'm ready to listen to any suggestions you or anyone else have (my patches that require little attention usually land into your inbox directly these days). |
|
|
You can force version number by creating a ".version" file in top_srcdir and placing 0.9.0 (or whatever) in there. The file is not (and should not) be in VCS. |
|
|
0001-patch applied as SVN 18516. |
|
|
0004-New-search-bar-in-the-main-window.patch - creates a search bar at the top of the main window. Search bar allows one to select a namespace to search in (TODO: namespace list is a dummy, fix this to use real namespaces), a query, an anonymity level (ATM there are 3 levels - None=0, Normal=1 and Paranoid=10; easily adjustable by editing .glade file), and an optional restriction by mime type (TODO: mime type list is a dummy, fill it with real mime types and descriptions; list will be adjustable via .glade file editing), which also fixes 0001944 . <s>TODO: get rid of the "New search" tab, since searches can now be started from the search bar.</s> DONE. TODO: get rid of the "Search" dialog, since search toolbar should now replace it. |
|
|
Attached 0001-A-lump-of-GUI-changes-and-tweaks.patch and 0002-Get-text-from-the-combobox-entry.patch These continue along the lines of 0004-New-search-bar-in-the-main-window.patch and towards fixing 0001944 |
|
|
Uploaded 0003-Do-not-use-the-new-search-tab-keep-the-code-for-now.patch and 0004-Fix-search-tab-label.patch First one is one-liner to disable 'new search' tab, the second one is purely cosmetic. |
|
|
I just noticed that you bumped the gtk required version to 2.24, with gtk 2.20, I now get: (<unknown>:7476): Gtk-WARNING **: Unknown property: GtkComboBox.has-entry (<unknown>:7476): Gtk-WARNING **: Unknown property: GtkComboBox.entry-text-column (<unknown>:7476): Gtk-WARNING **: Could not find signal handler 'main_window_search_mime_combobox_popdown_cb' (<unknown>:7476): Gtk-WARNING **: Could not find signal handler 'main_window_search_mime_combobox_popup_cb' I think requiring 2.24 is a bit aggressive right now... |
|
|
Playing around with the UI, I also get (<unknown>:7476): GLib-GObject-WARNING **: invalid cast from `GtkCellView' to `GtkEntry' (<unknown>:7476): Gtk-CRITICAL **: gtk_entry_get_text: assertion `GTK_IS_ENTRY (entry)' failed whenever I start a search with the 'Find' button. |
|
|
Also, I should mention that selecting the namespace doesn't actually work (at least with gtk 2.20). |
|
|
has-entry is necessary to keep combobox small (otherwise it contains the whole row, not just first column). H-m-m-m...although i think there's a way to fix this, i'll try it today. main_window_search_mime_combobox_pop*_cb - forgot to remove these from .glade file warnings and criticals - i'll need to see backtraces (i will try to reproduce these, most likely i have them too) Namespace selector is slightly untested due to the fact that my node knows no namespaces (and thus i only have "Any" namespace, and the treeview is not configured to allow you to re-select a namespace that is already selected). |
|
|
Can't fix the need for has-entry. Either has-entry stays, or mime type selection combobox will be as long as its longest row is. OR i could scrap it completely and do the same thing i did with the namespace selector (by the way, i've made a "custom" combobox lookalike out of existing elements - see the two gtk-2.24.8-custom-combo images, the source is in custom_combo.glade; we could use it instead). |
|
|
I'm not getting GTK_ENTRY-related errors when i search - are you sure you've applied 0002-Get-text-from-the-combobox-entry.patch ? |
|
|
(to clarify: patches are applied in the same order they are uploaded, not in the order that numbers in file names might suggest). |
|
|
Uploaded: 0001-Make-tabs-smaller.patch - cosmetic fix 0002-Remove-has-entry-hide-columns-del-signals.patch and 0003-Revert-Get-text-from-the-combobox-entry.patch revert some of the changes in previous patches |
|
|
I also think the tab label for namespace-searches should then not show the raw URI but the namespace-name + keyword. (the full URI doesn't fit anyway and thus we currently just show garbage) |
|
|
Applied (hopefully) all patches up to the 3-revert patch in SVN 18561. |
|
|
Uploaded: 0001-Multiple-GUI-changes.patch - see the patch description 0002-Change-required-GTK-to-2.20.patch - small fix |
|
|
0002-Various-changes.patch - mostly removes gtk_dialog_run() for file save dialog. Also makes preview widget sensitive. Enables FS persistence and probes. 0003-Disable-propes-and-persistence-they-are-broken.patch - Disables FS persistence and probes. |
|
|
Uploaded three more patches: 0001-Make-metadata-list-items-selectable.patch 0002-Make-metadata-copyable.patch 0003-Be-more-careful-with-strings.patch They probably won't apply without previous ones, which is why they are here, despite the fact that they have NOTHING to do with gtk_dialog_run(). |
|
|
Patches up to 0003-Be more careful have now been applied. |
|
|
Uploaded two patches: 0001-Remove-old-commented-out-code.patch - commented code cleanup 0002-Make-download-by-uri-dialogue-less.patch - turns download-by-uril dialog into non-dialog window. Also, uri is now entered into a textview (multiline), not an entry. Anonymity is chosen the same way it is in the searchbar (the same datastore is used, and a related utility function is now more universal). |
|
|
0001-Finally-got-rid-of-gtk_dialog_run-.-Completely.patch is here! I have to admit that it could have been MUCH smoother if i knew from the start how to handle GtkDialogs without gtk_dialog_run(). Still, some dialogs required changes (IMHO) anyway, so it wasn't too much a waste of time. For edit_publication window UI discussion (if any) i suggest a separate issue. This one is fixed. |
|
|
Applied 0001-Finally-got-rid... patch in SVN 18757. |
|
|
Not quite done yet: $ ../gnunet/bin/grepsrc.sh gtk_dialog_run ./src/fs/gnunet-fs-gtk-main_window_file_search.c:202: gtk_dialog_run (GTK_DIALOG (ad)); |
|
|
No, it's an old piece of code, not really used anymore. I kept it for ... sentimental reasons. |
|
|
Could you please make a patch to remove all sentimental code? Pretty please... |
|
|
Sentimental code removed in 18825, resolving bug. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2011-08-15 18:27 | Christian Grothoff | New Issue | |
| 2011-09-15 14:17 | Christian Grothoff | Category | gnunet-gtk => gnunet-fs-gtk |
| 2011-09-16 10:14 | Christian Grothoff | Priority | normal => low |
| 2011-09-16 10:14 | Christian Grothoff | Severity | major => minor |
| 2011-09-16 10:14 | Christian Grothoff | Status | new => confirmed |
| 2011-11-26 18:23 | Christian Grothoff | Relationship added | child of 0001966 |
| 2011-12-07 15:08 | LRN | File Added: 0001-Starting-to-get-rid-of-gtk_dialog_run-and-more.patch | |
| 2011-12-07 15:11 | LRN | Note Added: 0005018 | |
| 2011-12-07 15:47 | Christian Grothoff | Note Added: 0005019 | |
| 2011-12-07 16:02 | LRN | Note Added: 0005020 | |
| 2011-12-07 19:58 | LRN | Note Added: 0005021 | |
| 2011-12-08 17:15 | Christian Grothoff | Note Added: 0005025 | |
| 2011-12-11 03:12 | LRN | File Added: 0004-New-search-bar-in-the-main-window.patch | |
| 2011-12-11 03:16 | LRN | Note Added: 0005029 | |
| 2011-12-12 00:07 | LRN | File Added: 0001-A-lump-of-GUI-changes-and-tweaks.patch | |
| 2011-12-12 00:08 | LRN | File Added: 0002-Get-text-from-the-combobox-entry.patch | |
| 2011-12-12 00:09 | LRN | Note Added: 0005041 | |
| 2011-12-12 00:28 | LRN | File Added: 0003-Do-not-use-the-new-search-tab-keep-the-code-for-now.patch | |
| 2011-12-12 00:28 | LRN | File Added: 0004-Fix-search-tab-label.patch | |
| 2011-12-12 00:29 | LRN | Note Added: 0005042 | |
| 2011-12-12 00:30 | LRN | Note Edited: 0005029 | |
| 2011-12-12 14:23 | Christian Grothoff | Note Added: 0005047 | |
| 2011-12-12 14:28 | Christian Grothoff | Note Added: 0005048 | |
| 2011-12-12 14:29 | Christian Grothoff | Note Added: 0005049 | |
| 2011-12-12 14:34 | LRN | Note Added: 0005050 | |
| 2011-12-12 15:08 | LRN | File Added: gtk-2.24.8-custom-combo-01.png | |
| 2011-12-12 15:08 | LRN | File Added: gtk-2.24.8-custom-combo-02.png | |
| 2011-12-12 15:10 | LRN | File Added: custom_combo.glade | |
| 2011-12-12 15:10 | LRN | Note Added: 0005051 | |
| 2011-12-12 15:15 | LRN | Note Added: 0005052 | |
| 2011-12-12 15:15 | LRN | Note Added: 0005053 | |
| 2011-12-12 15:41 | LRN | File Added: 0001-Make-tabs-smaller.patch | |
| 2011-12-12 15:41 | LRN | File Added: 0002-Remove-has-entry-hide-columns-del-signals.patch | |
| 2011-12-12 15:41 | LRN | File Added: 0003-Revert-Get-text-from-the-combobox-entry.patch | |
| 2011-12-12 15:42 | LRN | Note Added: 0005054 | |
| 2011-12-12 16:33 | Christian Grothoff | Note Added: 0005059 | |
| 2011-12-12 16:36 | Christian Grothoff | Note Added: 0005060 | |
| 2011-12-12 20:55 | LRN | File Added: 0001-Multiple-GUI-changes.patch | |
| 2011-12-12 20:55 | LRN | File Added: 0002-Change-required-GTK-to-2.20.patch | |
| 2011-12-12 20:56 | LRN | Note Added: 0005061 | |
| 2011-12-13 19:22 | LRN | File Added: 0001-Change-required-GTK-to-2.20.patch | |
| 2011-12-13 19:22 | LRN | File Deleted: 0001-Change-required-GTK-to-2.20.patch | |
| 2011-12-13 19:22 | LRN | File Added: 0002-Various-changes.patch | |
| 2011-12-13 19:22 | LRN | File Added: 0003-Disable-propes-and-persistence-they-are-broken.patch | |
| 2011-12-13 19:24 | LRN | Note Added: 0005092 | |
| 2011-12-13 19:24 | LRN | Summary | gtk_dialog_run is bad as it stops the GNUnet scheduler loop as well => [patch] gtk_dialog_run is bad as it stops the GNUnet scheduler loop as well |
| 2011-12-16 10:43 | LRN | File Added: 0001-Make-metadata-list-items-selectable.patch | |
| 2011-12-16 10:44 | LRN | File Added: 0002-Make-metadata-copyable.patch | |
| 2011-12-16 10:44 | LRN | File Added: 0003-Be-more-careful-with-strings.patch | |
| 2011-12-16 10:46 | LRN | Note Added: 0005105 | |
| 2011-12-16 10:57 | LRN | File Added: 0001-Don-t-re-attach-the-menu.patch | |
| 2011-12-16 20:08 | Christian Grothoff | Note Added: 0005111 | |
| 2011-12-16 20:08 | Christian Grothoff | Summary | [patch] gtk_dialog_run is bad as it stops the GNUnet scheduler loop as well => gtk_dialog_run is bad as it stops the GNUnet scheduler loop as well |
| 2011-12-18 03:57 | LRN | File Added: 0001-Remove-old-commented-out-code.patch | |
| 2011-12-18 03:57 | LRN | File Added: 0002-Make-download-by-uri-dialogue-less.patch | |
| 2011-12-18 03:58 | LRN | Summary | gtk_dialog_run is bad as it stops the GNUnet scheduler loop as well => [patch] gtk_dialog_run is bad as it stops the GNUnet scheduler loop as well |
| 2011-12-18 04:00 | LRN | Note Added: 0005124 | |
| 2011-12-18 12:18 | Christian Grothoff | Summary | [patch] gtk_dialog_run is bad as it stops the GNUnet scheduler loop as well => gtk_dialog_run is bad as it stops the GNUnet scheduler loop as well |
| 2011-12-19 13:54 | Christian Grothoff | Assigned To | => LRN |
| 2011-12-19 14:22 | Christian Grothoff | Product Version | => 0.9.0 |
| 2011-12-19 14:22 | Christian Grothoff | Target Version | => 0.9.1 |
| 2011-12-23 06:59 | LRN | File Added: 0001-Finally-got-rid-of-gtk_dialog_run-.-Completely.patch | |
| 2011-12-23 07:00 | LRN | Summary | gtk_dialog_run is bad as it stops the GNUnet scheduler loop as well => [patch] gtk_dialog_run is bad as it stops the GNUnet scheduler loop as well |
| 2011-12-23 07:01 | LRN | Note Added: 0005164 | |
| 2011-12-23 09:41 | Christian Grothoff | Note Added: 0005165 | |
| 2011-12-23 10:48 | Christian Grothoff | Note Added: 0005166 | |
| 2011-12-23 10:48 | Christian Grothoff | Summary | [patch] gtk_dialog_run is bad as it stops the GNUnet scheduler loop as well => gtk_dialog_run is bad as it stops the GNUnet scheduler loop as well |
| 2011-12-23 10:50 | LRN | Note Added: 0005167 | |
| 2011-12-23 17:57 | Christian Grothoff | Note Added: 0005183 | |
| 2011-12-26 13:05 | Christian Grothoff | Note Added: 0005207 | |
| 2011-12-26 13:05 | Christian Grothoff | Status | confirmed => resolved |
| 2011-12-26 13:05 | Christian Grothoff | Fixed in Version | => 0.9.1 |
| 2011-12-26 13:05 | Christian Grothoff | Resolution | open => fixed |
| 2011-12-26 22:28 | Christian Grothoff | Status | resolved => closed |