[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3567 - in gnunet-gtk: . src/plugins/fs
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3567 - in gnunet-gtk: . src/plugins/fs |
Date: |
Sun, 29 Oct 2006 15:57:55 -0800 (PST) |
Author: grothoff
Date: 2006-10-29 15:57:48 -0800 (Sun, 29 Oct 2006)
New Revision: 3567
Modified:
gnunet-gtk/gnunet-gtk.glade
gnunet-gtk/src/plugins/fs/download.c
gnunet-gtk/src/plugins/fs/search.c
gnunet-gtk/src/plugins/fs/upload.c
Log:
more event handlers and proper save calling
Modified: gnunet-gtk/gnunet-gtk.glade
===================================================================
--- gnunet-gtk/gnunet-gtk.glade 2006-10-29 23:35:44 UTC (rev 3566)
+++ gnunet-gtk/gnunet-gtk.glade 2006-10-29 23:57:48 UTC (rev 3567)
@@ -1236,7 +1236,7 @@
<property name="use_stock">True</property>
<property
name="relief">GTK_RELIEF_NORMAL</property>
<property
name="focus_on_click">True</property>
- <signal name="clicked"
handler="on_abortDownloadButton_clicked" last_modification_time="Wed, 01 Jun
2005 19:54:07 GMT"/>
+ <signal name="clicked"
handler="on_abortDownloadButton_clicked_" last_modification_time="Wed, 01 Jun
2005 19:54:07 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
@@ -1414,7 +1414,7 @@
<property name="use_stock">True</property>
<property
name="relief">GTK_RELIEF_NORMAL</property>
<property
name="focus_on_click">True</property>
- <signal name="clicked"
handler="on_clearCompletedDownloadsButton_clicked_"
last_modification_time="Wed, 01 Jun 2005 19:53:58 GMT"/>
+ <signal name="clicked"
handler="on_clearCompletedUploadsButton_clicked_" last_modification_time="Mon,
30 Oct 2006 00:26:29 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
Modified: gnunet-gtk/src/plugins/fs/download.c
===================================================================
--- gnunet-gtk/src/plugins/fs/download.c 2006-10-29 23:35:44 UTC (rev
3566)
+++ gnunet-gtk/src/plugins/fs/download.c 2006-10-29 23:57:48 UTC (rev
3567)
@@ -639,13 +639,26 @@
FREE(urid);
}
+struct FCBC {
+ int (*method)(struct FSUI_Context * ctx,
+ struct FSUI_DownloadList * list);
+ struct FSUI_DownloadList * argument;
+};
+static void * fsui_callback(void * cls) {
+ struct FCBC * fcbc = cls;
+ fcbc->method(ctx,
+ fcbc->argument);
+ return NULL;
+}
+
static void
clearCompletedDownloadCallback(GtkTreeModel * model,
GtkTreePath * path,
GtkTreeIter * iter,
gpointer unused) {
DownloadList * dl;
+ struct FCBC fcbc;
GE_ASSERT(ectx,
model == GTK_TREE_MODEL(download_summary));
@@ -653,9 +666,12 @@
iter,
DOWNLOAD_INTERNAL, &dl,
-1);
- if (dl->has_terminated)
- FSUI_stopDownload(ctx,
- dl->fsui_list);
+ if (dl->has_terminated) {
+ fcbc.method = &FSUI_stopDownload;
+ fcbc.argument = dl->fsui_list;
+ run_with_save_calls(&fsui_callback,
+ &fcbc);
+ }
}
void on_clearCompletedDownloadsButton_clicked_fs(void * unused,
@@ -673,11 +689,12 @@
}
static void
-abortDownloadCallback(GtkTreeModel * model,
- GtkTreePath * path,
- GtkTreeIter * iter,
- gpointer unused) {
+fsuiCallDownloadCallback(GtkTreeModel * model,
+ GtkTreePath * path,
+ GtkTreeIter * iter,
+ gpointer fsui_call) {
DownloadList * dl;
+ struct FCBC fcbc;
GE_ASSERT(ectx,
model == GTK_TREE_MODEL(download_summary));
@@ -685,8 +702,10 @@
iter,
DOWNLOAD_INTERNAL, &dl,
-1);
- FSUI_abortDownload(ctx,
- dl->fsui_list);
+ fcbc.method = fsui_call;
+ fcbc.argument = dl->fsui_list;
+ run_with_save_calls(&fsui_callback,
+ &fcbc);
}
void on_abortDownloadButton_clicked_fs(void * unused,
@@ -699,8 +718,22 @@
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(downloadList));
gtk_tree_selection_selected_foreach
(selection,
- &abortDownloadCallback,
- NULL);
+ &fsuiCallDownloadCallback,
+ &FSUI_abortDownload);
}
+void on_stopDownloadButton_clicked_fs(void * unused,
+ GtkWidget * clearButton) {
+ GtkTreeSelection * selection;
+ GtkWidget * downloadList;
+
+ downloadList = glade_xml_get_widget(getMainXML(),
+ "activeDownloadsList");
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(downloadList));
+ gtk_tree_selection_selected_foreach
+ (selection,
+ &fsuiCallDownloadCallback,
+ &FSUI_stopDownload);
+}
+
/* end of download.c */
Modified: gnunet-gtk/src/plugins/fs/search.c
===================================================================
--- gnunet-gtk/src/plugins/fs/search.c 2006-10-29 23:35:44 UTC (rev 3566)
+++ gnunet-gtk/src/plugins/fs/search.c 2006-10-29 23:57:48 UTC (rev 3567)
@@ -588,6 +588,19 @@
uri);
}
+struct FCBC {
+ int (*method)(struct FSUI_Context * ctx,
+ struct FSUI_SearchList * list);
+ struct FSUI_SearchList * argument;
+};
+
+static void * fsui_callback(void * cls) {
+ struct FCBC * fcbc = cls;
+ fcbc->method(ctx,
+ fcbc->argument);
+ return NULL;
+}
+
/**
* This method is called when the user clicks on either
* the "CLOSE" button (at the bottom of the search page)
@@ -599,6 +612,7 @@
void on_closeSearchButton_clicked_fs(GtkWidget * searchPage,
GtkWidget * closeButton) {
SearchList * list;
+ struct FCBC fcbc;
list = search_head;
while (list != NULL) {
@@ -608,8 +622,10 @@
list = list->next;
}
GE_ASSERT(ectx, list != NULL);
- FSUI_stopSearch(ctx,
- list->fsui_list);
+ fcbc.method = &FSUI_stopSearch;
+ fcbc.argument = list->fsui_list;
+ run_with_save_calls(&fsui_callback,
+ &fcbc);
}
/**
@@ -635,15 +651,19 @@
GtkTreeIter * iter,
gpointer unused) {
SearchList * s;
+ struct FCBC fcbc;
s = NULL;
gtk_tree_model_get(model,
iter,
SEARCH_SUMMARY_INTERNAL, &s,
-1);
- if (s != NULL)
- FSUI_stopSearch(ctx,
- s->fsui_list);
+ if (s != NULL) {
+ fcbc.method = &FSUI_stopSearch;
+ fcbc.argument = s->fsui_list;
+ run_with_save_calls(&fsui_callback,
+ &fcbc);
+ }
}
/**
@@ -665,15 +685,19 @@
GtkTreeIter * iter,
gpointer unused) {
SearchList * s;
+ struct FCBC fcbc;
s = NULL;
gtk_tree_model_get(model,
iter,
SEARCH_SUMMARY_INTERNAL, &s,
-1);
- if (s != NULL)
- FSUI_abortSearch(ctx,
- s->fsui_list);
+ if (s != NULL) {
+ fcbc.method = &FSUI_abortSearch;
+ fcbc.argument = s->fsui_list;
+ run_with_save_calls(&fsui_callback,
+ &fcbc);
+ }
}
/**
Modified: gnunet-gtk/src/plugins/fs/upload.c
===================================================================
--- gnunet-gtk/src/plugins/fs/upload.c 2006-10-29 23:35:44 UTC (rev 3566)
+++ gnunet-gtk/src/plugins/fs/upload.c 2006-10-29 23:57:48 UTC (rev 3567)
@@ -390,4 +390,105 @@
free(filename);
}
+/* FIXME: handlers for clear and stop! */
+
+struct FCBC {
+ int (*method)(struct FSUI_Context * ctx,
+ struct FSUI_UploadList * list);
+ struct FSUI_UploadList * argument;
+};
+
+static void * fsui_callback(void * cls) {
+ struct FCBC * fcbc = cls;
+ fcbc->method(ctx,
+ fcbc->argument);
+ return NULL;
+}
+
+static void
+clearCompletedUploadCallback(GtkTreeModel * model,
+ GtkTreePath * path,
+ GtkTreeIter * iter,
+ gpointer unused) {
+ UploadList * ul;
+ struct FCBC fcbc;
+
+ GE_ASSERT(ectx,
+ model == GTK_TREE_MODEL(upload_summary));
+ gtk_tree_model_get(model,
+ iter,
+ UPLOAD_INTERNAL, &ul,
+ -1);
+ if (ul->has_terminated) {
+ fcbc.method = &FSUI_stopUpload;
+ fcbc.argument = ul->fsui_list;
+ run_with_save_calls(&fsui_callback,
+ &fcbc);
+ }
+}
+
+void on_clearCompletedUploadsButton_clicked_fs(void * unused,
+ GtkWidget * clearButton) {
+ GtkTreeSelection * selection;
+ GtkWidget * uploadList;
+
+ uploadList = glade_xml_get_widget(getMainXML(),
+ "activeUploadsList");
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(uploadList));
+ gtk_tree_selection_selected_foreach
+ (selection,
+ &clearCompletedUploadCallback,
+ NULL);
+}
+
+static void
+fsuiCallUploadCallback(GtkTreeModel * model,
+ GtkTreePath * path,
+ GtkTreeIter * iter,
+ gpointer fsui_call) {
+ UploadList * ul;
+ struct FCBC fcbc;
+
+ GE_ASSERT(ectx,
+ model == GTK_TREE_MODEL(upload_summary));
+ gtk_tree_model_get(model,
+ iter,
+ UPLOAD_INTERNAL, &ul,
+ -1);
+ fcbc.method = fsui_call;
+ fcbc.argument = ul->fsui_list;
+ run_with_save_calls(&fsui_callback,
+ &fcbc);
+}
+
+void on_abortUploadButton_clicked_fs(void * unused,
+ GtkWidget * clearButton) {
+ GtkTreeSelection * selection;
+ GtkWidget * uploadList;
+
+ uploadList = glade_xml_get_widget(getMainXML(),
+ "activeUploadsList");
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(uploadList));
+ gtk_tree_selection_selected_foreach
+ (selection,
+ &fsuiCallUploadCallback,
+ &FSUI_abortUpload);
+}
+
+void on_stopUploadButton_clicked_fs(void * unused,
+ GtkWidget * clearButton) {
+ GtkTreeSelection * selection;
+ GtkWidget * uploadList;
+
+ uploadList = glade_xml_get_widget(getMainXML(),
+ "activeUploadsList");
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(uploadList));
+ gtk_tree_selection_selected_foreach
+ (selection,
+ &fsuiCallUploadCallback,
+ &FSUI_stopUpload);
+}
+
+
+
/* end of upload.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3567 - in gnunet-gtk: . src/plugins/fs,
grothoff <=