Commit 39bade990302a11283ced95ceed404367fe428c3

Authored by Perry Werneck
1 parent c82b99e3

Updating data directory detecction.

src/include/config.h.in
@@ -36,6 +36,9 @@ @@ -36,6 +36,9 @@
36 #undef PACKAGE_NAME 36 #undef PACKAGE_NAME
37 #undef PACKAGE_VERSION 37 #undef PACKAGE_VERSION
38 #undef PACKAGE_RELEASE 38 #undef PACKAGE_RELEASE
  39 + #undef PRODUCT_NAME
  40 + #undef PACKAGE_DESCRIPTION
  41 +
39 #undef DEFAULT_SESSION_NAME 42 #undef DEFAULT_SESSION_NAME
40 #undef APPLICATION_NAME 43 #undef APPLICATION_NAME
41 44
src/include/pw3270.h
@@ -62,7 +62,6 @@ @@ -62,7 +62,6 @@
62 62
63 LIB3270_EXPORT GtkWidget * pw3270_get_toplevel(void); 63 LIB3270_EXPORT GtkWidget * pw3270_get_toplevel(void);
64 64
65 - LIB3270_EXPORT gchar * pw3270_build_filename(GtkWidget *widget, const gchar *first_element, ...);  
66 LIB3270_EXPORT void pw3270_save_window_size(GtkWidget *widget, const gchar *name); 65 LIB3270_EXPORT void pw3270_save_window_size(GtkWidget *widget, const gchar *name);
67 LIB3270_EXPORT void pw3270_restore_window(GtkWidget *widget, const gchar *name); 66 LIB3270_EXPORT void pw3270_restore_window(GtkWidget *widget, const gchar *name);
68 67
src/include/pw3270/plugin.h
@@ -47,7 +47,7 @@ @@ -47,7 +47,7 @@
47 LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget *window, GtkWidget *terminal); 47 LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget *window, GtkWidget *terminal);
48 48
49 // plugins 49 // plugins
50 - LIB3270_EXPORT void pw3270_load_plugins(const gchar *path); 50 + LIB3270_EXPORT void pw3270_load_plugins(void);
51 LIB3270_EXPORT void pw3270_unload_plugins(void); 51 LIB3270_EXPORT void pw3270_unload_plugins(void);
52 52
53 LIB3270_EXPORT void pw3270_start_plugins(GtkWidget *widget); 53 LIB3270_EXPORT void pw3270_start_plugins(GtkWidget *widget);
src/pw3270/dialog.c
@@ -32,170 +32,11 @@ @@ -32,170 +32,11 @@
32 #include <config.h> 32 #include <config.h>
33 #include "private.h" 33 #include "private.h"
34 #include <v3270.h> 34 #include <v3270.h>
  35 + #include <lib3270.h>
