[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r12429 - in gnunet-gtk: contrib src
From: |
gnunet |
Subject: |
[GNUnet-SVN] r12429 - in gnunet-gtk: contrib src |
Date: |
Sun, 1 Aug 2010 21:31:34 +0200 |
Author: grothoff
Date: 2010-08-01 21:31:34 +0200 (Sun, 01 Aug 2010)
New Revision: 12429
Modified:
gnunet-gtk/contrib/Makefile.in
gnunet-gtk/contrib/download_as.glade
gnunet-gtk/src/download.c
gnunet-gtk/src/fs_event_handler.c
Log:
enable recursive download, aborting download
Modified: gnunet-gtk/contrib/Makefile.in
===================================================================
--- gnunet-gtk/contrib/Makefile.in 2010-08-01 18:57:41 UTC (rev 12428)
+++ gnunet-gtk/contrib/Makefile.in 2010-08-01 19:31:34 UTC (rev 12429)
@@ -157,7 +157,6 @@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBICONV = @LIBICONV@
@@ -261,6 +260,7 @@
pkgdata_DATA = \
about.glade \
+ advertise_pseudonym_dialog.glade \
create_namespace_dialog.glade \
download_as.glade \
main_tab_new_frame.glade \
@@ -274,6 +274,7 @@
publish_tab.glade \
search_dialog.glade \
search_tab.glade \
+ select_pseudonym_dialog.glade \
status_bar_menu.glade
all: all-recursive
Modified: gnunet-gtk/contrib/download_as.glade
===================================================================
--- gnunet-gtk/contrib/download_as.glade 2010-08-01 18:57:41 UTC (rev
12428)
+++ gnunet-gtk/contrib/download_as.glade 2010-08-01 19:31:34 UTC (rev
12429)
@@ -2,6 +2,12 @@
<interface>
<requires lib="gtk+" version="2.20"/>
<!-- interface-naming-policy project-wide -->
+ <object class="GtkAdjustment" id="GNUNET_GTK_anonymity_adjustment">
+ <property name="upper">100000</property>
+ <property name="value">1</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
<object class="GtkFileChooserDialog" id="GNUNET_GTK_save_as_dialog">
<property name="can_default">True</property>
<property name="has_default">True</property>
@@ -12,9 +18,9 @@
<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>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox4">
<property name="visible">True</property>
@@ -51,7 +57,21 @@
</packing>
</child>
<child>
- <placeholder/>
+ <object class="GtkCheckButton"
id="GNUNET_GTK_save_as_recursive_check_button">
+ <property name="label" translatable="yes">_recursive</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>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
</child>
</object>
<packing>
@@ -111,10 +131,4 @@
<action-widget
response="-5">GNUNET_GTK_save_as_dialog_ok_button</action-widget>
</action-widgets>
</object>
- <object class="GtkAdjustment" id="GNUNET_GTK_anonymity_adjustment">
- <property name="upper">100000</property>
- <property name="value">1</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
</interface>
Modified: gnunet-gtk/src/download.c
===================================================================
--- gnunet-gtk/src/download.c 2010-08-01 18:57:41 UTC (rev 12428)
+++ gnunet-gtk/src/download.c 2010-08-01 19:31:34 UTC (rev 12429)
@@ -37,6 +37,7 @@
enum GNUNET_FS_DownloadOptions opt;
uint32_t anonymity;
struct DownloadEntry *de;
+ GtkWidget *cb;
builder = GNUNET_GTK_get_new_builder ("download_as.glade");
if (builder == NULL)
@@ -49,6 +50,10 @@
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)
@@ -81,6 +86,7 @@
}
GNUNET_free_non_null (dc->filename);
dc->filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(ad));
+ dc->is_recursive = (TRUE == gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(cb))) ? GNUNET_YES : GNUNET_NO;
fs = GNUNET_GTK_get_fs_handle ();
opt = GNUNET_FS_DOWNLOAD_OPTION_NONE;
if (dc->is_recursive)
Modified: gnunet-gtk/src/fs_event_handler.c
===================================================================
--- gnunet-gtk/src/fs_event_handler.c 2010-08-01 18:57:41 UTC (rev 12428)
+++ gnunet-gtk/src/fs_event_handler.c 2010-08-01 19:31:34 UTC (rev 12429)
@@ -517,11 +517,12 @@
dlc->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
dlc->rr = gtk_tree_row_reference_new (tm, path);
dlc->sr = sr->result;
- dlc->anonymity = 1; /* FIXME: grab from search? */
+ dlc->anonymity = -1;
GNUNET_GTK_open_download_as_dialog (dlc);
}
+
/**
* Row reference for the current search context menu.
*/
@@ -560,6 +561,75 @@
/**
+ * Download was selected in the current search context menu.
+ */
+static void
+abort_download_ctx_menu (gpointer user_data,
+ guint unused,
+ GtkWidget *widget)
+{
+ struct DownloadEntry *de = user_data;
+
+ GNUNET_assert (de->dc != NULL);
+ GNUNET_FS_download_stop (de->dc,
+ GNUNET_YES);
+ current_context_search_tab = NULL;
+}
+
+
+/**
+ * Copy current URI to clipboard.
+ */
+static void
+copy_uri_to_clipboard_ctx_menu (gpointer user_data,
+ guint unused,
+ GtkWidget *widget)
+{
+ GtkTreePath *path;
+ GtkTreeView *tv;
+ GtkTreeModel *tm;
+ GtkTreeIter iter;
+ struct GNUNET_FS_Uri *uri;
+ char *uris;
+ GtkClipboard *cb;
+
+ if (current_context_row_reference == NULL)
+ {
+ GNUNET_break (0);
+ return;
+ }
+ path = gtk_tree_row_reference_get_path (current_context_row_reference);
+ gtk_tree_row_reference_free (current_context_row_reference);
+ current_context_row_reference = NULL;
+ tv = GTK_TREE_VIEW (gtk_builder_get_object
(current_context_search_tab->builder,
+ "_search_result_frame"));
+ tm = gtk_tree_view_get_model (tv);
+ if (TRUE != gtk_tree_model_get_iter (tm, &iter, path))
+ {
+ GNUNET_break (0);
+ gtk_tree_path_free (path);
+ return;
+ }
+ gtk_tree_model_get (tm, &iter,
+ 1, &uri, -1);
+ gtk_tree_path_free (path);
+ current_context_search_tab = NULL;
+ if (uri == NULL)
+ {
+ GNUNET_break (0);
+ return;
+ }
+ uris = GNUNET_FS_uri_to_string (uri);
+ cb = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+ gtk_clipboard_set_text (cb,
+ uris,
+ -1);
+ gtk_clipboard_store (cb);
+ GNUNET_free (uris);
+}
+
+
+/**
* We got a right-click on the search result list. Display the context
* menu.
*/
@@ -577,7 +647,6 @@
GtkTreeModel *tm;
GtkTreeIter iter;
struct SearchResult *sr;
- int have_entries;
tv = GTK_TREE_VIEW (widget);
if (event->type == GDK_BUTTON_PRESS)
@@ -618,7 +687,6 @@
- abort active download (!)
=> need to know download status before creating menu!
*/
- have_entries = GNUNET_NO;
menu = GTK_MENU (gtk_menu_new ());
if (sr->download == NULL)
{
@@ -626,24 +694,42 @@
g_signal_connect (child,
"activate",
G_CALLBACK (start_download_ctx_menu),
- NULL /*FIXME */);
+ NULL);
gtk_label_set_use_underline (GTK_LABEL
(gtk_bin_get_child (GTK_BIN
(child))),
TRUE);
gtk_widget_show (child);
- have_entries = GNUNET_YES;
}
- if (have_entries != GNUNET_NO)
- {
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
- gtk_menu_popup (menu, NULL, NULL, NULL, NULL,
- event_button->button,
- event_button->time);
- }
else
{
- g_object_unref (G_OBJECT(menu));
+ child = gtk_menu_item_new_with_label (_("_Abort download"));
+ g_signal_connect (child,
+ "activate",
+ G_CALLBACK (abort_download_ctx_menu),
+ sr->download);
+ gtk_label_set_use_underline (GTK_LABEL
+ (gtk_bin_get_child (GTK_BIN
(child))),
+ TRUE);
+ gtk_widget_show (child);
+
}
+
+ child = gtk_menu_item_new_with_label (_("_Copy URI to Clipboard"));
+ g_signal_connect (child,
+ "activate",
+ G_CALLBACK (copy_uri_to_clipboard_ctx_menu),
+ NULL);
+ gtk_label_set_use_underline (GTK_LABEL
+ (gtk_bin_get_child (GTK_BIN (child))),
+ TRUE);
+ gtk_widget_show (child);
+
+
+
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
+ gtk_menu_popup (menu, NULL, NULL, NULL, NULL,
+ event_button->button,
+ event_button->time);
}
}
return FALSE;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r12429 - in gnunet-gtk: contrib src,
gnunet <=