Commit 4984a67fc1f5fbe75edf55f83138ad18d8dcbcb3

Authored by Perry Werneck
1 parent 7b2c2b03

Fixing toolbar actions list.

pw3270.cbp
... ... @@ -143,7 +143,7 @@
143 143 <Unit filename="src/objects/window/actions/hostproperties.c">
144 144 <Option compilerVar="CC" />
145 145 </Unit>
146   - <Unit filename="src/objects/window/actions/open.c">
  146 + <Unit filename="src/objects/window/actions/print.c">
147 147 <Option compilerVar="CC" />
148 148 </Unit>
149 149 <Unit filename="src/objects/window/actions/sessionproperties.c">
... ...
src/objects/actions/lib3270/action.c
... ... @@ -77,6 +77,7 @@
77 77 }
78 78  
79 79 static const gchar * get_icon_name(GAction *action) {
  80 + debug("%s(%s)=\"%s\"",__FUNCTION__,g_action_get_name(action),PW3270_LIB3270_ACTION(action)->definition->icon);
80 81 return PW3270_LIB3270_ACTION(action)->definition->icon;
81 82 }
82 83  
... ...
src/objects/actions/print.c
... ... @@ -36,7 +36,7 @@
36 36 #include <v3270.h>
37 37 #include <pw3270/application.h>
38 38  
39   - static void activate_print_screen(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
  39 + static void activate_print_all(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
40 40 debug("%s",__FUNCTION__);
41 41 v3270_print_all(terminal,NULL);
42 42 }
... ... @@ -46,15 +46,16 @@
46 46 v3270_print_selected(terminal,NULL);
47 47 }
48 48  
49   - void pw3270_application_print_copy_activated(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
  49 + static void activate_print(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
50 50  
51 51 debug("%s",__FUNCTION__);
52   - v3270_print_copy(terminal,NULL);
  52 +
53 53 }
54 54  
55   - static void activate_print(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
  55 + void pw3270_application_print_copy_activated(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
56 56  
57 57 debug("%s",__FUNCTION__);
  58 + v3270_print_copy(terminal,NULL);
58 59  
59 60 }
60 61  
... ... @@ -63,25 +64,27 @@
63 64 pw3270SimpleAction * action = pw3270_simple_action_new();
64 65  
65 66 action->parent.activate = activate_print;
66   - action->parent.types.parameter = G_VARIANT_TYPE_STRING;
  67 +// action->parent.types.parameter = G_VARIANT_TYPE_STRING;
67 68  
68 69 action->group.id = LIB3270_ACTION_GROUP_ONLINE;
69 70 action->parent.name = "print";
70   - action->label = N_( "Print" );
71   - action->tooltip = N_( "Print terminal contents." );
  71 + action->label = N_( "Print" );
  72 + action->icon_name = "printer";
  73 + action->tooltip = N_( "Print terminal contents or selected area." );
72 74  
73 75 return G_ACTION(action);
74 76  
75 77 }
76 78  
77   - GAction * pw3270_action_print_screen_new(void) {
  79 + GAction * pw3270_action_print_all_new(void) {
78 80  
79 81 pw3270SimpleAction * action = pw3270_simple_action_new();
80 82  
81   - action->parent.activate = activate_print_screen;
  83 + action->parent.activate = activate_print_all;
82 84  
83 85 action->group.id = LIB3270_ACTION_GROUP_ONLINE;
84 86 action->parent.name = "print.screen";
  87 + action->icon_name = "printer";
85 88 action->label = N_( "Print screen" );
86 89  
87 90 return G_ACTION(action);
... ... @@ -96,6 +99,7 @@
96 99  
97 100 action->group.id = LIB3270_ACTION_GROUP_SELECTION;
98 101 action->parent.name = "print.selected";
  102 + action->icon_name = "printer";
99 103 action->label = N_( "Print selected" );
100 104  
101 105 return G_ACTION(action);
... ...
src/objects/actions/private.h
... ... @@ -69,11 +69,9 @@
69 69 G_GNUC_INTERNAL GAction * pw3270_action_save_new(void);
70 70 G_GNUC_INTERNAL GAction * pw3270_action_save_screen_new(void);
71 71 G_GNUC_INTERNAL GAction * pw3270_action_save_selected_new(void);
72   - G_GNUC_INTERNAL GAction * pw3270_action_save_copy_new(GtkWidget *widget);
73 72  
74 73 G_GNUC_INTERNAL GAction * pw3270_action_print_new(void);
75   - G_GNUC_INTERNAL GAction * pw3270_action_print_screen_new(void);
  74 + G_GNUC_INTERNAL GAction * pw3270_action_print_all_new(void);
76 75 G_GNUC_INTERNAL GAction * pw3270_action_print_selected_new(void);
77   - G_GNUC_INTERNAL GAction * pw3270_action_print_copy_new(GtkWidget *widget);
78 76  
79 77 #endif // PRIVATE_H_INCLUDED
... ...
src/objects/actions/view.c
... ... @@ -224,19 +224,19 @@
224 224 if(!action)
225 225 return list;
226 226  
227   - if(!g_object_class_find_property(G_OBJECT_GET_CLASS(action),"label"))
  227 + if(!g_object_class_find_property(G_OBJECT_GET_CLASS(action),"label")) {
  228 + debug("Action \"%s\": Doesn't have a label",g_action_get_name(action));
228 229 return list;
  230 + }
229 231  
230   - GParamSpec *spec = g_object_class_find_property(G_OBJECT_GET_CLASS(action),"toolbar-icon");
231   - if(!spec)
  232 + GdkPixbuf * pixbuf = g_action_get_pixbuf(action, GTK_ICON_SIZE_MENU);
  233 + if(!pixbuf) {
  234 + debug("Action \"%s\": Doesn't have a pixbuf",g_action_get_name(action));
232 235 return list;
  236 + }
233 237  
234 238 const gchar *name = g_action_get_name(action);
235 239  
236   - GdkPixbuf * pixbuf = g_action_get_pixbuf(action, GTK_ICON_SIZE_MENU);
237   - if(!pixbuf)
238   - return list;
239   -
240 240 struct ListElement * element = (struct ListElement *) g_malloc0(sizeof(struct ListElement) + strlen(type) + strlen(name));
241 241  
242 242 strcpy(element->name,type);
... ...
src/objects/actions/window.c
... ... @@ -77,13 +77,14 @@
77 77 // pw3270_action_save_screen_new(),
78 78 // pw3270_action_save_selected_new(),
79 79  
80   - pw3270_action_print_screen_new(),
  80 + pw3270_action_print_new(),
  81 + pw3270_action_print_all_new(),
81 82 pw3270_action_print_selected_new(),
82 83  
83 84 };
84 85  
85 86 for(ix = 0; ix < G_N_ELEMENTS(actions); ix++) {
86   - debug("Creating action %u (%s)", (unsigned int) ix, g_action_get_name(actions[ix]));
  87 + debug("Creating action %u (names=%s ptype=%s)", (unsigned int) ix, g_action_get_name(actions[ix]), (const char *) g_action_get_parameter_type(actions[ix]));
87 88 g_action_map_add_action(map,actions[ix]);
88 89 }
89 90 }
... ...
src/objects/application/application.c
... ... @@ -328,6 +328,7 @@
328 328 {
329 329 .label = N_("Print copy"),
330 330 .action_name = "print.copy",
  331 + .icon_name = "printer",
331 332 .property_name = "has_copy",
332 333 .activate = pw3270_application_print_copy_activated
333 334 }
... ...
src/objects/window/header.c
... ... @@ -58,8 +58,10 @@
58 58 elements = g_strsplit(header_blocks[0],",",-1);
59 59 for(ix=0;elements[ix];ix++) {
60 60 button = pw3270_header_button_new_from_builder(GTK_WIDGET(window),builder,elements[ix]);
61   - g_object_set_data(G_OBJECT(button),"header-position-id",GINT_TO_POINTER(0));
62   - gtk_header_bar_pack_start(GTK_HEADER_BAR(header), button);
  61 + if(button) {
  62 + g_object_set_data(G_OBJECT(button),"header-position-id",GINT_TO_POINTER(0));
  63 + gtk_header_bar_pack_start(GTK_HEADER_BAR(header), button);
  64 + }
63 65 }
64 66 g_strfreev(elements);
65 67  
... ... @@ -67,8 +69,10 @@
67 69 elements = g_strsplit(header_blocks[1],",",-1);
68 70 for(ix=0;elements[ix];ix++) {
69 71 button = pw3270_header_button_new_from_builder(GTK_WIDGET(window),builder,elements[ix]);
70   - g_object_set_data(G_OBJECT(button),"header-position-id",GINT_TO_POINTER(1));
71   - gtk_header_bar_pack_end(GTK_HEADER_BAR(header), button);
  72 + if(button) {
  73 + g_object_set_data(G_OBJECT(button),"header-position-id",GINT_TO_POINTER(1));
  74 + gtk_header_bar_pack_end(GTK_HEADER_BAR(header), button);
  75 + }
72 76 }
73 77 g_strfreev(elements);
74 78  
... ... @@ -122,6 +126,10 @@
122 126 gtk_widget_set_can_default(button,FALSE);
123 127 gtk_widget_set_name(button,action_name);
124 128  
  129 + } else {
  130 +
  131 + g_warning("Can't create button for action \"%s\"",action_name);
  132 +
125 133 }
126 134  
127 135 return button;
... ...
src/objects/window/window.c
... ... @@ -148,10 +148,13 @@
148 148  
149 149 GAction * actions[] = {
150 150 pw3270_action_host_properties_new(),
151   - pw3270_set_color_action_new(),
152 151 pw3270_action_session_properties_new(),
  152 + pw3270_set_color_action_new(),
  153 +
153 154 pw3270_file_transfer_action_new(),
  155 +
154 156 pw3270_action_window_close_new(),
  157 +
155 158 };
156 159  
157 160 for(ix = 0; ix < G_N_ELEMENTS(actions); ix++) {
... ...