[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3551 - gnunet-gtk/src/plugins/fs
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3551 - gnunet-gtk/src/plugins/fs |
Date: |
Tue, 24 Oct 2006 16:12:09 -0700 (PDT) |
Author: grothoff
Date: 2006-10-24 16:12:03 -0700 (Tue, 24 Oct 2006)
New Revision: 3551
Modified:
gnunet-gtk/src/plugins/fs/Makefile.am
gnunet-gtk/src/plugins/fs/download.c
gnunet-gtk/src/plugins/fs/download.h
gnunet-gtk/src/plugins/fs/fs.h
gnunet-gtk/src/plugins/fs/helper.c
gnunet-gtk/src/plugins/fs/helper.h
gnunet-gtk/src/plugins/fs/namespace.c
gnunet-gtk/src/plugins/fs/search.c
gnunet-gtk/src/plugins/fs/search.h
Log:
ref
Modified: gnunet-gtk/src/plugins/fs/Makefile.am
===================================================================
--- gnunet-gtk/src/plugins/fs/Makefile.am 2006-10-24 23:00:02 UTC (rev
3550)
+++ gnunet-gtk/src/plugins/fs/Makefile.am 2006-10-24 23:12:03 UTC (rev
3551)
@@ -11,7 +11,6 @@
libgnunetgtkmodule_fs_la_SOURCES = \
collection.c collection.h \
- download.c download.h \
fs.c fs.h \
helper.c helper.h \
meta.c meta.h \
Modified: gnunet-gtk/src/plugins/fs/download.c
===================================================================
--- gnunet-gtk/src/plugins/fs/download.c 2006-10-24 23:00:02 UTC (rev
3550)
+++ gnunet-gtk/src/plugins/fs/download.c 2006-10-24 23:12:03 UTC (rev
3551)
@@ -195,12 +195,6 @@
we'll just add it as a new tab for now */
run_with_save_calls(&startSearch,
&idc);
- if (idc.ret != NULL)
- openTabForSearch(idc.ret,
- idc.uri,
- idc.anon,
- 0,
- NULL);
return;
} else {
GE_BREAK(ectx, 0); /* unsupported URI type (i.e. ksk or loc) */
Modified: gnunet-gtk/src/plugins/fs/download.h
===================================================================
--- gnunet-gtk/src/plugins/fs/download.h 2006-10-24 23:00:02 UTC (rev
3550)
+++ gnunet-gtk/src/plugins/fs/download.h 2006-10-24 23:12:03 UTC (rev
3551)
@@ -29,21 +29,4 @@
#include <GNUnet/gnunet_ecrs_lib.h>
-/**
- */
-void displayDownloadUpdate(const struct ECRS_URI * uri,
- unsigned long long completed,
- const char * data,
- unsigned int size);
-
-/**
- */
-void displayDownloadComplete(const struct ECRS_URI * uri,
- const char * filename);
-
-void fs_download_start(struct GE_Context * e,
- struct GC_Configuration * c);
-
-void fs_download_stop(void);
-
#endif
Modified: gnunet-gtk/src/plugins/fs/fs.h
===================================================================
--- gnunet-gtk/src/plugins/fs/fs.h 2006-10-24 23:00:02 UTC (rev 3550)
+++ gnunet-gtk/src/plugins/fs/fs.h 2006-10-24 23:12:03 UTC (rev 3551)
@@ -47,6 +47,7 @@
NS_SEARCH_DESCRIPTION = 0,
NS_SEARCH_ENCNAME,
NS_SEARCH_METADATA,
+ NS_SEARCH_FSUI,
NS_SEARCH_RATING,
NS_SEARCH_NUM,
};
@@ -55,6 +56,7 @@
SER_SUM_NAME = 0,
SER_SUM_COUNT,
SER_SUM_URI,
+ SER_SUM_FSUI,
SER_SUM_NUM
};
Modified: gnunet-gtk/src/plugins/fs/helper.c
===================================================================
--- gnunet-gtk/src/plugins/fs/helper.c 2006-10-24 23:00:02 UTC (rev 3550)
+++ gnunet-gtk/src/plugins/fs/helper.c 2006-10-24 23:12:03 UTC (rev 3551)
@@ -92,3 +92,116 @@
return OK;
}
+/**
+ * FIXME: convert this into a glade widget!
+ */
+GtkWidget *
+buildSearchTabLabel(GtkWidget *searchPage,
+ const char *title) {
+ GtkWidget *hbox;
+ GtkWidget *label_hbox;
+ GtkWidget *label_ebox;
+ GtkWidget *label;
+ GtkWidget *dummy_label;
+ GtkWidget *close_button;
+ GtkRcStyle *rcstyle;
+ GtkRequisition size;
+ GtkWidget *image;
+ char *short_title;
+ char *orig_title;
+ char *final_title;
+ char *short_title_end;
+ char *tip_title;
+ int short_title_len;
+ static GtkTooltips *searchTabLabelTooltip = NULL;
+ unsigned int *file_count;
+
+ if(!searchTabLabelTooltip)
+ searchTabLabelTooltip = gtk_tooltips_new();
+
+ hbox = gtk_hbox_new (FALSE, 2);
+
+ label_ebox = gtk_event_box_new ();
+ gtk_event_box_set_visible_window (GTK_EVENT_BOX (label_ebox), FALSE);
+ gtk_box_pack_start (GTK_BOX (hbox), label_ebox, TRUE, TRUE, 0);
+
+ label_hbox = gtk_hbox_new (FALSE, 2);
+ gtk_container_add (GTK_CONTAINER (label_ebox), label_hbox);
+
+ /* setup close button */
+ close_button = gtk_button_new ();
+ gtk_button_set_relief (GTK_BUTTON (close_button),
+ GTK_RELIEF_NONE);
+ /* don't allow focus on the close button */
+ gtk_button_set_focus_on_click (GTK_BUTTON (close_button), FALSE);
+
+ /* make it as small as possible */
+ rcstyle = gtk_rc_style_new ();
+ rcstyle->xthickness = 0;
+ rcstyle->ythickness = 0;
+ gtk_widget_modify_style (close_button, rcstyle);
+ gtk_rc_style_unref (rcstyle),
+
+ image = gtk_image_new_from_stock (GTK_STOCK_CLOSE,
+ GTK_ICON_SIZE_MENU);
+ gtk_widget_size_request (image, &size);
+ gtk_widget_set_size_request (close_button, size.width, size.height);
+ gtk_container_add (GTK_CONTAINER (close_button), image);
+ gtk_box_pack_start (GTK_BOX (hbox), close_button, FALSE, FALSE, 0);
+
+ g_signal_connect_swapped(close_button,
+ "clicked",
+ G_CALLBACK (on_closeSearchButton_clicked_fs),
+ searchPage);
+
+ /* truncate the description if needed */
+ if(g_utf8_strlen(title, 16) > 15) {
+ short_title_end = g_utf8_offset_to_pointer (title, 15);
+ short_title_len = short_title_end - title;
+ short_title = g_strndup(title, short_title_len);
+ orig_title = g_strconcat(short_title, "...", NULL);
+ FREE(short_title);
+ } else {
+ orig_title = STRDUP(title);
+ }
+
+ /* setup label */
+ final_title = g_strconcat(orig_title, " (0)", NULL);
+ label = gtk_label_new (final_title);
+ FREE(final_title);
+
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_misc_set_padding (GTK_MISC (label), 0, 0);
+ gtk_box_pack_start (GTK_BOX (label_hbox), label, FALSE, FALSE, 0);
+
+ /* add a forced space before the button */
+ dummy_label = gtk_label_new ("");
+ gtk_box_pack_start (GTK_BOX (label_hbox), dummy_label, TRUE, TRUE, 0);
+
+ /* tooltips */
+ gtk_tooltips_set_tip(searchTabLabelTooltip, close_button,
+ _("Close this search"), NULL);
+ tip_title = g_strconcat (_("Search: "), title, NULL);
+ gtk_tooltips_set_tip(searchTabLabelTooltip, label_ebox,
+ tip_title, NULL);
+
+ /* store some references to access count & title later */
+ file_count = malloc(sizeof(unsigned int));
+ *file_count = 0;
+ g_object_set_data(G_OBJECT(searchPage),
+ "file_count", (gpointer) file_count);
+ g_object_set_data(G_OBJECT(searchPage),
+ "label", (gpointer) label);
+ g_object_set_data(G_OBJECT(searchPage),
+ "title", (gpointer) orig_title);
+
+ gtk_widget_show (hbox);
+ gtk_widget_show (label_ebox);
+ gtk_widget_show (label_hbox);
+ gtk_widget_show (label);
+ gtk_widget_show (dummy_label);
+ gtk_widget_show (image);
+ gtk_widget_show (close_button);
+
+ return hbox;
+}
Modified: gnunet-gtk/src/plugins/fs/helper.h
===================================================================
--- gnunet-gtk/src/plugins/fs/helper.h 2006-10-24 23:00:02 UTC (rev 3550)
+++ gnunet-gtk/src/plugins/fs/helper.h 2006-10-24 23:12:03 UTC (rev 3551)
@@ -27,6 +27,19 @@
* @author Christian Grothoff
*/
+/* Create the tab label and icon,
+ * adding a little button to close the search
+ * This function is a modified version of an Epiphany/Gedit code,
+ * part of this work is copyrighted (GPL license) by its authors.
+ *
+ * @param the title of the new label
+ * @returns the created widget to pack into the page header
+ */
+GtkWidget *
+buildSearchTabLabel (GtkWidget *searchPage,
+ const char *title);
+
+
/**
* Parse a time given in the form
* "XX seconds yy days zz months".
Modified: gnunet-gtk/src/plugins/fs/namespace.c
===================================================================
--- gnunet-gtk/src/plugins/fs/namespace.c 2006-10-24 23:00:02 UTC (rev
3550)
+++ gnunet-gtk/src/plugins/fs/namespace.c 2006-10-24 23:12:03 UTC (rev
3551)
@@ -1208,7 +1208,149 @@
YES : NO);
}
+/**
+ * The spin button giving the rating for a particular namespace
+ * has been changed. Store the new rating for the namespace.
+ */
+void on_namespaceRatingSpinButton_changed_fs(GtkWidget * dummy,
+ GtkWidget * dummy2) {
+ GtkWidget * spin;
+ GtkWidget * ncbe;
+ GtkTreeModel * model;
+ GtkTreeIter iter;
+ char * encStr;
+ char * description;
+ int rating;
+ int newrating;
+ DEBUG_BEGIN();
+ spin
+ = glade_xml_get_widget(getMainXML(),
+ "namespaceRatingSpinButton");
+ ncbe
+ = glade_xml_get_widget(getMainXML(),
+ "searchNamespaceComboBoxEntry");
+ model = gtk_combo_box_get_model(GTK_COMBO_BOX(ncbe));
+ if (TRUE == gtk_combo_box_get_active_iter(GTK_COMBO_BOX(ncbe),
+ &iter)) {
+ gtk_tree_model_get(model,
+ &iter,
+ NS_SEARCH_DESCRIPTION, &description,
+ NS_SEARCH_ENCNAME, &encStr,
+ NS_SEARCH_RATING, &rating,
+ -1);
+ if ( (description != NULL) &&
+ (0 == strcmp(description,
+ _("globally"))) ) {
+ /* just to be sure */
+ gtk_widget_set_sensitive(spin,
+ FALSE);
+ } else {
+ if (encStr != NULL) {
+ newrating = gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin));
+ rating = NS_rankNamespace(ectx,
+ cfg,
+ encStr,
+ newrating - rating);
+ if (rating != newrating) {
+ /* concurrent modification? */
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),
+ rating);
+ GE_BREAK(ectx, 0);
+ }
+ gtk_list_store_set(GTK_LIST_STORE(model),
+ &iter,
+ NS_SEARCH_RATING, rating,
+ -1);
+ }
+ }
+ } else {
+ /* FIXME: if enc2hash succeeds, we may want to keep this
+ active */
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),
+ 0);
+ gtk_widget_set_sensitive(spin,
+ FALSE);
+ }
+ DEBUG_END();
+}
+
+
+/**
+ * The namespace in the search window has changed.
+ * Update the trust level (possibly changing sensitivity)
+ * and set the search string to the root (if available).
+ */
+void on_searchNamespaceComboBoxEntry_changed_fs(GtkWidget * dummy,
+ GtkWidget * dummy2) {
+ GtkWidget * keyword;
+ GtkWidget * spin;
+ GtkWidget * ncbe;
+ GtkTreeModel * model;
+ GtkTreeIter iter;
+ int rating;
+ char * encStr;
+ char * descStr;
+ HashCode512 ns;
+ HashCode512 root;
+ EncName enc;
+
+ DEBUG_BEGIN();
+ spin
+ = glade_xml_get_widget(getMainXML(),
+ "namespaceRatingSpinButton");
+ ncbe
+ = glade_xml_get_widget(getMainXML(),
+ "searchNamespaceComboBoxEntry");
+ model = gtk_combo_box_get_model(GTK_COMBO_BOX(ncbe));
+ if (TRUE == gtk_combo_box_get_active_iter(GTK_COMBO_BOX(ncbe),
+ &iter)) {
+ encStr = NULL;
+ descStr = NULL;
+ gtk_tree_model_get(model,
+ &iter,
+ NS_SEARCH_DESCRIPTION, &descStr,
+ NS_SEARCH_ENCNAME, &encStr,
+ NS_SEARCH_RATING, &rating,
+ -1);
+ if ( (descStr != NULL) &&
+ (0 == strcmp(descStr,
+ _("globally"))) ) {
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),
+ 0);
+ gtk_widget_set_sensitive(spin,
+ FALSE);
+ } else if (encStr != NULL) {
+ enc2hash(encStr,
+ &ns);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),
+ rating);
+ gtk_widget_set_sensitive(spin,
+ TRUE);
+ if (OK == NS_getNamespaceRoot(ectx,
+ cfg,
+ encStr,
+ &root)) {
+ hash2enc(&root,
+ &enc);
+ keyword
+ = glade_xml_get_widget(getMainXML(),
+ "fssearchKeywordComboBoxEntry");
+ gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(keyword))),
+ (const gchar*) &enc);
+ }
+ }
+ } else {
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),
+ 0);
+ gtk_widget_set_sensitive(spin,
+ FALSE);
+ }
+ DEBUG_END();
+}
+
+
+
void fs_namespace_start(struct GE_Context * e,
struct GC_Configuration * c) {
GtkWidget * contentList;
Modified: gnunet-gtk/src/plugins/fs/search.c
===================================================================
--- gnunet-gtk/src/plugins/fs/search.c 2006-10-24 23:00:02 UTC (rev 3550)
+++ gnunet-gtk/src/plugins/fs/search.c 2006-10-24 23:12:03 UTC (rev 3551)
@@ -209,146 +209,6 @@
iter));
}
-/**
- * The spin button giving the rating for a particular namespace
- * has been changed. Store the new rating for the namespace.
- */
-void on_namespaceRatingSpinButton_changed_fs(GtkWidget * dummy,
- GtkWidget * dummy2) {
- GtkWidget * spin;
- GtkWidget * ncbe;
- GtkTreeModel * model;
- GtkTreeIter iter;
- char * encStr;
- char * description;
- int rating;
- int newrating;
-
- DEBUG_BEGIN();
- spin
- = glade_xml_get_widget(getMainXML(),
- "namespaceRatingSpinButton");
- ncbe
- = glade_xml_get_widget(getMainXML(),
- "searchNamespaceComboBoxEntry");
- model = gtk_combo_box_get_model(GTK_COMBO_BOX(ncbe));
- if (TRUE == gtk_combo_box_get_active_iter(GTK_COMBO_BOX(ncbe),
- &iter)) {
- gtk_tree_model_get(model,
- &iter,
- NS_SEARCH_DESCRIPTION, &description,
- NS_SEARCH_ENCNAME, &encStr,
- NS_SEARCH_RATING, &rating,
- -1);
- if ( (description != NULL) &&
- (0 == strcmp(description,
- _("globally"))) ) {
- /* just to be sure */
- gtk_widget_set_sensitive(spin,
- FALSE);
- } else {
- if (encStr != NULL) {
- newrating = gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin));
- rating = NS_rankNamespace(ectx,
- cfg,
- encStr,
- newrating - rating);
- if (rating != newrating) {
- /* concurrent modification? */
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),
- rating);
- GE_BREAK(ectx, 0);
- }
- gtk_list_store_set(GTK_LIST_STORE(model),
- &iter,
- NS_SEARCH_RATING, rating,
- -1);
- }
- }
- } else {
- /* FIXME: if enc2hash succeeds, we may want to keep this
- active */
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),
- 0);
- gtk_widget_set_sensitive(spin,
- FALSE);
- }
- DEBUG_END();
-}
-
-/**
- * The namespace in the search window has changed.
- * Update the trust level (possibly changing sensitivity)
- * and set the search string to the root (if available).
- */
-void on_searchNamespaceComboBoxEntry_changed_fs(GtkWidget * dummy,
- GtkWidget * dummy2) {
- GtkWidget * keyword;
- GtkWidget * spin;
- GtkWidget * ncbe;
- GtkTreeModel * model;
- GtkTreeIter iter;
- int rating;
- char * encStr;
- char * descStr;
- HashCode512 ns;
- HashCode512 root;
- EncName enc;
-
- DEBUG_BEGIN();
- spin
- = glade_xml_get_widget(getMainXML(),
- "namespaceRatingSpinButton");
- ncbe
- = glade_xml_get_widget(getMainXML(),
- "searchNamespaceComboBoxEntry");
- model = gtk_combo_box_get_model(GTK_COMBO_BOX(ncbe));
- if (TRUE == gtk_combo_box_get_active_iter(GTK_COMBO_BOX(ncbe),
- &iter)) {
- encStr = NULL;
- descStr = NULL;
- gtk_tree_model_get(model,
- &iter,
- NS_SEARCH_DESCRIPTION, &descStr,
- NS_SEARCH_ENCNAME, &encStr,
- NS_SEARCH_RATING, &rating,
- -1);
- if ( (descStr != NULL) &&
- (0 == strcmp(descStr,
- _("globally"))) ) {
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),
- 0);
- gtk_widget_set_sensitive(spin,
- FALSE);
- } else if (encStr != NULL) {
- enc2hash(encStr,
- &ns);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),
- rating);
- gtk_widget_set_sensitive(spin,
- TRUE);
- if (OK == NS_getNamespaceRoot(ectx,
- cfg,
- encStr,
- &root)) {
- hash2enc(&root,
- &enc);
- keyword
- = glade_xml_get_widget(getMainXML(),
- "fssearchKeywordComboBoxEntry");
- gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(keyword))),
- (const gchar*) &enc);
- }
- }
- } else {
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),
- 0);
- gtk_widget_set_sensitive(spin,
- FALSE);
- }
- DEBUG_END();
-}
-
void on_searchResults_destroy_fs(GtkWidget * dummy,
GtkWidget * treeview) {
GtkTreeStore * tree;
@@ -1044,7 +904,8 @@
int i;
unsigned int *file_count;
GtkWidget *tab_label;
- char *tab_title, *new_title;
+ char * tab_title;
+ char * new_title;
DEBUG_BEGIN();
description = ECRS_uriToString(uri);
@@ -1122,8 +983,8 @@
void fs_search_start(struct GE_Context * e,
struct GC_Configuration * c) {
GtkWidget * searchCB;
- GtkListStore * model;
GtkWidget * searchList;
+ GtkListStore * model;
GtkCellRenderer * renderer;
GtkTreeViewColumn * column;
int col;
@@ -1138,26 +999,20 @@
model = gtk_list_store_new(NS_SEARCH_NUM,
G_TYPE_STRING, /* what we show */
G_TYPE_STRING, /* EncName of namespace */
- G_TYPE_POINTER,
+ G_TYPE_POINTER, /* ECRS MetaData */
+ G_TYPE_POINTER, /* FSUI search list */
G_TYPE_INT); /* Meta-data about namespace */
gtk_combo_box_set_model(GTK_COMBO_BOX(searchCB),
GTK_TREE_MODEL(model));
gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(searchCB),
NS_SEARCH_DESCRIPTION);
-#if 0
- /* FIXME: replace with event callback! */
- cron_job_add(cron,
- &updateNCBModel,
- 0,
- 5 * cronMINUTES,
- NULL);
-#endif
searchList = glade_xml_get_widget(getMainXML(),
"activeSearchesSummary");
summary =
gtk_list_store_new(SER_SUM_NUM,
G_TYPE_STRING, /* name */
G_TYPE_INT, /* # results */
+ G_TYPE_POINTER, /* internal: FSUI search list */
G_TYPE_POINTER); /* internal: uri */
gtk_tree_view_set_model(GTK_TREE_VIEW(searchList),
GTK_TREE_MODEL(summary));
@@ -1174,8 +1029,6 @@
gtk_tree_view_column_set_clickable(column, TRUE);
gtk_tree_view_column_set_reorderable(column, TRUE);
gtk_tree_view_column_set_sort_column_id(column, SER_SUM_NAME);
- /*gtk_tree_view_column_set_sort_indicator(column, TRUE);*/
-
gtk_tree_view_column_set_resizable(gtk_tree_view_get_column(GTK_TREE_VIEW(searchList),
col - 1),
TRUE);
@@ -1199,149 +1052,8 @@
}
void fs_search_stop() {
- SearchList * list;
- GtkTreeIter iter;
- struct ECRS_URI * u;
-
-#if 0
- cron_job_del(cron,
- &updateNCBModel,
- 5 * cronMINUTES,
- NULL);
-#endif
- while (head != NULL) {
- list = head;
- head = head->next;
- freeSearchModel(list->model, NULL);
- gtkSaveCall((SimpleCallback)&closeSearchPage,
- list);
- FREE(list);
- }
-
- /* free URIs in summary */
- if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary),
- &iter)) {
- do {
- gtk_tree_model_get(GTK_TREE_MODEL(summary),
- &iter,
- SER_SUM_URI, &u,
- -1);
- if (u != NULL)
- ECRS_freeUri(u);
- gtk_list_store_set(summary,
- &iter,
- SER_SUM_URI, NULL,
- -1);
- } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary),
- &iter));
- }
}
-/* Create the tab label and icon,
- * adding a little button to close the search
- * This function is a modified version of an Epiphany/Gedit code,
- * part of this work is copyrighted (GPL license) by its authors.
- */
-GtkWidget *buildSearchTabLabel(GtkWidget *searchPage,
- const char *title) {
- GtkWidget *hbox, *label_hbox, *label_ebox;
- GtkWidget *label, *dummy_label;
- GtkWidget *close_button;
- GtkRcStyle *rcstyle;
- GtkRequisition size;
- GtkWidget *image;
- char *short_title, *orig_title, *final_title;
- char *short_title_end, *tip_title;
- int short_title_len;
- static GtkTooltips *searchTabLabelTooltip = NULL;
- unsigned int *file_count;
- if(!searchTabLabelTooltip)
- searchTabLabelTooltip = gtk_tooltips_new();
- hbox = gtk_hbox_new (FALSE, 2);
-
- label_ebox = gtk_event_box_new ();
- gtk_event_box_set_visible_window (GTK_EVENT_BOX (label_ebox), FALSE);
- gtk_box_pack_start (GTK_BOX (hbox), label_ebox, TRUE, TRUE, 0);
-
- label_hbox = gtk_hbox_new (FALSE, 2);
- gtk_container_add (GTK_CONTAINER (label_ebox), label_hbox);
-
- /* setup close button */
- close_button = gtk_button_new ();
- gtk_button_set_relief (GTK_BUTTON (close_button),
- GTK_RELIEF_NONE);
- /* don't allow focus on the close button */
- gtk_button_set_focus_on_click (GTK_BUTTON (close_button), FALSE);
-
- /* make it as small as possible */
- rcstyle = gtk_rc_style_new ();
- rcstyle->xthickness = rcstyle->ythickness = 0;
- gtk_widget_modify_style (close_button, rcstyle);
- gtk_rc_style_unref (rcstyle),
-
- image = gtk_image_new_from_stock (GTK_STOCK_CLOSE,
- GTK_ICON_SIZE_MENU);
- gtk_widget_size_request (image, &size);
- gtk_widget_set_size_request (close_button, size.width, size.height);
- gtk_container_add (GTK_CONTAINER (close_button), image);
- gtk_box_pack_start (GTK_BOX (hbox), close_button, FALSE, FALSE, 0);
-
- g_signal_connect_swapped(close_button,
- "clicked",
- G_CALLBACK (on_closeSearchButton_clicked_fs),
- searchPage);
-
- /* truncate the description if needed */
- if(g_utf8_strlen(title, 16) > 15) {
- short_title_end = g_utf8_offset_to_pointer (title, 15);
- short_title_len = short_title_end - title;
- short_title = g_strndup(title, short_title_len);
- orig_title = g_strconcat(short_title, "...", NULL);
- FREE(short_title); }
- else {
- orig_title = STRDUP(title); }
-
- /* setup label */
- final_title = g_strconcat(orig_title, " (0)", NULL);
- label = gtk_label_new (final_title);
- FREE(final_title);
-
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_misc_set_padding (GTK_MISC (label), 0, 0);
- gtk_box_pack_start (GTK_BOX (label_hbox), label, FALSE, FALSE, 0);
-
- /* add a forced space before the button */
- dummy_label = gtk_label_new ("");
- gtk_box_pack_start (GTK_BOX (label_hbox), dummy_label, TRUE, TRUE, 0);
-
- /* tooltips */
- gtk_tooltips_set_tip(searchTabLabelTooltip, close_button,
- _("Close this search"), NULL);
- tip_title = g_strconcat (_("Search: "), title, NULL);
- gtk_tooltips_set_tip(searchTabLabelTooltip, label_ebox,
- tip_title, NULL);
-
- /* store some references to access count & title later */
- file_count = malloc(sizeof(unsigned int));
- *file_count = 0;
- g_object_set_data(G_OBJECT(searchPage),
- "file_count", (gpointer) file_count);
- g_object_set_data(G_OBJECT(searchPage),
- "label", (gpointer) label);
- g_object_set_data(G_OBJECT(searchPage),
- "title", (gpointer) orig_title);
-
- gtk_widget_show (hbox);
- gtk_widget_show (label_ebox);
- gtk_widget_show (label_hbox);
- gtk_widget_show (label);
- gtk_widget_show (dummy_label);
- gtk_widget_show (image);
- gtk_widget_show (close_button);
-
- return hbox;
-}
-
/* end of search.c */
Modified: gnunet-gtk/src/plugins/fs/search.h
===================================================================
--- gnunet-gtk/src/plugins/fs/search.h 2006-10-24 23:00:02 UTC (rev 3550)
+++ gnunet-gtk/src/plugins/fs/search.h 2006-10-24 23:12:03 UTC (rev 3551)
@@ -30,19 +30,26 @@
#include <GNUnet/gnunet_ecrs_lib.h>
#include <GNUnet/gnunet_fsui_lib.h>
-/**
- * Add an entry to the search tree.
- *
- * @param model the search model
- * @param pos the position to add the entry
- * @param uri the URI to add
- * @param meta metadata describing the URI
- */
-void addEntryToSearchTree(GtkTreeStore * model,
- GtkTreeIter * pos,
- const struct ECRS_URI * uri,
- const struct ECRS_MetaData * meta);
+void * fs_download_started(void * downloadContext,
+ unsigned long long total,
+ unsigned int anonymityLevel,
+ const struct ECRS_URI * uri,
+ const char * filename,
+ unsigned long long completed,
+ cron_t eta);
+void fs_download_update(void * downloadContext,
+ unsigned long long completed,
+ const char * data,
+ unsigned int size);
+
+void fs_download_completed(void * downloadContext);
+
+void fs_download_aborted(void * downloadContext);
+
+void fs_download_stopped(void * downloadContext);
+
+
/**
* Add the given result to the model (search result
* list).
@@ -51,34 +58,42 @@
* @param path the tree path that selects where to add
* the information, NULL for top-level
*/
-void displaySearchResult(const ECRS_FileInfo * info,
+void fs_search_result_received(void * searchContext,
+ const ECRS_FileInfo * info,
+ const struct ECRS_URI * uri);
+
+/**
+ * A search has been started. Open tab.
+ *
+ * @return internal search context
+ */
+void * fs_search_started(struct FSUI_SearchList * list,
const struct ECRS_URI * uri,
- GtkTreeRowReference * row);
+ unsigned int anonymityLevel,
+ unsigned int resultCount,
+ const ECRS_FileInfo * results);
/**
- * Helper for download.
+ * A search process has been aborted. Update display.
*/
-GtkWidget * getAnonymityButtonFromTM(GtkTreeModel * model);
+void fs_search_aborted(void * searchContext);
-int openTabForSearch(struct FSUI_SearchList * list,
- const struct ECRS_URI * uri,
- unsigned int anonymityLevel,
- unsigned int resultCount,
- const ECRS_FileInfo * results);
+/**
+ * A search process has stopped. Clean up.
+ */
+void fs_search_stopped(void * searchContext);
+
+/**
+ * Initialize the search module.
+ */
void fs_search_start(struct GE_Context * e,
struct GC_Configuration * c);
+/**
+ * Shutdown the search module.
+ */
void fs_search_stop(void);
-/* Create the tab label and icon,
- * adding a little button to close the search
- * This function is a modified version of an Epiphany/Gedit code,
- * part of this work is copyrighted (GPL license) by its authors.
- *
- * @param the title of the new label
- * @returns the created widget to pack into the page header
- */
-GtkWidget *buildSearchTabLabel (GtkWidget *searchPage, const char *title);
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3551 - gnunet-gtk/src/plugins/fs,
grothoff <=