Commit 26de0ea4825abd4834ea717969db3b5f693fb587
1 parent
81d957a7
Exists in
master
and in
5 other branches
Ajustes para compilar em versão do GTK anterior à 3.10
Showing
4 changed files
with
105 additions
and
24 deletions
Show diff stats
src/pw3270/v3270ft/private.h
src/pw3270/v3270ft/set.c
... | ... | @@ -143,7 +143,11 @@ void v3270ft_set_options(GtkWidget *widget, LIB3270_FT_OPTION opt) { |
143 | 143 | |
144 | 144 | void v3270ftprogress_set_header(GtkWidget *widget, const gchar *status) { |
145 | 145 | |
146 | +#ifdef HAVE_GTK_HEADER_BAR | |
146 | 147 | gtk_header_bar_set_subtitle(GTK_HEADER_BAR(gtk_dialog_get_header_bar(GTK_DIALOG(widget))),status); |
148 | +#else | |
149 | + #warning aqui | |
150 | +#endif | |
147 | 151 | |
148 | 152 | } |
149 | 153 | ... | ... |
src/pw3270/v3270ft/v3270ft.c
... | ... | @@ -347,7 +347,7 @@ static void v3270ft_init(v3270ft *dialog) { |
347 | 347 | GtkTreeModel * model; |
348 | 348 | GtkCellRenderer * renderer; |
349 | 349 | GtkWidget * widget; |
350 | - GtkBox * box = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))); | |
350 | + GtkBox * box = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))); | |
351 | 351 | GtkWidget * entry[G_N_ELEMENTS(label)]; |
352 | 352 | |
353 | 353 | // Initialize |
... | ... | @@ -367,12 +367,46 @@ static void v3270ft_init(v3270ft *dialog) { |
367 | 367 | } action[FT_BUTTON_COUNT] = { |
368 | 368 | |
369 | 369 | { |
370 | + FT_BUTTON_LOAD_LIST, | |
371 | + TRUE, | |
372 | + "document-open", | |
373 | + N_("Get transfer queue from an external XML file"), | |
374 | + G_CALLBACK(load_file) | |
375 | + }, | |
376 | + | |
377 | + { | |
378 | + FT_BUTTON_SAVE_LIST, | |
379 | + TRUE, | |
380 | + "document-save", | |
381 | + N_("Save transfer queue to an external XML file"), | |
382 | + G_CALLBACK(save_file) | |
383 | + }, | |
384 | + | |
385 | + { | |
386 | + FT_BUTTON_INSERT_FILE, | |
387 | + TRUE, | |
388 | + "list-add", | |
389 | + N_("Insert new file in the transfer queue"), | |
390 | + G_CALLBACK(insert_file) | |
391 | + }, | |
392 | + | |
393 | + { | |
394 | + FT_BUTTON_REMOVE_FILE, | |
395 | + TRUE, | |
396 | + "list-remove", | |
397 | + N_("Remove selected file from the transfer queue"), | |
398 | + G_CALLBACK(remove_file) | |
399 | + }, | |
400 | + | |
401 | + { | |
370 | 402 | FT_BUTTON_START_TRANSFER, |
371 | 403 | FALSE, |
372 | 404 | "network-server", |
373 | 405 | N_("Start file transfer"), |
374 | 406 | G_CALLBACK(start_transfer) |
375 | 407 | }, |
408 | + | |
409 | +#if HAVE_GTK_HEADER_BAR | |
376 | 410 | { |
377 | 411 | FT_BUTTON_GO_LAST, |
378 | 412 | FALSE, |
... | ... | @@ -380,6 +414,7 @@ static void v3270ft_init(v3270ft *dialog) { |
380 | 414 | N_("Select last file"), |
381 | 415 | G_CALLBACK(select_last) |
382 | 416 | }, |
417 | + | |
383 | 418 | { |
384 | 419 | FT_BUTTON_GO_NEXT, |
385 | 420 | FALSE, |
... | ... | @@ -387,6 +422,7 @@ static void v3270ft_init(v3270ft *dialog) { |
387 | 422 | N_("Select next file"), |
388 | 423 | G_CALLBACK(select_next) |
389 | 424 | }, |
425 | + | |
390 | 426 | { |
391 | 427 | FT_BUTTON_GO_PREVIOUS, |
392 | 428 | FALSE, |
... | ... | @@ -394,6 +430,7 @@ static void v3270ft_init(v3270ft *dialog) { |
394 | 430 | N_("Select previous file"), |
395 | 431 | G_CALLBACK(select_previous) |
396 | 432 | }, |
433 | + | |
397 | 434 | { |
398 | 435 | FT_BUTTON_GO_FIRST, |
399 | 436 | FALSE, |
... | ... | @@ -402,38 +439,46 @@ static void v3270ft_init(v3270ft *dialog) { |
402 | 439 | G_CALLBACK(select_first) |
403 | 440 | }, |
404 | 441 | |
442 | +#else | |
405 | 443 | { |
406 | - FT_BUTTON_LOAD_LIST, | |
407 | - TRUE, | |
408 | - "document-open", | |
409 | - N_("Get transfer queue from an external XML file"), | |
410 | - G_CALLBACK(load_file) | |
444 | + FT_BUTTON_GO_FIRST, | |
445 | + FALSE, | |
446 | + "go-first", | |
447 | + N_("Select first file"), | |
448 | + G_CALLBACK(select_first) | |
411 | 449 | }, |
412 | 450 | |
413 | 451 | { |
414 | - FT_BUTTON_SAVE_LIST, | |
415 | - TRUE, | |
416 | - "document-save", | |
417 | - N_("Save transfer queue to an external XML file"), | |
418 | - G_CALLBACK(save_file) | |
452 | + FT_BUTTON_GO_PREVIOUS, | |
453 | + FALSE, | |
454 | + "go-previous", | |
455 | + N_("Select previous file"), | |
456 | + G_CALLBACK(select_previous) | |
419 | 457 | }, |
458 | + | |
420 | 459 | { |
421 | - FT_BUTTON_INSERT_FILE, | |
422 | - TRUE, | |
423 | - "list-add", | |
424 | - N_("Insert new file in the transfer queue"), | |
425 | - G_CALLBACK(insert_file) | |
460 | + FT_BUTTON_GO_NEXT, | |
461 | + FALSE, | |
462 | + "go-next", | |
463 | + N_("Select next file"), | |
464 | + G_CALLBACK(select_next) | |
426 | 465 | }, |
466 | + | |
427 | 467 | { |
428 | - FT_BUTTON_REMOVE_FILE, | |
429 | - TRUE, | |
430 | - "list-remove", | |
431 | - N_("Remove selected file from the transfer queue"), | |
432 | - G_CALLBACK(remove_file) | |
468 | + FT_BUTTON_GO_LAST, | |
469 | + FALSE, | |
470 | + "go-last", | |
471 | + N_("Select last file"), | |
472 | + G_CALLBACK(select_last) | |
433 | 473 | }, |
474 | + | |
475 | +#endif // HAVE_GTK_HEADER_BAR | |
476 | + | |
434 | 477 | }; |
435 | 478 | |
479 | +#if HAVE_GTK_HEADER_BAR | |
436 | 480 | widget = gtk_dialog_get_header_bar(GTK_DIALOG(dialog)); |
481 | + | |
437 | 482 | for(f=0;f<G_N_ELEMENTS(action);f++) { |
438 | 483 | |
439 | 484 | GtkWidget *button = gtk_button_new_from_icon_name(action[f].name,GTK_ICON_SIZE_BUTTON); |
... | ... | @@ -453,6 +498,30 @@ static void v3270ft_init(v3270ft *dialog) { |
453 | 498 | |
454 | 499 | } |
455 | 500 | |
501 | +#else | |
502 | + | |
503 | + widget = gtk_toolbar_new(); | |
504 | + gtk_toolbar_set_icon_size(GTK_TOOLBAR(widget),GTK_ICON_SIZE_SMALL_TOOLBAR); | |
505 | + | |
506 | + gtk_box_pack_start(box,GTK_WIDGET(widget),FALSE,FALSE,2); | |
507 | + | |
508 | + for(f=0;f<G_N_ELEMENTS(action);f++) { | |
509 | + | |
510 | + GtkWidget *button = GTK_WIDGET(gtk_tool_button_new(gtk_image_new_from_icon_name(action[f].name,GTK_ICON_SIZE_SMALL_TOOLBAR),NULL)); | |
511 | + | |
512 | + gtk_widget_set_tooltip_markup(button,gettext(action[f].tooltip)); | |
513 | + | |
514 | + gtk_toolbar_insert(GTK_TOOLBAR(widget),GTK_TOOL_ITEM(button),-1); | |
515 | + | |
516 | + g_signal_connect(button,"clicked",action[f].callback,dialog); | |
517 | + | |
518 | + dialog->button[action[f].id] = button; | |
519 | + gtk_widget_set_sensitive(button,FALSE); | |
520 | + | |
521 | + } | |
522 | + | |
523 | +#endif | |
524 | + | |
456 | 525 | gtk_widget_set_sensitive(dialog->button[FT_BUTTON_LOAD_LIST],TRUE); |
457 | 526 | gtk_widget_set_sensitive(dialog->button[FT_BUTTON_REMOVE_FILE],TRUE); |
458 | 527 | ... | ... |
src/pw3270/v3270ft/v3270ftprogress.c
... | ... | @@ -468,12 +468,16 @@ static void v3270ftprogress_init(v3270ftprogress *dialog) { |
468 | 468 | |
469 | 469 | |
470 | 470 | // Buttons |
471 | - frame = gtk_dialog_get_header_bar(GTK_DIALOG(dialog)); | |
472 | - | |
473 | - // https://developer.gnome.org/icon-naming-spec/ | |
474 | 471 | widget = gtk_button_new_with_label(_("Cancel")); |
475 | 472 | g_signal_connect(widget,"clicked",G_CALLBACK(cancel_clicked),dialog); |
473 | + | |
474 | +#ifdef HAVE_GTK_HEADER_BAR | |
475 | + frame = gtk_dialog_get_header_bar(GTK_DIALOG(dialog)); | |
476 | 476 | gtk_header_bar_pack_start(GTK_HEADER_BAR(frame),widget); |
477 | +#else | |
478 | + frame = gtk_dialog_get_action_area(GTK_DIALOG(dialog)); | |
479 | + gtk_box_pack_end(GTK_BOX(frame),widget,FALSE,TRUE,2); | |
480 | +#endif | |
477 | 481 | |
478 | 482 | } |
479 | 483 | ... | ... |