diff options
Diffstat (limited to 'src/include/gnunet_gtk.h')
-rw-r--r-- | src/include/gnunet_gtk.h | 154 |
1 files changed, 154 insertions, 0 deletions
diff --git a/src/include/gnunet_gtk.h b/src/include/gnunet_gtk.h new file mode 100644 index 00000000..4403ab4b --- /dev/null +++ b/src/include/gnunet_gtk.h | |||
@@ -0,0 +1,154 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2011 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file src/include/gnunet_gtk.h | ||
23 | * @brief Helper library for Gtk user interfaces to GNUnet | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #ifndef GNUNET_GTK_H | ||
27 | #define GNUNET_GTK_H | ||
28 | |||
29 | #ifndef HAVE_USED_CONFIG_H | ||
30 | #define HAVE_USED_CONFIG_H | ||
31 | #if HAVE_CONFIG_H | ||
32 | #include "gnunet_gtk_config.h" | ||
33 | #endif | ||
34 | #endif | ||
35 | |||
36 | #include <gnunet/platform.h> | ||
37 | #include <gnunet/gnunet_util_lib.h> | ||
38 | #include <gnunet/gnunet_fs_service.h> | ||
39 | #include <extractor.h> | ||
40 | #include <gladeui/glade.h> | ||
41 | #include <gtk/gtk.h> | ||
42 | |||
43 | |||
44 | /** | ||
45 | * Initialize natural language support. | ||
46 | */ | ||
47 | void | ||
48 | GNUNET_GTK_setup_nls (void); | ||
49 | |||
50 | |||
51 | /** | ||
52 | * Get the name of the directory where all of our package | ||
53 | * data is stored ($PREFIX/share/) | ||
54 | * | ||
55 | * @return name of the data directory | ||
56 | */ | ||
57 | const char * | ||
58 | GNUNET_GTK_get_data_dir (void); | ||
59 | |||
60 | |||
61 | /** | ||
62 | * @brief get the path to a specific GNUnet installation directory or, | ||
63 | * with GNUNET_IPK_SELF_PREFIX, the current running apps installation directory | ||
64 | * @author Milan | ||
65 | * @return a pointer to the dir path (to be freed by the caller) | ||
66 | */ | ||
67 | char * | ||
68 | GNUNET_GTK_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind); | ||
69 | |||
70 | |||
71 | /** | ||
72 | * Create an initialize a new builder based on the GNUnet-GTK glade | ||
73 | * file. | ||
74 | * | ||
75 | * @param filename name of the resource file to load | ||
76 | * @return NULL on error | ||
77 | */ | ||
78 | GtkBuilder * | ||
79 | GNUNET_GTK_get_new_builder (const char *filename); | ||
80 | |||
81 | |||
82 | /** | ||
83 | * This displays an about dialog. | ||
84 | * | ||
85 | * @param dialogfile name of the glade file containing the dialog | ||
86 | * @param dialogname name of the about dialog in the file | ||
87 | */ | ||
88 | void | ||
89 | GNUNET_GTK_display_about (const char *dialogfile, | ||
90 | const char *dialogname); | ||
91 | |||
92 | |||
93 | /** | ||
94 | * Handle for our main loop. | ||
95 | */ | ||
96 | struct GNUNET_GTK_MainLoop; | ||
97 | |||
98 | |||
99 | /** | ||
100 | * Initialize the main loop. | ||
101 | * | ||
102 | * @param binary_name binary name | ||
103 | * @param binary_help help text for the binary | ||
104 | * @param argc number of command line options | ||
105 | * @param argv command line options | ||
106 | * @param options allowed command line options | ||
107 | * @param main_window_file glade file for the main window | ||
108 | * @param main_task first task to run, closure will be set to the 'struct GNUNET_GTK_MainLoop' | ||
109 | * @return GNUNET_OK on success, GNUNET_SYSERR on error (i.e. bad command-line options, etc) | ||
110 | */ | ||
111 | int | ||
112 | GNUNET_GTK_main_loop_start (const char *binary_name, | ||
113 | const char *binary_help, | ||
114 | int argc, | ||
115 | char *const*argv, | ||
116 | struct GNUNET_GETOPT_CommandLineOption *options, | ||
117 | const char *main_window_file, | ||
118 | GNUNET_SCHEDULER_Task main_task); | ||
119 | |||
120 | |||
121 | /** | ||
122 | * Get an object from the main window. | ||
123 | * | ||
124 | * @param ml handle to the main loop | ||
125 | * @param name name of the object | ||
126 | * @return NULL on error, otherwise the object | ||
127 | */ | ||
128 | GObject * | ||
129 | GNUNET_GTK_main_loop_get_object (struct GNUNET_GTK_MainLoop *ml, | ||
130 | const char *name); | ||
131 | |||
132 | |||
133 | /** | ||
134 | * Get the configuration. | ||
135 | * | ||
136 | * @param ml handle to the main loop | ||
137 | * @return handle to the configuration, never NULL | ||
138 | */ | ||
139 | const struct GNUNET_CONFIGURATION_Handle * | ||
140 | GNUNET_GTK_main_loop_get_configuration (struct GNUNET_GTK_MainLoop *ml); | ||
141 | |||
142 | |||
143 | /** | ||
144 | * Trigger shutdown of the GUI and exit the main loop. | ||
145 | * | ||
146 | * @param ml handle to the main loop | ||
147 | */ | ||
148 | void | ||
149 | GNUNET_GTK_main_loop_quit (struct GNUNET_GTK_MainLoop *ml); | ||
150 | |||
151 | |||
152 | |||
153 | #endif | ||
154 | /* end of gnunet_gtk.h */ | ||