35 #include <v3270/dialogs.h> 36 #include <v3270/dialogs.h>
36 37
37 - /*  
38 - #ifdef _WIN32  
39 - #include <gdk/gdkwin32.h>  
40 -  
41 - struct file {  
42 - OPENFILENAME ofn;  
43 - gboolean enabled;  
44 - char szName[260]; // buffer for file name  
45 - GtkFileChooserAction action;  
46 - BOOL ok;  
47 - };  
48 -  
49 -  
50 - #endif // _WIN32  
51 - */  
52 -  
53 - /*  
54 - #if defined(HAVE_LIBSSL)  
55 - #include <openssl/ssl.h>  
56 - #include <openssl/err.h>  
57 - #endif  
58 - */  
59 -  
60 -/*--[ Globals ]--------------------------------------------------------------------------------------*/  
61 -  
62 -/*  
63 - static const struct _charset  
64 - {  
65 - const gchar *name;  
66 - const gchar *description;  
67 - } charset[] =  
68 - {  
69 - // http://en.wikipedia.org/wiki/Character_encoding  
70 - { "UTF-8", N_( "UTF-8" ) },  
71 - { "ISO-8859-1", N_( "Western Europe (ISO 8859-1)" ) },  
72 - { "CP1252", N_( "Windows Western languages (CP1252)" ) },  
73 -  
74 - { NULL, NULL }  
75 - };  
76 -*/  
77 -  
78 /*--[ Implement ]------------------------------------------------------------------------------------*/ 38 /*--[ Implement ]------------------------------------------------------------------------------------*/
79 39
80 -/*  
81 - static void charset_changed(GtkComboBox *widget,gchar **encoding)  
82 - {  
83 - gchar *new_encoding = NULL;  
84 -  
85 -#if GTK_CHECK_VERSION(3,0,0)  
86 -  
87 - new_encoding = g_strdup(gtk_combo_box_get_active_id(GTK_COMBO_BOX(widget)));  
88 -  
89 -#else  
90 -  
91 - GValue value = { 0, };  
92 - GtkTreeIter iter;  
93 -  
94 - if(!gtk_combo_box_get_active_iter(widget,&iter))  
95 - return;  
96 -  
97 - gtk_tree_model_get_value(gtk_combo_box_get_model(widget),&iter,1,&value);  
98 - new_encoding = g_strdup(g_value_get_string(&value));  
99 -  
100 -#endif  
101 -  
102 - if(!new_encoding)  
103 - return;  
104 -  
105 - trace("%s: %s->%s",__FUNCTION__,*encoding,new_encoding);  
106 - if(*encoding)  
107 - g_free(*encoding);  
108 -  
109 - *encoding = new_encoding;  
110 - }  
111 -*/  
112 -  
113 - /*  
114 - static void add_option_menus(GtkWidget *widget, GtkAction *action, gchar **encoding)  
115 - {  
116 -#if GTK_CHECK_VERSION(3,0,0)  
117 - GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,6);  
118 -#else  
119 - GtkWidget *box = gtk_hbox_new(FALSE,6);  
120 -#endif // GTK(3,0,0)  
121 -  
122 - gchar *ptr = g_object_get_data(G_OBJECT(action),"charset");  
123 -  
124 - if(ptr)  
125 - {  
126 - *encoding = g_strdup(ptr);  
127 - }  
128 - else  
129 - {  
130 - // Add charset options  
131 - GtkWidget * label = gtk_label_new_with_mnemonic (_("C_haracter Coding:"));  
132 - const gchar * scharset = NULL;  
133 -#if GTK_CHECK_VERSION(3,0,0)  
134 - GtkWidget * menu = gtk_combo_box_text_new();  
135 -#else  
136 - GtkTreeModel * model = (GtkTreeModel *) gtk_list_store_new(2,G_TYPE_STRING,G_TYPE_STRING);  
137 - GtkWidget * menu = gtk_combo_box_new_with_model(model);  
138 - GtkCellRenderer * renderer = gtk_cell_renderer_text_new();  
139 - GtkTreeIter iter;  
140 -#endif // GTK(3,0,0)  
141 - gchar * text;  
142 - int f;  
143 - int p = 0;  
144 -  
145 - g_get_charset(&scharset);  
146 - *encoding = g_strdup(scharset);  
147 -  
148 - text = g_strdup_printf(_("Current (%s)"),scharset);  
149 -  
150 -#if GTK_CHECK_VERSION(3,0,0)  
151 -  
152 - gtk_combo_box_text_insert(GTK_COMBO_BOX_TEXT(menu),p,scharset,text);  
153 -  
154 -#else  
155 -  
156 - gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(menu), renderer, TRUE);  
157 - gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(menu), renderer, "text", 0, NULL);  
158 -  
159 - gtk_list_store_append((GtkListStore *) model,&iter);  
160 - gtk_list_store_set((GtkListStore *) model, &iter, 0, text, 1, scharset, -1);  
161 -  
162 -#endif // GTK(3,0,0)  
163 -  
164 - g_free(text);  
165 -  
166 - gtk_combo_box_set_active(GTK_COMBO_BOX(menu),p++);  
167 -  
168 - for(f=0;charset[f].name;f++)  
169 - {  
170 - if(strcasecmp(scharset,charset[f].name))  
171 - {  
172 -#if GTK_CHECK_VERSION(3,0,0)  
173 - gtk_combo_box_text_insert(GTK_COMBO_BOX_TEXT(menu),p++,charset[f].name,gettext(charset[f].description));  
174 -#else  
175 - gtk_list_store_append((GtkListStore *) model,&iter);  
176 - gtk_list_store_set((GtkListStore *) model, &iter, 0, gettext(charset[f].description), 1, charset[f].name, -1);  
177 -#endif // GTK(3,0,0)  
178 - }  
179 - }  
180 -  
181 -  
182 - gtk_label_set_mnemonic_widget(GTK_LABEL(label), menu);  
183 -  
184 - gtk_box_pack_start(GTK_BOX(box),label,FALSE,FALSE,0);  
185 -  
186 - gtk_box_pack_start(GTK_BOX(box),menu,TRUE,TRUE,0);  
187 -  
188 - g_signal_connect(G_OBJECT(menu),"changed",G_CALLBACK(charset_changed),encoding);  
189 -  
190 - }  
191 -  
192 -  
193 - gtk_widget_show_all(box);  
194 - gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(widget),box);  
195 -  
196 - }  
197 - */  
198 -  
199 void save_all_action(GtkAction *action, GtkWidget *widget) 40 void save_all_action(GtkAction *action, GtkWidget *widget)
200 { 41 {
201 v3270_save_all(widget,g_object_get_data(G_OBJECT(action),"filename"),NULL); 42 v3270_save_all(widget,g_object_get_data(G_OBJECT(action),"filename"),NULL);
@@ -211,43 +52,6 @@ @@ -211,43 +52,6 @@
211 v3270_save_copy(widget,g_object_get_data(G_OBJECT(action),"filename"),NULL); 52 v3270_save_copy(widget,g_object_get_data(G_OBJECT(action),"filename"),NULL);
212 } 53 }
213 54
214 - /*  
215 - static void paste_filename(GtkWidget *widget, const gchar *filename, const gchar *encoding)  
216 - {  
217 - GError *error = NULL;  
218 - gchar *text = NULL;  
219 -  
220 - if(!encoding)  
221 - g_get_charset(&encoding);  
222 -  
223 - trace("Loading \"%s\" encoding=%s",filename,encoding);  
224 -  
225 - if(!g_file_get_contents(filename,&text,NULL,&error))  
226 - {  
227 - GtkWidget *popup = gtk_message_dialog_new_with_markup(  
228 - GTK_WINDOW(gtk_widget_get_toplevel(widget)),  
229 - GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,  
230 - GTK_MESSAGE_ERROR,GTK_BUTTONS_CLOSE,  
231 - _( "Error loading %s" ),filename);  
232 -  
233 - gtk_window_set_title(GTK_WINDOW(popup),_("Can't load file"));  
234 -  
235 - gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(popup),"%s",error->message);  
236 - g_error_free(error);  
237 -  
238 - gtk_dialog_run(GTK_DIALOG(popup));  
239 - gtk_widget_destroy(popup);  
240 -  
241 - }  
242 -  
243 - if(text)  
244 - {  
245 - v3270_input_text(widget,text,encoding);  
246 - g_free(text);  
247 - }  
248 -  
249 - }  
250 - */  
251 void paste_file_action(GtkAction *action, GtkWidget *widget) 55 void paste_file_action(GtkAction *action, GtkWidget *widget)
252 { 56 {
253 const gchar * user_title = g_object_get_data(G_OBJECT(action),"title"); 57 const gchar * user_title = g_object_get_data(G_OBJECT(action),"title");
@@ -262,59 +66,6 @@ @@ -262,59 +66,6 @@
262 66
263 gtk_widget_destroy(dialog); 67 gtk_widget_destroy(dialog);
264 68
265 - /*  
266 - const gchar * user_title = g_object_get_data(G_OBJECT(action),"title");  
267 - const gchar * filename = g_object_get_data(G_OBJECT(action),"filename");  
268 - gchar * encattr = NULL;  
269 - GtkWidget * dialog;  
270 - gchar * ptr;  
271 - const gchar * encoding = NULL;  
272 -  
273 - g_get_charset(&encoding);  
274 -  
275 - trace("Action %s activated on widget %p",gtk_action_get_name(action),widget);  
276 -  
277 - if(filename)  
278 - {  
279 - ptr = g_object_get_data(G_OBJECT(action),"charset");  
280 - paste_filename(widget,filename,ptr);  
281 - return;  
282 - }  
283 -  
284 - dialog = gtk_file_chooser_dialog_new( gettext(user_title ? user_title : N_( "Paste text file contents" )),  
285 - GTK_WINDOW(gtk_widget_get_toplevel(widget)),  
286 - GTK_FILE_CHOOSER_ACTION_OPEN,  
287 - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,  
288 - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,  
289 - NULL );  
290 -  
291 - add_option_menus(dialog, action, &encattr);  
292 -  
293 - ptr = get_string_from_config("load",gtk_action_get_name(action),"");  
294 -  
295 - if(*ptr)  
296 - gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),ptr);  
297 - else  
298 - gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),g_get_user_special_dir(G_USER_DIRECTORY_DOCUMENTS));  
299 -  
300 - g_free(ptr);  
301 -  
302 - if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)  
303 - {  
304 - ptr = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));  
305 -  
306 - if(ptr)  
307 - {  
308 - set_string_to_config("load",gtk_action_get_name(action),"%s",ptr);  
309 - paste_filename(widget,ptr,encattr);  
310 - g_free(ptr);  
311 - }  
312 - }  
313 - gtk_widget_destroy(dialog);  
314 -  
315 - if(encattr)  
316 - g_free(encattr);  
317 - */  
318 } 69 }
319 70
320 G_GNUC_INTERNAL void about_dialog_action(GtkAction *action, GtkWidget *widget) 71 G_GNUC_INTERNAL void about_dialog_action(GtkAction *action, GtkWidget *widget)
@@ -342,10 +93,9 @@ @@ -342,10 +93,9 @@
342 "Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 " 93 "Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 "
343 "USA" ); 94 "USA" );
344 95
345 - GtkAboutDialog * dialog = GTK_ABOUT_DIALOG(gtk_about_dialog_new());  
346 - g_autofree gchar * text = g_strdup_printf("%s-logo.png",g_get_application_name());  
347 - g_autofree gchar * filename = build_data_filename(text,NULL);  
348 - g_autofree gchar * info = g_strdup_printf(_( "3270 terminal emulator for GTK %d.%d" ),GTK_MAJOR_VERSION,GTK_MINOR_VERSION); 96 + GtkAboutDialog * dialog = GTK_ABOUT_DIALOG(gtk_about_dialog_new());
  97 + lib3270_autoptr(char) logo = lib3270_build_data_filename(G_STRINGIFY(PRODUCT_NAME) "-logo.png",NULL);
  98 + g_autofree gchar * info = g_strdup_printf(_( "3270 terminal emulator for GTK %d.%d" ),GTK_MAJOR_VERSION,GTK_MINOR_VERSION);
