If Folder's display name changes, signal so UI can update
Noticed this while working on Gtk.HeaderBar patch, that if the display name changes it won't be reflected in the UI. Conflicts: src/client/components/main-window.vala src/engine/abstract/geary-abstract-folder.vala
This commit is contained in:
parent
546e97bfa5
commit
85d887248d
3 changed files with 31 additions and 7 deletions
|
|
@ -14,11 +14,13 @@ public class FolderList.FolderEntry : FolderList.AbstractFolderEntry, Sidebar.In
|
|||
has_new = false;
|
||||
folder.properties.notify[Geary.FolderProperties.PROP_NAME_EMAIL_TOTAL].connect(on_counts_changed);
|
||||
folder.properties.notify[Geary.FolderProperties.PROP_NAME_EMAIL_UNREAD].connect(on_counts_changed);
|
||||
folder.display_name_changed.connect(on_display_name_changed);
|
||||
}
|
||||
|
||||
~FolderEntry() {
|
||||
folder.properties.notify[Geary.FolderProperties.PROP_NAME_EMAIL_TOTAL].disconnect(on_counts_changed);
|
||||
folder.properties.notify[Geary.FolderProperties.PROP_NAME_EMAIL_UNREAD].disconnect(on_counts_changed);
|
||||
folder.display_name_changed.disconnect(on_display_name_changed);
|
||||
}
|
||||
|
||||
public override string get_sidebar_name() {
|
||||
|
|
@ -118,6 +120,10 @@ public class FolderList.FolderEntry : FolderList.AbstractFolderEntry, Sidebar.In
|
|||
sidebar_tooltip_changed(get_sidebar_tooltip());
|
||||
}
|
||||
|
||||
private void on_display_name_changed() {
|
||||
sidebar_name_changed(folder.get_display_name());
|
||||
}
|
||||
|
||||
public override int get_count() {
|
||||
if (folder.special_folder_type == Geary.SpecialFolderType.DRAFTS ||
|
||||
folder.special_folder_type == Geary.SpecialFolderType.OUTBOX)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,14 @@
|
|||
public abstract class Geary.AbstractFolder : BaseObject, Geary.Folder {
|
||||
public Geary.ProgressMonitor opening_monitor { get; protected set; }
|
||||
|
||||
public abstract Geary.Account account { get; }
|
||||
|
||||
public abstract Geary.FolderProperties properties { get; }
|
||||
|
||||
public abstract Geary.FolderPath path { get; }
|
||||
|
||||
public abstract Geary.SpecialFolderType special_folder_type { get; }
|
||||
|
||||
/*
|
||||
* notify_* methods for AbstractFolder are marked internal because the SendReplayOperations
|
||||
* need access to them to report changes as they occur.
|
||||
|
|
@ -60,15 +68,16 @@ public abstract class Geary.AbstractFolder : BaseObject, Geary.Folder {
|
|||
internal virtual void notify_special_folder_type_changed(Geary.SpecialFolderType old_type,
|
||||
Geary.SpecialFolderType new_type) {
|
||||
special_folder_type_changed(old_type, new_type);
|
||||
|
||||
// in default implementation, this may also mean the display name changed; subclasses may
|
||||
// override this behavior, but no way to detect this, so notify
|
||||
if (special_folder_type != Geary.SpecialFolderType.NONE)
|
||||
notify_display_name_changed();
|
||||
}
|
||||
|
||||
public abstract Geary.Account account { get; }
|
||||
|
||||
public abstract Geary.FolderProperties properties { get; }
|
||||
|
||||
public abstract Geary.FolderPath path { get; }
|
||||
|
||||
public abstract Geary.SpecialFolderType special_folder_type { get; }
|
||||
internal virtual void notify_display_name_changed() {
|
||||
display_name_changed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Default is to display the basename of the Folder's path.
|
||||
|
|
|
|||
|
|
@ -282,6 +282,13 @@ public interface Geary.Folder : BaseObject {
|
|||
public signal void special_folder_type_changed(Geary.SpecialFolderType old_type,
|
||||
Geary.SpecialFolderType new_type);
|
||||
|
||||
/**
|
||||
* Fired when the Folder's display name has changed.
|
||||
*
|
||||
* @see get_display_name
|
||||
*/
|
||||
public signal void display_name_changed();
|
||||
|
||||
protected abstract void notify_opened(OpenState state, int count);
|
||||
|
||||
protected abstract void notify_open_failed(OpenFailed failure, Error? err);
|
||||
|
|
@ -308,6 +315,8 @@ public interface Geary.Folder : BaseObject {
|
|||
protected abstract void notify_special_folder_type_changed(Geary.SpecialFolderType old_type,
|
||||
Geary.SpecialFolderType new_type);
|
||||
|
||||
protected abstract void notify_display_name_changed();
|
||||
|
||||
/**
|
||||
* Returns a name suitable for displaying to the user.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue