Commit 122c9194c79f5683fdb605da277179b5d4ca2c21
1 parent
3aad3a3c
Exists in
master
and in
5 other branches
Função pastenext não estava sendo habilitada devido à erro de cast no objeto GtkAction.
Showing
1 changed file
with
12 additions
and
18 deletions
Show diff stats
src/pw3270/window.c
... | ... | @@ -416,13 +416,17 @@ |
416 | 416 | gtk_menu_item_set_submenu(GTK_MENU_ITEM(widget),menu); |
417 | 417 | } |
418 | 418 | |
419 | + static void setSensitive(GtkAction *action, gboolean on) | |
420 | + { | |
421 | + if(action) | |
422 | + { | |
423 | + gtk_action_set_sensitive(action,on); | |
424 | + } | |
425 | + } | |
426 | + | |
419 | 427 | static void pastenext(GtkWidget *widget, gboolean on, GtkAction **action) |
420 | 428 | { |
421 | -#if GTK_CHECK_VERSION(3,10,0) | |
422 | - g_simple_action_set_enabled(G_SIMPLE_ACTION(action[ACTION_PASTENEXT]),on); | |
423 | -#else | |
424 | - gtk_action_set_sensitive(action[ACTION_PASTENEXT],on); | |
425 | -#endif // GTK(3,10) | |
429 | + setSensitive(action[ACTION_PASTENEXT],on); | |
426 | 430 | } |
427 | 431 | |
428 | 432 | static void disconnected(GtkWidget *terminal, GtkWidget * window) |
... | ... | @@ -481,15 +485,7 @@ |
481 | 485 | { |
482 | 486 | GtkAction **action = (GtkAction **) g_object_get_data(G_OBJECT(widget),"named_actions"); |
483 | 487 | gtk_action_group_set_sensitive(group[ACTION_GROUP_SELECTION],on); |
484 | - | |
485 | -#if GTK_CHECK_VERSION(3,10,0) | |
486 | - if(action[ACTION_RESELECT]) | |
487 | - g_simple_action_set_enabled(G_SIMPLE_ACTION(action[ACTION_RESELECT]),!on); | |
488 | -#else | |
489 | - if(action[ACTION_RESELECT]) | |
490 | - gtk_action_set_sensitive(action[ACTION_RESELECT],!on); | |
491 | -#endif // GTK(3,10) | |
492 | - | |
488 | + setSensitive(action[ACTION_RESELECT],!on); | |
493 | 489 | } |
494 | 490 | |
495 | 491 | static gboolean popup_menu(GtkWidget *widget, gboolean selected, gboolean online, GdkEventButton *event, GtkWidget **popup) |
... | ... | @@ -651,13 +647,11 @@ |
651 | 647 | |
652 | 648 | if(action[ACTION_PASTENEXT]) |
653 | 649 | { |
654 | - gtk_action_set_sensitive(action[ACTION_PASTENEXT],FALSE); | |
650 | + setSensitive(action[ACTION_PASTENEXT],FALSE); | |
655 | 651 | g_signal_connect(widget->terminal,"pastenext",G_CALLBACK(pastenext),action); |
656 | 652 | } |
657 | 653 | |
658 | - if(action[ACTION_RESELECT]) | |
659 | - gtk_action_set_sensitive(action[ACTION_RESELECT],FALSE); | |
660 | - | |
654 | + setSensitive(action[ACTION_RESELECT],FALSE); | |
661 | 655 | |
662 | 656 | // Connect action signals |
663 | 657 | g_signal_connect(widget->terminal,"disconnected",G_CALLBACK(disconnected),widget); | ... | ... |