349 99
350 g_autofree gchar * version = 100 g_autofree gchar * version =
351 #ifdef PACKAGE_RELEASE 101 #ifdef PACKAGE_RELEASE
@@ -359,10 +109,10 @@ @@ -359,10 +109,10 @@
359 gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(widget))); 109 gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(widget)));
360 } 110 }
361 111
362 - if(g_file_test(filename,G_FILE_TEST_EXISTS)) 112 + if(g_file_test(logo,G_FILE_TEST_EXISTS))
363 { 113 {
364 GError * error = NULL; 114 GError * error = NULL;
365 - GdkPixbuf * pix = gdk_pixbuf_new_from_file(filename,&error); 115 + GdkPixbuf * pix = gdk_pixbuf_new_from_file(logo,&error);
366 116
367 gtk_about_dialog_set_logo(dialog,pix); 117 gtk_about_dialog_set_logo(dialog,pix);
368 118
@@ -372,13 +122,13 @@ @@ -372,13 +122,13 @@
372 } 122 }
373 else 123 else
374 { 124 {
375 - g_warning("Can't load %s: %s",filename,error->message); 125 + g_warning("Can't load %s: %s",logo,error->message);
376 g_error_free(error); 126 g_error_free(error);
377 } 127 }
378 128
379 } else { 129 } else {
380 130
381 - g_message("Can't load %s: %s",filename,strerror(ENOENT)); 131 + g_message("%s: %s",logo,strerror(ENOENT));
382 132
383 } 133 }
384 134
src/pw3270/main.c
@@ -45,6 +45,7 @@ @@ -45,6 +45,7 @@
45 #endif // HAVE_GTKMAC 45 #endif // HAVE_GTKMAC
46 46
47 #include <v3270.h> 47 #include <v3270.h>
  48 +#include <lib3270.h>
