diff options
author | Christian Grothoff <christian@grothoff.org> | 2005-07-05 22:02:57 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2005-07-05 22:02:57 +0000 |
commit | cb8edf8bcc9030e4bb8f72ffee46de4a82e18c94 (patch) | |
tree | 6bb99b81fe7dd761e8ea1f145fafe5991dabde35 /src/common/helper.c | |
parent | 23c3e30bb76d94ec32633296a3aeb7ec4958ec49 (diff) | |
download | gnunet-gtk-cb8edf8bcc9030e4bb8f72ffee46de4a82e18c94.tar.gz gnunet-gtk-cb8edf8bcc9030e4bb8f72ffee46de4a82e18c94.zip |
die gui message, die
Diffstat (limited to 'src/common/helper.c')
-rw-r--r-- | src/common/helper.c | 73 |
1 files changed, 1 insertions, 72 deletions
diff --git a/src/common/helper.c b/src/common/helper.c index bf2ae4a8..59c10bf8 100644 --- a/src/common/helper.c +++ b/src/common/helper.c | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2003, 2004, 2005 Christian Grothoff (and other contributing authors) | ||
3 | 4 | ||
4 | GNUnet is free software; you can redistribute it and/or modify | 5 | 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 | it under the terms of the GNU General Public License as published |
@@ -144,78 +145,6 @@ deleteEvent(GtkWidget * widget, | |||
144 | return FALSE; | 145 | return FALSE; |
145 | } | 146 | } |
146 | 147 | ||
147 | /** | ||
148 | * A callback to destroy any widget given as second argument | ||
149 | */ | ||
150 | static void | ||
151 | destroyWidget(GtkWidget * dummy, | ||
152 | GtkWidget * widget) { | ||
153 | gtk_widget_destroy(widget); | ||
154 | } | ||
155 | |||
156 | /** | ||
157 | * Callback function for guiMessage() | ||
158 | * | ||
159 | * FIXME: use GLADE (or direct GTK functionality) here! | ||
160 | */ | ||
161 | static void doGuiMessage(void * args) { | ||
162 | const gchar * msg = args; | ||
163 | GtkWidget * window; | ||
164 | GtkWidget * label; | ||
165 | GtkWidget * box; | ||
166 | GtkWidget * button; | ||
167 | |||
168 | window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | ||
169 | gtk_container_set_border_width(GTK_CONTAINER(window), 10); | ||
170 | gtk_window_set_title(GTK_WINDOW(window), | ||
171 | _("Notification")); | ||
172 | gtk_signal_connect(GTK_OBJECT(window), | ||
173 | "delete_event", | ||
174 | GTK_SIGNAL_FUNC(deleteEvent), | ||
175 | NULL); | ||
176 | |||
177 | box = gtk_vbox_new(FALSE, 0); | ||
178 | gtk_container_add(GTK_CONTAINER(window), | ||
179 | box); | ||
180 | |||
181 | label = gtk_label_new(msg); | ||
182 | gtk_box_pack_start(GTK_BOX(box), | ||
183 | label, | ||
184 | FALSE, | ||
185 | FALSE, | ||
186 | 0); | ||
187 | |||
188 | button = gtk_button_new_with_label(_("Ok")); | ||
189 | gtk_signal_connect(GTK_OBJECT (button), | ||
190 | "clicked", | ||
191 | GTK_SIGNAL_FUNC(destroyWidget), | ||
192 | window); | ||
193 | gtk_box_pack_start(GTK_BOX(box), | ||
194 | button, | ||
195 | FALSE, | ||
196 | FALSE, | ||
197 | 0); | ||
198 | gtk_window_set_position(GTK_WINDOW(window), | ||
199 | GTK_WIN_POS_MOUSE); | ||
200 | gtk_widget_show_all(window); | ||
201 | gtk_widget_grab_focus(button); | ||
202 | } | ||
203 | |||
204 | /** | ||
205 | * Displays an informative message to the user in a fresh window | ||
206 | */ | ||
207 | void guiMessage(const char * format, | ||
208 | ...) { | ||
209 | va_list args; | ||
210 | gchar *note; | ||
211 | |||
212 | va_start(args, format); | ||
213 | note = g_strdup_vprintf(format, args); | ||
214 | va_end(args); | ||
215 | gtkSaveCall(&doGuiMessage, note); | ||
216 | free(note); | ||
217 | } | ||
218 | |||
219 | static void hideWindow(GtkWidget * widget, | 148 | static void hideWindow(GtkWidget * widget, |
220 | gpointer data) { | 149 | gpointer data) { |
221 | if (widget != NULL) | 150 | if (widget != NULL) |