aboutsummaryrefslogtreecommitdiff
path: root/src/helper.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/helper.h')
-rw-r--r--src/helper.h139
1 files changed, 139 insertions, 0 deletions
diff --git a/src/helper.h b/src/helper.h
new file mode 100644
index 00000000..3bf65f11
--- /dev/null
+++ b/src/helper.h
@@ -0,0 +1,139 @@
1/*
2 This file is part of GNUnet
3
4 GNUnet is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published
6 by the Free Software Foundation; either version 2, or (at your
7 option) any later version.
8
9 GNUnet is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with GNUnet; see the file COPYING. If not, write to the
16 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA.
18*/
19
20/**
21 * @file src/helper.h
22 * @author Igor Wronsky
23 */
24
25#ifndef GTKUI_HELPER_H
26#define GTKUI_HELPER_H
27
28#include "platform.h"
29#include <GNUnet/gnunet_util.h>
30
31/* for GTK 2 */
32#define GTK_ENABLE_BROKEN
33
34#include <gtk/gtk.h>
35#include <gtk/gtktext.h>
36
37typedef struct {
38 Semaphore *sem;
39 void *args;
40 GtkFunction func;
41} SaveCall;
42
43typedef struct {
44 int doPopup;
45 gchar *note;
46} InfoMessage;
47
48typedef struct {
49 const char *labelName;
50 GtkWidget *frame;
51} AddNotebook;
52
53
54/* callback: window close: close the window */
55gint deleteEvent(GtkWidget * widget,
56 GdkEvent * event,
57 gpointer data);
58
59/**
60 * A callback to destroy any widget given as second argument
61 *
62 */
63void destroyWidget(GtkWidget * dummy, GtkWidget * widget);
64
65/**
66 * Displays an informative message to the user
67 */
68void guiMessage(const char * format, ...);
69
70/**
71 * Appends a message to the info window
72 */
73void infoMessage(int doPopup, const char * format, ...);
74
75/**
76 * Appends a log entry to the info window
77 *
78 * @param txt the log entry
79 *
80 */
81void addLogEntry(const char *txt);
82
83/**
84 * A function for numeric comparisons of strings
85 */
86gint numericComp(GtkCList *clist,
87 gconstpointer ptr1,
88 gconstpointer ptr2);
89
90/**
91 * A function for case-insensitive text comparisons
92 */
93gint alphaComp(GtkCList *clist,
94 gconstpointer ptr1,
95 gconstpointer ptr2);
96
97/**
98 * A function for comparisons of percentages
99 */
100gint percentComp(GtkCList *clist,
101 gconstpointer ptr1,
102 gconstpointer ptr2);
103
104/**
105 * A general right-button popup menu callback
106 */
107gboolean popupCallback(GtkWidget *widget,
108 GdkEvent *event,
109 GtkWidget *menu );
110
111/**
112 * Call a callback function from the mainloop/main thread ("SaveCall").
113 * Since GTK doesn't work with multi-threaded applications under Windows,
114 * all GTK operations have to be done in the main thread
115 */
116void gtkSaveCall(GtkFunction func, void *args);
117
118/**
119 * Initialize "SaveCalls"
120 */
121void gtkInitSaveCalls();
122
123void gtkDoneSaveCalls();
124
125int gtkRunSomeSaveCalls();
126
127/**
128 * Called from a "SaveCall"-function to indicate that it is done
129 */
130void gtkSaveCallDone(Semaphore *sem);
131
132/**
133 * Destroy a widget. Called from threads other than the main thread
134 */
135gint doDestroyWidget(SaveCall *call);
136
137extern GtkWidget * infoWindow;
138
139#endif