Commit 9d4b500e8142e07c94c9be0a219325bdfb9eef72

Authored by Perry Werneck
1 parent 6308992c

Implementing save/print copy.

src/include/pw3270/application.h
@@ -71,6 +71,11 @@ @@ -71,6 +71,11 @@
71 71
72 gboolean pw3270_settings_set_int(const gchar *key, gint value); 72 gboolean pw3270_settings_set_int(const gchar *key, gint value);
73 73
  74 +
  75 + // Actions
  76 + void pw3270_application_print_copy_activated(GAction *action, GVariant *parameter, GtkWidget *terminal);
  77 + void pw3270_application_save_copy_activated(GAction *action, GVariant *parameter, GtkWidget *terminal);
  78 +
74 G_END_DECLS 79 G_END_DECLS
75 80
76 81
src/objects/actions/abstract.c
@@ -396,6 +396,7 @@ @@ -396,6 +396,7 @@
396 } 396 }
397 397
398 void internal_activate(GAction *action, GVariant G_GNUC_UNUSED(*parameter), GtkWidget G_GNUC_UNUSED(*terminal)) { 398 void internal_activate(GAction *action, GVariant G_GNUC_UNUSED(*parameter), GtkWidget G_GNUC_UNUSED(*terminal)) {
  399 + debug("%s",__FUNCTION__);
399 g_message("Action %s can't be activated",pw3270_action_get_name(action)); 400 g_message("Action %s can't be activated",pw3270_action_get_name(action));
400 } 401 }
401 402
src/objects/actions/print.c
@@ -34,23 +34,22 @@ @@ -34,23 +34,22 @@
34 34
35 #include "private.h" 35 #include "private.h"
36 #include <v3270.h> 36 #include <v3270.h>
  37 + #include <pw3270/application.h>
37 38
38 static void activate_print_screen(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { 39 static void activate_print_screen(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
39 -  
40 debug("%s",__FUNCTION__); 40 debug("%s",__FUNCTION__);
41 - 41 + v3270_print_all(terminal,NULL);
42 } 42 }
43 43
44 static void activate_print_selected(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { 44 static void activate_print_selected(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
45 -  
46 debug("%s",__FUNCTION__); 45 debug("%s",__FUNCTION__);
47 - 46 + v3270_print_selected(terminal,NULL);
48 } 47 }
49 48
50 - static void activate_print_copy(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { 49 + void pw3270_application_print_copy_activated(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
51 50
52 debug("%s",__FUNCTION__); 51 debug("%s",__FUNCTION__);
53 - 52 + v3270_print_copy(terminal,NULL);
54 } 53 }
55 54
56 static void activate_print(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { 55 static void activate_print(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
src/objects/actions/save.c
@@ -34,23 +34,21 @@ @@ -34,23 +34,21 @@
34 34
35 #include "private.h" 35 #include "private.h"
36 #include <v3270.h> 36 #include <v3270.h>
  37 + #include <pw3270/application.h>
37 38
38 static void activate_save_screen(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { 39 static void activate_save_screen(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
39 -  
40 debug("%s",__FUNCTION__); 40 debug("%s",__FUNCTION__);
41 - 41 + v3270_save_all(terminal,NULL,NULL);
42 } 42 }
43 43
44 static void activate_save_selected(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { 44 static void activate_save_selected(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
45 -  
46 debug("%s",__FUNCTION__); 45 debug("%s",__FUNCTION__);
47 - 46 + v3270_save_selected(terminal,NULL,NULL);
48 } 47 }
49 48
50 - static void activate_save_copy(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {  
51 - 49 + void pw3270_application_save_copy_activated(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
52 debug("%s",__FUNCTION__); 50 debug("%s",__FUNCTION__);
53 - 51 + v3270_save_copy(terminal,NULL,NULL);
54 } 52 }
55 53
56 static void activate_save(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { 54 static void activate_save(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
src/objects/application/application.c
@@ -305,16 +305,19 @@ @@ -305,16 +305,19 @@
305 const gchar * tooltip; 305 const gchar * tooltip;
306 const gchar * action_name; 306 const gchar * action_name;
307 const gchar * property_name; 307 const gchar * property_name;
  308 + void (*activate)(GAction *action, GVariant *parameter, GtkWidget *terminal);
308 } conditional_actions[] = { 309 } conditional_actions[] = {
309 { 310 {
310 .label = N_("Save copy"), 311 .label = N_("Save copy"),
311 .action_name = "save_copy", 312 .action_name = "save_copy",
312 - .property_name = "has_copy" 313 + .property_name = "has_copy",
  314 + .activate = pw3270_application_save_copy_activated
313 }, 315 },
314 { 316 {
315 .label = N_("Print copy"), 317 .label = N_("Print copy"),
316 .action_name = "print_copy", 318 .action_name = "print_copy",
317 - .property_name = "has_copy" 319 + .property_name = "has_copy",
  320 + .activate = pw3270_application_print_copy_activated
318 } 321 }
319 }; 322 };
320 323
@@ -325,6 +328,7 @@ @@ -325,6 +328,7 @@
325 action->parent.name = conditional_actions[ix].action_name; 328 action->parent.name = conditional_actions[ix].action_name;
326 action->label = conditional_actions[ix].label; 329 action->label = conditional_actions[ix].label;
327 action->tooltip = conditional_actions[ix].tooltip; 330 action->tooltip = conditional_actions[ix].tooltip;
  331 + PW3270_ACTION(action)->activate = conditional_actions[ix].activate;
328 332
329 g_action_map_add_action( 333 g_action_map_add_action(
330 G_ACTION_MAP(window), 334 G_ACTION_MAP(window),
src/objects/window/actions/sethost.c
@@ -47,6 +47,7 @@ @@ -47,6 +47,7 @@
47 return G_ACTION(action); 47 return G_ACTION(action);
48 } 48 }
49 49
  50 + /*
50 static void on_response(GtkWidget *dialog, gint response_id, GtkWidget *settings) { 51 static void on_response(GtkWidget *dialog, gint response_id, GtkWidget *settings) {
51 52
52 if(response_id == GTK_RESPONSE_APPLY) { 53 if(response_id == GTK_RESPONSE_APPLY) {
@@ -65,6 +66,7 @@ @@ -65,6 +66,7 @@
65 gtk_widget_destroy(GTK_WIDGET(dialog)); 66 gtk_widget_destroy(GTK_WIDGET(dialog));
66 67
67 } 68 }
  69 + */
68 70
69 GtkWidget * factory(GtkWidget *terminal) { 71 GtkWidget * factory(GtkWidget *terminal) {
70 72