Commit 5efbc8cb51eb427aa7fc88550cf71a786b6914ac

Authored by Perry Werneck
1 parent 51bb9a8a
Exists in master and in 1 other branch develop

Fixing CodeQL warnings.

src/include/pw3270/toolbar.h
... ... @@ -57,7 +57,6 @@ GType pw3270ToolBar_get_type(void) G_GNUC_CONST;
57 57 GtkWidget * pw3270_toolbar_new(void);
58 58 GtkWidget * pw3270_toolbar_settings_new(void);
59 59  
60   -// GtkWidget * pw3270_toolbar_insert_lib3270_action(GtkWidget *toolbar, const LIB3270_ACTION *action, gint pos);
61 60 GtkWidget * pw3270_toolbar_insert_action(GtkWidget *toolbar, const gchar *name, gint pos);
62 61  
63 62 void pw3270_toolbar_set_actions(GtkWidget *toolbar, const gchar *action_names);
... ...
src/main/builder.c
... ... @@ -21,29 +21,6 @@
21 21 #include <pw3270/application.h>
22 22 #include <pw3270/keypad.h>
23 23  
24   - /*
25   - static GMenu * keypad_menu_new(GApplication *application) {
26   -
27   - GList * keypads = pw3270_application_get_keypad_models(application);
28   -
29   - if(!keypads)
30   - return NULL;
31   -
32   - GMenu * menu = g_menu_new();
33   -
34   - // Create keypad items.
35   - GList *item;
36   - for(item = keypads; item; item = g_list_next(item)) {
37   - GObject * model = G_OBJECT(item->data);
38   - g_autofree gchar * action_name = g_strconcat("win.keypad.",pw3270_keypad_model_get_name(model),NULL);
39   - g_menu_append(menu,pw3270_keypad_model_get_label(model),action_name);
40   - }
41   -
42   - return menu;
43   -
44   - }
45   - */
46   -
47 24 GtkBuilder * pw3270_application_builder_new(GApplication *application) {
48 25  
49 26 #if !defined(DEBUG)
... ...
src/objects/actions/abstract.c
... ... @@ -165,10 +165,7 @@ void PW3270Action_init(PW3270Action *action) {
165 165 }
166 166  
167 167 void finalize(GObject *object) {
168   -
169   - // PW3270Action * action = PW3270_ACTION(object);
170 168 G_OBJECT_CLASS(PW3270Action_parent_class)->finalize(object);
171   -
172 169 }
173 170  
174 171 void get_property(GObject *object, guint prop_id, GValue *value, GParamSpec G_GNUC_UNUSED(*pspec)) {
... ... @@ -215,7 +212,6 @@ void get_property(GObject *object, guint prop_id, GValue *value, GParamSpec G_GN
215 212 }
216 213  
217 214 void set_property(GObject G_GNUC_UNUSED(*object), guint G_GNUC_UNUSED(prop_id), const GValue G_GNUC_UNUSED(*value), GParamSpec G_GNUC_UNUSED(*pspec)) {
218   -// g_message("Action %s property %s is read-only",g_action_get_name(G_ACTION(object)),pspec->name);
219 215 }
220 216  
221 217 static gboolean bg_notify_enabled(GObject *action) {
... ...
src/objects/actions/simple.c
... ... @@ -35,145 +35,3 @@
35 35 #include "private.h"
36 36 #include <v3270.h>
37 37  
38   -/*
39   -static void pw3270SimpleAction_class_init(pw3270SimpleActionClass *klass);
40   -static void pw3270SimpleAction_init(pw3270SimpleAction *action);
41   -static void change_widget(GAction *object, GtkWidget *from, GtkWidget *to);
42   -
43   -G_DEFINE_TYPE(pw3270SimpleAction, pw3270SimpleAction, PW3270_TYPE_ACTION);
44   -
45   -static void activate(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget G_GNUC_UNUSED(*terminal)) {
46   -debug("%s",__FUNCTION__);
47   -}
48   -
49   -static gboolean get_enabled(GAction *action, GtkWidget *terminal) {
50   -
51   - if(terminal) {
52   - return lib3270_action_group_get_activatable(v3270_get_session(terminal),PW3270_SIMPLE_ACTION(action)->group.id);
53   - }
54   -
55   - return FALSE;
56   -}
57   -
58   -static const gchar * get_icon_name(GAction *action) {
59   -return PW3270_SIMPLE_ACTION(action)->icon_name;
60   -}
61   -
62   -static const gchar * get_label(GAction *action) {
63   -return PW3270_SIMPLE_ACTION(action)->label;
64   -}
65   -
66   -static const gchar * get_tooltip(GAction *action) {
67   -return PW3270_SIMPLE_ACTION(action)->tooltip;
68   -}
69   -
70   -static void dispose(GObject *object) {
71   -
72   -pw3270SimpleAction *action = PW3270_SIMPLE_ACTION(object);
73   -
74   -if(action->group.listener) {
75   - lib3270_unregister_action_group_listener(pw3270_action_get_session(G_ACTION(object)),action->group.id,action->group.listener);
76   - action->group.listener = NULL;
77   -}
78   -
79   -G_OBJECT_CLASS(pw3270SimpleAction_parent_class)->dispose(object);
80   -}
81   -
82   -static void pw3270SimpleAction_class_init(pw3270SimpleActionClass *klass) {
83   -
84   - klass->parent_class.get_icon_name = get_icon_name;
85   - klass->parent_class.get_label = get_label;
86   - klass->parent_class.get_tooltip = get_tooltip;
87   - klass->parent_class.get_enabled = get_enabled;
88   -klass->parent_class.change_widget = change_widget;
89   -
90   -G_OBJECT_CLASS(klass)->dispose = dispose;
91   -
92   -}
93   -
94   -static void pw3270SimpleAction_init(pw3270SimpleAction *action) {
95   -
96   -action->icon_name = NULL;
97   -action->label = N_( "No label" );
98   -action->tooltip = NULL;
99   -
100   -action->group.id = LIB3270_ACTION_GROUP_NONE;
101   -action->group.listener = NULL;
102   -
103   -}
104   -
105   -void pw3270_simple_action_set_lib3270_property(pw3270SimpleAction *action, const LIB3270_PROPERTY * property) {
106   -
107   -if(property) {
108   - action->parent.name = property->name;
109   - action->tooltip = property->summary ? property->summary : property->description;
110   - action->group.id = property->group;
111   -}
112   -
113   -}
114   -
115   -pw3270SimpleAction * pw3270_simple_action_new_from_lib3270(const LIB3270_ACTION * definition, const gchar *name) {
116   -
117   -if(!definition)
118   - return NULL;
119   -
120   -debug("%s(%s,%s)",__FUNCTION__,definition->name,name);
121   -
122   - pw3270SimpleAction * action = (pw3270SimpleAction *) g_object_new(PW3270_TYPE_SIMPLE_ACTION, NULL);
123   -
124   - pw3270_simple_action_set_lib3270_property(action, (const LIB3270_PROPERTY *) definition);
125   -
126   - action->parent.name = name ? name : definition->name;
127   -action->icon_name = definition->icon;
128   -action->label = definition->label;
129   -action->activate = activate;
130   -
131   -return action;
132   -
133   -}
134   -
135   -
136   -pw3270SimpleAction * pw3270_simple_action_new_from_name(const gchar *source_name, const gchar *name) {
137   -return pw3270_simple_action_new_from_lib3270(lib3270_action_get_by_name(source_name),name);
138   -}
139   -
140   -pw3270SimpleAction * pw3270_simple_action_new() {
141   - return (pw3270SimpleAction *) g_object_new(PW3270_TYPE_SIMPLE_ACTION, NULL);
142   -}
143   -
144   -static gboolean bg_notify_enabled(GAction *action) {
145   - pw3270_action_notify_enabled(action);
146   -return FALSE;
147   -}
148   -
149   -static void event_listener(H3270 G_GNUC_UNUSED(*hSession), void *object) {
150   -g_idle_add((GSourceFunc) bg_notify_enabled, G_ACTION(object));
151   -}
152   -
153   -void change_widget(GAction *object, GtkWidget *from, GtkWidget *to) {
154   -
155   -// Remove old listener
156   -pw3270SimpleAction * action = PW3270_SIMPLE_ACTION(object);
157   -
158   -if(action->group.listener) {
159   - lib3270_unregister_action_group_listener(pw3270_action_get_session(object),action->group.id,action->group.listener);
160   - action->group.listener = NULL;
161   -}
162   -
163   -// Get the current "enabled" state
164   -gboolean enabled = g_action_get_enabled(object);
165   -
166   -// Change widget
167   -PW3270_ACTION_CLASS(pw3270SimpleAction_parent_class)->change_widget(object,from,to);
168   -
169   -// Setup new listener
170   -if(action->group.id != LIB3270_ACTION_GROUP_NONE && to) {
171   - action->group.listener = lib3270_register_action_group_listener(pw3270_action_get_session(object),action->group.id,event_listener,object);
172   -}
173   -
174   -// Does the "enabled" state has changed? If yes notify customers.
175   -if(g_action_get_enabled(object) != enabled)
176   - pw3270_action_notify_enabled(object);
177   -
178   -}
179   -*/
... ...
src/objects/actions/view.c
... ... @@ -45,7 +45,6 @@ enum {
45 45 };
46 46  
47 47 struct ListElement {
48   -// GAction * action;
49 48 GdkPixbuf * pixbuf;
50 49 gchar * action_name;
51 50 gchar * action_label;
... ...
src/objects/application/actions/about.c
... ... @@ -60,21 +60,6 @@ static GtkWidget * factory(PW3270Action G_GNUC_UNUSED(*action), GtkApplication *
60 60 G_STRINGIFY(PACKAGE_NAME) ".png",
61 61 };
62 62  
63   - /*
64   -#ifdef DEBUG
65   - static const char * logo = "./branding/" G_STRINGIFY(PRODUCT_NAME) "-logo.svg";
66   - static const char * icon = "./branding/" G_STRINGIFY(PRODUCT_NAME) ".svg";
67   -#else
68   - lib3270_autoptr(char) logo = lib3270_build_data_filename(G_STRINGIFY(PRODUCT_NAME) "-logo.svg",NULL);
69   - lib3270_autoptr(char) icon = lib3270_build_data_filename("icons", G_STRINGIFY(PRODUCT_NAME) ".svg",NULL);
70   -#endif // DEBUG
71   -
72   - const char * imgs[] = {
73   - logo,
74   - icon
75   - };
76   - */
77   -
78 63 size_t ix;
79 64  
80 65 for(ix = 0; ix < G_N_ELEMENTS(names); ix++) {
... ...
src/objects/window/header.c
... ... @@ -82,7 +82,7 @@ void pw3270_window_set_header_action_names(GtkWidget *window, const gchar *actio
82 82 }
83 83 g_strfreev(elements);
84 84  
85   - // And then, the right side actions;
  85 + // And then, the right side actions
86 86 elements = g_strsplit(header_blocks[1],",",-1);
87 87 for(ix=0; elements[ix]; ix++) {
88 88 button = pw3270_header_button_new_from_builder(GTK_WIDGET(window),builder,elements[ix]);
... ...
src/objects/window/window.c
... ... @@ -184,34 +184,6 @@ static void pw3270ApplicationWindow_class_init(pw3270ApplicationWindowClass *kla
184 184 }
185 185 #endif // DEBUG
186 186  
187   - /*
188   - {
189   - gtk_icon_theme_append_search_path(
190   - gtk_icon_theme_get_default(),
191   - "./icons"
192   - );
193   -
194   - gchar **paths = NULL;
195   - gint n_paths = 0;
196   -
197   - gtk_icon_theme_get_search_path (
198   - gtk_icon_theme_get_default(),
199   - &paths,
200   - &n_paths
201   - );
202   -
203   - gint p;
204   - for(p = 0; p < n_paths;p++) {
205   - printf("**** [%s]\n",paths[p]);
206   - }
207   -
208   - }
209   -#else
210   - {
211   - }
212   -#endif // DEBUG
213   - */
214   -
215 187 {
216 188 GtkWidgetClass *widget = GTK_WIDGET_CLASS(klass);
217 189 widget->destroy = destroy;
... ... @@ -749,8 +721,6 @@ GtkWidget * pw3270_application_window_new(GtkApplication * application, const gc
749 721  
750 722 pw3270_application_window_set_active_terminal(GTK_WIDGET(window),terminal);
751 723  
752   - // gtk_window_set_interactive_debugging(TRUE);
753   -
754 724 return GTK_WIDGET(window);
755 725  
756 726 }
... ...