48 #include <pw3270/plugin.h> 49 #include <pw3270/plugin.h>
49 #include "v3270/accessible.h" 50 #include "v3270/accessible.h"
50 #include <stdlib.h> 51 #include <stdlib.h>
@@ -104,7 +105,6 @@ static int initialize(void) @@ -104,7 +105,6 @@ static int initialize(void)
104 105
105 static void toplevel_setup(GtkWindow *window) 106 static void toplevel_setup(GtkWindow *window)
106 { 107 {
107 - g_autofree gchar * name = g_strdup_printf("%s.png",g_get_application_name());  
108 g_autofree gchar * role = g_strdup_printf("%s_top",g_get_application_name()); 108 g_autofree gchar * role = g_strdup_printf("%s_top",g_get_application_name());
109 109
110 gtk_window_set_type_hint(window,GDK_WINDOW_TYPE_HINT_NORMAL); 110 gtk_window_set_type_hint(window,GDK_WINDOW_TYPE_HINT_NORMAL);
@@ -112,20 +112,65 @@ static void toplevel_setup(GtkWindow *window) @@ -112,20 +112,65 @@ static void toplevel_setup(GtkWindow *window)
112 gtk_window_set_role(window,role); 112 gtk_window_set_role(window,role);
113 113
114 #ifndef _WIN32 114 #ifndef _WIN32
115 - // Set default icon  
116 - g_autofree gchar * filename = pw3270_build_filename(GTK_WIDGET(window),name,NULL);  
117 - if(g_file_test(filename,G_FILE_TEST_EXISTS)) 115 +
  116 + size_t ix;
  117 +
  118 + static const gchar * icons[] =
118 { 119 {
119 - GError * error = NULL; 120 + G_STRINGIFY(PRODUCT_NAME) ".svg",
  121 + G_STRINGIFY(PRODUCT_NAME) ".png",
120 122
121 - trace("Loading default icon from %s",filename); 123 + G_STRINGIFY(PACKAGE_NAME) ".svg",
  124 + G_STRINGIFY(PACKAGE_NAME) ".png"
  125 + };
  126 +
  127 + for(ix = 0; ix < G_N_ELEMENTS(icons); ix++)
  128 + {
  129 + g_autofree gchar * filename = g_strconcat("/usr/share/pixmaps/",icons[ix],NULL);
122 130
123 - if(!gtk_window_set_default_icon_from_file(filename,&error)) 131 + if(g_file_test(filename,G_FILE_TEST_EXISTS))
124 { 132 {
125 - g_warning("Error %s loading default icon from %s",error->message,filename);  
126 - g_error_free(error); 133 + GError * error = NULL;
  134 +
  135 + trace("Loading default icon from %s",filename);
  136 +
  137 + if(!gtk_window_set_default_icon_from_file(filename,&error))
  138 + {
  139 + g_warning("Error %s loading icon from %s",error->message,filename);
  140 + g_error_free(error);
  141 + }
  142 +
  143 + return;
  144 +
127 } 145 }
  146 +
128 } 147 }
  148 +
  149 + for(ix = 0; ix < G_N_ELEMENTS(icons); ix++)
  150 + {
  151 + lib3270_autoptr(char) filename = lib3270_build_data_filename(icons[ix], NULL);
  152 +
  153 + if(g_file_test(filename,G_FILE_TEST_EXISTS))
  154 + {
  155 + GError * error = NULL;
  156 +
  157 + trace("Loading default icon from %s",filename);
  158 +
  159 + if(!gtk_window_set_default_icon_from_file(filename,&error))
  160 + {
  161 + g_warning("Error %s loading icon from %s",error->message,filename);
  162 + g_error_free(error);
  163 + }
  164 +
  165 + return;
  166 +
  167 + }
  168 +
  169 + }
  170 +
  171 + // https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
  172 + gtk_window_set_default_icon_name("utilities-terminal");
  173 +
129 #endif // _WIN32 174 #endif // _WIN32
130 175
131 } 176 }
@@ -171,7 +216,6 @@ static gboolean startup(GtkWidget *toplevel) @@ -171,7 +216,6 @@ static gboolean startup(GtkWidget *toplevel)
171 216
172 int main(int argc, char *argv[]) 217 int main(int argc, char *argv[])
173 { 218 {
174 - const gchar * pluginpath = NULL;  
175 #ifdef APPLICATION_NAME 219 #ifdef APPLICATION_NAME
176 const char * app_name = G_STRINGIFY(APPLICATION_NAME); 220 const char * app_name = G_STRINGIFY(APPLICATION_NAME);
177 #else 221 #else
@@ -219,12 +263,12 @@ int main(int argc, char *argv[]) @@ -219,12 +263,12 @@ int main(int argc, char *argv[])
219 #if defined(ENABLE_WINDOWS_REGISTRY) 263 #if defined(ENABLE_WINDOWS_REGISTRY)
220 HKEY hMainKey; 264 HKEY hMainKey;
221 DWORD disp; 265 DWORD disp;
222 - LSTATUS winRegError = RegCreateKeyEx(HKEY_CURRENT_USER,"SOFTWARE\\" PACKAGE_NAME,0,NULL,REG_OPTION_NON_VOLATILE,KEY_SET_VALUE,NULL,&hMainKey,&disp); 266 + LSTATUS winRegError = RegCreateKeyEx(HKEY_CURRENT_USER,"SOFTWARE\\" G_STRINGIFY(PRODUCT_NAME),0,NULL,REG_OPTION_NON_VOLATILE,KEY_SET_VALUE,NULL,&hMainKey,&disp);
223 if(winRegError == ERROR_SUCCESS) 267 if(winRegError == ERROR_SUCCESS)
224 { 268 {
225 HKEY hKey; 269 HKEY hKey;
226 270
227 - winRegError = RegCreateKeyEx(HKEY_CURRENT_USER,"SOFTWARE\\" PACKAGE_NAME "\application",0,NULL,REG_OPTION_NON_VOLATILE,KEY_SET_VALUE,NULL,&hKey,&disp); 271 + winRegError = RegCreateKeyEx(HKEY_CURRENT_USER,"SOFTWARE\\" G_STRINGIFY(PRODUCT_NAME) "\application",0,NULL,REG_OPTION_NON_VOLATILE,KEY_SET_VALUE,NULL,&hKey,&disp);
228 if(winRegError == ERROR_SUCCESS) 272 if(winRegError == ERROR_SUCCESS)
229 { 273 {
230 const struct _versions 274 const struct _versions
@@ -252,7 +296,7 @@ int main(int argc, char *argv[]) @@ -252,7 +296,7 @@ int main(int argc, char *argv[])
252 #ifdef DEBUG 296 #ifdef DEBUG
253 else 297 else
254 { 298 {
255 - g_error("Can't open HKCU\\SOFTWARE\\" PACKAGE_NAME ": %s", lib3270_win32_strerror(winRegError)); 299 + g_error("Can't open HKCU\\SOFTWARE\\" G_STRINGIFY(PRODUCT_NAME) ": %s", lib3270_win32_strerror(winRegError));
256 } 300 }
257 #endif 301 #endif
258 RegCloseKey(hMainKey); 302 RegCloseKey(hMainKey);
@@ -260,7 +304,7 @@ int main(int argc, char *argv[]) @@ -260,7 +304,7 @@ int main(int argc, char *argv[])
260 #ifdef DEBUG 304 #ifdef DEBUG
261 else 305 else
262 { 306 {
263 - g_error("Can't open HKCU\\SOFTWARE\\" PACKAGE_NAME "\application: %s",lib3270_win32_strerror(winRegError)); 307 + g_error("Can't open HKCU\\SOFTWARE\\" G_STRINGIFY(PRODUCT_NAME) "\application: %s",lib3270_win32_strerror(winRegError));
264 } 308 }
265 #endif 309 #endif
266 310
@@ -308,7 +352,6 @@ int main(int argc, char *argv[]) @@ -308,7 +352,6 @@ int main(int argc, char *argv[])
308 { "model", 'M', 0, G_OPTION_ARG_STRING, &model, N_( "The model of 3270 display to be emulated" ), NULL }, 352 { "model", 'M', 0, G_OPTION_ARG_STRING, &model, N_( "The model of 3270 display to be emulated" ), NULL },
309 { "oversize", 'O', 0, G_OPTION_ARG_STRING, &oversize, N_( "Makes the screen larger than the default for the chosen model number." ), NULL }, 353 { "oversize", 'O', 0, G_OPTION_ARG_STRING, &oversize, N_( "Makes the screen larger than the default for the chosen model number." ), NULL },
310 { "autodisconnect", 'D', 0, G_OPTION_ARG_INT, &timer, N_( "Minutes for auto-disconnect" ), 0 }, 354 { "autodisconnect", 'D', 0, G_OPTION_ARG_INT, &timer, N_( "Minutes for auto-disconnect" ), 0 },
311 - { "pluginpath", 'P', 0, G_OPTION_ARG_STRING, &pluginpath, N_( "Path for plugin files" ), NULL },  
312 355
313 #ifdef APPLICATION_NAME 356 #ifdef APPLICATION_NAME
314 { "application-name", 'A', 0, G_OPTION_ARG_STRING, &app_name, N_( "Application name" ), G_STRINGIFY(APPLICATION_NAME) }, 357 { "application-name", 'A', 0, G_OPTION_ARG_STRING, &app_name, N_( "Application name" ), G_STRINGIFY(APPLICATION_NAME) },
@@ -453,7 +496,7 @@ int main(int argc, char *argv[]) @@ -453,7 +496,7 @@ int main(int argc, char *argv[])
453 pw3270_set_string(toplevel,"application","session",session_name); 496 pw3270_set_string(toplevel,"application","session",session_name);
454 #endif // _WIN32 497 #endif // _WIN32
455 498
456 - pw3270_load_plugins(pluginpath); 499 + pw3270_load_plugins();
457 500
458 if(toggleset) 501 if(toggleset)
459 { 502 {
src/pw3270/plugin.c
@@ -39,21 +39,27 @@ @@ -39,21 +39,27 @@
39 39
40 /*--[ Implement ]------------------------------------------------------------------------------------*/ 40 /*--[ Implement ]------------------------------------------------------------------------------------*/
41 41
42 - static void load(const gchar *path) 42 + LIB3270_EXPORT void pw3270_load_plugins(void)
43 { 43 {
44 - GDir * dir;  
45 - const gchar * name;  
46 - GError * err = NULL;  
47 - GList * lst = NULL;  
48 #ifdef _WIN32 44 #ifdef _WIN32
49 UINT errorMode; 45 UINT errorMode;
  46 + lib3270_autoptr(char) path = lib3270_build_data_filename("plugins")
  47 +#else
  48 + const gchar * path = LIBDIR G_DIR_SEPARATOR_S G_STRINGIFY(PRODUCT_NAME) "-plugins";
50 #endif // _WIN32 49 #endif // _WIN32
51 50
  51 + GDir * dir;
  52 + const gchar * name;
  53 + GError * err = NULL;
  54 + GList * lst = NULL;
52 55
53 trace("Loading plugins from %s",path); 56 trace("Loading plugins from %s",path);
54 57
55 if(!g_file_test(path,G_FILE_TEST_IS_DIR)) 58 if(!g_file_test(path,G_FILE_TEST_IS_DIR))
  59 + {
  60 + g_warning("Can't load plugins from %s",path);
56 return; 61 return;
  62 + }
57 63
58 dir = g_dir_open(path,0,&err); 64 dir = g_dir_open(path,0,&err);
59 if(!dir) 65 if(!dir)
@@ -159,6 +165,7 @@ @@ -159,6 +165,7 @@
159 165
160 } 166 }
161 167
  168 + /*
162 LIB3270_EXPORT void pw3270_load_plugins(const gchar *p) 169 LIB3270_EXPORT void pw3270_load_plugins(const gchar *p)
163 { 170 {
164 if(p) 171 if(p)
@@ -221,6 +228,7 @@ @@ -221,6 +228,7 @@
221 228
222 #endif 229 #endif
223 } 230 }
  231 + */
224 232
225 LIB3270_EXPORT void pw3270_start_plugins(GtkWidget *widget) 233 LIB3270_EXPORT void pw3270_start_plugins(GtkWidget *widget)
226 { 234 {