Bladeren bron

Only reload list after saving if necessary.

Thomas Buck 11 jaren geleden
bovenliggende
commit
716a3809f6

+ 1
- 1
BaconBarHelper/BaconBarHelper-Info.plist Bestand weergeven

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

+ 1
- 1
RedditBar/AppDelegate.h Bestand weergeven

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

+ 8
- 6
RedditBar/AppDelegate.m Bestand weergeven

@@ -319,14 +319,16 @@ NSInteger numberOfStaticMenuItems = 10;
319 319
     [application orderFrontStandardAboutPanel:self];
320 320
 }
321 321
 
322
--(void)prefsDidSave {
322
+-(void)prefsDidSaveReload:(Boolean)shouldReload {
323 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 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 334
 @end

+ 1
- 1
RedditBar/BaconBar-Info.plist Bestand weergeven

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

+ 22
- 2
RedditBar/PrefController.m Bestand weergeven

@@ -164,10 +164,30 @@ NSString *subredditCharacters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRST
164 164
     else
165 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 187
     state.username = username.stringValue;
168 188
     state.modhash = modhash;
169 189
     state.useSubscriptions = subs;
170
-    state.subreddits = [subreddits.textStorage.string componentsSeparatedByString: @"\n"];
190
+    state.subreddits = subredditsToUse;
171 191
     state.length = [lengthField integerValue];
172 192
     state.showSubreddit = print;
173 193
     state.titleLength = [titleField integerValue];
@@ -176,7 +196,7 @@ NSString *subredditCharacters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRST
176 196
     state.removeVisited = remove;
177 197
     state.reloadAfterVisit = reload;
178 198
     state.startOnLogin = start;
179
-    [(AppDelegate *)parent prefsDidSave];
199
+    [(AppDelegate *)parent prefsDidSaveReload:changesRequireReload];
180 200
     [win performClose:self];
181 201
 }
182 202
 

+ 1
- 0
web/index.html Bestand weergeven

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

Laden…
Annuleren
Opslaan