Commit 2ebec4334665269e1f43360dd7d61ae389b3ca36
1 parent
c49d2497
Exists in
master
and in
2 other branches
Adjustments in linux save shortcut.
Showing
3 changed files
with
138 additions
and
120 deletions
Show diff stats
src/include/v3270/keyfile.h
| @@ -43,12 +43,12 @@ | @@ -43,12 +43,12 @@ | ||
| 43 | typedef struct _V3270KeyFile V3270KeyFile; | 43 | typedef struct _V3270KeyFile V3270KeyFile; |
| 44 | 44 | ||
| 45 | gchar * v3270_keyfile_get_default_filename(void); | 45 | gchar * v3270_keyfile_get_default_filename(void); |
| 46 | - gchar * v3270_key_file_get_default_path(GtkWidget *terminal, gboolean create); | 46 | + gchar * v3270_key_file_get_default_path(GtkWidget *terminal); |
| 47 | 47 | ||
| 48 | V3270KeyFile * v3270_key_file_open(GtkWidget *terminal, const gchar *name, GError **error); | 48 | V3270KeyFile * v3270_key_file_open(GtkWidget *terminal, const gchar *name, GError **error); |
| 49 | void v3270_key_file_close(GtkWidget *terminal); | 49 | void v3270_key_file_close(GtkWidget *terminal); |
| 50 | - void v3270_key_file_save(GtkWidget *terminal); | ||
| 51 | - void v3270_key_file_save_to_file(GtkWidget * terminal, const gchar *filename); | 50 | + void v3270_key_file_save(GtkWidget *terminal, GError **error); |
| 51 | + void v3270_key_file_save_to_file(GtkWidget * terminal, const gchar *filename, GError **error); | ||
| 52 | 52 | ||
| 53 | /// @brief Get current key filename | 53 | /// @brief Get current key filename |
| 54 | const gchar * v3270_key_file_get_filename(GtkWidget *terminal); | 54 | const gchar * v3270_key_file_get_filename(GtkWidget *terminal); |
src/objects/os/linux/savedesktopicon.c
| @@ -67,20 +67,36 @@ X-Desktop-File-Install-Version=0.23 | @@ -67,20 +67,36 @@ X-Desktop-File-Install-Version=0.23 | ||
| 67 | const gchar * tooltip; | 67 | const gchar * tooltip; |
| 68 | const gchar * default_value; | 68 | const gchar * default_value; |
| 69 | gint width; | 69 | gint width; |
| 70 | -// gint n_chars; | ||
| 71 | 70 | ||
| 72 | } entries[] = { | 71 | } entries[] = { |
| 73 | 72 | ||
| 73 | + // 0 = Shortcut name | ||
| 74 | { | 74 | { |
| 75 | - .label = N_("File name"), | 75 | + .key = "Name", |
| 76 | + .label = N_("Shortcut name"), | ||
| 77 | + .default_value = G_STRINGIFY(PRODUCT_NAME), | ||
| 78 | + .width = 20, | ||
| 79 | + }, | ||
| 80 | + | ||
| 81 | + // 1 = Shortcut file | ||
| 82 | + { | ||
| 83 | + .label = N_("Shortcut file"), | ||
| 84 | + .tooltip = N_("Path for the new shortcut"), | ||
| 76 | .width = 40, | 85 | .width = 40, |
| 77 | }, | 86 | }, |
| 78 | 87 | ||
| 88 | + // 2 = Session name | ||
| 79 | { | 89 | { |
| 80 | - .key = "Name", | ||
| 81 | - .label = N_("Launcher name"), | ||
| 82 | - .default_value = G_STRINGIFY(PRODUCT_NAME), | ||
| 83 | - .width = 20, | 90 | + .label = N_("Session name"), |
| 91 | + .tooltip = N_("The session name used in the window/tab title (empty for default)"), | ||
| 92 | + .width = 15, | ||
| 93 | + }, | ||
| 94 | + | ||
| 95 | + // 3 = Session file | ||
| 96 | + { | ||
| 97 | + .label = N_("Session file"), | ||
| 98 | + .tooltip = N_("The file with the session preferences for this shortcut"), | ||
| 99 | + .width = 40, | ||
| 84 | }, | 100 | }, |
| 85 | 101 | ||
| 86 | { | 102 | { |
| @@ -111,6 +127,38 @@ X-Desktop-File-Install-Version=0.23 | @@ -111,6 +127,38 @@ X-Desktop-File-Install-Version=0.23 | ||
| 111 | 127 | ||
| 112 | } | 128 | } |
| 113 | 129 | ||
| 130 | + static gchar * get_filename(GtkWidget *terminal) { | ||
| 131 | + | ||
| 132 | + g_autofree gchar * defname = v3270_keyfile_get_default_filename(); | ||
| 133 | + const gchar * current = v3270_key_file_get_filename(terminal); | ||
| 134 | + | ||
| 135 | + // If is not the default name, return it. | ||
| 136 | + if(strcmp(defname,current)) { | ||
| 137 | + return g_strdup(current); | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + // It's the default one, create a new one on the user_config dir | ||
| 141 | + g_autofree gchar * config_path = v3270_key_file_get_default_path(terminal); | ||
| 142 | + | ||
| 143 | + // Use the hostname | ||
| 144 | + const char * hostname = lib3270_host_get_name(v3270_get_session(terminal)); | ||
| 145 | + if(!hostname) { | ||
| 146 | + hostname = G_STRINGIFY(PRODUCT_NAME); | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + // Build the filename | ||
| 150 | + gchar *filename = g_strconcat(config_path,G_DIR_SEPARATOR_S,hostname,".3270",NULL); | ||
| 151 | + | ||
| 152 | + unsigned int index = 0; | ||
| 153 | + while(g_file_test(filename,G_FILE_TEST_EXISTS)) { | ||
| 154 | + g_free(filename); | ||
| 155 | + filename = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s.%u.3270",config_path,hostname,++index); | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + return filename; | ||
| 159 | + | ||
| 160 | + } | ||
| 161 | + | ||
| 114 | GtkWidget * factory(V3270SimpleAction *action, GtkWidget *terminal) { | 162 | GtkWidget * factory(V3270SimpleAction *action, GtkWidget *terminal) { |
| 115 | 163 | ||
| 116 | size_t ix; | 164 | size_t ix; |
| @@ -168,8 +216,11 @@ X-Desktop-File-Install-Version=0.23 | @@ -168,8 +216,11 @@ X-Desktop-File-Install-Version=0.23 | ||
| 168 | gtk_entry_set_text(GTK_ENTRY(inputs[ix]),gettext(entries[ix].default_value)); | 216 | gtk_entry_set_text(GTK_ENTRY(inputs[ix]),gettext(entries[ix].default_value)); |
| 169 | } | 217 | } |
| 170 | 218 | ||
| 219 | + if(entries[ix].tooltip) { | ||
| 220 | + gtk_widget_set_tooltip_markup(GTK_WIDGET(inputs[ix]),gettext(entries[ix].tooltip)); | ||
| 221 | + } | ||
| 222 | + | ||
| 171 | gtk_entry_set_width_chars(GTK_ENTRY(inputs[ix]),entries[ix].width); | 223 | gtk_entry_set_width_chars(GTK_ENTRY(inputs[ix]),entries[ix].width); |
| 172 | -// gtk_entry_set_max_width_chars(GTK_ENTRY(inputs[ix]),entries[ix].n_chars); | ||
| 173 | gtk_widget_set_hexpand(inputs[ix],FALSE); | 224 | gtk_widget_set_hexpand(inputs[ix],FALSE); |
| 174 | gtk_widget_set_vexpand(inputs[ix],FALSE); | 225 | gtk_widget_set_vexpand(inputs[ix],FALSE); |
| 175 | 226 | ||
| @@ -179,70 +230,30 @@ X-Desktop-File-Install-Version=0.23 | @@ -179,70 +230,30 @@ X-Desktop-File-Install-Version=0.23 | ||
| 179 | 230 | ||
| 180 | g_autofree gchar * filename = g_strdup_printf("%s/" G_STRINGIFY(PRODUCT_NAME) ".desktop",g_get_user_special_dir(G_USER_DIRECTORY_DESKTOP)); | 231 | g_autofree gchar * filename = g_strdup_printf("%s/" G_STRINGIFY(PRODUCT_NAME) ".desktop",g_get_user_special_dir(G_USER_DIRECTORY_DESKTOP)); |
| 181 | 232 | ||
| 182 | - gtk_entry_set_text(GTK_ENTRY(inputs[0]),filename); | 233 | + // 1 = Shortcut filename |
| 234 | + gtk_entry_set_text(GTK_ENTRY(inputs[1]),filename); | ||
| 183 | 235 | ||
| 184 | - /* | ||
| 185 | - gtk_entry_set_placeholder_text(GTK_ENTRY(inputs[1]),G_STRINGIFY(PRODUCT_NAME)); | ||
| 186 | - gtk_entry_set_text(GTK_ENTRY(inputs[1]),G_STRINGIFY(PRODUCT_NAME)); | ||
| 187 | - | ||
| 188 | - gtk_entry_set_placeholder_text(GTK_ENTRY(inputs[2]),G_STRINGIFY(PRODUCT_NAME)); | ||
| 189 | - gtk_entry_set_text(GTK_ENTRY(inputs[2]),G_STRINGIFY(PRODUCT_NAME)); | ||
| 190 | - */ | 236 | + // 3 = Session filename |
| 237 | + { | ||
| 238 | + g_autofree gchar * session_filename = get_filename(terminal); | ||
| 239 | + gtk_entry_set_text(GTK_ENTRY(inputs[3]),session_filename); | ||
| 240 | + } | ||
| 191 | 241 | ||
| 192 | - gtk_entry_set_placeholder_text(GTK_ENTRY(inputs[3]),v3270_get_url(terminal)); | ||
| 193 | - gtk_entry_set_text(GTK_ENTRY(inputs[3]),v3270_get_url(terminal)); | ||
| 194 | - gtk_entry_set_input_hints(GTK_ENTRY(inputs[3]),GTK_INPUT_HINT_SPELLCHECK); | 242 | + // 4 = Generic name |
| 243 | + gtk_entry_set_placeholder_text(GTK_ENTRY(inputs[4]),v3270_get_url(terminal)); | ||
| 244 | + gtk_entry_set_text(GTK_ENTRY(inputs[4]),v3270_get_url(terminal)); | ||
| 245 | + gtk_entry_set_input_hints(GTK_ENTRY(inputs[4]),GTK_INPUT_HINT_SPELLCHECK); | ||
| 195 | 246 | ||
| 196 | gtk_widget_show_all(GTK_WIDGET(grid)); | 247 | gtk_widget_show_all(GTK_WIDGET(grid)); |
| 197 | return dialog; | 248 | return dialog; |
| 198 | } | 249 | } |
| 199 | 250 | ||
| 200 | - static gchar * get_filename(GtkWidget *terminal, const gchar *session_name) { | ||
| 201 | - | ||
| 202 | - if(!(session_name && *session_name)) | ||
| 203 | - session_name = G_STRINGIFY(PRODUCT_NAME); | ||
| 204 | - | ||
| 205 | - g_autofree gchar * defname = v3270_keyfile_get_default_filename(); | ||
| 206 | - const gchar * current = v3270_key_file_get_filename(terminal); | ||
| 207 | - | ||
| 208 | - // If is not the default name, return it. | ||
| 209 | - if(strcmp(defname,current)) { | ||
| 210 | - return g_strdup(current); | ||
| 211 | - } | ||
| 212 | - | ||
| 213 | - // It's the default one, create a new one on the user_config dir | ||
| 214 | - g_autofree gchar * config_path = v3270_key_file_get_default_path(terminal,TRUE); | ||
| 215 | - | ||
| 216 | - // Use the hostname | ||
| 217 | - const char * hostname = lib3270_host_get_name(v3270_get_session(terminal)); | ||
| 218 | - if(!hostname) { | ||
| 219 | - hostname = "session"; | ||
| 220 | - } | ||
| 221 | - | ||
| 222 | - // Build the filename | ||
| 223 | - gchar *filename = g_strconcat(config_path,G_DIR_SEPARATOR_S,hostname,".",session_name,".3270",NULL); | ||
| 224 | - | ||
| 225 | - unsigned int index = 0; | ||
| 226 | - while(g_file_test(filename,G_FILE_TEST_EXISTS)) { | ||
| 227 | - g_free(filename); | ||
| 228 | - filename = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s.%s.%u.3270",config_path,hostname,session_name,++index); | ||
| 229 | - } | ||
| 230 | - | ||
| 231 | - v3270_key_file_save_to_file(terminal,filename); | ||
| 232 | - | ||
| 233 | - g_message("New session file create at \"%s\"",filename); | ||
| 234 | - | ||
| 235 | - return filename; | ||
| 236 | - | ||
| 237 | - } | ||
| 238 | - | ||
| 239 | - void response(GtkWidget *dialog, gint response_id, GtkWidget *terminal) { | 251 | + static void apply(GtkWidget *dialog, GtkWidget *terminal) { |
| 240 | 252 | ||
| 241 | - debug("%s(%d)",__FUNCTION__,response_id); | ||
| 242 | - | ||
| 243 | - if(response_id == GTK_RESPONSE_APPLY) { | 253 | + GError * error = NULL; |
| 254 | + size_t ix; | ||
| 244 | 255 | ||
| 245 | - static const char * key_file_data = | 256 | + static const char * key_file_data = |
| 246 | "[Desktop Entry]\n" \ | 257 | "[Desktop Entry]\n" \ |
| 247 | "Icon=" G_STRINGIFY(PRODUCT_NAME) "\n" \ | 258 | "Icon=" G_STRINGIFY(PRODUCT_NAME) "\n" \ |
| 248 | "Terminal=false\n" \ | 259 | "Terminal=false\n" \ |
| @@ -251,68 +262,82 @@ X-Desktop-File-Install-Version=0.23 | @@ -251,68 +262,82 @@ X-Desktop-File-Install-Version=0.23 | ||
| 251 | "Categories=GTK;GNOME;TerminalEmulator\n" \ | 262 | "Categories=GTK;GNOME;TerminalEmulator\n" \ |
| 252 | "OnlyShowIn=GNOME;Unity\n"; | 263 | "OnlyShowIn=GNOME;Unity\n"; |
| 253 | 264 | ||
| 254 | - GError * error = NULL; | ||
| 255 | - size_t ix; | ||
| 256 | - | ||
| 257 | - GKeyFile * keyfile = g_key_file_new(); | ||
| 258 | - g_key_file_load_from_data(keyfile,key_file_data,-1,G_KEY_FILE_NONE,NULL); | 265 | + GKeyFile * keyfile = g_key_file_new(); |
| 266 | + g_key_file_load_from_data(keyfile,key_file_data,-1,G_KEY_FILE_NONE,NULL); | ||
| 259 | 267 | ||
| 260 | #ifdef DEBUG | 268 | #ifdef DEBUG |
| 261 | - { | ||
| 262 | - g_autofree gchar * dbg_data = g_key_file_to_data(keyfile,NULL,NULL); | ||
| 263 | - debug("\n%s\n",dbg_data); | ||
| 264 | - } | 269 | + { |
| 270 | + g_autofree gchar * dbg_data = g_key_file_to_data(keyfile,NULL,NULL); | ||
| 271 | + debug("\n%s\n",dbg_data); | ||
| 272 | + } | ||
| 265 | #endif // DEBUG | 273 | #endif // DEBUG |
| 266 | 274 | ||
| 267 | 275 | ||
| 268 | - GtkWidget ** inputs = g_object_get_data(G_OBJECT(dialog),"inputs"); | ||
| 269 | - debug("dialog=%p inputs=%p",dialog,inputs); | 276 | + GtkWidget ** inputs = g_object_get_data(G_OBJECT(dialog),"inputs"); |
| 277 | + debug("dialog=%p inputs=%p",dialog,inputs); | ||
| 270 | 278 | ||
| 271 | - for(ix = 0; ix < G_N_ELEMENTS(entries); ix++) { | ||
| 272 | - if(entries[ix].key) { | ||
| 273 | - debug("inputs[%u]=%p",(unsigned int) ix, inputs[ix]); | ||
| 274 | - g_key_file_set_string(keyfile,"Desktop Entry",entries[ix].key,gtk_entry_get_text(GTK_ENTRY(inputs[ix]))); | ||
| 275 | - } | 279 | + for(ix = 0; ix < G_N_ELEMENTS(entries); ix++) { |
| 280 | + if(entries[ix].key) { | ||
| 281 | + debug("inputs[%u]=%p",(unsigned int) ix, inputs[ix]); | ||
| 282 | + g_key_file_set_string(keyfile,"Desktop Entry",entries[ix].key,gtk_entry_get_text(GTK_ENTRY(inputs[ix]))); | ||
| 276 | } | 283 | } |
| 284 | + } | ||
| 277 | 285 | ||
| 278 | - // Get session filename | ||
| 279 | - g_autofree gchar * filename = get_filename(terminal,NULL); | 286 | + // Save keyfile |
| 287 | + v3270_key_file_save_to_file( | ||
| 288 | + terminal, | ||
| 289 | + gtk_entry_get_text(GTK_ENTRY(inputs[3])), | ||
| 290 | + &error | ||
| 291 | + ); | ||
| 280 | 292 | ||
| 281 | - // Get program file name | ||
| 282 | - // https://stackoverflow.com/questions/4517425/how-to-get-program-path | ||
| 283 | - { | ||
| 284 | - char buffer[4096]; | ||
| 285 | - g_autofree gchar * pidfile = g_strdup_printf("/proc/%d/exe", getpid()); | 293 | + // Get program file name |
| 294 | + // https://stackoverflow.com/questions/4517425/how-to-get-program-path | ||
| 295 | + if(!error) { | ||
| 296 | + char buffer[4096]; | ||
| 297 | + g_autofree gchar * pidfile = g_strdup_printf("/proc/%d/exe", getpid()); | ||
| 286 | 298 | ||
| 287 | - int bytes = readlink(pidfile,buffer,4095); | 299 | + int bytes = readlink(pidfile,buffer,4095); |
| 288 | 300 | ||
| 289 | - if(bytes >= 0) | ||
| 290 | - buffer[bytes] = '\0'; | 301 | + if(bytes >= 0) |
| 302 | + buffer[bytes] = '\0'; | ||
| 291 | 303 | ||
| 292 | - g_autofree gchar * exec_line = g_strdup_printf("%s \"%s\"",buffer,filename); | ||
| 293 | - g_key_file_set_string(keyfile,"Desktop Entry","Exec",exec_line); | 304 | + g_autofree gchar * exec_line = |
| 305 | + g_strconcat( | ||
| 306 | + buffer, | ||
| 307 | + " \"",gtk_entry_get_text(GTK_ENTRY(inputs[3])),"\"", | ||
| 308 | + NULL | ||
| 309 | + ); | ||
| 294 | 310 | ||
| 295 | - } | 311 | + g_key_file_set_string(keyfile,"Desktop Entry","Exec",exec_line); |
| 296 | 312 | ||
| 297 | - g_key_file_save_to_file(keyfile,gtk_entry_get_text(GTK_ENTRY(inputs[0])),&error); | 313 | + } |
| 298 | 314 | ||
| 299 | - if(error) { | 315 | + // Save shortcude |
| 316 | + g_key_file_save_to_file(keyfile,gtk_entry_get_text(GTK_ENTRY(inputs[1])),&error); | ||
| 300 | 317 | ||
| 301 | - g_message("%s",error->message); | 318 | + g_key_file_free(keyfile); |
| 302 | 319 | ||
| 320 | + if(error) { | ||
| 303 | 321 | ||
| 304 | - g_error_free(error); | 322 | + g_message("%s",error->message); |
| 323 | + g_error_free(error); | ||
| 305 | 324 | ||
| 306 | - } else { | 325 | + } |
| 307 | 326 | ||
| 308 | - g_message("File \"%s\" was saved",gtk_entry_get_text(GTK_ENTRY(inputs[0]))); | ||
| 309 | 327 | ||
| 310 | - } | 328 | +} |
| 329 | + | ||
| 330 | +void response(GtkWidget *dialog, gint response_id, GtkWidget *terminal) { | ||
| 311 | 331 | ||
| 332 | + debug("%s(%d)",__FUNCTION__,response_id); | ||
| 312 | 333 | ||
| 313 | - g_key_file_free(keyfile); | 334 | + gtk_widget_hide(dialog); |
| 335 | + if(response_id == GTK_RESPONSE_APPLY) { | ||
| 336 | + apply(dialog,terminal); | ||
| 314 | } | 337 | } |
| 315 | 338 | ||
| 316 | - gtk_widget_destroy(dialog); | 339 | + gtk_widget_destroy(dialog); |
| 317 | 340 | ||
| 318 | } | 341 | } |
| 342 | + | ||
| 343 | + |
src/objects/window/keyfile.c
| @@ -126,7 +126,7 @@ | @@ -126,7 +126,7 @@ | ||
| 126 | 126 | ||
| 127 | g_object_set_data_full(G_OBJECT(terminal),"session-descriptor",new_session,(GDestroyNotify) close_keyfile); | 127 | g_object_set_data_full(G_OBJECT(terminal),"session-descriptor",new_session,(GDestroyNotify) close_keyfile); |
| 128 | if(new_session->changed) { | 128 | if(new_session->changed) { |
| 129 | - v3270_key_file_save(terminal); | 129 | + v3270_key_file_save(terminal,error); |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | if(!*error) { | 132 | if(!*error) { |
| @@ -189,7 +189,10 @@ void v3270_key_file_close(GtkWidget *terminal) { | @@ -189,7 +189,10 @@ void v3270_key_file_close(GtkWidget *terminal) { | ||
| 189 | return v3270_get_session_descriptor(terminal)->key_file; | 189 | return v3270_get_session_descriptor(terminal)->key_file; |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | - void v3270_key_file_save_to_file(GtkWidget * terminal, const gchar *filename) { | 192 | + void v3270_key_file_save_to_file(GtkWidget * terminal, const gchar *filename, GError **error) { |
| 193 | + | ||
| 194 | + if(*error) | ||
| 195 | + return; | ||
| 193 | 196 | ||
| 194 | V3270KeyFile * new_session = (V3270KeyFile *) g_malloc0(sizeof(struct _V3270KeyFile) + strlen(filename)); | 197 | V3270KeyFile * new_session = (V3270KeyFile *) g_malloc0(sizeof(struct _V3270KeyFile) + strlen(filename)); |
| 195 | V3270KeyFile * old_session = g_object_get_data(G_OBJECT(terminal),"session-descriptor"); | 198 | V3270KeyFile * old_session = g_object_get_data(G_OBJECT(terminal),"session-descriptor"); |
| @@ -202,11 +205,11 @@ void v3270_key_file_close(GtkWidget *terminal) { | @@ -202,11 +205,11 @@ void v3270_key_file_close(GtkWidget *terminal) { | ||
| 202 | new_session->key_file = g_key_file_new(); | 205 | new_session->key_file = g_key_file_new(); |
| 203 | 206 | ||
| 204 | g_object_set_data_full(G_OBJECT(terminal),"session-descriptor",new_session,(GDestroyNotify) close_keyfile); | 207 | g_object_set_data_full(G_OBJECT(terminal),"session-descriptor",new_session,(GDestroyNotify) close_keyfile); |
| 205 | - v3270_key_file_save(terminal); | 208 | + v3270_key_file_save(terminal,error); |
| 206 | 209 | ||
| 207 | } | 210 | } |
| 208 | 211 | ||
| 209 | - void v3270_key_file_save(GtkWidget *terminal) { | 212 | + void v3270_key_file_save(GtkWidget *terminal, GError **error) { |
| 210 | 213 | ||
| 211 | V3270KeyFile *session = v3270_get_session_descriptor(terminal); | 214 | V3270KeyFile *session = v3270_get_session_descriptor(terminal); |
| 212 | 215 | ||
| @@ -222,7 +225,7 @@ void v3270_key_file_close(GtkWidget *terminal) { | @@ -222,7 +225,7 @@ void v3270_key_file_close(GtkWidget *terminal) { | ||
| 222 | } | 225 | } |
| 223 | 226 | ||
| 224 | /// @brief Search standard paths. | 227 | /// @brief Search standard paths. |
| 225 | - gchar * v3270_key_file_get_default_path(GtkWidget *terminal, gboolean create) { | 228 | + gchar * v3270_key_file_get_default_path(GtkWidget *terminal) { |
| 226 | 229 | ||
| 227 | size_t folder; | 230 | size_t folder; |
| 228 | const gchar *folders[] = { | 231 | const gchar *folders[] = { |
| @@ -233,7 +236,6 @@ void v3270_key_file_close(GtkWidget *terminal) { | @@ -233,7 +236,6 @@ void v3270_key_file_close(GtkWidget *terminal) { | ||
| 233 | 236 | ||
| 234 | size_t application; | 237 | size_t application; |
| 235 | const gchar *applications[] = { | 238 | const gchar *applications[] = { |
| 236 | - v3270_get_session_name(terminal), | ||
| 237 | G_STRINGIFY(PRODUCT_NAME), | 239 | G_STRINGIFY(PRODUCT_NAME), |
| 238 | PACKAGE_NAME, | 240 | PACKAGE_NAME, |
| 239 | "3270", | 241 | "3270", |
| @@ -270,16 +272,8 @@ void v3270_key_file_close(GtkWidget *terminal) { | @@ -270,16 +272,8 @@ void v3270_key_file_close(GtkWidget *terminal) { | ||
| 270 | return g_path_get_dirname(filename); | 272 | return g_path_get_dirname(filename); |
| 271 | } | 273 | } |
| 272 | 274 | ||
| 273 | - if(!create) { | ||
| 274 | - return g_strdup(g_get_user_special_dir(G_USER_DIRECTORY_DOCUMENTS)); | ||
| 275 | - } | 275 | + return g_strdup(g_get_user_special_dir(G_USER_DIRECTORY_DOCUMENTS)); |
| 276 | 276 | ||
| 277 | - // Create folder. | ||
| 278 | - { | ||
| 279 | - gchar * default_dir = g_build_filename(g_get_user_special_dir(G_USER_DIRECTORY_DOCUMENTS),G_STRINGIFY(PRODUCT_NAME),NULL); | ||
| 280 | - g_mkdir_with_parents(default_dir,0775); | ||
| 281 | - return default_dir; | ||
| 282 | - } | ||
| 283 | } | 277 | } |
| 284 | 278 | ||
| 285 | gchar * v3270_keyfile_get_default_filename(void) { | 279 | gchar * v3270_keyfile_get_default_filename(void) { |
| @@ -300,8 +294,7 @@ void v3270_key_file_close(GtkWidget *terminal) { | @@ -300,8 +294,7 @@ void v3270_key_file_close(GtkWidget *terminal) { | ||
| 300 | return g_strdup(filename); | 294 | return g_strdup(filename); |
| 301 | } | 295 | } |
| 302 | 296 | ||
| 303 | - debug("\n\n\n%s",__FUNCTION__); | ||
| 304 | - g_autofree gchar * folder = v3270_key_file_get_default_path(terminal,FALSE); | 297 | + g_autofree gchar * folder = v3270_key_file_get_default_path(terminal); |
| 305 | 298 | ||
| 306 | const char * hostname = lib3270_host_get_name(v3270_get_session(terminal)); | 299 | const char * hostname = lib3270_host_get_name(v3270_get_session(terminal)); |
| 307 | debug("Hostname=\"%s\"",hostname); | 300 | debug("Hostname=\"%s\"",hostname); |