aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2008-11-18 01:46:48 +0000
committerrowanbeentje <rowan@beent.je>2008-11-18 01:46:48 +0000
commit862396873ddb3d4017a5ab323ae0be6bded755b8 (patch)
tree3a956b9e124e6f987c2e57435c097ae3a9a4f97f
parent4db467b061a83103c78cef1d86405f92e2b13ce2 (diff)
downloadsequelpro-862396873ddb3d4017a5ab323ae0be6bded755b8.tar.gz
sequelpro-862396873ddb3d4017a5ab323ae0be6bded755b8.tar.bz2
sequelpro-862396873ddb3d4017a5ab323ae0be6bded755b8.zip
Add support for marking the content for a required refresh on structure changes. Implemented by adding a method to TablesList (setContentRequiresReload) and using it when modifying the tble structure, thus only refreshing if the content is actually viewed again.
-rw-r--r--TableSource.m13
-rw-r--r--TablesList.h3
-rw-r--r--TablesList.m10
3 files changed, 26 insertions, 0 deletions
diff --git a/TableSource.m b/TableSource.m
index d43b83c5..9259a0b4 100644
--- a/TableSource.m
+++ b/TableSource.m
@@ -383,6 +383,9 @@ opens alertsheet and asks for confirmation
[tableType retain];
// [[NSNotificationCenter defaultCenter] postNotificationName:@"SelectedTableStatusHasChanged" object:self];
+
+ // Mark the content table for refresh
+ [tablesListInstance setContentRequiresReload];
} else {
[sender selectItemWithTitle:tableType];
NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
@@ -642,6 +645,10 @@ returns YES if no row is beeing edited and nothing has to be written to db
isEditingRow = NO;
isEditingNewRow = NO;
[self loadTable:selectedTable];
+
+ // Mark the content table for refresh
+ [tablesListInstance setContentRequiresReload];
+
return YES;
} else {
alertSheetOpened = YES;
@@ -694,6 +701,9 @@ returns YES if no row is beeing edited and nothing has to be written to db
if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
[self loadTable:selectedTable];
+
+ // Mark the content table for refresh
+ [tablesListInstance setContentRequiresReload];
} else {
NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
[NSString stringWithFormat:NSLocalizedString(@"Couldn't remove field %@.\nMySQL said: %@", @"message of panel when field cannot be removed"),
@@ -913,6 +923,9 @@ Having validated a drop, perform the field/column reordering to match.
[[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
+ // Mark the content table for refresh
+ [tablesListInstance setContentRequiresReload];
+
return YES;
}
diff --git a/TablesList.h b/TablesList.h
index 9a59de88..bc360434 100644
--- a/TablesList.h
+++ b/TablesList.h
@@ -73,6 +73,9 @@
- (BOOL)contentLoaded;
- (BOOL)statusLoaded;
+// Setter methods
+- (void)setContentRequiresReload;
+
//tableView datasource methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id)tableView:(NSTableView *)aTableView
diff --git a/TablesList.m b/TablesList.m
index 0cad02c5..270cd49b 100644
--- a/TablesList.m
+++ b/TablesList.m
@@ -341,6 +341,16 @@ returns YES if table status has already been loaded
return statusLoaded;
}
+#pragma mark Setter methods
+
+/*
+Mark the content table for refresh when it's next switched to
+*/
+- (void)setContentRequiresReload
+{
+ contentLoaded = NO;
+}
+
#pragma mark Datasource methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView