Browse Source

Only reload list after saving if necessary.

Thomas Buck 11 years ago
parent
commit
716a3809f6

+ 1
- 1
BaconBarHelper/BaconBarHelper-Info.plist View File

21
 	<key>CFBundleSignature</key>
21
 	<key>CFBundleSignature</key>
22
 	<string>????</string>
22
 	<string>????</string>
23
 	<key>CFBundleVersion</key>
23
 	<key>CFBundleVersion</key>
24
-	<string>29</string>
24
+	<string>31</string>
25
 	<key>LSBackgroundOnly</key>
25
 	<key>LSBackgroundOnly</key>
26
 	<true/>
26
 	<true/>
27
 	<key>LSMinimumSystemVersion</key>
27
 	<key>LSMinimumSystemVersion</key>

+ 1
- 1
RedditBar/AppDelegate.h View File

67
 -(void)readPMsCallback:(NSArray *)items;
67
 -(void)readPMsCallback:(NSArray *)items;
68
 -(void)singleItemReloadedCallback:(NSArray *)items;
68
 -(void)singleItemReloadedCallback:(NSArray *)items;
69
 
69
 
70
--(void)prefsDidSave;
70
+-(void)prefsDidSaveReload:(Boolean)shouldReload;
71
 
71
 
72
 @end
72
 @end

+ 8
- 6
RedditBar/AppDelegate.m View File

319
     [application orderFrontStandardAboutPanel:self];
319
     [application orderFrontStandardAboutPanel:self];
320
 }
320
 }
321
 
321
 
322
--(void)prefsDidSave {
322
+-(void)prefsDidSaveReload:(Boolean)shouldReload {
323
     [currentState savePreferences];
323
     [currentState savePreferences];
324
-    [firstMenuItem setTitle:NSLocalizedString(@"Loading...", nil)];
325
-    [self clearMenuItems];
326
-    [firstMenuItem setHidden:NO];
327
-    lastFullName = nil; // reload from start
328
-    [self reloadListWithOptions];
329
     [self recreateRefreshTimer];
324
     [self recreateRefreshTimer];
325
+    if (shouldReload) {
326
+        [firstMenuItem setTitle:NSLocalizedString(@"Loading...", nil)];
327
+        [self clearMenuItems];
328
+        [firstMenuItem setHidden:NO];
329
+        lastFullName = nil; // reload from start
330
+        [self reloadListWithOptions];
331
+    }
330
 }
332
 }
331
 
333
 
332
 @end
334
 @end

+ 1
- 1
RedditBar/BaconBar-Info.plist View File

21
 	<key>CFBundleSignature</key>
21
 	<key>CFBundleSignature</key>
22
 	<string>????</string>
22
 	<string>????</string>
23
 	<key>CFBundleVersion</key>
23
 	<key>CFBundleVersion</key>
24
-	<string>385</string>
24
+	<string>387</string>
25
 	<key>LSApplicationCategoryType</key>
25
 	<key>LSApplicationCategoryType</key>
26
 	<string>public.app-category.utilities</string>
26
 	<string>public.app-category.utilities</string>
27
 	<key>LSMinimumSystemVersion</key>
27
 	<key>LSMinimumSystemVersion</key>

+ 22
- 2
RedditBar/PrefController.m View File

164
     else
164
     else
165
         start = FALSE;
165
         start = FALSE;
166
     
166
     
167
+    NSArray *subredditsToUse = [subreddits.textStorage.string componentsSeparatedByString: @"\n"];
168
+    
169
+    Boolean changesRequireReload = FALSE;
170
+    if (![[username stringValue] isEqualToString:state.username])
171
+        changesRequireReload = TRUE;
172
+    if (![modhash isEqualToString:state.modhash])
173
+        changesRequireReload = TRUE;
174
+    if (subs != state.useSubscriptions)
175
+        changesRequireReload = TRUE;
176
+    if (subs && (![state.subreddits isEqualToArray:subredditsToUse]))
177
+        changesRequireReload = TRUE;
178
+    if ([lengthField integerValue] != state.length)
179
+        changesRequireReload = TRUE;
180
+    if (print != state.showSubreddit)
181
+        changesRequireReload = TRUE;
182
+    if ([titleField integerValue] != state.titleLength)
183
+        changesRequireReload = TRUE;
184
+    if (![[filterSelection titleOfSelectedItem] isEqualToString:state.filter])
185
+        changesRequireReload = TRUE;
186
+    
167
     state.username = username.stringValue;
187
     state.username = username.stringValue;
168
     state.modhash = modhash;
188
     state.modhash = modhash;
169
     state.useSubscriptions = subs;
189
     state.useSubscriptions = subs;
170
-    state.subreddits = [subreddits.textStorage.string componentsSeparatedByString: @"\n"];
190
+    state.subreddits = subredditsToUse;
171
     state.length = [lengthField integerValue];
191
     state.length = [lengthField integerValue];
172
     state.showSubreddit = print;
192
     state.showSubreddit = print;
173
     state.titleLength = [titleField integerValue];
193
     state.titleLength = [titleField integerValue];
176
     state.removeVisited = remove;
196
     state.removeVisited = remove;
177
     state.reloadAfterVisit = reload;
197
     state.reloadAfterVisit = reload;
178
     state.startOnLogin = start;
198
     state.startOnLogin = start;
179
-    [(AppDelegate *)parent prefsDidSave];
199
+    [(AppDelegate *)parent prefsDidSaveReload:changesRequireReload];
180
     [win performClose:self];
200
     [win performClose:self];
181
 }
201
 }
182
 
202
 

+ 1
- 0
web/index.html View File

70
                 <div class="panel-body">
70
                 <div class="panel-body">
71
                     <ul>
71
                     <ul>
72
                         <li>Can open BaconBar on login</li>
72
                         <li>Can open BaconBar on login</li>
73
+                        <li>When saving new Preferences, the list is only reloaded if needed</li>
73
                     </ul>
74
                     </ul>
74
                 </div>
75
                 </div>
75
             </div>
76
             </div>

Loading…
Cancel
Save