[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r18640 - in gnunet-gtk: contrib src/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r18640 - in gnunet-gtk: contrib src/fs |
Date: |
Fri, 16 Dec 2011 20:00:48 +0100 |
Author: grothoff
Date: 2011-12-16 20:00:48 +0100 (Fri, 16 Dec 2011)
New Revision: 18640
Added:
gnunet-gtk/contrib/gnunet_fs_gtk_about_window.glade
Modified:
gnunet-gtk/contrib/gnunet_fs_gtk_download_as_dialog.glade
gnunet-gtk/contrib/gnunet_fs_gtk_main_window.glade
gnunet-gtk/src/fs/gnunet-fs-gtk-download.c
gnunet-gtk/src/fs/gnunet-fs-gtk.c
Log:
LRN: Various changes (#1759)
* 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
Added: gnunet-gtk/contrib/gnunet_fs_gtk_about_window.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_fs_gtk_about_window.glade
(rev 0)
+++ gnunet-gtk/contrib/gnunet_fs_gtk_about_window.glade 2011-12-16 19:00:48 UTC
(rev 18640)
@@ -0,0 +1,363 @@
+<?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="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 GTK r18546</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) 2010-2011 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">never</property>
+ <property name="shadow_type">out</property>
+ <child>
+ <object class="GtkTextView" id="about_license_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">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 <address@hidden>
+Christian Muellner <address@hidden>
+Alex Jones <address@hidden>
+Nicklas Larsson <address@hidden>
+</property>
+ </object>
+ <object class="GtkTextBuffer" id="credits_authors_contents">
+ <property name="text">Juergen Appel <address@hidden>
+Krista Grothoff <address@hidden>
+James Blackwell <address@hidden>
+Ludovic Courtes <address@hidden>
+Nils Durner <address@hidden>
+Renaldo Ferreira <address@hidden>
+Christian Grothoff <address@hidden>
+Eric Haumant
+Tzvetan Horozov <address@hidden>
+Gerd Knorr <address@hidden>
+Werner Koch <address@hidden>
+Uli Luckas <address@hidden>
+Blake Matheny
+Glenn McGrath
+Hendrik Pagenhardt <address@hidden>
+Ioana Patrascu <address@hidden>
+Marko Raeihae
+Paul Ruth <address@hidden>
+Risto Saarelma
+Antti Salonen
+Tiberius Stef <address@hidden>
+Tuomas Toivonen
+Tomi Tukiainen
+Kevin Vandersloot <address@hidden>
+Simo Viitanen
+Larry Waldo
+Igor Wronsky <address@hidden>
+<address@hidden></property>
+ </object>
+ <object class="GtkTextBuffer" id="credits_docs_contents">
+ <property name="text">Christian Grothoff <address@hidden>
+Anders Carlsson <address@hidden>
+Nils Durner <address@hidden>
+Nicklas Larsson <address@hidden>
+Milan Bouchet-Valat <address@hidden>
+Igor Wronsky <address@hidden>
+</property>
+ </object>
+ <object class="GtkTextBuffer" id="credits_trans_contents">
+ <property name="text">Di Ma
+Jens Palsberg <address@hidden>
+Christian Grothoff <address@hidden>
+Nils Durner <address@hidden>
+Mathieu <address@hidden>
+Eric Haumant
address@hidden
+Hiroshi Yamauchi <address@hidden>
+Adam Welc <address@hidden>
+Bogdan Carbunar <address@hidden>
+Steven Michael Murphy <address@hidden>
+Phan Vinh Thinh <address@hidden>
+Daniel Nylander <address@hidden>
+</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>
Modified: gnunet-gtk/contrib/gnunet_fs_gtk_download_as_dialog.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_fs_gtk_download_as_dialog.glade 2011-12-16
18:58:37 UTC (rev 18639)
+++ gnunet-gtk/contrib/gnunet_fs_gtk_download_as_dialog.glade 2011-12-16
19:00:48 UTC (rev 18640)
@@ -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>
Modified: gnunet-gtk/contrib/gnunet_fs_gtk_main_window.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_fs_gtk_main_window.glade 2011-12-16 18:58:37 UTC
(rev 18639)
+++ gnunet-gtk/contrib/gnunet_fs_gtk_main_window.glade 2011-12-16 19:00:48 UTC
(rev 18640)
@@ -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 -->
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-download.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-download.c 2011-12-16 18:58:37 UTC (rev
18639)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-download.c 2011-12-16 19:00:48 UTC (rev
18640)
@@ -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;
+ 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;
struct GNUNET_FS_Handle *fs;
- uint64_t len;
- enum GNUNET_FS_DownloadOptions opt;
- uint32_t anonymity;
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)
+ if (GTK_RESPONSE_OK != dlc->response)
{
- 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)))
- {
- 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 @@
(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 @@
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 */
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk.c 2011-12-16 18:58:37 UTC (rev 18639)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk.c 2011-12-16 19:00:48 UTC (rev 18640)
@@ -648,9 +648,8 @@
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)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r18640 - in gnunet-gtk: contrib src/fs,
gnunet <=