Merge branch 'master' into emojis
This commit is contained in:
commit
aee03a38c8
2 changed files with 31 additions and 19 deletions
34
src/app.rs
34
src/app.rs
|
@ -133,18 +133,7 @@ impl AppOp {
|
|||
};
|
||||
|
||||
if password != passconf {
|
||||
let window: gtk::Window = self.gtk_builder
|
||||
.get_object("main_window")
|
||||
.expect("Couldn't find main_window in ui file.");
|
||||
let dialog = gtk::MessageDialog::new(Some(&window),
|
||||
gtk::DIALOG_MODAL,
|
||||
gtk::MessageType::Warning,
|
||||
gtk::ButtonsType::Ok,
|
||||
"Passwords didn't match, try again");
|
||||
dialog.show();
|
||||
|
||||
dialog.connect_response(move |d, _| { d.destroy(); });
|
||||
|
||||
self.show_error("Passwords didn't match, try again");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -594,7 +583,10 @@ impl AppOp {
|
|||
|
||||
let name = m.get_alias();
|
||||
|
||||
store.insert_with_values(None, &[0, 1], &[&name, &(m.uid)]);
|
||||
// only show 200 members...
|
||||
if self.members.len() < 200 {
|
||||
store.insert_with_values(None, &[0, 1], &[&name, &(m.uid)]);
|
||||
}
|
||||
|
||||
self.members.insert(m.uid.clone(), m);
|
||||
}
|
||||
|
@ -988,6 +980,19 @@ impl AppOp {
|
|||
.expect("Can't find search_button_stack in ui file.")
|
||||
.set_visible_child_name("normal");
|
||||
}
|
||||
|
||||
pub fn show_error(&self, msg: &str) {
|
||||
let window: gtk::Window = self.gtk_builder
|
||||
.get_object("main_window")
|
||||
.expect("Couldn't find main_window in ui file.");
|
||||
let dialog = gtk::MessageDialog::new(Some(&window),
|
||||
gtk::DIALOG_MODAL,
|
||||
gtk::MessageType::Warning,
|
||||
gtk::ButtonsType::Ok,
|
||||
msg);
|
||||
dialog.show();
|
||||
dialog.connect_response(move |d, _| { d.destroy(); });
|
||||
}
|
||||
}
|
||||
|
||||
/// State for the main thread.
|
||||
|
@ -1136,6 +1141,9 @@ impl App {
|
|||
}
|
||||
|
||||
// errors
|
||||
Ok(BKResponse::LoginError(_)) => {
|
||||
theop.lock().unwrap().show_error("Can't login, try again");
|
||||
},
|
||||
Ok(BKResponse::SyncError(_)) => {
|
||||
println!("SYNC Error");
|
||||
theop.lock().unwrap().syncing = false;
|
||||
|
|
|
@ -354,12 +354,16 @@ impl Backend {
|
|||
let uid = String::from(r["user_id"].as_str().unwrap_or(""));
|
||||
let tk = String::from(r["access_token"].as_str().unwrap_or(""));
|
||||
|
||||
data.lock().unwrap().user_id = uid.clone();
|
||||
data.lock().unwrap().access_token = tk.clone();
|
||||
data.lock().unwrap().since = String::from("");
|
||||
data.lock().unwrap().msgs_batch_end = String::from("");
|
||||
data.lock().unwrap().msgs_batch_start = String::from("");
|
||||
tx.send(BKResponse::Token(uid, tk)).unwrap();
|
||||
if uid.is_empty() || tk.is_empty() {
|
||||
tx.send(BKResponse::LoginError(Error::BackendError)).unwrap();
|
||||
} else {
|
||||
data.lock().unwrap().user_id = uid.clone();
|
||||
data.lock().unwrap().access_token = tk.clone();
|
||||
data.lock().unwrap().since = String::from("");
|
||||
data.lock().unwrap().msgs_batch_end = String::from("");
|
||||
data.lock().unwrap().msgs_batch_start = String::from("");
|
||||
tx.send(BKResponse::Token(uid, tk)).unwrap();
|
||||
}
|
||||
},
|
||||
|err| { tx.send(BKResponse::LoginError(err)).unwrap() }
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue