1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764
|
/* ************************************************************************** */
/* */
/* Copyright (C) 2000-2008 Cédric Auger (cedric@grisbi.org) */
/* 2003-2008 Benjamin Drieu (bdrieu@april.org) */
/* 2008-2009 Pierre Biava (grisbi@pierre.biava.name) */
/* http://www.grisbi.org */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* */
/* ************************************************************************** */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "include.h"
/*START_INCLUDE*/
#include "dialog.h"
#include "parametres.h"
/*END_INCLUDE*/
/*START_STATIC*/
static void dialogue_conditional ( gchar *text, gchar *var );
static GtkDialog *dialogue_conditional_new ( gchar *text,
gchar *var,
GtkMessageType type,
GtkButtonsType buttons );
static void dialogue_conditional_special ( gchar *text, gchar *var, GtkMessageType type );
static gboolean dialogue_update_var ( GtkWidget *checkbox, gint message );
/*END_STATIC*/
/*START_EXTERN*/
extern GtkWidget *window;
/*END_EXTERN*/
/** All messages */
struct conditional_message messages[] =
{
{ "ofx-security-not-implemented", N_("Security feature not implemented"),
N_("This file contains security information, which processing is not implemented at "
"this moment."),
FALSE, FALSE, },
{ "encryption-is-irreversible", N_("Encryption is irreversible."),
N_("Grisbi encrypts files in a very secure way that does not allow recovery without "
"original password. It means that if you forget your password, you will loose all "
"your data. Use with caution.\n\nI repeat: if you ever forget your password, there "
"is no coming back, we cannot help you."),
FALSE, FALSE, },
{ "account-file-readable", N_("Account file is world readable."),
N_("Your account file should not be readable by anybody else, but it is. You should "
"change its permissions."),
FALSE, FALSE, },
{ "account-already-opened", N_("File \"%s\" is already opened"),
N_("Either this file is already opened by another user or it wasn't closed correctly "
"(maybe Grisbi crashed?).\nGrisbi can't save the file unless you activate the "
"\"Force saving locked files\" option in setup."),
FALSE, FALSE, },
{ "minimum-balance-alert", N_("Account under desired balance."),
N_("Grisbi detected that an account is under a desired balance: %s"),
FALSE, FALSE, },
{ "no-budgetary-line", N_("No budgetary line was entered"),
N_("This transaction has no budgetary line entered. You should use them to "
"easily produce budgets and make reports on them."),
FALSE, FALSE, },
{ "recover-split", N_("Recover split?"),
N_("This is a split of transaction, associated transactions can be recovered as "
"in last transaction with this payee. Do you want to recover them?"),
FALSE, FALSE, },
{ "no-inconsistency-found", N_("No inconsistency found."),
N_("Grisbi found no known inconsistency in accounts processed."),
FALSE, FALSE, },
{ "reconcile-transaction", N_("Confirmation of manual (un)reconciliation"),
N_("You are trying to reconcile or unreconcile a transaction manually, "
"which is not a recommended action.\n"
"Are you really sure you know what you are doing?"),
FALSE, FALSE, },
{ "reconcile-start-end-dates", N_("Reconcile start and end dates."),
N_("In previous versions, Grisbi did not save start date, end date and balance for "
"reconciliation. This is now done, so Grisbi will try to guess values from your "
"accounts. Thought this can not harm data coherence, false values can be guessed. "
"Please check in the Preferences window for more information."),
FALSE, FALSE, },
{ "development-version", N_("You are running Grisbi version %s"),
N_("Warning, please be aware that the version you run is a DEVELOPMENT version. "
"Never use your original file grisbi: you could make it unusable.\n"
"Make a copy now."),
FALSE, FALSE },
{ "gtk_obsolete", N_("You are running Grisbi with GTK version %s"),
N_("Warning, please be aware that the version you run is a DEVELOPMENT version. "
"In any case do not work with this version on your original accounting files. "
"(File format may change and render files incompatible with previous versions)."),
FALSE, FALSE },
/*
{ "", N_(),
N_(),
FALSE, FALSE, },
*/
{ NULL },
};
/**
* Display an info dialog window with a hint displayed larger and in
* bold.
*
* \param text Text to display in window
* \param hint Hint to display
*/
void dialogue_hint ( gchar *text, gchar *hint )
{
dialogue_special ( GTK_MESSAGE_INFO, make_hint(hint, text) );
}
/**
* Display an info dialog window.
*
* \param text Text to display in window
*/
void dialogue ( gchar *texte_dialogue )
{
dialogue_special ( GTK_MESSAGE_INFO, texte_dialogue );
}
/**
* Display an error dialog window
*
* \param text Text to display in window
*/
G_MODULE_EXPORT void dialogue_error ( gchar *text )
{
dialogue_special ( GTK_MESSAGE_ERROR, text );
}
/**
* Display an error dialog window with an optional hint.
*
* \param text Text to display in window
* \param hint Text to display in window as hint (bold, larger)
*/
G_MODULE_EXPORT void dialogue_error_hint ( const gchar *text, gchar *hint )
{
dialogue_special ( GTK_MESSAGE_ERROR, make_hint (hint, text) );
}
/**
* Display a warning dialog window
*
* \param text Text to display in window
*/
G_MODULE_EXPORT void dialogue_warning ( gchar *text )
{
dialogue_special ( GTK_MESSAGE_WARNING, text );
}
/**
* Display a warning dialog window with an optional hint.
*
* \param text Text to display in window
* \param hint Text to display in window as hint (bold, larger)
*/
void dialogue_warning_hint ( gchar *text, gchar *hint )
{
dialogue_special ( GTK_MESSAGE_WARNING, make_hint (hint, text) );
}
/**
* Display a dialog window with arbitrary icon.
* WARNING you may need to escape text with g_markup_escape_text()
* or g_markup_printf_escaped():
*
* \param param Type of Window to display
* \param text Text to display in window
*/
void dialogue_special ( GtkMessageType param, gchar *text )
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new ( GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
param, GTK_BUTTONS_CLOSE,
"%s", text );
gtk_label_set_markup ( GTK_LABEL ( GTK_MESSAGE_DIALOG (dialog)->label ), text );
gtk_window_set_modal ( GTK_WINDOW ( dialog ), TRUE );
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy ( dialog );
}
/**
* Display a dialog window with arbitrary icon.
* WARNING you may need to escape text with g_markup_escape_text()
* or g_markup_printf_escaped():
*
* \param param Type of Window to display
* \param text Text to display in window
*/
GtkWidget *dialogue_special_no_run ( GtkMessageType param,
GtkButtonsType buttons,
gchar *text )
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new ( GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
param, buttons,
"%s", text );
gtk_label_set_markup ( GTK_LABEL ( GTK_MESSAGE_DIALOG(dialog)->label ), text );
gtk_window_set_modal ( GTK_WINDOW ( dialog ), TRUE );
return dialog;
}
/**
* Update the value of a message in memory according to the state of a
* checkbox button. These messages are conditional dialogs (see
* dialogue_conditional_new()). Normally called as an event.
*
* \param checbox GtkCheckbox that triggered this event.
* \param message struct conditional_message Message
*
* \return FALSE.
*/
gboolean dialogue_update_struct_message ( GtkWidget *checkbox,
struct conditional_message *message )
{
message -> hidden = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( checkbox ) );
return FALSE;
}
/**
* Update the value of a message in memory according to the state of a
* checkbox button. These messages are conditional dialogs (see
* dialogue_conditional_new()). Normally called as an event.
*
* \param checbox GtkCheckbox that triggered this event.
* \param message Message ID.
*
* \return FALSE.
*/
gboolean dialogue_update_var ( GtkWidget *checkbox, gint message )
{
messages[message].hidden = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON(checkbox) );
return FALSE;
}
/**
* Create a dialog with an informal text and a checkbox that allow
* this message not to be displayed again thanks to preferences.
* WARNING you may need to escape text with g_markup_escape_text()
* or g_markup_printf_escaped():
*
* \param text Text to be displayed
* \param var Variable that both controls whether the dialog will
* appear or not and that indicates which variable could
* be modified so that this message won't appear again.
*
* \return A newly-created GtkDialog.
*/
GtkDialog *dialogue_conditional_new ( gchar *text,
gchar *var,
GtkMessageType type,
GtkButtonsType buttons )
{
GtkWidget * vbox, * checkbox, *dialog = NULL;
int i;
if ( !var || !strlen ( var ) )
return NULL;
for ( i = 0; messages[i].name; i++ )
{
if ( !strcmp ( messages[i].name, var ) )
{
if ( messages[i].hidden )
{
return NULL;
}
break;
}
}
dialog = gtk_message_dialog_new ( GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
type, buttons,
"%s", text );
gtk_dialog_set_default_response ( GTK_DIALOG( dialog ), GTK_RESPONSE_CLOSE );
gtk_label_set_markup ( GTK_LABEL ( GTK_MESSAGE_DIALOG(dialog)->label ), text );
vbox = GTK_DIALOG(dialog) -> vbox;
checkbox = gtk_check_button_new_with_label ( _("Do not show this message again") );
g_signal_connect ( G_OBJECT ( checkbox ), "toggled",
G_CALLBACK ( dialogue_update_var ), GINT_TO_POINTER ( i ) );
gtk_box_pack_start ( GTK_BOX ( vbox ), checkbox, TRUE, TRUE, 6 );
gtk_widget_show_all ( checkbox );
gtk_window_set_modal ( GTK_WINDOW ( dialog ), TRUE );
return GTK_DIALOG (dialog);
}
/**
* This function pop ups a dialog with a hint (first sentence, in
* bold), an informal text and a checkbox that allow this message not
* to be displayed again thanks to preferences. It calls
* dialogue_conditional to achieve display.
*
* \param text text to be displayed
* \param hint hint to be displayed
* \param var variable that both controls whether the dialog will
* appear or not and that indicates which variable could be modified
* so that this message won't appear again.
*/
void dialogue_conditional_hint ( gchar *hint, gchar *text, gchar *var )
{
dialogue_conditional ( make_hint(hint, text), var );
}
/**
* This function pop ups a dialog with an informal text and a checkbox
* that allow this message not to be displayed again thanks to
* preferences.
*
* \param text text to be displayed
* \param var variable that both controls whether the dialog will
* appear or not and that indicates which variable could be modified
* so that this message won't appear again.
*/
void dialogue_conditional ( gchar *text, gchar *var )
{
dialogue_conditional_special ( text, var, GTK_MESSAGE_WARNING );
}
/**
* This function pop ups a dialog with an informal text and a checkbox
* that allow this message not to be displayed again thanks to
* preferences.
*
* \param text Text to be displayed
* \param var Variable that both controls whether the dialog will
* appear or not and that indicates which variable could
* be modified so that this message won't appear again.
*/
void dialogue_conditional_special ( gchar *text, gchar *var, GtkMessageType type )
{
GtkDialog *dialog;
dialog = dialogue_conditional_new ( text, var, type, GTK_BUTTONS_CLOSE );
if ( ! dialog )
return;
gtk_dialog_run ( GTK_DIALOG (dialog) );
gtk_widget_destroy ( GTK_WIDGET (dialog));
}
/**
* Pop up a warning dialog window with a question and wait for user to
* press 'OK' or 'Cancel'. A hint is displayed on the top of the
* window larger and in bold.
*
* \param hint Hint to be displayed
* \param texte Text to be displayed
* \param default_answer GTK_RESPONSE_OK or GTK_RESPONSE_CANCEL, will give the focus to the button
*
* \return TRUE if user pressed 'OK'. FALSE otherwise.
*/
gboolean question_yes_no_hint ( gchar *hint,
gchar *texte,
gint default_answer )
{
return question_yes_no ( make_hint ( hint, texte ), default_answer );
}
/**
* Pop up a warning dialog window with a question and wait for user to
* press 'YES' or 'NO'.
* WARNING you may need to escape text with g_markup_escape_text()
* or g_markup_printf_escaped():
*
* \param texte Text to be displayed
* \param default_answer GTK_RESPONSE_OK or GTK_RESPONSE_CANCEL, will give the focus to the button
*
* \return TRUE if user pressed 'YES'. FALSE otherwise.
*/
gboolean question_yes_no ( gchar *text, gint default_answer )
{
GtkWidget *dialog;
gint response;
dialog = gtk_message_dialog_new ( GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO,
"%s", text );
gtk_label_set_markup ( GTK_LABEL ( GTK_MESSAGE_DIALOG(dialog)->label ), text );
gtk_dialog_set_default_response (GTK_DIALOG (dialog), default_answer );
response = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy ( dialog );
if ( response == GTK_RESPONSE_YES )
return TRUE;
else
return FALSE;
}
/**
* Pop up a warning dialog window with a question and a checkbox that allow
* this message not to be displayed again thanks to preferences and wait
* for user to press 'YES' or 'NO'.
*
* \param var variable that both controls whether the dialog will
* appear or not and that indicates which variable could be modified
* so that this message won't appear again.
*
* \return TRUE if user pressed 'YES'. FALSE otherwise.
*/
gboolean question_conditional_yes_no ( gchar *var )
{
gint response, i;
GtkDialog *dialog;
for ( i = 0; messages[i].name; i++ )
{
if ( !strcmp ( messages[i].name, var ) )
{
if ( messages[i].hidden )
{
return messages[i].default_answer;
}
break;
}
}
dialog = dialogue_conditional_new ( make_hint ( _(messages[i].hint),
_(messages[i].message)),
var,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_YES_NO );
response = gtk_dialog_run (GTK_DIALOG (dialog));
if ( response == GTK_RESPONSE_YES )
messages[i].default_answer = TRUE;
else
messages[i].default_answer = FALSE;
gtk_widget_destroy (GTK_WIDGET (dialog));
return messages[i].default_answer;
}
/**
* Pop up a warning dialog window with a question and a checkbox that allow
* this message not to be displayed again thanks to preferences and wait
* for user to press 'YES' or 'NO'.
*
* \param struct conditional_message
*
* \return TRUE if user pressed 'YES'. FALSE otherwise.
*/
gboolean question_conditional_yes_no_with_struct ( struct conditional_message *message )
{
GtkWidget *dialog, *vbox, *checkbox;
gchar *text;
gint response;
if ( message -> hidden )
return message -> default_answer;
text = make_hint ( _(message -> hint), message -> message );
dialog = gtk_message_dialog_new ( GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_YES_NO,
"%s", text );
gtk_dialog_set_default_response ( GTK_DIALOG( dialog ), GTK_RESPONSE_NO );
gtk_label_set_markup ( GTK_LABEL ( GTK_MESSAGE_DIALOG ( dialog )->label ), text );
vbox = GTK_DIALOG ( dialog ) -> vbox;
checkbox = gtk_check_button_new_with_label ( _("Do not show this message again") );
g_signal_connect ( G_OBJECT ( checkbox ),
"toggled",
G_CALLBACK ( dialogue_update_struct_message ),
message );
gtk_box_pack_start ( GTK_BOX ( vbox ), checkbox, TRUE, TRUE, 6 );
gtk_widget_show_all ( checkbox );
response = gtk_dialog_run (GTK_DIALOG (dialog));
if ( response == GTK_RESPONSE_YES )
message -> default_answer = TRUE;
else
message -> default_answer = FALSE;
gtk_widget_destroy (GTK_WIDGET (dialog));
return message -> default_answer;
}
/**
* return the number of message
*
* \param struct conditional_message
* \param name of message
*
* \return message number or -1 is not present.
*/
gint question_conditional_yes_no_get_no_struct ( struct conditional_message *msg,
gchar *name )
{
gint i;
for ( i = 0; msg[i].name; i++ )
{
if ( strcmp ( msg[i].name, name ) == 0 )
return i;
}
return -1;
}
/**
* Concatenate two strings and use pango layout to produce a string
* that will contain an hint and a text.
*
* \param hint Text to use as hint
* \param text Text to use as secondary text
*
* \return a pango formated string with the two arguments concatenated. It returns a newly allocated string which must be freed when no more used.
*/
gchar *make_hint ( const gchar *hint, const gchar *text )
{
gchar *tmp_str = NULL;
gchar *tmp_markup_str;
tmp_markup_str = g_markup_printf_escaped (
"<span size=\"larger\" weight=\"bold\">%s</span>\n\n", hint );
if ( text && strlen ( text ) )
tmp_str = g_strconcat ( tmp_markup_str, text, NULL );
else
tmp_str = g_strdup ( tmp_markup_str );
g_free ( tmp_markup_str );
return tmp_str;
}
/**
* use pango layout to produce a string that will contain a text.
*
* \param text Text
*
* \return a pango formated string It returns a newly allocated string which must
* be freed when no more used.
*/
gchar *make_red ( gchar *text )
{
gchar *tmpstr;
tmpstr = g_markup_printf_escaped ( "<span foreground=\"red\">%s</span>", text );
return tmpstr;
}
/**
* use pango layout to produce a string that will contain a text.
*
* \param attribut exemple foreground=\"red\", size=\"x-large\"
* \param text Text
*
* \return a pango formated string It returns a newly allocated string which must
* be freed when no more used.
*/
gchar *make_pango_attribut ( gchar *attribut, gchar *text )
{
gchar *tmpstr;
tmpstr = g_markup_printf_escaped (
g_strconcat ( "<span ", attribut, ">%s</span>", NULL ), text );
return tmpstr;
}
/**
* use pango layout to produce a string that will contain a text.
*
* \param text Text
*
* \return a pango formated string It returns a newly allocated string which must
* be freed when no more used.
*/
gchar *make_blue ( gchar *text )
{
gchar *tmpstr;
tmpstr = g_markup_printf_escaped ( "<span foreground=\"blue\">%s</span>", text );
return tmpstr;
}
/**
* Displays a dialog message stating that bad things will happen
* soon. This dialog should not appear theorically, but it is here
* just in case to spot bugs.
*/
void dialogue_error_brain_damage ()
{
dialogue_error_hint ( _("Hi, you are in the middle of nowhere, between two lines of code."
" Grisbi is expected to crash very soon. Have a nice day."),
_("Serious brain damage expected.") );
}
/**
* Displays a dialog message stating that bad things will happen
* soon. This dialog should not appear theorically, but it is here
* just in case to spot bugs.
*/
void dialogue_error_memory ()
{
dialogue_error_hint ( _("Bad things will happen soon. Be sure to save any modification "
"in a separate file in case Grisbi would corrupt files."),
_("Cannot allocate memory") );
}
/**
*
*
*
*/
void dialog_message ( gchar *label, ... )
{
va_list ap;
int i = 0;
while ( messages[i] . name )
{
if ( !strcmp ( messages[i] . name, label ) )
{
if ( ! messages[i] . hidden )
{
gchar hint_buffer[1024], message_buffer[1024];
va_start ( ap, label );
vsnprintf ( hint_buffer, 1024, _(messages[i] . hint), ap );
vsnprintf ( message_buffer, 1024, _(messages[i] . message), ap );
dialogue_conditional_hint ( hint_buffer, message_buffer,
messages[i] . name );
}
return;
}
i ++;
}
}
/**
* Display an info dialog window with a hint displayed larger and in
* bold.
* add an entry and return the content of the entry
*
* \param text Text to display in window
* \param hint Hint to display
* \param entry_description label to set in front of the entry
*/
const gchar *dialogue_hint_with_entry ( gchar *text, gchar *hint, gchar *entry_description )
{
GtkWidget *dialog;
gchar *format_text;
GtkWidget *entry;
GtkWidget *hbox;
GtkWidget *label;
const gchar *string;
format_text = make_hint ( hint, text );
dialog = gtk_message_dialog_new ( GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
"%s", format_text );
gtk_label_set_markup ( GTK_LABEL ( GTK_MESSAGE_DIALOG(dialog)->label ), format_text );
hbox = gtk_hbox_new (FALSE, 5);
gtk_box_pack_start ( GTK_BOX (GTK_DIALOG (dialog) -> vbox),
hbox,
FALSE, FALSE, 0);
label = gtk_label_new (entry_description);
gtk_box_pack_start ( GTK_BOX (hbox), label, FALSE, FALSE, 0);
entry = gtk_entry_new ();
gtk_box_pack_start ( GTK_BOX (hbox), entry, FALSE, FALSE, 0);
gtk_widget_show_all (dialog);
gtk_window_set_modal ( GTK_WINDOW ( dialog ), TRUE );
gtk_dialog_run (GTK_DIALOG (dialog));
string = gtk_entry_get_text (GTK_ENTRY (entry));
gtk_widget_destroy ( dialog );
return string;
}
/* Local Variables: */
/* c-basic-offset: 4 */
/* End: */
|