diff options
author | Christian Grothoff <christian@grothoff.org> | 2005-08-31 21:40:52 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2005-08-31 21:40:52 +0000 |
commit | ff57ea67c0451a64b630b312f7c83888c902e82e (patch) | |
tree | d29bb0d32e342bab984af6aedd014cad59e14fec | |
parent | 19e262865374aaadd5cd098376f115bdc0b3e8de (diff) | |
download | gnunet-gtk-ff57ea67c0451a64b630b312f7c83888c902e82e.tar.gz gnunet-gtk-ff57ea67c0451a64b630b312f7c83888c902e82e.zip |
removing whitespace
-rw-r--r-- | src/common/helper.c | 36 | ||||
-rw-r--r-- | src/core/main.c | 16 | ||||
-rw-r--r-- | src/include/gnunetgtk_common.h | 16 | ||||
-rw-r--r-- | src/plugins/about/about.c | 4 | ||||
-rw-r--r-- | src/plugins/daemon/daemon.c | 36 | ||||
-rw-r--r-- | src/plugins/fs/collection.c | 22 | ||||
-rw-r--r-- | src/plugins/fs/download.c | 106 | ||||
-rw-r--r-- | src/plugins/fs/extensions/musicinsert.c | 8 | ||||
-rw-r--r-- | src/plugins/fs/fs.c | 6 | ||||
-rw-r--r-- | src/plugins/fs/helper.c | 8 | ||||
-rw-r--r-- | src/plugins/fs/meta.c | 54 | ||||
-rw-r--r-- | src/plugins/fs/meta.h | 2 | ||||
-rw-r--r-- | src/plugins/fs/namespace.c | 132 | ||||
-rw-r--r-- | src/plugins/fs/search.c | 90 | ||||
-rw-r--r-- | src/plugins/fs/upload.c | 40 | ||||
-rw-r--r-- | src/plugins/stats/functions.c | 52 | ||||
-rw-r--r-- | src/plugins/stats/statistics.c | 126 |
17 files changed, 377 insertions, 377 deletions
diff --git a/src/common/helper.c b/src/common/helper.c index c2d9a971..f323658e 100644 --- a/src/common/helper.c +++ b/src/common/helper.c | |||
@@ -53,7 +53,7 @@ static GtkWidget * infoWindow; | |||
53 | static GtkWidget * infoWindowTextView; | 53 | static GtkWidget * infoWindowTextView; |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * the main thread | 56 | * the main thread |
57 | */ | 57 | */ |
58 | static PTHREAD_T mainThread; | 58 | static PTHREAD_T mainThread; |
59 | 59 | ||
@@ -92,7 +92,7 @@ static gboolean saveCallWrapper(gpointer data) { | |||
92 | } | 92 | } |
93 | 93 | ||
94 | call->func(call->args); | 94 | call->func(call->args); |
95 | if (call->sem != NULL) | 95 | if (call->sem != NULL) |
96 | SEMAPHORE_UP(call->sem); | 96 | SEMAPHORE_UP(call->sem); |
97 | return FALSE; | 97 | return FALSE; |
98 | } | 98 | } |
@@ -102,7 +102,7 @@ static gboolean saveCallWrapper(gpointer data) { | |||
102 | * Since GTK doesn't work with multi-threaded applications under Windows, | 102 | * Since GTK doesn't work with multi-threaded applications under Windows, |
103 | * all GTK operations have to be done in the main thread | 103 | * all GTK operations have to be done in the main thread |
104 | */ | 104 | */ |
105 | void gtkSaveCall(SimpleCallback func, | 105 | void gtkSaveCall(SimpleCallback func, |
106 | void * args) { | 106 | void * args) { |
107 | SaveCall call; | 107 | SaveCall call; |
108 | 108 | ||
@@ -146,7 +146,7 @@ int gtkRunSomeSaveCalls() { | |||
146 | /* sleep here is somewhat important, first of | 146 | /* sleep here is somewhat important, first of |
147 | all, after completion we need to give the | 147 | all, after completion we need to give the |
148 | semaphore-mechanism time to remove the save-call | 148 | semaphore-mechanism time to remove the save-call |
149 | from the list to avoid running it twice; | 149 | from the list to avoid running it twice; |
150 | also, this function might be called in a tight | 150 | also, this function might be called in a tight |
151 | loop (see search.c), so we should give the | 151 | loop (see search.c), so we should give the |
152 | other threads some time to run. */ | 152 | other threads some time to run. */ |
@@ -155,7 +155,7 @@ int gtkRunSomeSaveCalls() { | |||
155 | } | 155 | } |
156 | 156 | ||
157 | /** | 157 | /** |
158 | * Callback for handling "delete_event": close the window | 158 | * Callback for handling "delete_event": close the window |
159 | */ | 159 | */ |
160 | gint on_statusWindow_delete_event(GtkWidget * widget, | 160 | gint on_statusWindow_delete_event(GtkWidget * widget, |
161 | GdkEvent * event, | 161 | GdkEvent * event, |
@@ -186,11 +186,11 @@ static void doInfoMessage(void * args) { | |||
186 | gtk_text_buffer_get_iter_at_offset(buffer, &iter, -1); | 186 | gtk_text_buffer_get_iter_at_offset(buffer, &iter, -1); |
187 | gtk_text_buffer_insert(buffer, | 187 | gtk_text_buffer_insert(buffer, |
188 | &iter, | 188 | &iter, |
189 | info->note, | 189 | info->note, |
190 | -1); | 190 | -1); |
191 | } | 191 | } |
192 | 192 | ||
193 | /** | 193 | /** |
194 | * Appends a message to the info window | 194 | * Appends a message to the info window |
195 | * | 195 | * |
196 | * @param doPopup do we open the window, YES or NO | 196 | * @param doPopup do we open the window, YES or NO |
@@ -205,7 +205,7 @@ void infoMessage(int doPopup, | |||
205 | info.note = g_strdup_vprintf(format, args); | 205 | info.note = g_strdup_vprintf(format, args); |
206 | va_end(args); | 206 | va_end(args); |
207 | info.doPopup = doPopup; | 207 | info.doPopup = doPopup; |
208 | gtkSaveCall(&doInfoMessage, | 208 | gtkSaveCall(&doInfoMessage, |
209 | &info); | 209 | &info); |
210 | g_free(info.note); | 210 | g_free(info.note); |
211 | } | 211 | } |
@@ -229,7 +229,7 @@ static void saveAddLogEntry(void * args) { | |||
229 | (const char*) args); | 229 | (const char*) args); |
230 | } | 230 | } |
231 | 231 | ||
232 | /** | 232 | /** |
233 | * Appends a log entry to the info window | 233 | * Appends a log entry to the info window |
234 | * | 234 | * |
235 | * @param txt the log entry | 235 | * @param txt the log entry |
@@ -239,7 +239,7 @@ void addLogEntry(const char * txt, | |||
239 | ...) { | 239 | ...) { |
240 | va_list args; | 240 | va_list args; |
241 | gchar * note; | 241 | gchar * note; |
242 | 242 | ||
243 | va_start(args, txt); | 243 | va_start(args, txt); |
244 | note = g_strdup_vprintf(txt, args); | 244 | note = g_strdup_vprintf(txt, args); |
245 | va_end(args); | 245 | va_end(args); |
@@ -397,12 +397,12 @@ void initGNUnetGTKCommon(void * callback) { | |||
397 | mainXML = glade_xml_new(gladeFile, | 397 | mainXML = glade_xml_new(gladeFile, |
398 | "mainWindow", | 398 | "mainWindow", |
399 | PACKAGE_NAME); | 399 | PACKAGE_NAME); |
400 | if (mainXML == NULL) | 400 | if (mainXML == NULL) |
401 | errexit(_("Failed to open `%s'.\n"), | 401 | errexit(_("Failed to open `%s'.\n"), |
402 | gladeFile); | 402 | gladeFile); |
403 | statusXML | 403 | statusXML |
404 | = glade_xml_new(getGladeFileName(), | 404 | = glade_xml_new(getGladeFileName(), |
405 | "statusWindow", | 405 | "statusWindow", |
406 | PACKAGE_NAME); | 406 | PACKAGE_NAME); |
407 | infoWindow | 407 | infoWindow |
408 | = glade_xml_get_widget(statusXML, | 408 | = glade_xml_get_widget(statusXML, |
@@ -430,10 +430,10 @@ void shutdownPlugins() { | |||
430 | Plugin * next; | 430 | Plugin * next; |
431 | 431 | ||
432 | next = plugin->next; | 432 | next = plugin->next; |
433 | unloadPlugin(plugin); | 433 | unloadPlugin(plugin); |
434 | plugin = next; | 434 | plugin = next; |
435 | } | 435 | } |
436 | 436 | ||
437 | gtk_widget_destroy(infoWindow); | 437 | gtk_widget_destroy(infoWindow); |
438 | infoWindow = NULL; | 438 | infoWindow = NULL; |
439 | UNREF(statusXML); | 439 | UNREF(statusXML); |
@@ -445,15 +445,15 @@ void shutdownPlugins() { | |||
445 | saveCallsUp = NO; | 445 | saveCallsUp = NO; |
446 | PTHREAD_REL_SELF(&mainThread); | 446 | PTHREAD_REL_SELF(&mainThread); |
447 | MUTEX_LOCK(&sclock); | 447 | MUTEX_LOCK(&sclock); |
448 | for (i=0;i<pscCount;i++) | 448 | for (i=0;i<pscCount;i++) |
449 | psc[i]->func(psc[i]); | 449 | psc[i]->func(psc[i]); |
450 | i = pscCount; | 450 | i = pscCount; |
451 | MUTEX_UNLOCK(&sclock); | 451 | MUTEX_UNLOCK(&sclock); |
452 | /* wait until all PSC-jobs have left | 452 | /* wait until all PSC-jobs have left |
453 | the gtkSaveCall method before destroying | 453 | the gtkSaveCall method before destroying |
454 | the mutex! */ | 454 | the mutex! */ |
455 | while (i != 0) { | 455 | while (i != 0) { |
456 | gnunet_util_sleep(50 * cronMILLIS); | 456 | gnunet_util_sleep(50 * cronMILLIS); |
457 | MUTEX_LOCK(&sclock); | 457 | MUTEX_LOCK(&sclock); |
458 | i = pscCount; | 458 | i = pscCount; |
459 | MUTEX_UNLOCK(&sclock); | 459 | MUTEX_UNLOCK(&sclock); |
@@ -484,7 +484,7 @@ void run_with_save_calls(PThreadMain cb, | |||
484 | PTHREAD_T doneThread; | 484 | PTHREAD_T doneThread; |
485 | void * unused; | 485 | void * unused; |
486 | struct rwsc_closure cls; | 486 | struct rwsc_closure cls; |
487 | 487 | ||
488 | cls.sig = SEMAPHORE_NEW(0); | 488 | cls.sig = SEMAPHORE_NEW(0); |
489 | cls.realMain = cb; | 489 | cls.realMain = cb; |
490 | cls.arg = arg; | 490 | cls.arg = arg; |
diff --git a/src/core/main.c b/src/core/main.c index f738c3e4..84a6f441 100644 --- a/src/core/main.c +++ b/src/core/main.c | |||
@@ -105,21 +105,21 @@ static void customLog(const char * msg) { | |||
105 | addLogEntry("%s", msg); | 105 | addLogEntry("%s", msg); |
106 | } | 106 | } |
107 | 107 | ||
108 | int main(int argc, | 108 | int main(int argc, |
109 | char *argv[]) { | 109 | char *argv[]) { |
110 | GtkWidget * root; | 110 | GtkWidget * root; |
111 | 111 | ||
112 | g_thread_init(NULL); | 112 | g_thread_init(NULL); |
113 | gtk_init(&argc, &argv); | 113 | gtk_init(&argc, &argv); |
114 | if (SYSERR == initUtil(argc, | 114 | if (SYSERR == initUtil(argc, |
115 | argv, | 115 | argv, |
116 | &parseOptions)) | 116 | &parseOptions)) |
117 | return 0; | 117 | return 0; |
118 | 118 | ||
119 | #ifdef WINDOWS | 119 | #ifdef WINDOWS |
120 | FreeConsole(); | 120 | FreeConsole(); |
121 | #endif | 121 | #endif |
122 | 122 | ||
123 | #if ENABLE_NLS | 123 | #if ENABLE_NLS |
124 | BINDTEXTDOMAIN("gnunet-gtk", PACKAGE_LOCALE_DIR); | 124 | BINDTEXTDOMAIN("gnunet-gtk", PACKAGE_LOCALE_DIR); |
125 | textdomain("gnunet-gtk"); | 125 | textdomain("gnunet-gtk"); |
@@ -135,12 +135,12 @@ int main(int argc, | |||
135 | gtk_widget_show(root); | 135 | gtk_widget_show(root); |
136 | setCustomLogProc(&customLog); | 136 | setCustomLogProc(&customLog); |
137 | /* start the event loop */ | 137 | /* start the event loop */ |
138 | gdk_threads_enter(); | 138 | gdk_threads_enter(); |
139 | gtk_main(); | 139 | gtk_main(); |
140 | gdk_threads_leave(); | 140 | gdk_threads_leave(); |
141 | doneGNUnetGTKCommon(); | 141 | doneGNUnetGTKCommon(); |
142 | doneUtil(); | 142 | doneUtil(); |
143 | 143 | ||
144 | return 0; | 144 | return 0; |
145 | } | 145 | } |
146 | 146 | ||
diff --git a/src/include/gnunetgtk_common.h b/src/include/gnunetgtk_common.h index a4708493..091b43cb 100644 --- a/src/include/gnunetgtk_common.h +++ b/src/include/gnunetgtk_common.h | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file src/include/gnunetgtk_common.h | 22 | * @file src/include/gnunetgtk_common.h |
23 | * @author Igor Wronsky | 23 | * @author Igor Wronsky |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | */ | 25 | */ |
26 | 26 | ||
@@ -44,15 +44,15 @@ const char * getGladeFileName(void); | |||
44 | GladeXML * getMainXML(void); | 44 | GladeXML * getMainXML(void); |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Appends a message to the info window | 47 | * Appends a message to the info window |
48 | * @param doPopup if YES, the info window will | 48 | * @param doPopup if YES, the info window will |
49 | * be opened | 49 | * be opened |
50 | */ | 50 | */ |
51 | void infoMessage(int doPopup, | 51 | void infoMessage(int doPopup, |
52 | const char * format, | 52 | const char * format, |
53 | ...); | 53 | ...); |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * Appends a log entry to the info window | 56 | * Appends a log entry to the info window |
57 | * and update the statusbar to show this | 57 | * and update the statusbar to show this |
58 | * message (until the next call). | 58 | * message (until the next call). |
@@ -60,7 +60,7 @@ void infoMessage(int doPopup, | |||
60 | * @param txt the log entry | 60 | * @param txt the log entry |
61 | */ | 61 | */ |
62 | void addLogEntry(const char * txt, ...); | 62 | void addLogEntry(const char * txt, ...); |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * Simple callback function. | 65 | * Simple callback function. |
66 | */ | 66 | */ |
@@ -71,7 +71,7 @@ typedef void (*SimpleCallback)(void *); | |||
71 | * Since GTK doesn't work with multi-threaded applications under Windows, | 71 | * Since GTK doesn't work with multi-threaded applications under Windows, |
72 | * all GTK operations have to be done in the main thread | 72 | * all GTK operations have to be done in the main thread |
73 | */ | 73 | */ |
74 | void gtkSaveCall(SimpleCallback func, | 74 | void gtkSaveCall(SimpleCallback func, |
75 | void * arg); | 75 | void * arg); |
76 | 76 | ||
77 | /** | 77 | /** |
@@ -96,5 +96,5 @@ void run_with_save_calls(PThreadMain cb, | |||
96 | * Glade XML. | 96 | * Glade XML. |
97 | */ | 97 | */ |
98 | void connectGladeWithPlugins(GladeXML * xml); | 98 | void connectGladeWithPlugins(GladeXML * xml); |
99 | 99 | ||
100 | #endif | 100 | #endif |
diff --git a/src/plugins/about/about.c b/src/plugins/about/about.c index 3e6a3c01..51e8081e 100644 --- a/src/plugins/about/about.c +++ b/src/plugins/about/about.c | |||
@@ -36,10 +36,10 @@ void on_about_clicked(GtkWidget *dummy, | |||
36 | gpointer data) { | 36 | gpointer data) { |
37 | GtkWidget * ad; | 37 | GtkWidget * ad; |
38 | GladeXML * axml; | 38 | GladeXML * axml; |
39 | 39 | ||
40 | axml | 40 | axml |
41 | = glade_xml_new(getGladeFileName(), | 41 | = glade_xml_new(getGladeFileName(), |
42 | "aboutDialog", | 42 | "aboutDialog", |
43 | PACKAGE_NAME); | 43 | PACKAGE_NAME); |
44 | ad | 44 | ad |
45 | = glade_xml_get_widget(axml, | 45 | = glade_xml_get_widget(axml, |
diff --git a/src/plugins/daemon/daemon.c b/src/plugins/daemon/daemon.c index ab765fab..91325f8c 100644 --- a/src/plugins/daemon/daemon.c +++ b/src/plugins/daemon/daemon.c | |||
@@ -43,7 +43,7 @@ static void updateAppModelSafe(void * unused) { | |||
43 | char * next; | 43 | char * next; |
44 | char * pos; | 44 | char * pos; |
45 | char * desc; | 45 | char * desc; |
46 | 46 | ||
47 | model = gtk_list_store_new(2, | 47 | model = gtk_list_store_new(2, |
48 | G_TYPE_STRING, | 48 | G_TYPE_STRING, |
49 | G_TYPE_STRING); | 49 | G_TYPE_STRING); |
@@ -56,7 +56,7 @@ static void updateAppModelSafe(void * unused) { | |||
56 | "GNUNETD", | 56 | "GNUNETD", |
57 | "APPLICATIONS"); | 57 | "APPLICATIONS"); |
58 | } | 58 | } |
59 | if (apps != NULL) { | 59 | if (apps != NULL) { |
60 | next = apps; | 60 | next = apps; |
61 | do { | 61 | do { |
62 | while (*next == ' ') | 62 | while (*next == ' ') |
@@ -85,8 +85,8 @@ static void updateAppModelSafe(void * unused) { | |||
85 | 1, dgettext("GNUnet", desc), | 85 | 1, dgettext("GNUnet", desc), |
86 | -1); | 86 | -1); |
87 | FREENONNULL(desc); | 87 | FREENONNULL(desc); |
88 | } | 88 | } |
89 | } while (next != NULL); | 89 | } while (next != NULL); |
90 | FREE(apps); | 90 | FREE(apps); |
91 | } | 91 | } |
92 | w = glade_xml_get_widget(getMainXML(), | 92 | w = glade_xml_get_widget(getMainXML(), |
@@ -119,10 +119,10 @@ static void doUpdateMenus(void * arg) { | |||
119 | launchEntry | 119 | launchEntry |
120 | = glade_xml_get_widget(getMainXML(), | 120 | = glade_xml_get_widget(getMainXML(), |
121 | "startDaemon"); | 121 | "startDaemon"); |
122 | statsEntryYes | 122 | statsEntryYes |
123 | = glade_xml_get_widget(getMainXML(), | 123 | = glade_xml_get_widget(getMainXML(), |
124 | "statusPixmapYes"); | 124 | "statusPixmapYes"); |
125 | statsEntryNo | 125 | statsEntryNo |
126 | = glade_xml_get_widget(getMainXML(), | 126 | = glade_xml_get_widget(getMainXML(), |
127 | "statusPixmapNo"); | 127 | "statusPixmapNo"); |
128 | host = getConfigurationString("NETWORK", | 128 | host = getConfigurationString("NETWORK", |
@@ -145,22 +145,22 @@ static void doUpdateMenus(void * arg) { | |||
145 | gtk_widget_show_all(statsEntryYes); | 145 | gtk_widget_show_all(statsEntryYes); |
146 | gtk_widget_set_sensitive(killEntry, TRUE); | 146 | gtk_widget_set_sensitive(killEntry, TRUE); |
147 | gtk_widget_set_sensitive(launchEntry, FALSE); | 147 | gtk_widget_set_sensitive(launchEntry, FALSE); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | static void cronCheckDaemon(void * dummy) { | 151 | static void cronCheckDaemon(void * dummy) { |
152 | static int last = 42; | 152 | static int last = 42; |
153 | int ret; | 153 | int ret; |
154 | 154 | ||
155 | ret = checkGNUnetDaemonRunning(); | 155 | ret = checkGNUnetDaemonRunning(); |
156 | if (ret != last) { | 156 | if (ret != last) { |
157 | last = ret; | 157 | last = ret; |
158 | gtkSaveCall(&doUpdateMenus, &ret); | 158 | gtkSaveCall(&doUpdateMenus, &ret); |
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ||
162 | 162 | ||
163 | /** | 163 | /** |
164 | * Launch gnunetd w/ checks | 164 | * Launch gnunetd w/ checks |
165 | */ | 165 | */ |
166 | void on_startDaemon_clicked(GtkWidget * widget, | 166 | void on_startDaemon_clicked(GtkWidget * widget, |
@@ -183,7 +183,7 @@ void on_startDaemon_clicked(GtkWidget * widget, | |||
183 | } | 183 | } |
184 | } | 184 | } |
185 | 185 | ||
186 | /** | 186 | /** |
187 | * Kill gnunetd | 187 | * Kill gnunetd |
188 | */ | 188 | */ |
189 | void on_stopDaemon_clicked(GtkWidget * widget, | 189 | void on_stopDaemon_clicked(GtkWidget * widget, |
@@ -193,23 +193,23 @@ void on_stopDaemon_clicked(GtkWidget * widget, | |||
193 | = glade_xml_get_widget(getMainXML(), | 193 | = glade_xml_get_widget(getMainXML(), |
194 | "stopDaemon"); | 194 | "stopDaemon"); |
195 | gtk_widget_set_sensitive(killEntry, FALSE); | 195 | gtk_widget_set_sensitive(killEntry, FALSE); |
196 | 196 | ||
197 | if (OK == checkGNUnetDaemonRunning() ) { | 197 | if (OK == checkGNUnetDaemonRunning() ) { |
198 | if (OK != stopGNUnetDaemon()) { | 198 | if (OK != stopGNUnetDaemon()) { |
199 | GtkWidget * dialog; | 199 | GtkWidget * dialog; |
200 | 200 | ||
201 | dialog = gtk_message_dialog_new | 201 | dialog = gtk_message_dialog_new |
202 | (NULL, | 202 | (NULL, |
203 | GTK_DIALOG_MODAL, | 203 | GTK_DIALOG_MODAL, |
204 | GTK_MESSAGE_ERROR, | 204 | GTK_MESSAGE_ERROR, |
205 | GTK_BUTTONS_CLOSE, | 205 | GTK_BUTTONS_CLOSE, |
206 | _("Error requesting shutdown of gnunetd.")); | 206 | _("Error requesting shutdown of gnunetd.")); |
207 | gtk_dialog_run(GTK_DIALOG(dialog)); | 207 | gtk_dialog_run(GTK_DIALOG(dialog)); |
208 | gtk_widget_destroy(dialog); | 208 | gtk_widget_destroy(dialog); |
209 | } else { | 209 | } else { |
210 | addLogEntry(_("Terminating gnunetd...")); | 210 | addLogEntry(_("Terminating gnunetd...")); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | cronCheckDaemon(NULL); | 213 | cronCheckDaemon(NULL); |
214 | } | 214 | } |
215 | 215 | ||
@@ -245,7 +245,7 @@ void init_daemon() { | |||
245 | = glade_xml_get_widget(getMainXML(), | 245 | = glade_xml_get_widget(getMainXML(), |
246 | "daemonScrolledWindow"); | 246 | "daemonScrolledWindow"); |
247 | gtk_widget_show(tab); | 247 | gtk_widget_show(tab); |
248 | addCronJob(&cronCheckDaemon, | 248 | addCronJob(&cronCheckDaemon, |
249 | 0, | 249 | 0, |
250 | 15 * cronSECONDS, | 250 | 15 * cronSECONDS, |
251 | NULL); | 251 | NULL); |
@@ -256,7 +256,7 @@ void init_daemon() { | |||
256 | } | 256 | } |
257 | 257 | ||
258 | void done_daemon() { | 258 | void done_daemon() { |
259 | delCronJob(&cronCheckDaemon, | 259 | delCronJob(&cronCheckDaemon, |
260 | 15 * cronSECONDS, | 260 | 15 * cronSECONDS, |
261 | NULL); | 261 | NULL); |
262 | delCronJob(&updateAppModel, | 262 | delCronJob(&updateAppModel, |
diff --git a/src/plugins/fs/collection.c b/src/plugins/fs/collection.c index 93c0d74c..da25ddbc 100644 --- a/src/plugins/fs/collection.c +++ b/src/plugins/fs/collection.c | |||
@@ -37,14 +37,14 @@ static GladeXML * metaXML; | |||
37 | void on_collectionDialogMetaDataAddButton_clicked(gpointer dummy, | 37 | void on_collectionDialogMetaDataAddButton_clicked(gpointer dummy, |
38 | GtkWidget * uploadButton) { | 38 | GtkWidget * uploadButton) { |
39 | handleMetaDataListUpdate(metaXML, | 39 | handleMetaDataListUpdate(metaXML, |
40 | "collectionMetaDataTypeComboBox", | 40 | "collectionMetaDataTypeComboBox", |
41 | "collectionMetaDataValueEntry", | 41 | "collectionMetaDataValueEntry", |
42 | "collectionMetaDataTreeView"); | 42 | "collectionMetaDataTreeView"); |
43 | } | 43 | } |
44 | 44 | ||
45 | 45 | ||
46 | void createCollection_clicked(GtkWidget * dummy1, | 46 | void createCollection_clicked(GtkWidget * dummy1, |
47 | GtkWidget * dummy2) { | 47 | GtkWidget * dummy2) { |
48 | const char * collectionName; | 48 | const char * collectionName; |
49 | const char * updateIntervalString; | 49 | const char * updateIntervalString; |
50 | GtkWidget * w; | 50 | GtkWidget * w; |
@@ -76,7 +76,7 @@ void createCollection_clicked(GtkWidget * dummy1, | |||
76 | "collectionUpdateIntervalComboBoxEntry"); | 76 | "collectionUpdateIntervalComboBoxEntry"); |
77 | nameLine | 77 | nameLine |
78 | = gtk_bin_get_child(GTK_BIN(nameLine)); | 78 | = gtk_bin_get_child(GTK_BIN(nameLine)); |
79 | updateIntervalString | 79 | updateIntervalString |
80 | = gtk_entry_get_text(GTK_ENTRY(nameLine)); | 80 | = gtk_entry_get_text(GTK_ENTRY(nameLine)); |
81 | if (0 == strcmp(_("--sporadic update--"), | 81 | if (0 == strcmp(_("--sporadic update--"), |
82 | updateIntervalString)) | 82 | updateIntervalString)) |
@@ -89,24 +89,24 @@ void createCollection_clicked(GtkWidget * dummy1, | |||
89 | gtk_widget_destroy(dialog); | 89 | gtk_widget_destroy(dialog); |
90 | UNREF(metaXML); | 90 | UNREF(metaXML); |
91 | metaXML = NULL; | 91 | metaXML = NULL; |
92 | dialog = gtk_message_dialog_new | 92 | dialog = gtk_message_dialog_new |
93 | (NULL, | 93 | (NULL, |
94 | GTK_DIALOG_MODAL, | 94 | GTK_DIALOG_MODAL, |
95 | GTK_MESSAGE_ERROR, | 95 | GTK_MESSAGE_ERROR, |
96 | GTK_BUTTONS_CLOSE, | 96 | GTK_BUTTONS_CLOSE, |
97 | _("Failed to parse given time interval!")); | 97 | _("Failed to parse given time interval!")); |
98 | gtk_dialog_run(GTK_DIALOG(dialog)); | 98 | gtk_dialog_run(GTK_DIALOG(dialog)); |
99 | gtk_widget_destroy(dialog); | 99 | gtk_widget_destroy(dialog); |
100 | return; | 100 | return; |
101 | } | 101 | } |
102 | meta = getMetaDataFromList(metaXML, | 102 | meta = getMetaDataFromList(metaXML, |
103 | "collectionMetaDataTreeView", | 103 | "collectionMetaDataTreeView", |
104 | NULL); | 104 | NULL); |
105 | spin = glade_xml_get_widget(metaXML, | 105 | spin = glade_xml_get_widget(metaXML, |
106 | "collectionAnonymityLevel"); | 106 | "collectionAnonymityLevel"); |
107 | nameLine = glade_xml_get_widget(metaXML, | 107 | nameLine = glade_xml_get_widget(metaXML, |
108 | "collectionIdentifierEntry"); | 108 | "collectionIdentifierEntry"); |
109 | collectionName | 109 | collectionName |
110 | = gtk_entry_get_text(GTK_ENTRY(nameLine)); | 110 | = gtk_entry_get_text(GTK_ENTRY(nameLine)); |
111 | root = NULL; | 111 | root = NULL; |
112 | if (OK == FSUI_startCollection(ctx, | 112 | if (OK == FSUI_startCollection(ctx, |
@@ -123,8 +123,8 @@ void createCollection_clicked(GtkWidget * dummy1, | |||
123 | gtk_widget_set_sensitive(w, TRUE); | 123 | gtk_widget_set_sensitive(w, TRUE); |
124 | } else { | 124 | } else { |
125 | GtkWidget * dialog; | 125 | GtkWidget * dialog; |
126 | 126 | ||
127 | dialog = gtk_message_dialog_new | 127 | dialog = gtk_message_dialog_new |
128 | (NULL, | 128 | (NULL, |
129 | GTK_DIALOG_MODAL, | 129 | GTK_DIALOG_MODAL, |
130 | GTK_MESSAGE_ERROR, | 130 | GTK_MESSAGE_ERROR, |
@@ -132,7 +132,7 @@ void createCollection_clicked(GtkWidget * dummy1, | |||
132 | _("Failed to start collection `%s' (consult logs)."), | 132 | _("Failed to start collection `%s' (consult logs)."), |
133 | collectionName); | 133 | collectionName); |
134 | gtk_dialog_run(GTK_DIALOG(dialog)); | 134 | gtk_dialog_run(GTK_DIALOG(dialog)); |
135 | gtk_widget_destroy(dialog); | 135 | gtk_widget_destroy(dialog); |
136 | } | 136 | } |
137 | ECRS_freeMetaData(meta); | 137 | ECRS_freeMetaData(meta); |
138 | } | 138 | } |
@@ -163,7 +163,7 @@ void deleteCollection_clicked(GtkWidget * dummy1, | |||
163 | void fs_collection_start() { | 163 | void fs_collection_start() { |
164 | GtkWidget * w; | 164 | GtkWidget * w; |
165 | 165 | ||
166 | if (NULL != FSUI_getCollection(ctx)) | 166 | if (NULL != FSUI_getCollection(ctx)) |
167 | w = glade_xml_get_widget(getMainXML(), | 167 | w = glade_xml_get_widget(getMainXML(), |
168 | "createCollection"); | 168 | "createCollection"); |
169 | else | 169 | else |
diff --git a/src/plugins/fs/download.c b/src/plugins/fs/download.c index c84de4dd..2bb724d7 100644 --- a/src/plugins/fs/download.c +++ b/src/plugins/fs/download.c | |||
@@ -57,8 +57,8 @@ static int addFilesToDirectory | |||
57 | pos = head; | 57 | pos = head; |
58 | while (pos != NULL) { | 58 | while (pos != NULL) { |
59 | if (ECRS_equalsUri(uri, | 59 | if (ECRS_equalsUri(uri, |
60 | pos->uri)) | 60 | pos->uri)) |
61 | break; | 61 | break; |
62 | pos = pos->next; | 62 | pos = pos->next; |
63 | } | 63 | } |
64 | if (pos == NULL) { | 64 | if (pos == NULL) { |
@@ -90,8 +90,8 @@ static int addFilesToDirectory | |||
90 | -1); | 90 | -1); |
91 | if ( (uri != NULL) && | 91 | if ( (uri != NULL) && |
92 | (ECRS_equalsUri(uri, | 92 | (ECRS_equalsUri(uri, |
93 | fi->uri)) ) | 93 | fi->uri)) ) |
94 | return OK; | 94 | return OK; |
95 | } | 95 | } |
96 | } | 96 | } |
97 | gtk_tree_store_append(GTK_TREE_STORE(pos->model), | 97 | gtk_tree_store_append(GTK_TREE_STORE(pos->model), |
@@ -151,7 +151,7 @@ static void initiateDownload(GtkTreeModel * model, | |||
151 | } else { | 151 | } else { |
152 | anon = gtk_spin_button_get_value_as_int | 152 | anon = gtk_spin_button_get_value_as_int |
153 | (GTK_SPIN_BUTTON(spin)); | 153 | (GTK_SPIN_BUTTON(spin)); |
154 | } | 154 | } |
155 | if (! ECRS_isFileUri(uri)) { | 155 | if (! ECRS_isFileUri(uri)) { |
156 | if (ECRS_isNamespaceUri(uri)) { | 156 | if (ECRS_isNamespaceUri(uri)) { |
157 | /* start namespace search; would probably be better | 157 | /* start namespace search; would probably be better |
@@ -171,9 +171,9 @@ static void initiateDownload(GtkTreeModel * model, | |||
171 | return; | 171 | return; |
172 | } | 172 | } |
173 | } | 173 | } |
174 | filename = ECRS_uriToString(uri); | 174 | filename = ECRS_uriToString(uri); |
175 | if ( (filename == NULL) || | 175 | if ( (filename == NULL) || |
176 | (strlen(filename) < | 176 | (strlen(filename) < |
177 | strlen(ECRS_URI_PREFIX) + | 177 | strlen(ECRS_URI_PREFIX) + |
178 | strlen(ECRS_FILE_INFIX)) ) { | 178 | strlen(ECRS_FILE_INFIX)) ) { |
179 | BREAK(); | 179 | BREAK(); |
@@ -182,9 +182,9 @@ static void initiateDownload(GtkTreeModel * model, | |||
182 | } | 182 | } |
183 | if (name == NULL) | 183 | if (name == NULL) |
184 | name = filename; | 184 | name = filename; |
185 | 185 | ||
186 | addLogEntry(_("Downloading `%s'"), name); | 186 | addLogEntry(_("Downloading `%s'"), name); |
187 | 187 | ||
188 | list = MALLOC(sizeof(DownloadList)); | 188 | list = MALLOC(sizeof(DownloadList)); |
189 | list->next = head; | 189 | list->next = head; |
190 | list->rr = NULL; | 190 | list->rr = NULL; |
@@ -208,19 +208,19 @@ static void initiateDownload(GtkTreeModel * model, | |||
208 | strlen(filename)); | 208 | strlen(filename)); |
209 | strcpy(pfx, fn); | 209 | strcpy(pfx, fn); |
210 | if (pfx[strlen(pfx)-1] != DIR_SEPARATOR) | 210 | if (pfx[strlen(pfx)-1] != DIR_SEPARATOR) |
211 | strcat(pfx, | 211 | strcat(pfx, |
212 | DIR_SEPARATOR_STR); | 212 | DIR_SEPARATOR_STR); |
213 | strcpy(lnk, fn); | 213 | strcpy(lnk, fn); |
214 | FREE(fn); | 214 | FREE(fn); |
215 | if (lnk[strlen(lnk)-1] != DIR_SEPARATOR) | 215 | if (lnk[strlen(lnk)-1] != DIR_SEPARATOR) |
216 | strcat(lnk, | 216 | strcat(lnk, |
217 | DIR_SEPARATOR_STR); | 217 | DIR_SEPARATOR_STR); |
218 | strcat(pfx, | 218 | strcat(pfx, |
219 | name); | 219 | name); |
220 | strcat(lnk, | 220 | strcat(lnk, |
221 | &filename[strlen(ECRS_URI_PREFIX) + | 221 | &filename[strlen(ECRS_URI_PREFIX) + |
222 | strlen(ECRS_FILE_INFIX)]); | 222 | strlen(ECRS_FILE_INFIX)]); |
223 | 223 | ||
224 | /* Append ".gnd" if needed */ | 224 | /* Append ".gnd" if needed */ |
225 | if (mime && strcmp(mime, GNUNET_DIRECTORY_MIME) == 0) { | 225 | if (mime && strcmp(mime, GNUNET_DIRECTORY_MIME) == 0) { |
226 | int len = strlen(pfx); | 226 | int len = strlen(pfx); |
@@ -231,7 +231,7 @@ static void initiateDownload(GtkTreeModel * model, | |||
231 | } | 231 | } |
232 | strcat(pfx, GNUNET_DIRECTORY_EXT); | 232 | strcat(pfx, GNUNET_DIRECTORY_EXT); |
233 | } | 233 | } |
234 | 234 | ||
235 | #ifdef WINDOWS | 235 | #ifdef WINDOWS |
236 | { | 236 | { |
237 | /* Do not exceed MAX_PATH under Windows | 237 | /* Do not exceed MAX_PATH under Windows |
@@ -239,7 +239,7 @@ static void initiateDownload(GtkTreeModel * model, | |||
239 | $DOWNLOADDIR\hash.lnk | 239 | $DOWNLOADDIR\hash.lnk |
240 | or | 240 | or |
241 | $INCOMINGDIR\hash.lnk | 241 | $INCOMINGDIR\hash.lnk |
242 | 242 | ||
243 | We truncate the hash here accordingly. */ | 243 | We truncate the hash here accordingly. */ |
244 | 244 | ||
245 | int diff; /* How much is INCOMINGDIR larger than DOWNLOADDIR */ | 245 | int diff; /* How much is INCOMINGDIR larger than DOWNLOADDIR */ |
@@ -247,17 +247,17 @@ static void initiateDownload(GtkTreeModel * model, | |||
247 | "INCOMINGDIR", | 247 | "INCOMINGDIR", |
248 | _("You must specify a directory in the configuration" | 248 | _("You must specify a directory in the configuration" |
249 | " in section `%s' under `%s'.")); | 249 | " in section `%s' under `%s'.")); |
250 | 250 | ||
251 | diff = downDirLen - strlen(inc); | 251 | diff = downDirLen - strlen(inc); |
252 | if (diff < 0) | 252 | if (diff < 0) |
253 | diff = 0; | 253 | diff = 0; |
254 | 254 | ||
255 | FREE(inc); | 255 | FREE(inc); |
256 | 256 | ||
257 | char *end = lnk + MAX_PATH - 5 - diff; /* 4 = ".lnk" */ | 257 | char *end = lnk + MAX_PATH - 5 - diff; /* 4 = ".lnk" */ |
258 | 258 | ||
259 | *end = 0; | 259 | *end = 0; |
260 | 260 | ||
261 | if (strchr(end + 1, DIR_SEPARATOR)) { | 261 | if (strchr(end + 1, DIR_SEPARATOR)) { |
262 | BREAK(); | 262 | BREAK(); |
263 | return; | 263 | return; |
@@ -272,7 +272,7 @@ static void initiateDownload(GtkTreeModel * model, | |||
272 | FREE(pfx); | 272 | FREE(pfx); |
273 | pfx = STRDUP(lnk); | 273 | pfx = STRDUP(lnk); |
274 | } | 274 | } |
275 | 275 | ||
276 | /* If file is inside a directory, get the full path */ | 276 | /* If file is inside a directory, get the full path */ |
277 | dirTreePath = gtk_tree_path_copy(path); | 277 | dirTreePath = gtk_tree_path_copy(path); |
278 | dirPath = MALLOC(1); | 278 | dirPath = MALLOC(1); |
@@ -284,8 +284,8 @@ static void initiateDownload(GtkTreeModel * model, | |||
284 | if (! gtk_tree_path_up(dirTreePath)) | 284 | if (! gtk_tree_path_up(dirTreePath)) |
285 | break; | 285 | break; |
286 | 286 | ||
287 | if (!gtk_tree_model_get_iter(model, | 287 | if (!gtk_tree_model_get_iter(model, |
288 | &iiter, | 288 | &iiter, |
289 | dirTreePath)) | 289 | dirTreePath)) |
290 | break; | 290 | break; |
291 | gtk_tree_model_get(model, | 291 | gtk_tree_model_get(model, |
@@ -301,7 +301,7 @@ static void initiateDownload(GtkTreeModel * model, | |||
301 | dirPath = new; | 301 | dirPath = new; |
302 | } | 302 | } |
303 | gtk_tree_path_free(dirTreePath); | 303 | gtk_tree_path_free(dirTreePath); |
304 | 304 | ||
305 | list->filename = pfx; | 305 | list->filename = pfx; |
306 | head = list; | 306 | head = list; |
307 | gtk_tree_store_insert(summary, | 307 | gtk_tree_store_insert(summary, |
@@ -316,7 +316,7 @@ static void initiateDownload(GtkTreeModel * model, | |||
316 | DOWNLOAD_PROGRESS, 0, /* progress */ | 316 | DOWNLOAD_PROGRESS, 0, /* progress */ |
317 | DOWNLOAD_URISTRING, filename, | 317 | DOWNLOAD_URISTRING, filename, |
318 | DOWNLOAD_URI, ECRS_dupUri(uri), | 318 | DOWNLOAD_URI, ECRS_dupUri(uri), |
319 | DOWNLOAD_TREEPATH, list->rr, | 319 | DOWNLOAD_TREEPATH, list->rr, |
320 | DOWNLOAD_DIRPATH, dirPath, | 320 | DOWNLOAD_DIRPATH, dirPath, |
321 | /* internal: row reference! */ | 321 | /* internal: row reference! */ |
322 | -1); | 322 | -1); |
@@ -352,11 +352,11 @@ void displayDownloadUpdate(const struct ECRS_URI * uri, | |||
352 | unsigned long long total; | 352 | unsigned long long total; |
353 | struct ECRS_URI * u; | 353 | struct ECRS_URI * u; |
354 | struct ECRS_MetaData * meta; | 354 | struct ECRS_MetaData * meta; |
355 | 355 | ||
356 | 356 | ||
357 | if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary), | 357 | if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary), |
358 | &iter)) { | 358 | &iter)) { |
359 | do { | 359 | do { |
360 | gtk_tree_model_get(GTK_TREE_MODEL(summary), | 360 | gtk_tree_model_get(GTK_TREE_MODEL(summary), |
361 | &iter, | 361 | &iter, |
362 | DOWNLOAD_SIZE, &total, | 362 | DOWNLOAD_SIZE, &total, |
@@ -372,7 +372,7 @@ void displayDownloadUpdate(const struct ECRS_URI * uri, | |||
372 | gtk_tree_store_set(summary, | 372 | gtk_tree_store_set(summary, |
373 | &iter, | 373 | &iter, |
374 | DOWNLOAD_PROGRESS, val, | 374 | DOWNLOAD_PROGRESS, val, |
375 | -1); | 375 | -1); |
376 | break; | 376 | break; |
377 | } | 377 | } |
378 | } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary), | 378 | } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary), |
@@ -404,15 +404,15 @@ void displayDownloadComplete(const struct ECRS_URI * uri, | |||
404 | GtkTreePath * path; | 404 | GtkTreePath * path; |
405 | struct ECRS_URI * u; | 405 | struct ECRS_URI * u; |
406 | char *dirPath; | 406 | char *dirPath; |
407 | 407 | ||
408 | pos = head; | 408 | pos = head; |
409 | while (pos != NULL) { | 409 | while (pos != NULL) { |
410 | if (ECRS_equalsUri(uri, | 410 | if (ECRS_equalsUri(uri, |
411 | pos->uri)) | 411 | pos->uri)) |
412 | break; | 412 | break; |
413 | pos = pos->next; | 413 | pos = pos->next; |
414 | } | 414 | } |
415 | if (pos == NULL) | 415 | if (pos == NULL) |
416 | return; | 416 | return; |
417 | if ( (pos->rr != NULL) && | 417 | if ( (pos->rr != NULL) && |
418 | (gtk_tree_row_reference_valid(pos->rr)) ) { | 418 | (gtk_tree_row_reference_valid(pos->rr)) ) { |
@@ -445,13 +445,13 @@ void displayDownloadComplete(const struct ECRS_URI * uri, | |||
445 | gtk_tree_path_free(path); | 445 | gtk_tree_path_free(path); |
446 | return; | 446 | return; |
447 | } | 447 | } |
448 | gtk_tree_path_free(path); | 448 | gtk_tree_path_free(path); |
449 | } | 449 | } |
450 | 450 | ||
451 | /* only rename top-level files, not files inside of directories! */ | 451 | /* only rename top-level files, not files inside of directories! */ |
452 | if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary), | 452 | if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary), |
453 | &iter)) { | 453 | &iter)) { |
454 | do { | 454 | do { |
455 | ln = NULL; | 455 | ln = NULL; |
456 | fn = NULL; | 456 | fn = NULL; |
457 | gtk_tree_model_get(GTK_TREE_MODEL(summary), | 457 | gtk_tree_model_get(GTK_TREE_MODEL(summary), |
@@ -463,7 +463,7 @@ void displayDownloadComplete(const struct ECRS_URI * uri, | |||
463 | -1); | 463 | -1); |
464 | if (ECRS_equalsUri(u, uri)) { | 464 | if (ECRS_equalsUri(u, uri)) { |
465 | char *dstPath, *newFn, *dstFile; | 465 | char *dstPath, *newFn, *dstFile; |
466 | 466 | ||
467 | ren = ECRS_suggestFilename(ln); | 467 | ren = ECRS_suggestFilename(ln); |
468 | newFn = strrchr(ren ? ren : ln, DIR_SEPARATOR) + 1; | 468 | newFn = strrchr(ren ? ren : ln, DIR_SEPARATOR) + 1; |
469 | 469 | ||
@@ -473,7 +473,7 @@ void displayDownloadComplete(const struct ECRS_URI * uri, | |||
473 | " in section `%s' under `%s'.")); | 473 | " in section `%s' under `%s'.")); |
474 | if (!dstPath) | 474 | if (!dstPath) |
475 | return; | 475 | return; |
476 | 476 | ||
477 | /* If file is contained in a directory, create directory structure in | 477 | /* If file is contained in a directory, create directory structure in |
478 | the file system. */ | 478 | the file system. */ |
479 | if (dirPath) { | 479 | if (dirPath) { |
@@ -486,14 +486,14 @@ void displayDownloadComplete(const struct ECRS_URI * uri, | |||
486 | FREE(dirPath); | 486 | FREE(dirPath); |
487 | } | 487 | } |
488 | } | 488 | } |
489 | 489 | ||
490 | mkdirp(dstPath); | 490 | mkdirp(dstPath); |
491 | 491 | ||
492 | dstFile = MALLOC(strlen(dstPath) + strlen(newFn) + 2); | 492 | dstFile = MALLOC(strlen(dstPath) + strlen(newFn) + 2); |
493 | strcpy(dstFile, dstPath); | 493 | strcpy(dstFile, dstPath); |
494 | strcat(dstFile, DIR_SEPARATOR_STR); | 494 | strcat(dstFile, DIR_SEPARATOR_STR); |
495 | strcat(dstFile, newFn); | 495 | strcat(dstFile, newFn); |
496 | 496 | ||
497 | if (RENAME(fn, dstFile) == -1) { | 497 | if (RENAME(fn, dstFile) == -1) { |
498 | /* renaming failed, try to copy */ | 498 | /* renaming failed, try to copy */ |
499 | if (!copyFile(fn, dstFile)) { | 499 | if (!copyFile(fn, dstFile)) { |
@@ -501,10 +501,10 @@ void displayDownloadComplete(const struct ECRS_URI * uri, | |||
501 | fn, dstFile, STRERROR(errno)); | 501 | fn, dstFile, STRERROR(errno)); |
502 | FREE(dstFile); | 502 | FREE(dstFile); |
503 | FREE(ren); | 503 | FREE(ren); |
504 | 504 | ||
505 | return; | 505 | return; |
506 | } | 506 | } |
507 | 507 | ||
508 | if (REMOVE(fn) == -1) | 508 | if (REMOVE(fn) == -1) |
509 | LOG(LOG_ERROR, _("Could not remove temporary file %s: %s\n"), fn, STRERROR(errno)); | 509 | LOG(LOG_ERROR, _("Could not remove temporary file %s: %s\n"), fn, STRERROR(errno)); |
510 | } | 510 | } |
@@ -514,7 +514,7 @@ void displayDownloadComplete(const struct ECRS_URI * uri, | |||
514 | else | 514 | else |
515 | REMOVE(ln); | 515 | REMOVE(ln); |
516 | SYMLINK(dstFile, fn); | 516 | SYMLINK(dstFile, fn); |
517 | 517 | ||
518 | gtk_tree_store_set(summary, | 518 | gtk_tree_store_set(summary, |
519 | &iter, | 519 | &iter, |
520 | DOWNLOAD_LINKNAME, dstFile, | 520 | DOWNLOAD_LINKNAME, dstFile, |
@@ -522,7 +522,7 @@ void displayDownloadComplete(const struct ECRS_URI * uri, | |||
522 | FREENONNULL(ren); | 522 | FREENONNULL(ren); |
523 | FREE(dstFile); | 523 | FREE(dstFile); |
524 | FREE(dstPath); | 524 | FREE(dstPath); |
525 | 525 | ||
526 | break; | 526 | break; |
527 | } | 527 | } |
528 | } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary), | 528 | } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary), |
@@ -545,7 +545,7 @@ static int delDownloadView(void * cls, | |||
545 | 545 | ||
546 | if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary), | 546 | if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary), |
547 | &iter)) { | 547 | &iter)) { |
548 | do { | 548 | do { |
549 | gtk_tree_model_get(GTK_TREE_MODEL(summary), | 549 | gtk_tree_model_get(GTK_TREE_MODEL(summary), |
550 | &iter, | 550 | &iter, |
551 | DOWNLOAD_FILENAME, &f, | 551 | DOWNLOAD_FILENAME, &f, |
@@ -600,7 +600,7 @@ static void abortDownloadCallback(GtkTreeModel * model, | |||
600 | gtk_tree_store_remove(summary, | 600 | gtk_tree_store_remove(summary, |
601 | iter); | 601 | iter); |
602 | if (cls.u != NULL) | 602 | if (cls.u != NULL) |
603 | ECRS_freeUri(cls.u); | 603 | ECRS_freeUri(cls.u); |
604 | } | 604 | } |
605 | 605 | ||
606 | void on_abortDownloadButton_clicked(void * unused, | 606 | void on_abortDownloadButton_clicked(void * unused, |
@@ -657,7 +657,7 @@ void fs_download_start() { | |||
657 | GtkWidget * downloadList; | 657 | GtkWidget * downloadList; |
658 | GtkCellRenderer * renderer; | 658 | GtkCellRenderer * renderer; |
659 | 659 | ||
660 | 660 | ||
661 | downloadList = glade_xml_get_widget(getMainXML(), | 661 | downloadList = glade_xml_get_widget(getMainXML(), |
662 | "activeDownloadsList"); | 662 | "activeDownloadsList"); |
663 | summary = | 663 | summary = |
@@ -666,10 +666,10 @@ void fs_download_start() { | |||
666 | G_TYPE_STRING, /* name (user-friendly name) */ | 666 | G_TYPE_STRING, /* name (user-friendly name) */ |
667 | G_TYPE_UINT64, /* size */ | 667 | G_TYPE_UINT64, /* size */ |
668 | G_TYPE_INT, /* progress */ | 668 | G_TYPE_INT, /* progress */ |
669 | G_TYPE_STRING, /* uri */ | 669 | G_TYPE_STRING, /* uri */ |
670 | G_TYPE_POINTER, /* url */ | 670 | G_TYPE_POINTER, /* url */ |
671 | G_TYPE_POINTER, /* internal: gtk tree path / NULL */ | 671 | G_TYPE_POINTER, /* internal: gtk tree path / NULL */ |
672 | G_TYPE_POINTER); /* directory path if file is inside a dir */ | 672 | G_TYPE_POINTER); /* directory path if file is inside a dir */ |
673 | gtk_tree_view_set_model(GTK_TREE_VIEW(downloadList), | 673 | gtk_tree_view_set_model(GTK_TREE_VIEW(downloadList), |
674 | GTK_TREE_MODEL(summary)); | 674 | GTK_TREE_MODEL(summary)); |
675 | renderer = gtk_cell_renderer_progress_new(); | 675 | renderer = gtk_cell_renderer_progress_new(); |
@@ -711,7 +711,7 @@ void fs_download_stop() { | |||
711 | if (! gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary), | 711 | if (! gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary), |
712 | &iter)) | 712 | &iter)) |
713 | return; | 713 | return; |
714 | do { | 714 | do { |
715 | gtk_tree_model_get(GTK_TREE_MODEL(summary), | 715 | gtk_tree_model_get(GTK_TREE_MODEL(summary), |
716 | &iter, | 716 | &iter, |
717 | DOWNLOAD_URI, &u, | 717 | DOWNLOAD_URI, &u, |
@@ -720,7 +720,7 @@ void fs_download_stop() { | |||
720 | gtk_tree_store_set(summary, | 720 | gtk_tree_store_set(summary, |
721 | &iter, | 721 | &iter, |
722 | DOWNLOAD_URI, NULL, | 722 | DOWNLOAD_URI, NULL, |
723 | -1); | 723 | -1); |
724 | if (u != NULL) | 724 | if (u != NULL) |
725 | ECRS_freeUri(u); | 725 | ECRS_freeUri(u); |
726 | FREENONNULL(dirPath); | 726 | FREENONNULL(dirPath); |
diff --git a/src/plugins/fs/extensions/musicinsert.c b/src/plugins/fs/extensions/musicinsert.c index 317f3f9c..a586e362 100644 --- a/src/plugins/fs/extensions/musicinsert.c +++ b/src/plugins/fs/extensions/musicinsert.c | |||
@@ -134,7 +134,7 @@ show_musicinsertdialog () | |||
134 | gtk_widget_show (GTK_WIDGET (typecombobox)); | 134 | gtk_widget_show (GTK_WIDGET (typecombobox)); |
135 | 135 | ||
136 | /* | 136 | /* |
137 | * treeview creation | 137 | * treeview creation |
138 | */ | 138 | */ |
139 | 139 | ||
140 | /* liststore model */ | 140 | /* liststore model */ |
@@ -317,7 +317,7 @@ show_musicinsertdialog () | |||
317 | (gpointer) NULL); | 317 | (gpointer) NULL); |
318 | 318 | ||
319 | /* | 319 | /* |
320 | * show the main window | 320 | * show the main window |
321 | */ | 321 | */ |
322 | gtk_widget_show (musicinsertdialog); | 322 | gtk_widget_show (musicinsertdialog); |
323 | } | 323 | } |
@@ -666,7 +666,7 @@ insertfiles () | |||
666 | 666 | ||
667 | /* TODO : take care of the 'Insert as an album'/'Insert files separately' options | 667 | /* TODO : take care of the 'Insert as an album'/'Insert files separately' options |
668 | * and create or not a gnunet directory containing the files | 668 | * and create or not a gnunet directory containing the files |
669 | * | 669 | * |
670 | * TODO : Create a file and album description from metadatas - an idea : | 670 | * TODO : Create a file and album description from metadatas - an idea : |
671 | * Artist: Song (Album) - Type and Format # for files | 671 | * Artist: Song (Album) - Type and Format # for files |
672 | * Artist: Album - Type and number of the files # or album | 672 | * Artist: Album - Type and number of the files # or album |
@@ -1010,7 +1010,7 @@ remove_file_from_list (gpointer user_data) | |||
1010 | gtk_tree_view_get_selection (GTK_TREE_VIEW (filelist)); | 1010 | gtk_tree_view_get_selection (GTK_TREE_VIEW (filelist)); |
1011 | GList *selected_paths = | 1011 | GList *selected_paths = |
1012 | gtk_tree_selection_get_selected_rows (selection, | 1012 | gtk_tree_selection_get_selected_rows (selection, |
1013 | (GtkTreeModel **) | 1013 | (GtkTreeModel **) |
1014 | &filelist_store); | 1014 | &filelist_store); |
1015 | GList *selected_refs = NULL; | 1015 | GList *selected_refs = NULL; |
1016 | GtkTreePath *path; | 1016 | GtkTreePath *path; |
diff --git a/src/plugins/fs/fs.c b/src/plugins/fs/fs.c index 37bae3fd..6087312c 100644 --- a/src/plugins/fs/fs.c +++ b/src/plugins/fs/fs.c | |||
@@ -119,17 +119,17 @@ void init_fs() { | |||
119 | GtkWidget * tab; | 119 | GtkWidget * tab; |
120 | GtkWidget * book; | 120 | GtkWidget * book; |
121 | gint num; | 121 | gint num; |
122 | 122 | ||
123 | tab | 123 | tab |
124 | = glade_xml_get_widget(getMainXML(), | 124 | = glade_xml_get_widget(getMainXML(), |
125 | "fsnotebook"); | 125 | "fsnotebook"); |
126 | gtk_widget_show(tab); | 126 | gtk_widget_show(tab); |
127 | book | 127 | book |
128 | = glade_xml_get_widget(getMainXML(), "mainnotebook"); | 128 | = glade_xml_get_widget(getMainXML(), "mainnotebook"); |
129 | num = gtk_notebook_get_current_page(GTK_NOTEBOOK(book)); | 129 | num = gtk_notebook_get_current_page(GTK_NOTEBOOK(book)); |
130 | gtk_notebook_set_current_page(GTK_NOTEBOOK(book), 1); | 130 | gtk_notebook_set_current_page(GTK_NOTEBOOK(book), 1); |
131 | gtk_notebook_set_current_page(GTK_NOTEBOOK(book), num); | 131 | gtk_notebook_set_current_page(GTK_NOTEBOOK(book), num); |
132 | 132 | ||
133 | ctx = FSUI_start("gnunet-gtk", | 133 | ctx = FSUI_start("gnunet-gtk", |
134 | YES, | 134 | YES, |
135 | &eventProcessor, | 135 | &eventProcessor, |
diff --git a/src/plugins/fs/helper.c b/src/plugins/fs/helper.c index 70ff9e19..f4be7bdb 100644 --- a/src/plugins/fs/helper.c +++ b/src/plugins/fs/helper.c | |||
@@ -41,7 +41,7 @@ int parseTime(const char * t, | |||
41 | unsigned int val; | 41 | unsigned int val; |
42 | char * tmp; | 42 | char * tmp; |
43 | cron_t ret; | 43 | cron_t ret; |
44 | 44 | ||
45 | ret = 0; | 45 | ret = 0; |
46 | pos = 0; | 46 | pos = 0; |
47 | 47 | ||
@@ -54,7 +54,7 @@ int parseTime(const char * t, | |||
54 | pos - start); | 54 | pos - start); |
55 | if (1 != sscanf(tmp, | 55 | if (1 != sscanf(tmp, |
56 | "%u", | 56 | "%u", |
57 | &val) ) | 57 | &val) ) |
58 | return -1; /* parse error */ | 58 | return -1; /* parse error */ |
59 | FREE(tmp); | 59 | FREE(tmp); |
60 | while ( t[pos] == ' ') | 60 | while ( t[pos] == ' ') |
@@ -84,10 +84,10 @@ int parseTime(const char * t, | |||
84 | strlen(_("days")))) | 84 | strlen(_("days")))) |
85 | ret += cronDAYS * val; | 85 | ret += cronDAYS * val; |
86 | else | 86 | else |
87 | return SYSERR; /* parse error */ | 87 | return SYSERR; /* parse error */ |
88 | while ( t[pos] == ' ') | 88 | while ( t[pos] == ' ') |
89 | pos++; | 89 | pos++; |
90 | } | 90 | } |
91 | *param = ret / cronSECONDS; | 91 | *param = ret / cronSECONDS; |
92 | return OK; | 92 | return OK; |
93 | } | 93 | } |
diff --git a/src/plugins/fs/meta.c b/src/plugins/fs/meta.c index bd62b62b..e8264554 100644 --- a/src/plugins/fs/meta.c +++ b/src/plugins/fs/meta.c | |||
@@ -33,7 +33,7 @@ | |||
33 | 33 | ||
34 | static int publishMetaData(EXTRACTOR_KeywordType type, | 34 | static int publishMetaData(EXTRACTOR_KeywordType type, |
35 | const char * data, | 35 | const char * data, |
36 | void * cls) { | 36 | void * cls) { |
37 | GtkListStore * store = cls; | 37 | GtkListStore * store = cls; |
38 | const char * stype; | 38 | const char * stype; |
39 | GtkTreeIter iter; | 39 | GtkTreeIter iter; |
@@ -87,10 +87,10 @@ void createMetaDataListTreeView(GladeXML * xml, | |||
87 | NULL); | 87 | NULL); |
88 | gtk_tree_view_set_model(GTK_TREE_VIEW(metaList), | 88 | gtk_tree_view_set_model(GTK_TREE_VIEW(metaList), |
89 | GTK_TREE_MODEL(metamodel)); | 89 | GTK_TREE_MODEL(metamodel)); |
90 | if (init != NULL) | 90 | if (init != NULL) |
91 | ECRS_getMetaData(init, | 91 | ECRS_getMetaData(init, |
92 | &publishMetaData, | 92 | &publishMetaData, |
93 | metamodel); | 93 | metamodel); |
94 | if ( (previewName == NULL) || | 94 | if ( (previewName == NULL) || |
95 | (init == NULL) ) | 95 | (init == NULL) ) |
96 | return; | 96 | return; |
@@ -107,11 +107,11 @@ void createMetaDataListTreeView(GladeXML * xml, | |||
107 | gdk_pixbuf_loader_write(loader, | 107 | gdk_pixbuf_loader_write(loader, |
108 | (const guchar*) thumb, | 108 | (const guchar*) thumb, |
109 | ts, | 109 | ts, |
110 | NULL); | 110 | NULL); |
111 | pixbuf = gdk_pixbuf_loader_get_pixbuf(loader); | 111 | pixbuf = gdk_pixbuf_loader_get_pixbuf(loader); |
112 | g_object_ref(pixbuf); | 112 | g_object_ref(pixbuf); |
113 | gdk_pixbuf_loader_close(loader, | 113 | gdk_pixbuf_loader_close(loader, |
114 | NULL); | 114 | NULL); |
115 | if (pixbuf != NULL) { | 115 | if (pixbuf != NULL) { |
116 | gtk_image_set_from_pixbuf(GTK_IMAGE(preview), | 116 | gtk_image_set_from_pixbuf(GTK_IMAGE(preview), |
117 | pixbuf); | 117 | pixbuf); |
@@ -169,7 +169,7 @@ void createMetaTypeComboBox(GladeXML * xml, | |||
169 | GtkCellRenderer * renderer; | 169 | GtkCellRenderer * renderer; |
170 | GtkListStore * keywordTypeModel; | 170 | GtkListStore * keywordTypeModel; |
171 | GtkTreeIter iter; | 171 | GtkTreeIter iter; |
172 | EXTRACTOR_KeywordType type; | 172 | EXTRACTOR_KeywordType type; |
173 | 173 | ||
174 | keywordTypeModel | 174 | keywordTypeModel |
175 | = gtk_list_store_new(KTYPE_NUM, | 175 | = gtk_list_store_new(KTYPE_NUM, |
@@ -179,15 +179,15 @@ void createMetaTypeComboBox(GladeXML * xml, | |||
179 | name); | 179 | name); |
180 | gtk_combo_box_set_model(GTK_COMBO_BOX(metaType), | 180 | gtk_combo_box_set_model(GTK_COMBO_BOX(metaType), |
181 | GTK_TREE_MODEL(keywordTypeModel)); | 181 | GTK_TREE_MODEL(keywordTypeModel)); |
182 | for (type=0;type<EXTRACTOR_getHighestKeywordTypeNumber();type++) { | 182 | for (type=0;type<EXTRACTOR_getHighestKeywordTypeNumber();type++) { |
183 | stype = EXTRACTOR_getKeywordTypeAsString(type); | 183 | stype = EXTRACTOR_getKeywordTypeAsString(type); |
184 | gtk_list_store_append(keywordTypeModel, | 184 | gtk_list_store_append(keywordTypeModel, |
185 | &iter); | 185 | &iter); |
186 | gtk_list_store_set(keywordTypeModel, | 186 | gtk_list_store_set(keywordTypeModel, |
187 | &iter, | 187 | &iter, |
188 | KTYPE_STRING, stype, | 188 | KTYPE_STRING, stype, |
189 | KTYPE_TYPE, type, | 189 | KTYPE_TYPE, type, |
190 | -1); | 190 | -1); |
191 | } | 191 | } |
192 | renderer = gtk_cell_renderer_text_new(); | 192 | renderer = gtk_cell_renderer_text_new(); |
193 | gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(metaType), | 193 | gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(metaType), |
@@ -208,7 +208,7 @@ void handleKeywordListUpdate(GladeXML * xml, | |||
208 | GtkWidget * entryLine; | 208 | GtkWidget * entryLine; |
209 | GtkListStore * keymodel; | 209 | GtkListStore * keymodel; |
210 | GtkTreeIter iter; | 210 | GtkTreeIter iter; |
211 | 211 | ||
212 | keywordList = glade_xml_get_widget(xml, | 212 | keywordList = glade_xml_get_widget(xml, |
213 | keywordListName); | 213 | keywordListName); |
214 | keymodel | 214 | keymodel |
@@ -222,11 +222,11 @@ void handleKeywordListUpdate(GladeXML * xml, | |||
222 | gtk_list_store_set(keymodel, | 222 | gtk_list_store_set(keymodel, |
223 | &iter, | 223 | &iter, |
224 | 0, keyword, | 224 | 0, keyword, |
225 | -1); | 225 | -1); |
226 | gtk_entry_set_text(GTK_ENTRY(entryLine), ""); | 226 | gtk_entry_set_text(GTK_ENTRY(entryLine), ""); |
227 | } | 227 | } |
228 | 228 | ||
229 | void handleMetaDataListUpdate(GladeXML * xml, | 229 | void handleMetaDataListUpdate(GladeXML * xml, |
230 | const char * typeInputLineName, | 230 | const char * typeInputLineName, |
231 | const char * valueInputLineName, | 231 | const char * valueInputLineName, |
232 | const char * metaDataListName) { | 232 | const char * metaDataListName) { |
@@ -239,19 +239,19 @@ void handleMetaDataListUpdate(GladeXML * xml, | |||
239 | GtkListStore * typemodel; | 239 | GtkListStore * typemodel; |
240 | GtkTreeIter iter; | 240 | GtkTreeIter iter; |
241 | char * stype; | 241 | char * stype; |
242 | 242 | ||
243 | metaList = glade_xml_get_widget(xml, | 243 | metaList = glade_xml_get_widget(xml, |
244 | metaDataListName); | 244 | metaDataListName); |
245 | metamodel | 245 | metamodel |
246 | = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(metaList))); | 246 | = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(metaList))); |
247 | 247 | ||
248 | entryLine = glade_xml_get_widget(xml, | 248 | entryLine = glade_xml_get_widget(xml, |
249 | valueInputLineName); | 249 | valueInputLineName); |
250 | value = gtk_entry_get_text(GTK_ENTRY(entryLine)); | 250 | value = gtk_entry_get_text(GTK_ENTRY(entryLine)); |
251 | if ( (value == NULL) || (strlen(value) == 0) ) | 251 | if ( (value == NULL) || (strlen(value) == 0) ) |
252 | return; | 252 | return; |
253 | typeCB = glade_xml_get_widget(xml, | 253 | typeCB = glade_xml_get_widget(xml, |
254 | typeInputLineName); | 254 | typeInputLineName); |
255 | typemodel | 255 | typemodel |
256 | = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(typeCB))); | 256 | = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(typeCB))); |
257 | if (! gtk_combo_box_get_active_iter(GTK_COMBO_BOX(typeCB), | 257 | if (! gtk_combo_box_get_active_iter(GTK_COMBO_BOX(typeCB), |
@@ -261,7 +261,7 @@ void handleMetaDataListUpdate(GladeXML * xml, | |||
261 | &iter, | 261 | &iter, |
262 | KTYPE_STRING, &stype, | 262 | KTYPE_STRING, &stype, |
263 | KTYPE_TYPE, &type, | 263 | KTYPE_TYPE, &type, |
264 | -1); | 264 | -1); |
265 | gtk_list_store_append(metamodel, | 265 | gtk_list_store_append(metamodel, |
266 | &iter); | 266 | &iter); |
267 | gtk_list_store_set(metamodel, | 267 | gtk_list_store_set(metamodel, |
@@ -269,7 +269,7 @@ void handleMetaDataListUpdate(GladeXML * xml, | |||
269 | META_TYPE, type, | 269 | META_TYPE, type, |
270 | META_STYPE, stype, | 270 | META_STYPE, stype, |
271 | META_VALUE, value, | 271 | META_VALUE, value, |
272 | -1); | 272 | -1); |
273 | gtk_entry_set_text(GTK_ENTRY(entryLine), ""); | 273 | gtk_entry_set_text(GTK_ENTRY(entryLine), ""); |
274 | } | 274 | } |
275 | 275 | ||
@@ -303,17 +303,17 @@ struct ECRS_MetaData * getMetaDataFromList(GladeXML * xml, | |||
303 | } while (gtk_tree_model_iter_next(metamodel, | 303 | } while (gtk_tree_model_iter_next(metamodel, |
304 | &iter)); | 304 | &iter)); |
305 | } | 305 | } |
306 | if (previewName == NULL) | 306 | if (previewName == NULL) |
307 | return meta; | 307 | return meta; |
308 | 308 | ||
309 | preview = glade_xml_get_widget(xml, | 309 | preview = glade_xml_get_widget(xml, |
310 | previewName); | 310 | previewName); |
311 | 311 | ||
312 | if (GTK_IMAGE_PIXBUF == | 312 | if (GTK_IMAGE_PIXBUF == |
313 | gtk_image_get_storage_type(GTK_IMAGE(preview))) { | 313 | gtk_image_get_storage_type(GTK_IMAGE(preview))) { |
314 | size_t length; | 314 | size_t length; |
315 | char * thumb; | 315 | char * thumb; |
316 | 316 | ||
317 | pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(preview)); | 317 | pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(preview)); |
318 | if (pixbuf != NULL) { | 318 | if (pixbuf != NULL) { |
319 | thumb = NULL; | 319 | thumb = NULL; |
@@ -334,7 +334,7 @@ struct ECRS_MetaData * getMetaDataFromList(GladeXML * xml, | |||
334 | FREE(binary); | 334 | FREE(binary); |
335 | } | 335 | } |
336 | } | 336 | } |
337 | } | 337 | } |
338 | return meta; | 338 | return meta; |
339 | } | 339 | } |
340 | 340 | ||
@@ -352,7 +352,7 @@ struct ECRS_URI * getKeywordURIFromList(GladeXML * xml, | |||
352 | keyList = GTK_TREE_VIEW(glade_xml_get_widget(xml, | 352 | keyList = GTK_TREE_VIEW(glade_xml_get_widget(xml, |
353 | name)); | 353 | name)); |
354 | keymodel = gtk_tree_view_get_model(keyList); | 354 | keymodel = gtk_tree_view_get_model(keyList); |
355 | 355 | ||
356 | keywords = NULL; | 356 | keywords = NULL; |
357 | ksize = 0; | 357 | ksize = 0; |
358 | GROW(keywords, | 358 | GROW(keywords, |
@@ -375,9 +375,9 @@ struct ECRS_URI * getKeywordURIFromList(GladeXML * xml, | |||
375 | &iter)); | 375 | &iter)); |
376 | } | 376 | } |
377 | keywords[kpos] = NULL; | 377 | keywords[kpos] = NULL; |
378 | 378 | ||
379 | keywordURI = ECRS_keywordsToUri((const char**)keywords); | 379 | keywordURI = ECRS_keywordsToUri((const char**)keywords); |
380 | while (kpos > 0) | 380 | while (kpos > 0) |
381 | FREE(keywords[--kpos]); | 381 | FREE(keywords[--kpos]); |
382 | GROW(keywords, | 382 | GROW(keywords, |
383 | ksize, | 383 | ksize, |
@@ -403,7 +403,7 @@ int parseTimeInterval(const char * timeSpec, | |||
403 | else if (0 == strcmp(_("--no update--"), | 403 | else if (0 == strcmp(_("--no update--"), |
404 | timeSpec)) | 404 | timeSpec)) |
405 | *interval = ECRS_SBLOCK_UPDATE_NONE; | 405 | *interval = ECRS_SBLOCK_UPDATE_NONE; |
406 | else | 406 | else |
407 | return parseTime(timeSpec, | 407 | return parseTime(timeSpec, |
408 | interval); | 408 | interval); |
409 | return OK; | 409 | return OK; |
diff --git a/src/plugins/fs/meta.h b/src/plugins/fs/meta.h index 41bcbd69..fb54e464 100644 --- a/src/plugins/fs/meta.h +++ b/src/plugins/fs/meta.h | |||
@@ -46,7 +46,7 @@ void handleKeywordListUpdate(GladeXML * xml, | |||
46 | const char * inputLineName, | 46 | const char * inputLineName, |
47 | const char * keywordListName); | 47 | const char * keywordListName); |
48 | 48 | ||
49 | void handleMetaDataListUpdate(GladeXML * xml, | 49 | void handleMetaDataListUpdate(GladeXML * xml, |
50 | const char * typeInputLineName, | 50 | const char * typeInputLineName, |
51 | const char * valueInputLineName, | 51 | const char * valueInputLineName, |
52 | const char * metaDataListName); | 52 | const char * metaDataListName); |
diff --git a/src/plugins/fs/namespace.c b/src/plugins/fs/namespace.c index 175f4f6a..a592ea1e 100644 --- a/src/plugins/fs/namespace.c +++ b/src/plugins/fs/namespace.c | |||
@@ -63,7 +63,7 @@ static GtkWidget * makeNamespaceFrame(GtkWidget ** treeview, | |||
63 | 63 | ||
64 | namespaceXML | 64 | namespaceXML |
65 | = glade_xml_new(getGladeFileName(), | 65 | = glade_xml_new(getGladeFileName(), |
66 | "namespaceContentFrame", | 66 | "namespaceContentFrame", |
67 | PACKAGE_NAME); | 67 | PACKAGE_NAME); |
68 | connectGladeWithPlugins(namespaceXML); | 68 | connectGladeWithPlugins(namespaceXML); |
69 | window = glade_xml_get_widget(namespaceXML, | 69 | window = glade_xml_get_widget(namespaceXML, |
@@ -79,11 +79,11 @@ static GtkWidget * makeNamespaceFrame(GtkWidget ** treeview, | |||
79 | G_TYPE_STRING, /* (file)name */ | 79 | G_TYPE_STRING, /* (file)name */ |
80 | G_TYPE_UINT64, /* size */ | 80 | G_TYPE_UINT64, /* size */ |
81 | G_TYPE_STRING, /* description */ | 81 | G_TYPE_STRING, /* description */ |
82 | G_TYPE_STRING, /* mime-type */ | 82 | G_TYPE_STRING, /* mime-type */ |
83 | G_TYPE_STRING, /* last-ID */ | 83 | G_TYPE_STRING, /* last-ID */ |
84 | G_TYPE_STRING, /* next-ID */ | 84 | G_TYPE_STRING, /* next-ID */ |
85 | G_TYPE_STRING, /* pub-freq */ | 85 | G_TYPE_STRING, /* pub-freq */ |
86 | G_TYPE_STRING, /* next pub date */ | 86 | G_TYPE_STRING, /* next pub date */ |
87 | G_TYPE_POINTER, /* URI */ | 87 | G_TYPE_POINTER, /* URI */ |
88 | G_TYPE_POINTER); /* META */ | 88 | G_TYPE_POINTER); /* META */ |
89 | gtk_tree_view_set_model(GTK_TREE_VIEW(resultList), | 89 | gtk_tree_view_set_model(GTK_TREE_VIEW(resultList), |
@@ -178,7 +178,7 @@ static int updateView(const ECRS_FileInfo * fi, | |||
178 | NAMESPACE_URI, &euri, | 178 | NAMESPACE_URI, &euri, |
179 | -1); | 179 | -1); |
180 | if (ECRS_equalsUri(euri, | 180 | if (ECRS_equalsUri(euri, |
181 | fi->uri)) | 181 | fi->uri)) |
182 | return OK; /* already listed */ | 182 | return OK; /* already listed */ |
183 | } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(model), | 183 | } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(model), |
184 | &iter)); | 184 | &iter)); |
@@ -194,9 +194,9 @@ static int updateView(const ECRS_FileInfo * fi, | |||
194 | EXTRACTOR_CREATOR, | 194 | EXTRACTOR_CREATOR, |
195 | EXTRACTOR_PRODUCER, | 195 | EXTRACTOR_PRODUCER, |
196 | EXTRACTOR_UNKNOWN, | 196 | EXTRACTOR_UNKNOWN, |
197 | -1); | 197 | -1); |
198 | if (filename == NULL) | 198 | if (filename == NULL) |
199 | filename = STRDUP(_("no name given")); | 199 | filename = STRDUP(_("no name given")); |
200 | if (ECRS_isFileUri(fi->uri)) | 200 | if (ECRS_isFileUri(fi->uri)) |
201 | size = ECRS_fileSize(fi->uri); | 201 | size = ECRS_fileSize(fi->uri); |
202 | else | 202 | else |
@@ -233,10 +233,10 @@ static void clearContentList(void * mdl) { | |||
233 | -1); | 233 | -1); |
234 | ECRS_freeUri(uri); | 234 | ECRS_freeUri(uri); |
235 | ECRS_freeMetaData(meta); | 235 | ECRS_freeMetaData(meta); |
236 | 236 | ||
237 | } while (gtk_list_store_remove(GTK_LIST_STORE(model), | 237 | } while (gtk_list_store_remove(GTK_LIST_STORE(model), |
238 | &iter)); | 238 | &iter)); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
242 | /** | 242 | /** |
@@ -303,9 +303,9 @@ static int addNamespaceContentToModel(void * cls, | |||
303 | EXTRACTOR_CREATOR, | 303 | EXTRACTOR_CREATOR, |
304 | EXTRACTOR_PRODUCER, | 304 | EXTRACTOR_PRODUCER, |
305 | EXTRACTOR_UNKNOWN, | 305 | EXTRACTOR_UNKNOWN, |
306 | -1); | 306 | -1); |
307 | if (filename == NULL) | 307 | if (filename == NULL) |
308 | filename = STRDUP(_("no name given")); | 308 | filename = STRDUP(_("no name given")); |
309 | desc = ECRS_getFirstFromMetaData(fi->meta, | 309 | desc = ECRS_getFirstFromMetaData(fi->meta, |
310 | EXTRACTOR_DESCRIPTION, | 310 | EXTRACTOR_DESCRIPTION, |
311 | EXTRACTOR_GENRE, | 311 | EXTRACTOR_GENRE, |
@@ -328,17 +328,17 @@ static int addNamespaceContentToModel(void * cls, | |||
328 | size = 0; | 328 | size = 0; |
329 | uriString = ECRS_uriToString(fi->uri); | 329 | uriString = ECRS_uriToString(fi->uri); |
330 | hash2enc(lastId, &last); | 330 | hash2enc(lastId, &last); |
331 | if (nextId != NULL) | 331 | if (nextId != NULL) |
332 | hash2enc(nextId, &next); | 332 | hash2enc(nextId, &next); |
333 | else | 333 | else |
334 | memset(&next, 0, sizeof(EncName)); | 334 | memset(&next, 0, sizeof(EncName)); |
335 | if (publicationFrequency == ECRS_SBLOCK_UPDATE_SPORADIC) | 335 | if (publicationFrequency == ECRS_SBLOCK_UPDATE_SPORADIC) |
336 | date = STRDUP(_("unspecified")); | 336 | date = STRDUP(_("unspecified")); |
337 | else if (publicationFrequency == ECRS_SBLOCK_UPDATE_NONE) | 337 | else if (publicationFrequency == ECRS_SBLOCK_UPDATE_NONE) |
338 | date = STRDUP(_("never")); | 338 | date = STRDUP(_("never")); |
339 | else | 339 | else |
340 | date = GN_CTIME(&nextPublicationTime); | 340 | date = GN_CTIME(&nextPublicationTime); |
341 | 341 | ||
342 | freq = updateIntervalToString(publicationFrequency); | 342 | freq = updateIntervalToString(publicationFrequency); |
343 | gtk_list_store_append(model, | 343 | gtk_list_store_append(model, |
344 | &iter); | 344 | &iter); |
@@ -445,14 +445,14 @@ void create_namespace_clicked(GtkWidget * dummy1, | |||
445 | connectGladeWithPlugins(metaXML); | 445 | connectGladeWithPlugins(metaXML); |
446 | dialog = glade_xml_get_widget(metaXML, | 446 | dialog = glade_xml_get_widget(metaXML, |
447 | "namespaceMetaDataDialog"); | 447 | "namespaceMetaDataDialog"); |
448 | createMetaDataListTreeView(metaXML, | 448 | createMetaDataListTreeView(metaXML, |
449 | "namespaceMetaDataDialogMetaDataList", | 449 | "namespaceMetaDataDialogMetaDataList", |
450 | NULL, | 450 | NULL, |
451 | NULL); | 451 | NULL); |
452 | createKeywordListTreeView(metaXML, | 452 | createKeywordListTreeView(metaXML, |
453 | "namespaceMetaDataDialogKeywordList", | 453 | "namespaceMetaDataDialogKeywordList", |
454 | NULL); | 454 | NULL); |
455 | createMetaTypeComboBox(metaXML, | 455 | createMetaTypeComboBox(metaXML, |
456 | "namespaceMetaDataDialogMetaTypeComboBox"); | 456 | "namespaceMetaDataDialogMetaTypeComboBox"); |
457 | gtk_dialog_set_default_response(GTK_DIALOG(dialog), | 457 | gtk_dialog_set_default_response(GTK_DIALOG(dialog), |
458 | GTK_RESPONSE_OK); | 458 | GTK_RESPONSE_OK); |
@@ -461,19 +461,19 @@ void create_namespace_clicked(GtkWidget * dummy1, | |||
461 | = getMetaDataFromList(metaXML, | 461 | = getMetaDataFromList(metaXML, |
462 | "namespaceMetaDataDialogMetaDataList", | 462 | "namespaceMetaDataDialogMetaDataList", |
463 | NULL); | 463 | NULL); |
464 | keywordURI | 464 | keywordURI |
465 | = getKeywordURIFromList(metaXML, | 465 | = getKeywordURIFromList(metaXML, |
466 | "namespaceMetaDataDialogKeywordList"); | 466 | "namespaceMetaDataDialogKeywordList"); |
467 | spin = glade_xml_get_widget(metaXML, | 467 | spin = glade_xml_get_widget(metaXML, |
468 | "namespaceAnonymityspinbutton"); | 468 | "namespaceAnonymityspinbutton"); |
469 | nameLine = glade_xml_get_widget(metaXML, | 469 | nameLine = glade_xml_get_widget(metaXML, |
470 | "namespaceRootEntry"); | 470 | "namespaceRootEntry"); |
471 | namespaceName = gtk_entry_get_text(GTK_ENTRY(nameLine)); | 471 | namespaceName = gtk_entry_get_text(GTK_ENTRY(nameLine)); |
472 | if (namespaceName == NULL) | 472 | if (namespaceName == NULL) |
473 | namespaceName = "root"; /* do NOT translate "root"! */ | 473 | namespaceName = "root"; /* do NOT translate "root"! */ |
474 | hash(namespaceName, | 474 | hash(namespaceName, |
475 | strlen(namespaceName), | 475 | strlen(namespaceName), |
476 | &rootEntry); | 476 | &rootEntry); |
477 | nameLine = glade_xml_get_widget(metaXML, | 477 | nameLine = glade_xml_get_widget(metaXML, |
478 | "namespaceNameEntry"); | 478 | "namespaceNameEntry"); |
479 | namespaceName = gtk_entry_get_text(GTK_ENTRY(nameLine)); | 479 | namespaceName = gtk_entry_get_text(GTK_ENTRY(nameLine)); |
@@ -495,8 +495,8 @@ void create_namespace_clicked(GtkWidget * dummy1, | |||
495 | ECRS_freeUri(root); | 495 | ECRS_freeUri(root); |
496 | } else { | 496 | } else { |
497 | GtkWidget * dialog; | 497 | GtkWidget * dialog; |
498 | 498 | ||
499 | dialog = gtk_message_dialog_new | 499 | dialog = gtk_message_dialog_new |
500 | (NULL, | 500 | (NULL, |
501 | GTK_DIALOG_MODAL, | 501 | GTK_DIALOG_MODAL, |
502 | GTK_MESSAGE_ERROR, | 502 | GTK_MESSAGE_ERROR, |
@@ -507,7 +507,7 @@ void create_namespace_clicked(GtkWidget * dummy1, | |||
507 | "already exists."), | 507 | "already exists."), |
508 | namespaceName); | 508 | namespaceName); |
509 | gtk_dialog_run(GTK_DIALOG(dialog)); | 509 | gtk_dialog_run(GTK_DIALOG(dialog)); |
510 | gtk_widget_destroy(dialog); | 510 | gtk_widget_destroy(dialog); |
511 | } | 511 | } |
512 | ECRS_freeMetaData(meta); | 512 | ECRS_freeMetaData(meta); |
513 | ECRS_freeUri(keywordURI); | 513 | ECRS_freeUri(keywordURI); |
@@ -524,31 +524,31 @@ void namespaceDelete_clicked(GtkWidget * dummy1, | |||
524 | NamespaceList * prev; | 524 | NamespaceList * prev; |
525 | gint num; | 525 | gint num; |
526 | GtkWidget * page; | 526 | GtkWidget * page; |
527 | GtkWidget * dialog; | 527 | GtkWidget * dialog; |
528 | gint ret; | 528 | gint ret; |
529 | 529 | ||
530 | notebook | 530 | notebook |
531 | = glade_xml_get_widget(getMainXML(), | 531 | = glade_xml_get_widget(getMainXML(), |
532 | "localNamespacesNotebook"); | 532 | "localNamespacesNotebook"); |
533 | num | 533 | num |
534 | = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)); | 534 | = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)); |
535 | if (num == -1) { | 535 | if (num == -1) { |
536 | /* IMPROVE-ME: disable the menu item | 536 | /* IMPROVE-ME: disable the menu item |
537 | as long as this may happen! */ | 537 | as long as this may happen! */ |
538 | dialog = gtk_message_dialog_new | 538 | dialog = gtk_message_dialog_new |
539 | (NULL, | 539 | (NULL, |
540 | GTK_DIALOG_MODAL, | 540 | GTK_DIALOG_MODAL, |
541 | GTK_MESSAGE_ERROR, | 541 | GTK_MESSAGE_ERROR, |
542 | GTK_BUTTONS_CLOSE, | 542 | GTK_BUTTONS_CLOSE, |
543 | _("No local namespaces available that could be deleted!")); | 543 | _("No local namespaces available that could be deleted!")); |
544 | gtk_dialog_run(GTK_DIALOG(dialog)); | 544 | gtk_dialog_run(GTK_DIALOG(dialog)); |
545 | gtk_widget_destroy(dialog); | 545 | gtk_widget_destroy(dialog); |
546 | return; | 546 | return; |
547 | } | 547 | } |
548 | page | 548 | page |
549 | = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), | 549 | = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), |
550 | num); | 550 | num); |
551 | list | 551 | list |
552 | = head; | 552 | = head; |
553 | prev | 553 | prev |
554 | = NULL; | 554 | = NULL; |
@@ -563,8 +563,8 @@ void namespaceDelete_clicked(GtkWidget * dummy1, | |||
563 | } | 563 | } |
564 | /* open window to ask for confirmation, | 564 | /* open window to ask for confirmation, |
565 | only then delete */ | 565 | only then delete */ |
566 | 566 | ||
567 | dialog = gtk_message_dialog_new | 567 | dialog = gtk_message_dialog_new |
568 | (NULL, | 568 | (NULL, |
569 | GTK_DIALOG_MODAL, | 569 | GTK_DIALOG_MODAL, |
570 | GTK_MESSAGE_ERROR, | 570 | GTK_MESSAGE_ERROR, |
@@ -572,7 +572,7 @@ void namespaceDelete_clicked(GtkWidget * dummy1, | |||
572 | _("Should the namespace `%s' really be deleted?"), | 572 | _("Should the namespace `%s' really be deleted?"), |
573 | list->name); | 573 | list->name); |
574 | ret = gtk_dialog_run(GTK_DIALOG(dialog)); | 574 | ret = gtk_dialog_run(GTK_DIALOG(dialog)); |
575 | gtk_widget_destroy(dialog); | 575 | gtk_widget_destroy(dialog); |
576 | if (GTK_RESPONSE_YES != ret) | 576 | if (GTK_RESPONSE_YES != ret) |
577 | return; | 577 | return; |
578 | 578 | ||
@@ -594,7 +594,7 @@ typedef struct { | |||
594 | TIME_T updateInterval; | 594 | TIME_T updateInterval; |
595 | HashCode512 * lastId; | 595 | HashCode512 * lastId; |
596 | HashCode512 thisId; | 596 | HashCode512 thisId; |
597 | HashCode512 * nextId; | 597 | HashCode512 * nextId; |
598 | struct ECRS_MetaData * meta; | 598 | struct ECRS_MetaData * meta; |
599 | } IUC; | 599 | } IUC; |
600 | 600 | ||
@@ -625,11 +625,11 @@ static void initiateUpload(GtkTreeModel * model, | |||
625 | original file ID (ometa) with the new metadata (cls->meta) here; | 625 | original file ID (ometa) with the new metadata (cls->meta) here; |
626 | or if we limit us to one file at a time, show the original | 626 | or if we limit us to one file at a time, show the original |
627 | metadata immediately with the dialog. */ | 627 | metadata immediately with the dialog. */ |
628 | 628 | ||
629 | if (dst == NULL) { | 629 | if (dst == NULL) { |
630 | BREAK(); | 630 | BREAK(); |
631 | return; | 631 | return; |
632 | } | 632 | } |
633 | resultURI = FSUI_addToNamespace(ctx, | 633 | resultURI = FSUI_addToNamespace(ctx, |
634 | cls->anonymityLevel, | 634 | cls->anonymityLevel, |
635 | cls->namespaceName, | 635 | cls->namespaceName, |
@@ -664,7 +664,7 @@ static void initiateUpload(GtkTreeModel * model, | |||
664 | _("Failed to insert content into namespace " | 664 | _("Failed to insert content into namespace " |
665 | "(consult logs).\n")); | 665 | "(consult logs).\n")); |
666 | } | 666 | } |
667 | } | 667 | } |
668 | 668 | ||
669 | void on_namespaceInsertMetaDataDialogMetaDataAddButton_clicked(GtkWidget * dummy1, | 669 | void on_namespaceInsertMetaDataDialogMetaDataAddButton_clicked(GtkWidget * dummy1, |
670 | GtkWidget * dummy2) { | 670 | GtkWidget * dummy2) { |
@@ -693,20 +693,20 @@ void on_namespaceInsertButton_clicked(GtkWidget * dummy1, | |||
693 | contentList | 693 | contentList |
694 | = glade_xml_get_widget(getMainXML(), | 694 | = glade_xml_get_widget(getMainXML(), |
695 | "availableContentList"); | 695 | "availableContentList"); |
696 | selection | 696 | selection |
697 | = gtk_tree_view_get_selection(GTK_TREE_VIEW(contentList)); | 697 | = gtk_tree_view_get_selection(GTK_TREE_VIEW(contentList)); |
698 | if (0 == gtk_tree_selection_count_selected_rows(selection)) { | 698 | if (0 == gtk_tree_selection_count_selected_rows(selection)) { |
699 | /* IMPROVE-ME: disable the menu item | 699 | /* IMPROVE-ME: disable the menu item |
700 | as long as this may happen! */ | 700 | as long as this may happen! */ |
701 | dialog = gtk_message_dialog_new | 701 | dialog = gtk_message_dialog_new |
702 | (NULL, | 702 | (NULL, |
703 | GTK_DIALOG_MODAL, | 703 | GTK_DIALOG_MODAL, |
704 | GTK_MESSAGE_ERROR, | 704 | GTK_MESSAGE_ERROR, |
705 | GTK_BUTTONS_CLOSE, | 705 | GTK_BUTTONS_CLOSE, |
706 | _("You must select some available content for publication first!")); | 706 | _("You must select some available content for publication first!")); |
707 | gtk_dialog_run(GTK_DIALOG(dialog)); | 707 | gtk_dialog_run(GTK_DIALOG(dialog)); |
708 | gtk_widget_destroy(dialog); | 708 | gtk_widget_destroy(dialog); |
709 | return; | 709 | return; |
710 | } | 710 | } |
711 | if (FALSE == gtk_tree_selection_get_selected(selection, | 711 | if (FALSE == gtk_tree_selection_get_selected(selection, |
712 | NULL, | 712 | NULL, |
@@ -758,14 +758,14 @@ void on_namespaceInsertButton_clicked(GtkWidget * dummy1, | |||
758 | gtk_widget_destroy(dialog); | 758 | gtk_widget_destroy(dialog); |
759 | UNREF(metaXML); | 759 | UNREF(metaXML); |
760 | metaXML = NULL; | 760 | metaXML = NULL; |
761 | dialog = gtk_message_dialog_new | 761 | dialog = gtk_message_dialog_new |
762 | (NULL, | 762 | (NULL, |
763 | GTK_DIALOG_MODAL, | 763 | GTK_DIALOG_MODAL, |
764 | GTK_MESSAGE_ERROR, | 764 | GTK_MESSAGE_ERROR, |
765 | GTK_BUTTONS_CLOSE, | 765 | GTK_BUTTONS_CLOSE, |
766 | _("Failed to parse given time interval!")); | 766 | _("Failed to parse given time interval!")); |
767 | gtk_dialog_run(GTK_DIALOG(dialog)); | 767 | gtk_dialog_run(GTK_DIALOG(dialog)); |
768 | gtk_widget_destroy(dialog); | 768 | gtk_widget_destroy(dialog); |
769 | return; | 769 | return; |
770 | } | 770 | } |
771 | 771 | ||
@@ -774,7 +774,7 @@ void on_namespaceInsertButton_clicked(GtkWidget * dummy1, | |||
774 | "namespaceInsertPreview"); | 774 | "namespaceInsertPreview"); |
775 | cls.anonymityLevel | 775 | cls.anonymityLevel |
776 | = getAnonymityLevel(metaXML, | 776 | = getAnonymityLevel(metaXML, |
777 | "anonymitySpinButton"); | 777 | "anonymitySpinButton"); |
778 | nameLine = glade_xml_get_widget(metaXML, | 778 | nameLine = glade_xml_get_widget(metaXML, |
779 | "namespaceContentIdentifierEntry"); | 779 | "namespaceContentIdentifierEntry"); |
780 | identifierName = gtk_entry_get_text(GTK_ENTRY(nameLine)); | 780 | identifierName = gtk_entry_get_text(GTK_ENTRY(nameLine)); |
@@ -791,7 +791,7 @@ void on_namespaceInsertButton_clicked(GtkWidget * dummy1, | |||
791 | if ( (identifierName == NULL) || | 791 | if ( (identifierName == NULL) || |
792 | (strlen(identifierName) == 0)) { | 792 | (strlen(identifierName) == 0)) { |
793 | cls.nextId = NULL; | 793 | cls.nextId = NULL; |
794 | } else { | 794 | } else { |
795 | hash(identifierName, | 795 | hash(identifierName, |
796 | strlen(identifierName), | 796 | strlen(identifierName), |
797 | &nextId); | 797 | &nextId); |
@@ -836,20 +836,20 @@ void on_namespaceUpdateButton_clicked(GtkWidget * dummy1, | |||
836 | contentList | 836 | contentList |
837 | = glade_xml_get_widget(getMainXML(), | 837 | = glade_xml_get_widget(getMainXML(), |
838 | "availableContentList"); | 838 | "availableContentList"); |
839 | selection | 839 | selection |
840 | = gtk_tree_view_get_selection(GTK_TREE_VIEW(contentList)); | 840 | = gtk_tree_view_get_selection(GTK_TREE_VIEW(contentList)); |
841 | if (0 == gtk_tree_selection_count_selected_rows(selection)) { | 841 | if (0 == gtk_tree_selection_count_selected_rows(selection)) { |
842 | /* IMPROVE-ME: disable the menu item | 842 | /* IMPROVE-ME: disable the menu item |
843 | as long as this may happen! */ | 843 | as long as this may happen! */ |
844 | dialog = gtk_message_dialog_new | 844 | dialog = gtk_message_dialog_new |
845 | (NULL, | 845 | (NULL, |
846 | GTK_DIALOG_MODAL, | 846 | GTK_DIALOG_MODAL, |
847 | GTK_MESSAGE_ERROR, | 847 | GTK_MESSAGE_ERROR, |
848 | GTK_BUTTONS_CLOSE, | 848 | GTK_BUTTONS_CLOSE, |
849 | _("You must select some available content for publication first!")); | 849 | _("You must select some available content for publication first!")); |
850 | gtk_dialog_run(GTK_DIALOG(dialog)); | 850 | gtk_dialog_run(GTK_DIALOG(dialog)); |
851 | gtk_widget_destroy(dialog); | 851 | gtk_widget_destroy(dialog); |
852 | return; | 852 | return; |
853 | } | 853 | } |
854 | if (FALSE == gtk_tree_selection_get_selected(selection, | 854 | if (FALSE == gtk_tree_selection_get_selected(selection, |
855 | NULL, | 855 | NULL, |
@@ -885,15 +885,15 @@ void on_namespaceUpdateButton_clicked(GtkWidget * dummy1, | |||
885 | if (0 == gtk_tree_selection_count_selected_rows(selectionNamespace)) { | 885 | if (0 == gtk_tree_selection_count_selected_rows(selectionNamespace)) { |
886 | /* IMPROVE-ME: disable the menu item | 886 | /* IMPROVE-ME: disable the menu item |
887 | as long as this may happen! */ | 887 | as long as this may happen! */ |
888 | dialog = gtk_message_dialog_new | 888 | dialog = gtk_message_dialog_new |
889 | (NULL, | 889 | (NULL, |
890 | GTK_DIALOG_MODAL, | 890 | GTK_DIALOG_MODAL, |
891 | GTK_MESSAGE_ERROR, | 891 | GTK_MESSAGE_ERROR, |
892 | GTK_BUTTONS_CLOSE, | 892 | GTK_BUTTONS_CLOSE, |
893 | _("You must select some existing namespace content to be updated first!")); | 893 | _("You must select some existing namespace content to be updated first!")); |
894 | gtk_dialog_run(GTK_DIALOG(dialog)); | 894 | gtk_dialog_run(GTK_DIALOG(dialog)); |
895 | gtk_widget_destroy(dialog); | 895 | gtk_widget_destroy(dialog); |
896 | return; | 896 | return; |
897 | } | 897 | } |
898 | if (FALSE == gtk_tree_selection_get_selected(selectionNamespace, | 898 | if (FALSE == gtk_tree_selection_get_selected(selectionNamespace, |
899 | NULL, | 899 | NULL, |
@@ -919,7 +919,7 @@ void on_namespaceUpdateButton_clicked(GtkWidget * dummy1, | |||
919 | next); | 919 | next); |
920 | if (OK != enc2hash(next, | 920 | if (OK != enc2hash(next, |
921 | &cls.thisId)) { | 921 | &cls.thisId)) { |
922 | BREAK(); | 922 | BREAK(); |
923 | UNREF(metaXML); | 923 | UNREF(metaXML); |
924 | metaXML = NULL; | 924 | metaXML = NULL; |
925 | return; | 925 | return; |
@@ -940,10 +940,10 @@ void on_namespaceUpdateButton_clicked(GtkWidget * dummy1, | |||
940 | } | 940 | } |
941 | if (cls.updateInterval == ECRS_SBLOCK_UPDATE_SPORADIC) { | 941 | if (cls.updateInterval == ECRS_SBLOCK_UPDATE_SPORADIC) { |
942 | gtk_entry_set_text(GTK_ENTRY(nameLine), | 942 | gtk_entry_set_text(GTK_ENTRY(nameLine), |
943 | ""); | 943 | ""); |
944 | } else { | 944 | } else { |
945 | EncName updateName; | 945 | EncName updateName; |
946 | 946 | ||
947 | if (OK != FSUI_computeNextId(list->name, | 947 | if (OK != FSUI_computeNextId(list->name, |
948 | &prevId, | 948 | &prevId, |
949 | &cls.thisId, | 949 | &cls.thisId, |
@@ -957,7 +957,7 @@ void on_namespaceUpdateButton_clicked(GtkWidget * dummy1, | |||
957 | hash2enc(&nextId, | 957 | hash2enc(&nextId, |
958 | &updateName); | 958 | &updateName); |
959 | gtk_entry_set_text(GTK_ENTRY(nameLine), | 959 | gtk_entry_set_text(GTK_ENTRY(nameLine), |
960 | (const char*) &updateName); | 960 | (const char*) &updateName); |
961 | gtk_entry_set_editable(GTK_ENTRY(nameLine), | 961 | gtk_entry_set_editable(GTK_ENTRY(nameLine), |
962 | FALSE); | 962 | FALSE); |
963 | } | 963 | } |
@@ -996,14 +996,14 @@ void on_namespaceUpdateButton_clicked(GtkWidget * dummy1, | |||
996 | gtk_widget_destroy(dialog); | 996 | gtk_widget_destroy(dialog); |
997 | UNREF(metaXML); | 997 | UNREF(metaXML); |
998 | metaXML = NULL; | 998 | metaXML = NULL; |
999 | dialog = gtk_message_dialog_new | 999 | dialog = gtk_message_dialog_new |
1000 | (NULL, | 1000 | (NULL, |
1001 | GTK_DIALOG_MODAL, | 1001 | GTK_DIALOG_MODAL, |
1002 | GTK_MESSAGE_ERROR, | 1002 | GTK_MESSAGE_ERROR, |
1003 | GTK_BUTTONS_CLOSE, | 1003 | GTK_BUTTONS_CLOSE, |
1004 | error); | 1004 | error); |
1005 | gtk_dialog_run(GTK_DIALOG(dialog)); | 1005 | gtk_dialog_run(GTK_DIALOG(dialog)); |
1006 | gtk_widget_destroy(dialog); | 1006 | gtk_widget_destroy(dialog); |
1007 | return; | 1007 | return; |
1008 | } | 1008 | } |
1009 | hash(identifierName, | 1009 | hash(identifierName, |
@@ -1014,14 +1014,14 @@ void on_namespaceUpdateButton_clicked(GtkWidget * dummy1, | |||
1014 | "namespaceUpdateMetaDataTreeView", | 1014 | "namespaceUpdateMetaDataTreeView", |
1015 | "namespaceUpdatePreviewImage"); | 1015 | "namespaceUpdatePreviewImage"); |
1016 | spin = glade_xml_get_widget(metaXML, | 1016 | spin = glade_xml_get_widget(metaXML, |
1017 | "namespaceUpdateAnonymitySpinButton"); | 1017 | "namespaceUpdateAnonymitySpinButton"); |
1018 | cls.anonymityLevel | 1018 | cls.anonymityLevel |
1019 | = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin)); | 1019 | = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin)); |
1020 | 1020 | ||
1021 | gtk_tree_selection_selected_foreach | 1021 | gtk_tree_selection_selected_foreach |
1022 | (selection, | 1022 | (selection, |
1023 | &initiateUpload, | 1023 | &initiateUpload, |
1024 | &cls); | 1024 | &cls); |
1025 | ECRS_freeMetaData(cls.meta); | 1025 | ECRS_freeMetaData(cls.meta); |
1026 | } | 1026 | } |
1027 | gtk_widget_destroy(dialog); | 1027 | gtk_widget_destroy(dialog); |
@@ -1072,7 +1072,7 @@ void fs_namespace_start() { | |||
1072 | = glade_xml_get_widget(getMainXML(), | 1072 | = glade_xml_get_widget(getMainXML(), |
1073 | "availableContentList"); | 1073 | "availableContentList"); |
1074 | 1074 | ||
1075 | model = gtk_list_store_new(NAMESPACE_NUM, | 1075 | model = gtk_list_store_new(NAMESPACE_NUM, |
1076 | G_TYPE_STRING, /* name */ | 1076 | G_TYPE_STRING, /* name */ |
1077 | G_TYPE_UINT64, /* size */ | 1077 | G_TYPE_UINT64, /* size */ |
1078 | G_TYPE_STRING, /* uri-string */ | 1078 | G_TYPE_STRING, /* uri-string */ |
@@ -1100,7 +1100,7 @@ void fs_namespace_start() { | |||
1100 | _("URI"), | 1100 | _("URI"), |
1101 | renderer, | 1101 | renderer, |
1102 | "text", NAMESPACE_URISTRING, | 1102 | "text", NAMESPACE_URISTRING, |
1103 | NULL); | 1103 | NULL); |
1104 | addCronJob(&updateContentList, | 1104 | addCronJob(&updateContentList, |
1105 | 0, | 1105 | 0, |
1106 | UPDATE_CONTENT_LIST_FREQUENCY, | 1106 | UPDATE_CONTENT_LIST_FREQUENCY, |
@@ -1139,7 +1139,7 @@ void on_localNamespacesNotebook_destroy(GtkWidget * dummy1, | |||
1139 | pos = head->next; | 1139 | pos = head->next; |
1140 | FREE(head->name); | 1140 | FREE(head->name); |
1141 | ECRS_freeMetaData(head->meta); | 1141 | ECRS_freeMetaData(head->meta); |
1142 | 1142 | ||
1143 | if (gtk_tree_model_get_iter_first(head->model, | 1143 | if (gtk_tree_model_get_iter_first(head->model, |
1144 | &iter)) { | 1144 | &iter)) { |
1145 | do { | 1145 | do { |
@@ -1152,7 +1152,7 @@ void on_localNamespacesNotebook_destroy(GtkWidget * dummy1, | |||
1152 | &iter, | 1152 | &iter, |
1153 | IN_NAMESPACE_URI, NULL, | 1153 | IN_NAMESPACE_URI, NULL, |
1154 | IN_NAMESPACE_META, NULL, | 1154 | IN_NAMESPACE_META, NULL, |
1155 | -1); | 1155 | -1); |
1156 | if (u != NULL) | 1156 | if (u != NULL) |
1157 | ECRS_freeUri(u); | 1157 | ECRS_freeUri(u); |
1158 | if (m != NULL) | 1158 | if (m != NULL) |
diff --git a/src/plugins/fs/search.c b/src/plugins/fs/search.c index 9c89226d..cd9dd14a 100644 --- a/src/plugins/fs/search.c +++ b/src/plugins/fs/search.c | |||
@@ -68,7 +68,7 @@ void addEntryToSearchTree(GtkTreeStore * model, | |||
68 | unsigned char * thumb; | 68 | unsigned char * thumb; |
69 | size_t ts; | 69 | size_t ts; |
70 | GdkPixbuf * pixbuf; | 70 | GdkPixbuf * pixbuf; |
71 | GdkPixbufLoader * loader; | 71 | GdkPixbufLoader * loader; |
72 | unsigned long long size; | 72 | unsigned long long size; |
73 | 73 | ||
74 | mime = ECRS_getFromMetaData(meta, | 74 | mime = ECRS_getFromMetaData(meta, |
@@ -98,11 +98,11 @@ void addEntryToSearchTree(GtkTreeStore * model, | |||
98 | EXTRACTOR_UNKNOWN, | 98 | EXTRACTOR_UNKNOWN, |
99 | -1); | 99 | -1); |
100 | if (name == NULL) | 100 | if (name == NULL) |
101 | name = STRDUP(_("no name given")); | 101 | name = STRDUP(_("no name given")); |
102 | if (ECRS_isFileUri(uri)) { | 102 | if (ECRS_isFileUri(uri)) { |
103 | size = ECRS_fileSize(uri); | 103 | size = ECRS_fileSize(uri); |
104 | } else { | 104 | } else { |
105 | size = 0; | 105 | size = 0; |
106 | } | 106 | } |
107 | thumb = NULL; | 107 | thumb = NULL; |
108 | ts = ECRS_getThumbnailFromMetaData(meta, | 108 | ts = ECRS_getThumbnailFromMetaData(meta, |
@@ -112,7 +112,7 @@ void addEntryToSearchTree(GtkTreeStore * model, | |||
112 | gdk_pixbuf_loader_write(loader, | 112 | gdk_pixbuf_loader_write(loader, |
113 | (const guchar*) thumb, | 113 | (const guchar*) thumb, |
114 | ts, | 114 | ts, |
115 | NULL); | 115 | NULL); |
116 | pixbuf = gdk_pixbuf_loader_get_pixbuf(loader); | 116 | pixbuf = gdk_pixbuf_loader_get_pixbuf(loader); |
117 | gdk_pixbuf_loader_close(loader, | 117 | gdk_pixbuf_loader_close(loader, |
118 | NULL); | 118 | NULL); |
@@ -137,7 +137,7 @@ void addEntryToSearchTree(GtkTreeStore * model, | |||
137 | FREE(name); | 137 | FREE(name); |
138 | FREENONNULL(thumb); | 138 | FREENONNULL(thumb); |
139 | } | 139 | } |
140 | 140 | ||
141 | 141 | ||
142 | GtkWidget * getAnonymityButtonFromTM(GtkTreeModel * model) { | 142 | GtkWidget * getAnonymityButtonFromTM(GtkTreeModel * model) { |
143 | SearchList * list; | 143 | SearchList * list; |
@@ -155,7 +155,7 @@ GtkWidget * getAnonymityButtonFromTM(GtkTreeModel * model) { | |||
155 | /** | 155 | /** |
156 | * Recursively free the (internal) model data fields | 156 | * Recursively free the (internal) model data fields |
157 | * (uri and meta) from the search tree model. | 157 | * (uri and meta) from the search tree model. |
158 | */ | 158 | */ |
159 | static void freeIterSubtree(GtkTreeModel * tree, | 159 | static void freeIterSubtree(GtkTreeModel * tree, |
160 | GtkTreeIter * iter) { | 160 | GtkTreeIter * iter) { |
161 | GtkTreeIter child; | 161 | GtkTreeIter child; |
@@ -185,8 +185,8 @@ static void freeIterSubtree(GtkTreeModel * tree, | |||
185 | freeIterSubtree(tree, &child); | 185 | freeIterSubtree(tree, &child); |
186 | } while (gtk_tree_model_iter_next(tree, | 186 | } while (gtk_tree_model_iter_next(tree, |
187 | iter)); | 187 | iter)); |
188 | 188 | ||
189 | 189 | ||
190 | } | 190 | } |
191 | 191 | ||
192 | /** | 192 | /** |
@@ -203,7 +203,7 @@ void on_namespaceRatingSpinButton_changed(GtkWidget * dummy, | |||
203 | char * description; | 203 | char * description; |
204 | int rating; | 204 | int rating; |
205 | int newrating; | 205 | int newrating; |
206 | 206 | ||
207 | spin | 207 | spin |
208 | = glade_xml_get_widget(getMainXML(), | 208 | = glade_xml_get_widget(getMainXML(), |
209 | "namespaceRatingSpinButton"); | 209 | "namespaceRatingSpinButton"); |
@@ -212,13 +212,13 @@ void on_namespaceRatingSpinButton_changed(GtkWidget * dummy, | |||
212 | "searchNamespaceComboBoxEntry"); | 212 | "searchNamespaceComboBoxEntry"); |
213 | model = gtk_combo_box_get_model(GTK_COMBO_BOX(ncbe)); | 213 | model = gtk_combo_box_get_model(GTK_COMBO_BOX(ncbe)); |
214 | if (TRUE == gtk_combo_box_get_active_iter(GTK_COMBO_BOX(ncbe), | 214 | if (TRUE == gtk_combo_box_get_active_iter(GTK_COMBO_BOX(ncbe), |
215 | &iter)) { | 215 | &iter)) { |
216 | gtk_tree_model_get(model, | 216 | gtk_tree_model_get(model, |
217 | &iter, | 217 | &iter, |
218 | NS_SEARCH_DESCRIPTION, &description, | 218 | NS_SEARCH_DESCRIPTION, &description, |
219 | NS_SEARCH_ENCNAME, &encStr, | 219 | NS_SEARCH_ENCNAME, &encStr, |
220 | NS_SEARCH_RATING, &rating, | 220 | NS_SEARCH_RATING, &rating, |
221 | -1); | 221 | -1); |
222 | if ( (description != NULL) && | 222 | if ( (description != NULL) && |
223 | (0 == strcmp(description, | 223 | (0 == strcmp(description, |
224 | _("globally"))) ) { | 224 | _("globally"))) ) { |
@@ -241,16 +241,16 @@ void on_namespaceRatingSpinButton_changed(GtkWidget * dummy, | |||
241 | &iter, | 241 | &iter, |
242 | NS_SEARCH_RATING, rating, | 242 | NS_SEARCH_RATING, rating, |
243 | -1); | 243 | -1); |
244 | } | 244 | } |
245 | } | 245 | } |
246 | } else { | 246 | } else { |
247 | /* FIXME: if enc2hash succeeds, we may want to keep this | 247 | /* FIXME: if enc2hash succeeds, we may want to keep this |
248 | active */ | 248 | active */ |
249 | gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), | 249 | gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), |
250 | 0); | 250 | 0); |
251 | gtk_widget_set_sensitive(spin, | 251 | gtk_widget_set_sensitive(spin, |
252 | FALSE); | 252 | FALSE); |
253 | } | 253 | } |
254 | } | 254 | } |
255 | 255 | ||
256 | /** | 256 | /** |
@@ -327,7 +327,7 @@ void on_searchResults_destroy(GtkWidget * dummy, | |||
327 | GtkWidget * treeview) { | 327 | GtkWidget * treeview) { |
328 | GtkTreeStore * tree; | 328 | GtkTreeStore * tree; |
329 | GtkTreeIter iter; | 329 | GtkTreeIter iter; |
330 | 330 | ||
331 | tree = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(treeview))); | 331 | tree = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(treeview))); |
332 | if (! gtk_tree_model_get_iter_first(GTK_TREE_MODEL(tree), | 332 | if (! gtk_tree_model_get_iter_first(GTK_TREE_MODEL(tree), |
333 | &iter)) | 333 | &iter)) |
@@ -359,13 +359,13 @@ static void addSearchResultToModel(const ECRS_FileInfo * info, | |||
359 | path = gtk_tree_row_reference_get_path(row); | 359 | path = gtk_tree_row_reference_get_path(row); |
360 | model = GTK_TREE_STORE | 360 | model = GTK_TREE_STORE |
361 | (gtk_tree_view_get_model | 361 | (gtk_tree_view_get_model |
362 | (GTK_TREE_VIEW(treeview))); | 362 | (GTK_TREE_VIEW(treeview))); |
363 | if (path != NULL) { | 363 | if (path != NULL) { |
364 | gtk_tree_model_get_iter(GTK_TREE_MODEL(model), | 364 | gtk_tree_model_get_iter(GTK_TREE_MODEL(model), |
365 | &parent, | 365 | &parent, |
366 | path); | 366 | path); |
367 | pparent = &parent; | 367 | pparent = &parent; |
368 | } else | 368 | } else |
369 | pparent = NULL; | 369 | pparent = NULL; |
370 | gtk_tree_store_insert(model, | 370 | gtk_tree_store_insert(model, |
371 | &iter, | 371 | &iter, |
@@ -387,10 +387,10 @@ static void addSearchResultToModel(const ECRS_FileInfo * info, | |||
387 | */ | 387 | */ |
388 | void displaySearchResult(const ECRS_FileInfo * info, | 388 | void displaySearchResult(const ECRS_FileInfo * info, |
389 | const struct ECRS_URI * uri, | 389 | const struct ECRS_URI * uri, |
390 | GtkTreeRowReference * row) { | 390 | GtkTreeRowReference * row) { |
391 | SearchList * list; | 391 | SearchList * list; |
392 | struct ECRS_URI * euri; | 392 | struct ECRS_URI * euri; |
393 | unsigned int count; | 393 | unsigned int count; |
394 | GtkTreeIter iter; | 394 | GtkTreeIter iter; |
395 | 395 | ||
396 | list = head; | 396 | list = head; |
@@ -407,13 +407,13 @@ void displaySearchResult(const ECRS_FileInfo * info, | |||
407 | addSearchResultToModel(info, | 407 | addSearchResultToModel(info, |
408 | list->treeview, | 408 | list->treeview, |
409 | row); | 409 | row); |
410 | 410 | ||
411 | if (! gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary), | 411 | if (! gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary), |
412 | &iter)) { | 412 | &iter)) { |
413 | BREAK(); | 413 | BREAK(); |
414 | return; | 414 | return; |
415 | } | 415 | } |
416 | 416 | ||
417 | do { | 417 | do { |
418 | gtk_tree_model_get(GTK_TREE_MODEL(summary), | 418 | gtk_tree_model_get(GTK_TREE_MODEL(summary), |
419 | &iter, | 419 | &iter, |
@@ -454,10 +454,10 @@ void on_closeSearchButton_clicked(GtkWidget * searchPage, | |||
454 | prev = list; | 454 | prev = list; |
455 | list = list->next; | 455 | list = list->next; |
456 | } | 456 | } |
457 | 457 | ||
458 | if (list == NULL) | 458 | if (list == NULL) |
459 | return; | 459 | return; |
460 | 460 | ||
461 | uri = list->uri; | 461 | uri = list->uri; |
462 | FSUI_stopSearch(ctx, | 462 | FSUI_stopSearch(ctx, |
463 | uri); | 463 | uri); |
@@ -466,7 +466,7 @@ void on_closeSearchButton_clicked(GtkWidget * searchPage, | |||
466 | else | 466 | else |
467 | prev->next = list->next; | 467 | prev->next = list->next; |
468 | FREE(list); | 468 | FREE(list); |
469 | 469 | ||
470 | notebook | 470 | notebook |
471 | = glade_xml_get_widget(getMainXML(), | 471 | = glade_xml_get_widget(getMainXML(), |
472 | "downloadNotebook"); | 472 | "downloadNotebook"); |
@@ -519,7 +519,7 @@ static GtkWidget * makeResultFrame(GtkWidget ** treeview, | |||
519 | 519 | ||
520 | searchXML | 520 | searchXML |
521 | = glade_xml_new(getGladeFileName(), | 521 | = glade_xml_new(getGladeFileName(), |
522 | "searchResultsFrame", | 522 | "searchResultsFrame", |
523 | PACKAGE_NAME); | 523 | PACKAGE_NAME); |
524 | connectGladeWithPlugins(searchXML); | 524 | connectGladeWithPlugins(searchXML); |
525 | window = glade_xml_get_widget(searchXML, | 525 | window = glade_xml_get_widget(searchXML, |
@@ -534,8 +534,8 @@ static GtkWidget * makeResultFrame(GtkWidget ** treeview, | |||
534 | gtk_tree_store_new(SEARCH_NUM, | 534 | gtk_tree_store_new(SEARCH_NUM, |
535 | G_TYPE_STRING, /* name */ | 535 | G_TYPE_STRING, /* name */ |
536 | G_TYPE_UINT64, /* size */ | 536 | G_TYPE_UINT64, /* size */ |
537 | G_TYPE_STRING, /* mime-type */ | 537 | G_TYPE_STRING, /* mime-type */ |
538 | G_TYPE_STRING, /* meta-data (some) */ | 538 | G_TYPE_STRING, /* meta-data (some) */ |
539 | GDK_TYPE_PIXBUF, /* preview */ | 539 | GDK_TYPE_PIXBUF, /* preview */ |
540 | G_TYPE_POINTER, /* url */ | 540 | G_TYPE_POINTER, /* url */ |
541 | G_TYPE_POINTER, /* meta */ | 541 | G_TYPE_POINTER, /* meta */ |
@@ -547,7 +547,7 @@ static GtkWidget * makeResultFrame(GtkWidget ** treeview, | |||
547 | -1, | 547 | -1, |
548 | _("Name"), | 548 | _("Name"), |
549 | renderer, | 549 | renderer, |
550 | "text", SEARCH_NAME, | 550 | "text", SEARCH_NAME, |
551 | NULL); | 551 | NULL); |
552 | renderer = gtk_cell_renderer_text_new(); | 552 | renderer = gtk_cell_renderer_text_new(); |
553 | gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(resultList), | 553 | gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(resultList), |
@@ -652,7 +652,7 @@ void on_fssearchbutton_clicked(gpointer dummy2, | |||
652 | 652 | ||
653 | if ( (descStr != NULL) && | 653 | if ( (descStr != NULL) && |
654 | (0 == strcmp(descStr, | 654 | (0 == strcmp(descStr, |
655 | _("globally"))) ) { | 655 | _("globally"))) ) { |
656 | ns = NULL; | 656 | ns = NULL; |
657 | } else { | 657 | } else { |
658 | GNUNET_ASSERT(strlen(ns) == sizeof(EncName) - 1); | 658 | GNUNET_ASSERT(strlen(ns) == sizeof(EncName) - 1); |
@@ -660,7 +660,7 @@ void on_fssearchbutton_clicked(gpointer dummy2, | |||
660 | descStr = ns; | 660 | descStr = ns; |
661 | } | 661 | } |
662 | } | 662 | } |
663 | if (ns != NULL) { | 663 | if (ns != NULL) { |
664 | char * ustring; | 664 | char * ustring; |
665 | 665 | ||
666 | ustring = MALLOC(strlen(ss) + sizeof(EncName) + | 666 | ustring = MALLOC(strlen(ss) + sizeof(EncName) + |
@@ -679,9 +679,9 @@ void on_fssearchbutton_clicked(gpointer dummy2, | |||
679 | } | 679 | } |
680 | FREE(ustring); | 680 | FREE(ustring); |
681 | } else { | 681 | } else { |
682 | uri = FSUI_parseCharKeywordURI(ss); | 682 | uri = FSUI_parseCharKeywordURI(ss); |
683 | } | 683 | } |
684 | if (uri == NULL) | 684 | if (uri == NULL) |
685 | return; | 685 | return; |
686 | if (ns == NULL) { | 686 | if (ns == NULL) { |
687 | tabtxt = STRDUP(ss); | 687 | tabtxt = STRDUP(ss); |
@@ -701,7 +701,7 @@ void on_fssearchbutton_clicked(gpointer dummy2, | |||
701 | pages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)); | 701 | pages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)); |
702 | while (list != NULL) { | 702 | while (list != NULL) { |
703 | if (ECRS_equalsUri(list->uri, | 703 | if (ECRS_equalsUri(list->uri, |
704 | uri)) { | 704 | uri)) { |
705 | for (i=0;i<pages;i++) { | 705 | for (i=0;i<pages;i++) { |
706 | page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), | 706 | page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), |
707 | i); | 707 | i); |
@@ -722,7 +722,7 @@ void on_fssearchbutton_clicked(gpointer dummy2, | |||
722 | list->searchpage | 722 | list->searchpage |
723 | = makeResultFrame(&list->treeview, | 723 | = makeResultFrame(&list->treeview, |
724 | &spin); | 724 | &spin); |
725 | list->next | 725 | list->next |
726 | = head; | 726 | = head; |
727 | list->uri | 727 | list->uri |
728 | = uri; | 728 | = uri; |
@@ -768,7 +768,7 @@ static int addNamespace(void * arg, | |||
768 | struct ECRS_MetaData * dmd; | 768 | struct ECRS_MetaData * dmd; |
769 | char * desc; | 769 | char * desc; |
770 | size_t n; | 770 | size_t n; |
771 | 771 | ||
772 | hash2enc(namespaceId, | 772 | hash2enc(namespaceId, |
773 | &enc); | 773 | &enc); |
774 | if (md == NULL) { | 774 | if (md == NULL) { |
@@ -792,7 +792,7 @@ static int addNamespace(void * arg, | |||
792 | if (desc == NULL) | 792 | if (desc == NULL) |
793 | desc = STRDUP(""); | 793 | desc = STRDUP(""); |
794 | } | 794 | } |
795 | 795 | ||
796 | n = strlen(desc) + 64; | 796 | n = strlen(desc) + 64; |
797 | name = MALLOC(n); | 797 | name = MALLOC(n); |
798 | SNPRINTF(name, | 798 | SNPRINTF(name, |
@@ -810,7 +810,7 @@ static int addNamespace(void * arg, | |||
810 | NS_SEARCH_METADATA, dmd, | 810 | NS_SEARCH_METADATA, dmd, |
811 | NS_SEARCH_RATING, rating, | 811 | NS_SEARCH_RATING, rating, |
812 | -1); | 812 | -1); |
813 | FREE(name); | 813 | FREE(name); |
814 | return OK; | 814 | return OK; |
815 | } | 815 | } |
816 | 816 | ||
@@ -822,8 +822,8 @@ static void updateNCBModelSafe(void * unused) { | |||
822 | GtkWidget * searchNamespaceCB; | 822 | GtkWidget * searchNamespaceCB; |
823 | GtkListStore * model; | 823 | GtkListStore * model; |
824 | GtkTreeIter iter; | 824 | GtkTreeIter iter; |
825 | 825 | ||
826 | model = gtk_list_store_new(NS_SEARCH_NUM, | 826 | model = gtk_list_store_new(NS_SEARCH_NUM, |
827 | G_TYPE_STRING, /* what we show */ | 827 | G_TYPE_STRING, /* what we show */ |
828 | G_TYPE_STRING, /* EncName of namespace */ | 828 | G_TYPE_STRING, /* EncName of namespace */ |
829 | G_TYPE_POINTER, | 829 | G_TYPE_POINTER, |
@@ -834,7 +834,7 @@ static void updateNCBModelSafe(void * unused) { | |||
834 | &iter, | 834 | &iter, |
835 | NS_SEARCH_DESCRIPTION, _("globally"), | 835 | NS_SEARCH_DESCRIPTION, _("globally"), |
836 | NS_SEARCH_ENCNAME, NULL, | 836 | NS_SEARCH_ENCNAME, NULL, |
837 | NS_SEARCH_METADATA, NULL, | 837 | NS_SEARCH_METADATA, NULL, |
838 | NS_SEARCH_RATING, 0, | 838 | NS_SEARCH_RATING, 0, |
839 | -1); | 839 | -1); |
840 | FSUI_listNamespaces(ctx, | 840 | FSUI_listNamespaces(ctx, |
@@ -891,7 +891,7 @@ int openTabForSearch(void * unused, | |||
891 | else if (0 == strncmp(dhead, | 891 | else if (0 == strncmp(dhead, |
892 | ECRS_SUBSPACE_INFIX, | 892 | ECRS_SUBSPACE_INFIX, |
893 | strlen(ECRS_SUBSPACE_INFIX))) | 893 | strlen(ECRS_SUBSPACE_INFIX))) |
894 | dhead = &dhead[strlen(ECRS_SUBSPACE_INFIX)]; | 894 | dhead = &dhead[strlen(ECRS_SUBSPACE_INFIX)]; |
895 | label = gtk_label_new(dhead); | 895 | label = gtk_label_new(dhead); |
896 | 896 | ||
897 | gtk_list_store_append(summary, | 897 | gtk_list_store_append(summary, |
@@ -944,7 +944,7 @@ void fs_search_start() { | |||
944 | = glade_xml_get_widget(getMainXML(), | 944 | = glade_xml_get_widget(getMainXML(), |
945 | "fssearchKeywordComboBoxEntry"); | 945 | "fssearchKeywordComboBoxEntry"); |
946 | 946 | ||
947 | model = gtk_list_store_new(NS_SEARCH_NUM, | 947 | model = gtk_list_store_new(NS_SEARCH_NUM, |
948 | G_TYPE_STRING, /* what we show */ | 948 | G_TYPE_STRING, /* what we show */ |
949 | G_TYPE_STRING, /* EncName of namespace */ | 949 | G_TYPE_STRING, /* EncName of namespace */ |
950 | G_TYPE_POINTER, | 950 | G_TYPE_POINTER, |
@@ -1017,7 +1017,7 @@ void fs_search_stop() { | |||
1017 | &iter, | 1017 | &iter, |
1018 | SEARCH_URI, NULL, | 1018 | SEARCH_URI, NULL, |
1019 | SEARCH_META, NULL, | 1019 | SEARCH_META, NULL, |
1020 | -1); | 1020 | -1); |
1021 | if (u != NULL) | 1021 | if (u != NULL) |
1022 | ECRS_freeUri(u); | 1022 | ECRS_freeUri(u); |
1023 | if (m != NULL) | 1023 | if (m != NULL) |
@@ -1045,7 +1045,7 @@ void fs_search_stop() { | |||
1045 | -1); | 1045 | -1); |
1046 | } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary), | 1046 | } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary), |
1047 | &iter)); | 1047 | &iter)); |
1048 | } | 1048 | } |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | /* end of search.c */ | 1051 | /* end of search.c */ |
diff --git a/src/plugins/fs/upload.c b/src/plugins/fs/upload.c index 778829d4..8607fe88 100644 --- a/src/plugins/fs/upload.c +++ b/src/plugins/fs/upload.c | |||
@@ -44,7 +44,7 @@ static GtkTreeStore * summary; | |||
44 | 44 | ||
45 | /** | 45 | /** |
46 | * XML tree for the meta-data dialog of upload. | 46 | * XML tree for the meta-data dialog of upload. |
47 | * (there can only be one at a time; | 47 | * (there can only be one at a time; |
48 | * maybe NULL at times where there is no dialog) | 48 | * maybe NULL at times where there is no dialog) |
49 | */ | 49 | */ |
50 | static GladeXML * metaXML; | 50 | static GladeXML * metaXML; |
@@ -77,7 +77,7 @@ void displayUploadUpdate(const char * mainName, | |||
77 | &iter, | 77 | &iter, |
78 | UPLOAD_PROGRESS, progress, | 78 | UPLOAD_PROGRESS, progress, |
79 | -1); | 79 | -1); |
80 | return; | 80 | return; |
81 | } | 81 | } |
82 | if (0 == strcmp(name, mainName)) { | 82 | if (0 == strcmp(name, mainName)) { |
83 | if (gtk_tree_model_iter_children(GTK_TREE_MODEL(summary), | 83 | if (gtk_tree_model_iter_children(GTK_TREE_MODEL(summary), |
@@ -96,7 +96,7 @@ void displayUploadUpdate(const char * mainName, | |||
96 | return; | 96 | return; |
97 | } | 97 | } |
98 | } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary), | 98 | } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary), |
99 | &child)); | 99 | &child)); |
100 | } | 100 | } |
101 | gtk_tree_store_append(GTK_TREE_STORE(summary), | 101 | gtk_tree_store_append(GTK_TREE_STORE(summary), |
102 | &child, | 102 | &child, |
@@ -108,7 +108,7 @@ void displayUploadUpdate(const char * mainName, | |||
108 | UPLOAD_URISTRING, NULL, | 108 | UPLOAD_URISTRING, NULL, |
109 | -1); | 109 | -1); |
110 | return; | 110 | return; |
111 | } | 111 | } |
112 | } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary), | 112 | } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary), |
113 | &iter)); | 113 | &iter)); |
114 | } | 114 | } |
@@ -171,7 +171,7 @@ void displayUploadComplete(const char * mainName, | |||
171 | UPLOAD_URISTRING, us, | 171 | UPLOAD_URISTRING, us, |
172 | -1); | 172 | -1); |
173 | FREE(us); | 173 | FREE(us); |
174 | return; | 174 | return; |
175 | } | 175 | } |
176 | if (0 == strcmp(name, mainName)) { | 176 | if (0 == strcmp(name, mainName)) { |
177 | if (gtk_tree_model_iter_children(GTK_TREE_MODEL(summary), | 177 | if (gtk_tree_model_iter_children(GTK_TREE_MODEL(summary), |
@@ -192,7 +192,7 @@ void displayUploadComplete(const char * mainName, | |||
192 | return; | 192 | return; |
193 | } | 193 | } |
194 | } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary), | 194 | } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary), |
195 | &child)); | 195 | &child)); |
196 | } | 196 | } |
197 | gtk_tree_store_append(GTK_TREE_STORE(summary), | 197 | gtk_tree_store_append(GTK_TREE_STORE(summary), |
198 | &child, | 198 | &child, |
@@ -205,7 +205,7 @@ void displayUploadComplete(const char * mainName, | |||
205 | -1); | 205 | -1); |
206 | FREE(us); | 206 | FREE(us); |
207 | return; | 207 | return; |
208 | } | 208 | } |
209 | } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary), | 209 | } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary), |
210 | &iter)); | 210 | &iter)); |
211 | } | 211 | } |
@@ -303,12 +303,12 @@ void on_fsinsertuploadbutton_clicked(gpointer dummy, | |||
303 | config); | 303 | config); |
304 | FREE(config); | 304 | FREE(config); |
305 | } | 305 | } |
306 | 306 | ||
307 | uploadLine = glade_xml_get_widget(getMainXML(), | 307 | uploadLine = glade_xml_get_widget(getMainXML(), |
308 | "uploadFilenameComboBoxEntry"); | 308 | "uploadFilenameComboBoxEntry"); |
309 | entry = gtk_bin_get_child(GTK_BIN(uploadLine)); | 309 | entry = gtk_bin_get_child(GTK_BIN(uploadLine)); |
310 | filename = gtk_entry_get_text(GTK_ENTRY(entry)); | 310 | filename = gtk_entry_get_text(GTK_ENTRY(entry)); |
311 | 311 | ||
312 | metaXML | 312 | metaXML |
313 | = glade_xml_new(getGladeFileName(), | 313 | = glade_xml_new(getGladeFileName(), |
314 | "metaDataDialog", | 314 | "metaDataDialog", |
@@ -345,7 +345,7 @@ void on_fsinsertuploadbutton_clicked(gpointer dummy, | |||
345 | if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_CANCEL) { | 345 | if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_CANCEL) { |
346 | int doIndex; | 346 | int doIndex; |
347 | int doRec; | 347 | int doRec; |
348 | 348 | ||
349 | addLogEntry(_("Uploading `%s'"), filenamerest); | 349 | addLogEntry(_("Uploading `%s'"), filenamerest); |
350 | 350 | ||
351 | recBut = glade_xml_get_widget(getMainXML(), | 351 | recBut = glade_xml_get_widget(getMainXML(), |
@@ -363,18 +363,18 @@ void on_fsinsertuploadbutton_clicked(gpointer dummy, | |||
363 | 363 | ||
364 | meta = getMetaDataFromList(metaXML, | 364 | meta = getMetaDataFromList(metaXML, |
365 | "metaDataDialogMetaDataList", | 365 | "metaDataDialogMetaDataList", |
366 | "previewImage"); | 366 | "previewImage"); |
367 | keywordURI = getKeywordURIFromList(metaXML, | 367 | keywordURI = getKeywordURIFromList(metaXML, |
368 | "metaDataDialogKeywordList"); | 368 | "metaDataDialogKeywordList"); |
369 | if (doRec) { | 369 | if (doRec) { |
370 | deepIndex = glade_xml_get_widget(getMainXML(), | 370 | deepIndex = glade_xml_get_widget(getMainXML(), |
371 | "deepIndexCheckButton"); | 371 | "deepIndexCheckButton"); |
372 | gkeywordURI = ECRS_stringToUri(ECRS_URI_PREFIX | 372 | gkeywordURI = ECRS_stringToUri(ECRS_URI_PREFIX |
373 | ECRS_SEARCH_INFIX); | 373 | ECRS_SEARCH_INFIX); |
374 | FSUI_uploadAll(ctx, | 374 | FSUI_uploadAll(ctx, |
375 | filename, | 375 | filename, |
376 | getAnonymityLevel(getMainXML(), | 376 | getAnonymityLevel(getMainXML(), |
377 | "uploadAnonymityLevelSpinButton"), | 377 | "uploadAnonymityLevelSpinButton"), |
378 | doIndex, | 378 | doIndex, |
379 | (TRUE == gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(deepIndex))) | 379 | (TRUE == gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(deepIndex))) |
380 | ? YES : NO, | 380 | ? YES : NO, |
@@ -385,7 +385,7 @@ void on_fsinsertuploadbutton_clicked(gpointer dummy, | |||
385 | FSUI_upload(ctx, | 385 | FSUI_upload(ctx, |
386 | filename, | 386 | filename, |
387 | getAnonymityLevel(getMainXML(), | 387 | getAnonymityLevel(getMainXML(), |
388 | "uploadAnonymityLevelSpinButton"), | 388 | "uploadAnonymityLevelSpinButton"), |
389 | doIndex, | 389 | doIndex, |
390 | NO, | 390 | NO, |
391 | meta, | 391 | meta, |
@@ -416,14 +416,14 @@ static char * selectFile() { | |||
416 | 416 | ||
417 | recBut = glade_xml_get_widget(getMainXML(), | 417 | recBut = glade_xml_get_widget(getMainXML(), |
418 | "scopeRecursiveButton"); | 418 | "scopeRecursiveButton"); |
419 | 419 | ||
420 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(recBut))) | 420 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(recBut))) |
421 | gtk_file_chooser_set_action(GTK_FILE_CHOOSER(dialog), | 421 | gtk_file_chooser_set_action(GTK_FILE_CHOOSER(dialog), |
422 | GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); | 422 | GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); |
423 | 423 | ||
424 | if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_CANCEL) { | 424 | if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_CANCEL) { |
425 | char * filename; | 425 | char * filename; |
426 | 426 | ||
427 | filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); | 427 | filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); |
428 | ret = STRDUP(filename); | 428 | ret = STRDUP(filename); |
429 | g_free(filename); | 429 | g_free(filename); |
@@ -445,7 +445,7 @@ static char * selectFile() { | |||
445 | else | 445 | else |
446 | fn = plibc_ChooseDir(_("Choose the directory you want to publish."), | 446 | fn = plibc_ChooseDir(_("Choose the directory you want to publish."), |
447 | BIF_USENEWUI | BIF_SHAREABLE | BIF_NONEWFOLDERBUTTON); | 447 | BIF_USENEWUI | BIF_SHAREABLE | BIF_NONEWFOLDERBUTTON); |
448 | 448 | ||
449 | return fn; | 449 | return fn; |
450 | #endif /* MINGW */ | 450 | #endif /* MINGW */ |
451 | } | 451 | } |
@@ -457,7 +457,7 @@ void on_mainFileSharingInsertBrowseButton_clicked(GtkWidget * browseButton, | |||
457 | GtkWidget * entry; | 457 | GtkWidget * entry; |
458 | GtkListStore * model; | 458 | GtkListStore * model; |
459 | GtkTreeIter iter; | 459 | GtkTreeIter iter; |
460 | 460 | ||
461 | if ((filename = selectFile())) { | 461 | if ((filename = selectFile())) { |
462 | uploadLine = glade_xml_get_widget(getMainXML(), | 462 | uploadLine = glade_xml_get_widget(getMainXML(), |
463 | "uploadFilenameComboBoxEntry"); | 463 | "uploadFilenameComboBoxEntry"); |
@@ -492,7 +492,7 @@ void fs_upload_start() { | |||
492 | G_TYPE_STRING); /* URI (as string) - after completion */ | 492 | G_TYPE_STRING); /* URI (as string) - after completion */ |
493 | gtk_tree_view_set_model(GTK_TREE_VIEW(uploadList), | 493 | gtk_tree_view_set_model(GTK_TREE_VIEW(uploadList), |
494 | GTK_TREE_MODEL(summary)); | 494 | GTK_TREE_MODEL(summary)); |
495 | renderer = gtk_cell_renderer_progress_new(); | 495 | renderer = gtk_cell_renderer_progress_new(); |
496 | gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(uploadList), | 496 | gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(uploadList), |
497 | -1, | 497 | -1, |
498 | _("Filename"), | 498 | _("Filename"), |
diff --git a/src/plugins/stats/functions.c b/src/plugins/stats/functions.c index 8b20557c..f96775fd 100644 --- a/src/plugins/stats/functions.c +++ b/src/plugins/stats/functions.c | |||
@@ -60,7 +60,7 @@ static int getStatValue(long long * value, | |||
60 | if (dtime != NULL) | 60 | if (dtime != NULL) |
61 | *dtime = lastStatValues[i].delta; | 61 | *dtime = lastStatValues[i].delta; |
62 | return OK; | 62 | return OK; |
63 | } | 63 | } |
64 | } | 64 | } |
65 | #if FUNCTIONS_DEBUG | 65 | #if FUNCTIONS_DEBUG |
66 | LOG(LOG_DEBUG, | 66 | LOG(LOG_DEBUG, |
@@ -86,7 +86,7 @@ static void updateConnectionGoal(void * unused) { | |||
86 | "LOAD", | 86 | "LOAD", |
87 | "MAXNETUPBPSTOTAL"); | 87 | "MAXNETUPBPSTOTAL"); |
88 | MUTEX_UNLOCK(&lock); | 88 | MUTEX_UNLOCK(&lock); |
89 | if (cmh == NULL) | 89 | if (cmh == NULL) |
90 | connectionGoal = 0; | 90 | connectionGoal = 0; |
91 | else | 91 | else |
92 | connectionGoal = atol(cmh); | 92 | connectionGoal = atol(cmh); |
@@ -113,7 +113,7 @@ static int getConnectedNodesStat(const void * closure, | |||
113 | if (OK != getStatValue(&val, | 113 | if (OK != getStatValue(&val, |
114 | NULL, | 114 | NULL, |
115 | NULL, | 115 | NULL, |
116 | "# of connected peers")) | 116 | "# of connected peers")) |
117 | return SYSERR; | 117 | return SYSERR; |
118 | data[0][0] = 0.8 * val / connectionGoal; | 118 | data[0][0] = 0.8 * val / connectionGoal; |
119 | return OK; | 119 | return OK; |
@@ -158,7 +158,7 @@ static int getTrafficRecvStats(const void * closure, | |||
158 | return SYSERR; | 158 | return SYSERR; |
159 | i = 0; | 159 | i = 0; |
160 | buffer = MALLOC(512); | 160 | buffer = MALLOC(512); |
161 | SNPRINTF(buffer, | 161 | SNPRINTF(buffer, |
162 | 512, | 162 | 512, |
163 | "# bytes received of type %d", | 163 | "# bytes received of type %d", |
164 | P2P_PROTO_gap_RESULT); | 164 | P2P_PROTO_gap_RESULT); |
@@ -167,10 +167,10 @@ static int getTrafficRecvStats(const void * closure, | |||
167 | NULL, | 167 | NULL, |
168 | buffer)) { | 168 | buffer)) { |
169 | content += 0; | 169 | content += 0; |
170 | lcontent += 0; | 170 | lcontent += 0; |
171 | } | 171 | } |
172 | i = 0; | 172 | i = 0; |
173 | SNPRINTF(buffer, | 173 | SNPRINTF(buffer, |
174 | 512, | 174 | 512, |
175 | "# bytes received of type %d", | 175 | "# bytes received of type %d", |
176 | P2P_PROTO_gap_QUERY); | 176 | P2P_PROTO_gap_QUERY); |
@@ -180,10 +180,10 @@ static int getTrafficRecvStats(const void * closure, | |||
180 | buffer)) { | 180 | buffer)) { |
181 | queries = 0; | 181 | queries = 0; |
182 | lqueries = 0; | 182 | lqueries = 0; |
183 | } | 183 | } |
184 | FREE(buffer); | 184 | FREE(buffer); |
185 | if (banddown == 0) | 185 | if (banddown == 0) |
186 | return SYSERR; | 186 | return SYSERR; |
187 | 187 | ||
188 | total -= ltotal; | 188 | total -= ltotal; |
189 | noise -= lnoise; | 189 | noise -= lnoise; |
@@ -200,7 +200,7 @@ static int getTrafficRecvStats(const void * closure, | |||
200 | data[0][1] = 0.8 * (content+noise) / (banddown * dtime / cronSECONDS); /* green */ | 200 | data[0][1] = 0.8 * (content+noise) / (banddown * dtime / cronSECONDS); /* green */ |
201 | data[0][2] = 0.8 * (queries+content+noise) / (banddown * dtime / cronSECONDS); /* yellow */ | 201 | data[0][2] = 0.8 * (queries+content+noise) / (banddown * dtime / cronSECONDS); /* yellow */ |
202 | data[0][3] = 0.8 * total / (banddown * dtime / cronSECONDS); /* blue */ | 202 | data[0][3] = 0.8 * total / (banddown * dtime / cronSECONDS); /* blue */ |
203 | /*printf("I: %f %f %f\n", | 203 | /*printf("I: %f %f %f\n", |
204 | data[0][0], | 204 | data[0][0], |
205 | data[0][1], | 205 | data[0][1], |
206 | data[0][2]);*/ | 206 | data[0][2]);*/ |
@@ -234,7 +234,7 @@ static int getTrafficSendStats(const void * closure, | |||
234 | return SYSERR; | 234 | return SYSERR; |
235 | i = 0; | 235 | i = 0; |
236 | buffer = MALLOC(512); | 236 | buffer = MALLOC(512); |
237 | SNPRINTF(buffer, | 237 | SNPRINTF(buffer, |
238 | 512, | 238 | 512, |
239 | "# bytes transmitted of type %d", | 239 | "# bytes transmitted of type %d", |
240 | P2P_PROTO_gap_RESULT); | 240 | P2P_PROTO_gap_RESULT); |
@@ -243,10 +243,10 @@ static int getTrafficSendStats(const void * closure, | |||
243 | NULL, | 243 | NULL, |
244 | buffer)) { | 244 | buffer)) { |
245 | content = 0; | 245 | content = 0; |
246 | lcontent = 0; | 246 | lcontent = 0; |
247 | } | 247 | } |
248 | i = 0; | 248 | i = 0; |
249 | SNPRINTF(buffer, | 249 | SNPRINTF(buffer, |
250 | 512, | 250 | 512, |
251 | "# bytes received of type %d", | 251 | "# bytes received of type %d", |
252 | P2P_PROTO_gap_QUERY); | 252 | P2P_PROTO_gap_QUERY); |
@@ -255,7 +255,7 @@ static int getTrafficSendStats(const void * closure, | |||
255 | NULL, | 255 | NULL, |
256 | buffer)) { | 256 | buffer)) { |
257 | queries = 0; | 257 | queries = 0; |
258 | lqueries = 0; | 258 | lqueries = 0; |
259 | } | 259 | } |
260 | FREE(buffer); | 260 | FREE(buffer); |
261 | if (bandup == 0) | 261 | if (bandup == 0) |
@@ -275,10 +275,10 @@ static int getTrafficSendStats(const void * closure, | |||
275 | data[0][1] = 0.8 * (noise + content) / (bandup*dtime / cronSECONDS); /* green */ | 275 | data[0][1] = 0.8 * (noise + content) / (bandup*dtime / cronSECONDS); /* green */ |
276 | data[0][2] = 0.8 * (noise + content + queries) / (bandup*dtime / cronSECONDS); /* yellow */ | 276 | data[0][2] = 0.8 * (noise + content + queries) / (bandup*dtime / cronSECONDS); /* yellow */ |
277 | data[0][3] = 0.8 * total / (bandup*dtime / cronSECONDS); /* yellow */ | 277 | data[0][3] = 0.8 * total / (bandup*dtime / cronSECONDS); /* yellow */ |
278 | /* printf("O: %f %f %f\n", | 278 | /* printf("O: %f %f %f\n", |
279 | data[0][0], | 279 | data[0][0], |
280 | data[0][1], | 280 | data[0][1], |
281 | data[0][2]);*/ | 281 | data[0][2]);*/ |
282 | return OK; | 282 | return OK; |
283 | } | 283 | } |
284 | 284 | ||
@@ -291,7 +291,7 @@ static int statsProcessor(const char * optName, | |||
291 | int found; | 291 | int found; |
292 | 292 | ||
293 | found = -1; | 293 | found = -1; |
294 | for (j=0;j<lsv_size;j++) | 294 | for (j=0;j<lsv_size;j++) |
295 | if (0 == strcmp(optName, | 295 | if (0 == strcmp(optName, |
296 | lastStatValues[j].statName)) | 296 | lastStatValues[j].statName)) |
297 | found = j; | 297 | found = j; |
@@ -310,7 +310,7 @@ static int statsProcessor(const char * optName, | |||
310 | lastStatValues[found].delta | 310 | lastStatValues[found].delta |
311 | = *delta; | 311 | = *delta; |
312 | return OK; | 312 | return OK; |
313 | } | 313 | } |
314 | 314 | ||
315 | /** | 315 | /** |
316 | * Cron-job that updates all stat values. | 316 | * Cron-job that updates all stat values. |
@@ -325,22 +325,22 @@ static void updateStatValues(void * unused) { | |||
325 | MUTEX_LOCK(&lock); | 325 | MUTEX_LOCK(&lock); |
326 | if (OK == requestStatistics(sock, | 326 | if (OK == requestStatistics(sock, |
327 | &statsProcessor, | 327 | &statsProcessor, |
328 | &delta)) | 328 | &delta)) |
329 | lastUpdate = now; | 329 | lastUpdate = now; |
330 | MUTEX_UNLOCK(&lock); | 330 | MUTEX_UNLOCK(&lock); |
331 | } | 331 | } |
332 | 332 | ||
333 | 333 | ||
334 | StatEntry stats[] = { | 334 | StatEntry stats[] = { |
335 | { | 335 | { |
336 | gettext_noop("Connectivity"), | 336 | gettext_noop("Connectivity"), |
337 | gettext_noop("# connected nodes (100% = connection table size)"), | 337 | gettext_noop("# connected nodes (100% = connection table size)"), |
338 | &getConnectedNodesStat, | 338 | &getConnectedNodesStat, |
339 | NULL, | 339 | NULL, |
340 | 1, | 340 | 1, |
341 | NO, | 341 | NO, |
342 | }, | 342 | }, |
343 | { | 343 | { |
344 | gettext_noop("CPU load"), | 344 | gettext_noop("CPU load"), |
345 | gettext_noop("CPU load (in percent of allowed load)"), | 345 | gettext_noop("CPU load (in percent of allowed load)"), |
346 | &getCPULoadStat, | 346 | &getCPULoadStat, |
@@ -348,7 +348,7 @@ StatEntry stats[] = { | |||
348 | 1, | 348 | 1, |
349 | NO, | 349 | NO, |
350 | }, | 350 | }, |
351 | { | 351 | { |
352 | gettext_noop("Inbound Traffic"), | 352 | gettext_noop("Inbound Traffic"), |
353 | gettext_noop("Noise (red), Content (green), Queries (yellow), other (blue)"), | 353 | gettext_noop("Noise (red), Content (green), Queries (yellow), other (blue)"), |
354 | &getTrafficRecvStats, | 354 | &getTrafficRecvStats, |
@@ -356,7 +356,7 @@ StatEntry stats[] = { | |||
356 | 4, | 356 | 4, |
357 | YES, | 357 | YES, |
358 | }, | 358 | }, |
359 | { | 359 | { |
360 | gettext_noop("Outbound Traffic"), | 360 | gettext_noop("Outbound Traffic"), |
361 | gettext_noop("Noise (red), Content (green), Queries (yellow), other (blue)"), | 361 | gettext_noop("Noise (red), Content (green), Queries (yellow), other (blue)"), |
362 | &getTrafficSendStats, | 362 | &getTrafficSendStats, |
@@ -377,7 +377,7 @@ StatEntry stats[] = { | |||
377 | int UPDATE_INTERVAL; | 377 | int UPDATE_INTERVAL; |
378 | 378 | ||
379 | void init_functions() { | 379 | void init_functions() { |
380 | UPDATE_INTERVAL | 380 | UPDATE_INTERVAL |
381 | = getConfigurationInt("GNUNET-GTK", | 381 | = getConfigurationInt("GNUNET-GTK", |
382 | "STATS-INTERVAL") * cronSECONDS; | 382 | "STATS-INTERVAL") * cronSECONDS; |
383 | if (UPDATE_INTERVAL == 0) | 383 | if (UPDATE_INTERVAL == 0) |
@@ -414,5 +414,5 @@ void done_functions() { | |||
414 | sock = NULL; | 414 | sock = NULL; |
415 | } | 415 | } |
416 | 416 | ||
417 | 417 | ||
418 | /* end of functions.c */ | 418 | /* end of functions.c */ |
diff --git a/src/plugins/stats/statistics.c b/src/plugins/stats/statistics.c index badbc303..db44f720 100644 --- a/src/plugins/stats/statistics.c +++ b/src/plugins/stats/statistics.c | |||
@@ -37,8 +37,8 @@ typedef struct { | |||
37 | guint count; | 37 | guint count; |
38 | guint speed; | 38 | guint speed; |
39 | guint draw_width, draw_height; | 39 | guint draw_width, draw_height; |
40 | guint num_points; | 40 | guint num_points; |
41 | guint allocated; | 41 | guint allocated; |
42 | GdkColor *colors; | 42 | GdkColor *colors; |
43 | gfloat **data, **odata; | 43 | gfloat **data, **odata; |
44 | guint data_size; | 44 | guint data_size; |
@@ -48,7 +48,7 @@ typedef struct { | |||
48 | GtkWidget *label; | 48 | GtkWidget *label; |
49 | GdkPixmap *pixmap; | 49 | GdkPixmap *pixmap; |
50 | GdkGC *gc; | 50 | GdkGC *gc; |
51 | int timer_index; | 51 | int timer_index; |
52 | gboolean draw; | 52 | gboolean draw; |
53 | int statIdx; | 53 | int statIdx; |
54 | } LoadGraph; | 54 | } LoadGraph; |
@@ -60,39 +60,39 @@ typedef struct { | |||
60 | } ProcConfig; | 60 | } ProcConfig; |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Redraws the backing pixmap for the load graph and updates the window | 63 | * Redraws the backing pixmap for the load graph and updates the window |
64 | */ | 64 | */ |
65 | static void load_graph_draw(LoadGraph *g) { | 65 | static void load_graph_draw(LoadGraph *g) { |
66 | guint i; | 66 | guint i; |
67 | guint j; | 67 | guint j; |
68 | gint dely; | 68 | gint dely; |
69 | float delx; | 69 | float delx; |
70 | 70 | ||
71 | if (!g->disp->window) | 71 | if (!g->disp->window) |
72 | return; | 72 | return; |
73 | 73 | ||
74 | g->draw_width = g->disp->allocation.width; | 74 | g->draw_width = g->disp->allocation.width; |
75 | g->draw_height = g->disp->allocation.height; | 75 | g->draw_height = g->disp->allocation.height; |
76 | 76 | ||
77 | if (!g->pixmap) | 77 | if (!g->pixmap) |
78 | g->pixmap = gdk_pixmap_new (g->disp->window, | 78 | g->pixmap = gdk_pixmap_new (g->disp->window, |
79 | g->draw_width, g->draw_height, | 79 | g->draw_width, g->draw_height, |
80 | gtk_widget_get_visual (g->disp)->depth); | 80 | gtk_widget_get_visual (g->disp)->depth); |
81 | 81 | ||
82 | /* Create GC if necessary. */ | 82 | /* Create GC if necessary. */ |
83 | if (!g->gc) { | 83 | if (!g->gc) { |
84 | g->gc = gdk_gc_new (g->disp->window); | 84 | g->gc = gdk_gc_new (g->disp->window); |
85 | gdk_gc_copy (g->gc, g->disp->style->white_gc); | 85 | gdk_gc_copy (g->gc, g->disp->style->white_gc); |
86 | } | 86 | } |
87 | 87 | ||
88 | /* Allocate colors. */ | 88 | /* Allocate colors. */ |
89 | if (!g->colors_allocated) { | 89 | if (!g->colors_allocated) { |
90 | GdkColormap *colormap; | 90 | GdkColormap *colormap; |
91 | 91 | ||
92 | colormap = gdk_window_get_colormap (g->disp->window); | 92 | colormap = gdk_window_get_colormap (g->disp->window); |
93 | for (i=0;i<2+g->count;i++) | 93 | for (i=0;i<2+g->count;i++) |
94 | gdk_color_alloc (colormap, &(g->colors [i])); | 94 | gdk_color_alloc (colormap, &(g->colors [i])); |
95 | 95 | ||
96 | g->colors_allocated = 1; | 96 | g->colors_allocated = 1; |
97 | } | 97 | } |
98 | /* Erase Rectangle */ | 98 | /* Erase Rectangle */ |
@@ -102,7 +102,7 @@ static void load_graph_draw(LoadGraph *g) { | |||
102 | TRUE, 0, 0, | 102 | TRUE, 0, 0, |
103 | g->disp->allocation.width, | 103 | g->disp->allocation.width, |
104 | g->disp->allocation.height); | 104 | g->disp->allocation.height); |
105 | 105 | ||
106 | /* draw frame */ | 106 | /* draw frame */ |
107 | gdk_gc_set_foreground (g->gc, &(g->colors [1])); | 107 | gdk_gc_set_foreground (g->gc, &(g->colors [1])); |
108 | gdk_draw_rectangle (g->pixmap, | 108 | gdk_draw_rectangle (g->pixmap, |
@@ -110,39 +110,39 @@ static void load_graph_draw(LoadGraph *g) { | |||
110 | FALSE, 0, 0, | 110 | FALSE, 0, 0, |
111 | g->draw_width, | 111 | g->draw_width, |
112 | g->disp->allocation.height); | 112 | g->disp->allocation.height); |
113 | 113 | ||
114 | dely = g->draw_height / 5; | 114 | dely = g->draw_height / 5; |
115 | for (i = 1; i <5; i++) { | 115 | for (i = 1; i <5; i++) { |
116 | gint y1 = g->draw_height + 1 - i * dely; | 116 | gint y1 = g->draw_height + 1 - i * dely; |
117 | gdk_draw_line (g->pixmap, g->gc, | 117 | gdk_draw_line (g->pixmap, g->gc, |
118 | 0, y1, g->draw_width, y1); | 118 | 0, y1, g->draw_width, y1); |
119 | } | 119 | } |
120 | 120 | ||
121 | gdk_gc_set_line_attributes(g->gc, | 121 | gdk_gc_set_line_attributes(g->gc, |
122 | 2, | 122 | 2, |
123 | GDK_LINE_SOLID, | 123 | GDK_LINE_SOLID, |
124 | GDK_CAP_ROUND, | 124 | GDK_CAP_ROUND, |
125 | GDK_JOIN_MITER); | 125 | GDK_JOIN_MITER); |
126 | delx = (float)g->draw_width / ( g->num_points - 1); | 126 | delx = (float)g->draw_width / ( g->num_points - 1); |
127 | 127 | ||
128 | for (j=0;j<g->count;j++) { | 128 | for (j=0;j<g->count;j++) { |
129 | gdk_gc_set_foreground (g->gc, &(g->colors [j + 2])); | 129 | gdk_gc_set_foreground (g->gc, &(g->colors [j + 2])); |
130 | for (i = 0; i < g->num_points - 1; i++) { | 130 | for (i = 0; i < g->num_points - 1; i++) { |
131 | gint x1 = i * delx; | 131 | gint x1 = i * delx; |
132 | gint x2 = (i + 1) * delx; | 132 | gint x2 = (i + 1) * delx; |
133 | gint y1 = g->data[i][j] * g->draw_height - 1; | 133 | gint y1 = g->data[i][j] * g->draw_height - 1; |
134 | gint y2 = g->data[i+1][j] * g->draw_height - 1; | 134 | gint y2 = g->data[i+1][j] * g->draw_height - 1; |
135 | 135 | ||
136 | if ((g->data[i][j] != -1) && (g->data[i+1][j] != -1)) { | 136 | if ((g->data[i][j] != -1) && (g->data[i+1][j] != -1)) { |
137 | if (stats[g->statIdx].fill == NO) { | 137 | if (stats[g->statIdx].fill == NO) { |
138 | gdk_draw_line(g->pixmap, g->gc, | 138 | gdk_draw_line(g->pixmap, g->gc, |
139 | g->draw_width - x2, | 139 | g->draw_width - x2, |
140 | g->draw_height - y2, | 140 | g->draw_height - y2, |
141 | g->draw_width - x1, | 141 | g->draw_width - x1, |
142 | g->draw_height - y1); | 142 | g->draw_height - y1); |
143 | } else { | 143 | } else { |
144 | GdkPoint points[4]; | 144 | GdkPoint points[4]; |
145 | 145 | ||
146 | points[0].x = g->draw_width - x2; | 146 | points[0].x = g->draw_width - x2; |
147 | points[0].y = g->draw_height - y2; | 147 | points[0].y = g->draw_height - y2; |
148 | points[1].x = g->draw_width - x1; | 148 | points[1].x = g->draw_width - x1; |
@@ -162,17 +162,17 @@ static void load_graph_draw(LoadGraph *g) { | |||
162 | g->gc, | 162 | g->gc, |
163 | 1, | 163 | 1, |
164 | points, | 164 | points, |
165 | 4); | 165 | 4); |
166 | } | 166 | } |
167 | } | 167 | } |
168 | } | 168 | } |
169 | } | 169 | } |
170 | 170 | ||
171 | gdk_gc_set_line_attributes (g->gc, 1, | 171 | gdk_gc_set_line_attributes (g->gc, 1, |
172 | GDK_LINE_SOLID, | 172 | GDK_LINE_SOLID, |
173 | GDK_CAP_ROUND, | 173 | GDK_CAP_ROUND, |
174 | GDK_JOIN_MITER ); | 174 | GDK_JOIN_MITER ); |
175 | 175 | ||
176 | gdk_draw_pixmap (g->disp->window, | 176 | gdk_draw_pixmap (g->disp->window, |
177 | g->disp->style->fg_gc [GTK_WIDGET_STATE(g->disp)], | 177 | g->disp->style->fg_gc [GTK_WIDGET_STATE(g->disp)], |
178 | g->pixmap, | 178 | g->pixmap, |
@@ -186,20 +186,20 @@ static void load_graph_draw(LoadGraph *g) { | |||
186 | /* Updates the load graph when the timeout expires */ | 186 | /* Updates the load graph when the timeout expires */ |
187 | static gboolean load_graph_update(gpointer ptr) { | 187 | static gboolean load_graph_update(gpointer ptr) { |
188 | LoadGraph *g = ptr; | 188 | LoadGraph *g = ptr; |
189 | guint i; | 189 | guint i; |
190 | guint j; | 190 | guint j; |
191 | 191 | ||
192 | for (i=0;i<g->num_points;i++) | 192 | for (i=0;i<g->num_points;i++) |
193 | memcpy(g->odata[i], | 193 | memcpy(g->odata[i], |
194 | g->data[i], | 194 | g->data[i], |
195 | g->data_size * g->count); | 195 | g->data_size * g->count); |
196 | stats[g->statIdx].getData(stats[g->statIdx].get_closure, | 196 | stats[g->statIdx].getData(stats[g->statIdx].get_closure, |
197 | g->data); | 197 | g->data); |
198 | for (i=0;i<g->num_points-1;i++) | 198 | for (i=0;i<g->num_points-1;i++) |
199 | for (j=0;j<g->count;j++) | 199 | for (j=0;j<g->count;j++) |
200 | g->data[i+1][j] = g->odata[i][j]; | 200 | g->data[i+1][j] = g->odata[i][j]; |
201 | if (g->draw) | 201 | if (g->draw) |
202 | load_graph_draw (g); | 202 | load_graph_draw (g); |
203 | return TRUE; | 203 | return TRUE; |
204 | } | 204 | } |
205 | 205 | ||
@@ -227,30 +227,30 @@ static void load_graph_alloc (LoadGraph *g) { | |||
227 | 227 | ||
228 | if (g->allocated) | 228 | if (g->allocated) |
229 | return; | 229 | return; |
230 | 230 | ||
231 | g->data = MALLOC(sizeof(gfloat *) * g->num_points); | 231 | g->data = MALLOC(sizeof(gfloat *) * g->num_points); |
232 | g->odata = MALLOC(sizeof(gfloat*) * g->num_points); | 232 | g->odata = MALLOC(sizeof(gfloat*) * g->num_points); |
233 | g->data_size = sizeof (gfloat); | 233 | g->data_size = sizeof (gfloat); |
234 | for (i = 0; i < g->num_points; i++) { | 234 | for (i = 0; i < g->num_points; i++) { |
235 | g->data[i] = MALLOC(g->data_size * g->count); | 235 | g->data[i] = MALLOC(g->data_size * g->count); |
236 | g->odata[i] = MALLOC(g->data_size * g->count); | 236 | g->odata[i] = MALLOC(g->data_size * g->count); |
237 | } | 237 | } |
238 | for (i=0;i<g->num_points;i++) | 238 | for (i=0;i<g->num_points;i++) |
239 | for (j=0;j<g->count;j++) | 239 | for (j=0;j<g->count;j++) |
240 | g->data[i][j] = -1; | 240 | g->data[i][j] = -1; |
241 | g->allocated = TRUE; | 241 | g->allocated = TRUE; |
242 | } | 242 | } |
243 | 243 | ||
244 | static gint load_graph_configure(GtkWidget *widget, | 244 | static gint load_graph_configure(GtkWidget *widget, |
245 | GdkEventConfigure *event, | 245 | GdkEventConfigure *event, |
246 | gpointer data_ptr) { | 246 | gpointer data_ptr) { |
247 | LoadGraph *c = (LoadGraph *) data_ptr; | 247 | LoadGraph *c = (LoadGraph *) data_ptr; |
248 | 248 | ||
249 | if (c->pixmap) { | 249 | if (c->pixmap) { |
250 | gdk_pixmap_unref (c->pixmap); | 250 | gdk_pixmap_unref (c->pixmap); |
251 | c->pixmap = NULL; | 251 | c->pixmap = NULL; |
252 | } | 252 | } |
253 | 253 | ||
254 | if (!c->pixmap) | 254 | if (!c->pixmap) |
255 | c->pixmap = gdk_pixmap_new(widget->window, | 255 | c->pixmap = gdk_pixmap_new(widget->window, |
256 | widget->allocation.width, | 256 | widget->allocation.width, |
@@ -267,9 +267,9 @@ static gint load_graph_configure(GtkWidget *widget, | |||
267 | 0, 0, | 267 | 0, 0, |
268 | 0, 0, | 268 | 0, 0, |
269 | c->disp->allocation.width, | 269 | c->disp->allocation.width, |
270 | c->disp->allocation.height); | 270 | c->disp->allocation.height); |
271 | 271 | ||
272 | load_graph_draw(c); | 272 | load_graph_draw(c); |
273 | return TRUE; | 273 | return TRUE; |
274 | } | 274 | } |
275 | 275 | ||
@@ -277,7 +277,7 @@ static gint load_graph_expose(GtkWidget *widget, | |||
277 | GdkEventExpose *event, | 277 | GdkEventExpose *event, |
278 | gpointer data_ptr) { | 278 | gpointer data_ptr) { |
279 | LoadGraph *g = (LoadGraph *) data_ptr; | 279 | LoadGraph *g = (LoadGraph *) data_ptr; |
280 | 280 | ||
281 | gdk_draw_pixmap(widget->window, | 281 | gdk_draw_pixmap(widget->window, |
282 | widget->style->fg_gc [GTK_WIDGET_STATE(widget)], | 282 | widget->style->fg_gc [GTK_WIDGET_STATE(widget)], |
283 | g->pixmap, | 283 | g->pixmap, |
@@ -297,10 +297,10 @@ static void load_graph_stop (LoadGraph *g) { | |||
297 | g->draw = FALSE; | 297 | g->draw = FALSE; |
298 | } | 298 | } |
299 | 299 | ||
300 | static void load_graph_destroy(GtkWidget *widget, | 300 | static void load_graph_destroy(GtkWidget *widget, |
301 | gpointer data_ptr) { | 301 | gpointer data_ptr) { |
302 | LoadGraph *g = (LoadGraph *) data_ptr; | 302 | LoadGraph *g = (LoadGraph *) data_ptr; |
303 | load_graph_stop(g); | 303 | load_graph_stop(g); |
304 | if (g->timer_index != -1) | 304 | if (g->timer_index != -1) |
305 | gtk_timeout_remove (g->timer_index); | 305 | gtk_timeout_remove (g->timer_index); |
306 | load_graph_unalloc(g); | 306 | load_graph_unalloc(g); |
@@ -317,7 +317,7 @@ static LoadGraph * load_graph_new(int statIdx, | |||
317 | BREAK(); | 317 | BREAK(); |
318 | return NULL; | 318 | return NULL; |
319 | } | 319 | } |
320 | 320 | ||
321 | g = MALLOC(sizeof(LoadGraph)); | 321 | g = MALLOC(sizeof(LoadGraph)); |
322 | g->statIdx = statIdx; | 322 | g->statIdx = statIdx; |
323 | g->count = stats[statIdx].count; | 323 | g->count = stats[statIdx].count; |
@@ -325,8 +325,8 @@ static LoadGraph * load_graph_new(int statIdx, | |||
325 | g->num_points = 600; | 325 | g->num_points = 600; |
326 | g->colors = MALLOC(sizeof(GdkColor) * (2+g->count)); | 326 | g->colors = MALLOC(sizeof(GdkColor) * (2+g->count)); |
327 | g->colors[0] = config->bg_color; | 327 | g->colors[0] = config->bg_color; |
328 | g->colors[1] = config->frame_color; | 328 | g->colors[1] = config->frame_color; |
329 | for (i=0;i<g->count;i++) | 329 | for (i=0;i<g->count;i++) |
330 | g->colors[2+i] = config->mem_color[i]; | 330 | g->colors[2+i] = config->mem_color[i]; |
331 | g->timer_index = -1; | 331 | g->timer_index = -1; |
332 | g->draw = FALSE; | 332 | g->draw = FALSE; |
@@ -337,24 +337,24 @@ static LoadGraph * load_graph_new(int statIdx, | |||
337 | gtk_signal_connect(GTK_OBJECT (g->disp), | 337 | gtk_signal_connect(GTK_OBJECT (g->disp), |
338 | "expose_event", | 338 | "expose_event", |
339 | GTK_SIGNAL_FUNC (load_graph_expose), g); | 339 | GTK_SIGNAL_FUNC (load_graph_expose), g); |
340 | gtk_signal_connect(GTK_OBJECT(g->disp), | 340 | gtk_signal_connect(GTK_OBJECT(g->disp), |
341 | "configure_event", | 341 | "configure_event", |
342 | GTK_SIGNAL_FUNC (load_graph_configure), g); | 342 | GTK_SIGNAL_FUNC (load_graph_configure), g); |
343 | gtk_signal_connect(GTK_OBJECT(g->disp), | 343 | gtk_signal_connect(GTK_OBJECT(g->disp), |
344 | "destroy", | 344 | "destroy", |
345 | GTK_SIGNAL_FUNC (load_graph_destroy), g); | 345 | GTK_SIGNAL_FUNC (load_graph_destroy), g); |
346 | gtk_widget_add_events(g->disp, | 346 | gtk_widget_add_events(g->disp, |
347 | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK); | 347 | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK); |
348 | gtk_box_pack_start(GTK_BOX(g->main_widget), | 348 | gtk_box_pack_start(GTK_BOX(g->main_widget), |
349 | g->disp, | 349 | g->disp, |
350 | TRUE, | 350 | TRUE, |
351 | TRUE, | 351 | TRUE, |
352 | 0); | 352 | 0); |
353 | load_graph_alloc(g); | 353 | load_graph_alloc(g); |
354 | gtk_widget_show_all(g->main_widget); | 354 | gtk_widget_show_all(g->main_widget); |
355 | g->timer_index = gtk_timeout_add(g->speed, | 355 | g->timer_index = gtk_timeout_add(g->speed, |
356 | &load_graph_update, g); | 356 | &load_graph_update, g); |
357 | 357 | ||
358 | return g; | 358 | return g; |
359 | } | 359 | } |
360 | 360 | ||
@@ -395,12 +395,12 @@ void init_stats() { | |||
395 | ProcConfig config; | 395 | ProcConfig config; |
396 | int i; | 396 | int i; |
397 | 397 | ||
398 | init_functions(); | 398 | init_functions(); |
399 | notebook | 399 | notebook |
400 | = glade_xml_get_widget(getMainXML(), | 400 | = glade_xml_get_widget(getMainXML(), |
401 | "statsNotebook"); | 401 | "statsNotebook"); |
402 | memset(&config, | 402 | memset(&config, |
403 | 0, | 403 | 0, |
404 | sizeof(ProcConfig)); | 404 | sizeof(ProcConfig)); |
405 | gdk_color_parse("black", | 405 | gdk_color_parse("black", |
406 | &config.bg_color); | 406 | &config.bg_color); |
@@ -419,14 +419,14 @@ void init_stats() { | |||
419 | while (stats[++i].paneName != NULL) { | 419 | while (stats[++i].paneName != NULL) { |
420 | sys_box = create_sys_view(i, | 420 | sys_box = create_sys_view(i, |
421 | &config); | 421 | &config); |
422 | if (sys_box == NULL) | 422 | if (sys_box == NULL) |
423 | continue; /* oops */ | 423 | continue; /* oops */ |
424 | 424 | ||
425 | label = gtk_label_new(gettext(stats[i].paneName)); | 425 | label = gtk_label_new(gettext(stats[i].paneName)); |
426 | gtk_notebook_append_page(GTK_NOTEBOOK(notebook), | 426 | gtk_notebook_append_page(GTK_NOTEBOOK(notebook), |
427 | sys_box, | 427 | sys_box, |
428 | label); | 428 | label); |
429 | } | 429 | } |
430 | gtk_widget_show(notebook); | 430 | gtk_widget_show(notebook); |
431 | } | 431 | } |
432 | 432 | ||
@@ -434,5 +434,5 @@ void done_stats() { | |||
434 | done_functions(); | 434 | done_functions(); |
435 | } | 435 | } |
436 | 436 | ||
437 | 437 | ||
438 | /* end of statistics.c */ | 438 | /* end of statistics.c */ |