19
19
#include "common.h"
20
#if !GTK_CHECK_VERSION(2,4,0)
20
21
#include <libgnomeui/libgnomeui.h>
24
extern GtkWidget *main_window;
22
26
/* Find the length of a string vector */
23
27
gint vectorlength(gchar **vector)
43
47
* new GLib functions -> 2.0 */
49
53
return g_strdup(add);
50
55
tmpstring = (gchar *) g_malloc(strlen(org) + strlen(add) + 1);
51
56
tmpstring = strcpy(tmpstring, org);
52
57
tmpstring = strcat(tmpstring, add);
134
139
* a string in mm:ss notation */
135
140
gchar *seconds_to_mmss(guint seconds)
144
guint secfrac = seconds % 60;
145
guint minfrac = seconds / 60;
141
148
return g_strdup("0:00");
142
sprintf(tmp2, "0%u", seconds%60);
150
snprintf(tmp2, 10, "0%u", secfrac);
143
151
while (strlen(tmp2)>2) {
148
sprintf(tmp, "%lu:%s", seconds/60, tmp2);
156
snprintf(tmp, 10, "%lu:%s", minfrac, tmp2);
149
157
return g_strdup(tmp);
204
212
GtkWidget *dialog;
205
213
GtkWidget *label, *button;
215
#if GTK_CHECK_VERSION(2,4,0)
216
dialog = gtk_message_dialog_new (GTK_WINDOW(main_window),
217
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
221
g_signal_connect_object(GTK_OBJECT(dialog),
223
G_CALLBACK(gtk_widget_destroy),
226
g_signal_connect_object(GTK_OBJECT(dialog),
228
G_CALLBACK(gtk_widget_destroy),
231
gtk_widget_show(dialog);
207
233
dialog = gnome_message_box_new (errorstring,
208
234
GNOME_MESSAGE_BOX_ERROR,
209
235
GNOME_STOCK_BUTTON_OK,
211
237
gtk_widget_show(dialog);
241
gboolean request_confirmation_dialog(gchar *confirmstring)
244
GtkWidget *label, *button;
246
gboolean retval = FALSE;
248
#if GTK_CHECK_VERSION(2,4,0)
249
dialog = gtk_message_dialog_new (GTK_WINDOW(main_window),
250
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
251
GTK_MESSAGE_QUESTION,
254
i = gtk_dialog_run(GTK_DIALOG(dialog));
255
gtk_widget_destroy(dialog);
256
if (i == GTK_RESPONSE_YES) {
261
I can't seem to get GNOMEUI to do this properly, so I'm leaving it
262
out for clients that do not have a sufficiently new GTK.
264
g_print("Awaiting confirmation (GNOMEUI): %s...\n", confirmstring);
265
dialog = gnome_message_box_new (confirmstring,
266
GNOME_MESSAGE_BOX_QUESTION,
267
GNOME_STOCK_BUTTON_YES,
268
GNOME_STOCK_BUTTON_CANCEL,
270
gtk_widget_show(dialog);
271
i = gnome_dialog_run_and_close(GNOME_DIALOG(dialog));
214
282
void hexdump(unsigned char *data, guint len)