Commit b9b915f0f9b4e46f7a41b9bee2ffe80c4d3c629d

Authored by Perry Werneck
1 parent 79a41c35

Fixing last-session-save engine.

schemas/linux/application.gschema.xml.in
@@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
69 <description></description> 69 <description></description>
70 </key> 70 </key>
71 71
72 - <key name="update-session-file" type="b"> 72 + <key name="update-default-session-file" type="b">
73 <default>true</default> 73 <default>true</default>
74 <summary>Update default session time from command line</summary> 74 <summary>Update default session time from command line</summary>
75 <description></description> 75 <description></description>
schemas/windows/application.gschema.xml.in
@@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
81 <description></description> 81 <description></description>
82 </key> 82 </key>
83 83
84 - <key name="update-session-file" type="b"> 84 + <key name="update-default-session-file" type="b">
85 <default>true</default> 85 <default>true</default>
86 <summary>Update default session time from command line</summary> 86 <summary>Update default session time from command line</summary>
87 <description></description> 87 <description></description>
src/objects/application/open.c
@@ -69,21 +69,6 @@ @@ -69,21 +69,6 @@
69 69
70 } 70 }
71 71
72 - static void save_open_file(GApplication *application, const gchar *path) {  
73 -  
74 - GSettings * settings = pw3270_application_get_settings(application);  
75 -  
76 - if(g_settings_get_boolean(settings,"update-session-file")) {  
77 -  
78 - g_message("Updating default session file to '%s'",path);  
79 - g_settings_set_string(settings,"default-session-file",path);  
80 -  
81 - }  
82 -  
83 - gtk_recent_manager_add_item(gtk_recent_manager_get_default(),path);  
84 -  
85 - }  
86 -  
87 void pw3270_application_open(GApplication *application, GFile **files, gint n_files, const gchar G_GNUC_UNUSED(*hint)) { 72 void pw3270_application_open(GApplication *application, GFile **files, gint n_files, const gchar G_GNUC_UNUSED(*hint)) {
88 73
89 GtkWidget * window = GTK_WIDGET(gtk_application_get_active_window(GTK_APPLICATION(application))); 74 GtkWidget * window = GTK_WIDGET(gtk_application_get_active_window(GTK_APPLICATION(application)));
@@ -130,8 +115,6 @@ @@ -130,8 +115,6 @@
130 pw3270_application_window_new_tab(window,path); 115 pw3270_application_window_new_tab(window,path);
131 } 116 }
132 117
133 - save_open_file(application,path);  
134 -  
135 continue; 118 continue;
136 } 119 }
137 120
@@ -149,8 +132,6 @@ @@ -149,8 +132,6 @@
149 pw3270_application_window_new_tab(window, filename); 132 pw3270_application_window_new_tab(window, filename);
150 } 133 }
151 134
152 - save_open_file(application,filename);  
153 -  
154 continue; 135 continue;
155 } 136 }
156 137
src/objects/window/keyfile.c
@@ -158,6 +158,22 @@ @@ -158,6 +158,22 @@
158 } 158 }
159 } 159 }
160 160
  161 + if(!*error) {
  162 +
  163 + GSettings * settings = pw3270_application_get_settings(g_application_get_default());
  164 +
  165 + if(settings && g_settings_get_boolean(settings,"update-default-session-file")) {
  166 +
  167 + g_message("Updating default session file to '%s'",filename);
  168 + g_settings_set_string(settings,"default-session-file",filename);
  169 +
  170 + }
  171 +
  172 + gtk_recent_manager_add_item(gtk_recent_manager_get_default(),filename);
  173 +
  174 + }
  175 +
  176 +
161 return new_session; 177 return new_session;
162 } 178 }
163 179