Commit 2d23cf45959b0ed3ec5a9d1c712e624f08819fc7
1 parent
e073bb4b
Exists in
master
and in
5 other branches
Incluindo teste de versao gtk
Showing
2 changed files
with
36 additions
and
2 deletions
Show diff stats
src/pw3270/dialog.c
| ... | ... | @@ -544,6 +544,7 @@ |
| 544 | 544 | GtkAboutDialog * dialog = GTK_ABOUT_DIALOG(gtk_about_dialog_new()); |
| 545 | 545 | gchar * text = g_strdup_printf("%s-logo.png",g_get_application_name()); |
| 546 | 546 | gchar * filename = build_data_filename(text,NULL); |
| 547 | + gchar * info; | |
| 547 | 548 | |
| 548 | 549 | trace("[%s]",filename); |
| 549 | 550 | if(g_file_test(filename,G_FILE_TEST_EXISTS)) |
| ... | ... | @@ -572,7 +573,9 @@ |
| 572 | 573 | g_free(text); |
| 573 | 574 | |
| 574 | 575 | gtk_about_dialog_set_copyright(dialog, "Copyright © 2008 Banco do Brasil S.A." ); |
| 575 | - gtk_about_dialog_set_comments(dialog, _( "3270 terminal emulator for GTK+" ) ); | |
| 576 | + | |
| 577 | + info = g_strdup_printf(_( "3270 terminal emulator for GTK %d.%d" ),GTK_MAJOR_VERSION,GTK_MINOR_VERSION); | |
| 578 | + gtk_about_dialog_set_comments(dialog, info ); | |
| 576 | 579 | |
| 577 | 580 | gtk_about_dialog_set_license(dialog, gettext( license ) ); |
| 578 | 581 | gtk_about_dialog_set_wrap_license(dialog,TRUE); |
| ... | ... | @@ -586,4 +589,6 @@ |
| 586 | 589 | gtk_widget_show_all(GTK_WIDGET(dialog)); |
| 587 | 590 | gtk_dialog_run(GTK_DIALOG(dialog)); |
| 588 | 591 | gtk_widget_destroy(GTK_WIDGET(dialog)); |
| 592 | + | |
| 593 | + g_free(info); | |
| 589 | 594 | } | ... | ... |
src/pw3270/main.c
| ... | ... | @@ -196,7 +196,6 @@ int main(int argc, char *argv[]) |
| 196 | 196 | GOptionContext * options = g_option_context_new (_("- 3270 Emulator for Gtk")); |
| 197 | 197 | GError * error = NULL; |
| 198 | 198 | |
| 199 | - | |
| 200 | 199 | g_option_context_add_main_entries(options, app_options, NULL); |
| 201 | 200 | |
| 202 | 201 | if(!g_option_context_parse( options, &argc, &argv, &error )) |
| ... | ... | @@ -228,6 +227,36 @@ int main(int argc, char *argv[]) |
| 228 | 227 | } |
| 229 | 228 | } |
| 230 | 229 | |
| 230 | + { | |
| 231 | + const gchar *msg = gtk_check_version(GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); | |
| 232 | + | |
| 233 | + if(msg) | |
| 234 | + { | |
| 235 | + // Invalid GTK version, notify user and exit | |
| 236 | + int rc; | |
| 237 | + GtkWidget * dialog = gtk_message_dialog_new( NULL, | |
| 238 | + GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 239 | + GTK_MESSAGE_WARNING, | |
| 240 | + GTK_BUTTONS_OK_CANCEL, | |
| 241 | + _( "This program requires GTK version %d.%d.%d" ),GTK_MAJOR_VERSION,GTK_MINOR_VERSION,GTK_MICRO_VERSION ); | |
| 242 | + | |
| 243 | + | |
| 244 | + gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),"%s",msg); | |
| 245 | + gtk_window_set_title(GTK_WINDOW(dialog),_( "GTK Version mismatch" )); | |
| 246 | + | |
| 247 | +#if GTK_CHECK_VERSION(2,10,0) | |
| 248 | + gtk_window_set_deletable(GTK_WINDOW(dialog),FALSE); | |
| 249 | +#endif | |
| 250 | + | |
| 251 | + rc = gtk_dialog_run(GTK_DIALOG (dialog)); | |
| 252 | + gtk_widget_destroy(dialog); | |
| 253 | + | |
| 254 | + if(rc != GTK_RESPONSE_OK) | |
| 255 | + return EINVAL; | |
| 256 | + } | |
| 257 | + | |
| 258 | + } | |
| 259 | + | |
| 231 | 260 | #if defined(WIN32) |
| 232 | 261 | g_set_application_name(appname); |
| 233 | 262 | #endif // WIN32 | ... | ... |