chiark
/
gitweb
/
~mdw
/
mgLib
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Various Debian fixes.
[mgLib]
/
msg.c
diff --git
a/msg.c
b/msg.c
index d9be0ca04037ef54acc2863890801178706275df..d51fa21396768ab913af94a80e837cdad95ec075 100644
(file)
--- a/
msg.c
+++ b/
msg.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: msg.c,v 1.
7 1999/05/21 22:08:20
mdw Exp $
+ * $Id: msg.c,v 1.
10 2002/01/13 14:33:43
mdw Exp $
*
* Display a message and get an answer
*
*
* Display a message and get an answer
*
@@
-30,6
+30,15
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: msg.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: msg.c,v $
+ * Revision 1.10 2002/01/13 14:33:43 mdw
+ * Track @dstr_vputf@ change.
+ *
+ * Revision 1.9 2002/01/13 14:32:22 mdw
+ * Allow control over the message box title.
+ *
+ * Revision 1.8 1999/11/11 19:54:37 mdw
+ * Prep for standalone release.
+ *
* Revision 1.7 1999/05/21 22:08:20 mdw
* Take advantage of new dynamic string macros.
*
* Revision 1.7 1999/05/21 22:08:20 mdw
* Take advantage of new dynamic string macros.
*
@@
-54,8
+63,6
@@
*
*/
*
*/
-#ifdef HAVE_GTK
-
/*----- Header files ------------------------------------------------------*/
#include <stdarg.h>
/*----- Header files ------------------------------------------------------*/
#include <stdarg.h>
@@
-81,8
+88,9
@@
static int creply;
/* --- @msg@ --- *
*
/* --- @msg@ --- *
*
- * Arguments: @char *buttons@ = the button strings to display
- * @char *msg@ = the message skeleton string
+ * Arguments: @const char *title@ = the title for the message box
+ * @const char *buttons@ = the button strings to display
+ * @const char *msg@ = the message skeleton string
*
* Returns: Index of the button selected.
*
*
* Returns: Index of the button selected.
*
@@
-111,13
+119,14
@@
static void click(GtkWidget *w, gpointer p)
gtk_main_quit();
}
gtk_main_quit();
}
-int msg(const char *buttons, const char *msg, ...)
+int msg(const char *
title, const char *
buttons, const char *msg, ...)
{
GtkWidget *dbox, *w;
/* --- Make most of the dialogue box --- */
dbox = gtk_dialog_new();
{
GtkWidget *dbox, *w;
/* --- Make most of the dialogue box --- */
dbox = gtk_dialog_new();
+ gtk_window_set_title(GTK_WINDOW(dbox), title);
gtk_signal_connect(GTK_OBJECT(dbox), "delete_event",
GTK_SIGNAL_FUNC(close), 0);
gtk_box_set_homogeneous(GTK_BOX(GTK_DIALOG(dbox)->action_area), 0);
gtk_signal_connect(GTK_OBJECT(dbox), "delete_event",
GTK_SIGNAL_FUNC(close), 0);
gtk_box_set_homogeneous(GTK_BOX(GTK_DIALOG(dbox)->action_area), 0);
@@
-129,7
+138,7
@@
int msg(const char *buttons, const char *msg, ...)
va_list ap;
va_start(ap, msg);
va_list ap;
va_start(ap, msg);
- dstr_vputf(&d, msg, ap);
+ dstr_vputf(&d, msg,
&
ap);
va_end(ap);
w = gtk_label_new(d.buf);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dbox)->vbox), w, 1, 1, 0);
va_end(ap);
w = gtk_label_new(d.buf);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dbox)->vbox), w, 1, 1, 0);
@@
-146,11
+155,9
@@
int msg(const char *buttons, const char *msg, ...)
unsigned f = 0;
int i = 0;
unsigned f = 0;
int i = 0;
- enum {
- f_ok = 1,
- f_cancel = 2,
- f_mdwfocus = 4
- };
+#define f_ok 1u
+#define f_cancel 2u
+#define f_mdwfocus 4u
if (*p == '!') {
f |= f_mdwfocus;
if (*p == '!') {
f |= f_mdwfocus;
@@
-189,6
+196,9
@@
int msg(const char *buttons, const char *msg, ...)
if (f & f_mdwfocus)
mdwfocus(dbox);
if (f & f_mdwfocus)
mdwfocus(dbox);
+#undef f_ok
+#undef f_cancel
+#undef f_mdwfocus
}
/* --- Ready --- */
}
/* --- Ready --- */
@@
-202,7
+212,3
@@
int msg(const char *buttons, const char *msg, ...)
}
/*----- That's all, folks -------------------------------------------------*/
}
/*----- That's all, folks -------------------------------------------------*/
-
-#else
- int mgLib_msg = 0;
-#endif