Add gtk separators
This commit is contained in:
parent
ff76376aad
commit
c404f4ab65
|
@ -15,13 +15,6 @@
|
||||||
background:none;
|
background:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status{
|
|
||||||
border-bottom: 1px solid #cecece;
|
|
||||||
}
|
|
||||||
.status:last-child{
|
|
||||||
border-bottom:none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toot-text{
|
.toot-text{
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@ public class Tootle.HomeView : Tootle.AbstractView {
|
||||||
base (true);
|
base (true);
|
||||||
this.timeline = timeline;
|
this.timeline = timeline;
|
||||||
this.pars = pars;
|
this.pars = pars;
|
||||||
|
|
||||||
show_all();
|
show_all();
|
||||||
|
|
||||||
|
view.remove.connect (on_remove);
|
||||||
AccountManager.instance.changed_current.connect(on_account_changed);
|
AccountManager.instance.changed_current.connect(on_account_changed);
|
||||||
|
|
||||||
// var s = new Status(1);
|
// var s = new Status(1);
|
||||||
|
@ -45,11 +45,23 @@ public class Tootle.HomeView : Tootle.AbstractView {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void prepend(Status status){ //TODO: clear all on account switch
|
public void prepend(Status status){ //TODO: clear all on account switch
|
||||||
|
var separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL);
|
||||||
|
separator.show ();
|
||||||
|
|
||||||
var widget = new StatusWidget(status);
|
var widget = new StatusWidget(status);
|
||||||
|
widget.separator = separator;
|
||||||
widget.rebind (status);
|
widget.rebind (status);
|
||||||
|
view.pack_start(separator, false, false, 0);
|
||||||
view.pack_start(widget, false, false, 0);
|
view.pack_start(widget, false, false, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void on_remove (Widget widget){
|
||||||
|
if (!(widget is StatusWidget))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//debug ("removed");
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void on_account_changed (Account? account){
|
public virtual void on_account_changed (Account? account){
|
||||||
if(account == null)
|
if(account == null)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -23,6 +23,7 @@ public class Tootle.NotificationsView : Tootle.AbstractView {
|
||||||
base (true);
|
base (true);
|
||||||
show_all();
|
show_all();
|
||||||
|
|
||||||
|
view.remove.connect (on_remove);
|
||||||
AccountManager.instance.changed_current.connect(on_account_changed);
|
AccountManager.instance.changed_current.connect(on_account_changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,11 +36,23 @@ public class Tootle.NotificationsView : Tootle.AbstractView {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void prepend(Notification notification){
|
public void prepend(Notification notification){
|
||||||
|
var separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL);
|
||||||
|
separator.show ();
|
||||||
|
|
||||||
var widget = new NotificationWidget(notification);
|
var widget = new NotificationWidget(notification);
|
||||||
|
widget.separator = separator;
|
||||||
|
view.pack_start(separator, false, false, 0);
|
||||||
view.pack_start(widget, false, false, 0);
|
view.pack_start(widget, false, false, 0);
|
||||||
image.icon_name = "notification-new-symbolic";
|
image.icon_name = "notification-new-symbolic";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void on_remove (Widget widget){
|
||||||
|
if (!(widget is NotificationWidget))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//debug ("removed");
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void on_account_changed (Account? account){
|
public virtual void on_account_changed (Account? account){
|
||||||
if(account == null)
|
if(account == null)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -5,9 +5,10 @@ public class Tootle.NotificationWidget : Gtk.Grid {
|
||||||
|
|
||||||
public Notification notification;
|
public Notification notification;
|
||||||
|
|
||||||
|
public Gtk.Separator? separator;
|
||||||
private Gtk.Image image;
|
private Gtk.Image image;
|
||||||
private Gtk.Label label;
|
private Gtk.Label label;
|
||||||
private Gtk.Button dismiss;
|
private Gtk.Button dismiss_button;
|
||||||
private StatusWidget? status_widget;
|
private StatusWidget? status_widget;
|
||||||
|
|
||||||
construct {
|
construct {
|
||||||
|
@ -20,17 +21,17 @@ public class Tootle.NotificationWidget : Gtk.Grid {
|
||||||
label.hexpand = true;
|
label.hexpand = true;
|
||||||
label.halign = Gtk.Align.START;
|
label.halign = Gtk.Align.START;
|
||||||
label.use_markup = true;
|
label.use_markup = true;
|
||||||
dismiss = new Gtk.Button.from_icon_name ("close-symbolic", Gtk.IconSize.SMALL_TOOLBAR);
|
dismiss_button = new Gtk.Button.from_icon_name ("close-symbolic", Gtk.IconSize.SMALL_TOOLBAR);
|
||||||
dismiss.tooltip_text = _("Dismiss");
|
dismiss_button.tooltip_text = _("Dismiss");
|
||||||
dismiss.clicked.connect (() => {
|
dismiss_button.clicked.connect (() => {
|
||||||
var parent = this.get_parent () as Gtk.Box;
|
var parent = this.get_parent () as Gtk.Box;
|
||||||
parent.remove (this);
|
parent.remove (this);
|
||||||
dismiss_notification (this.notification);
|
//dismiss (this.notification);
|
||||||
});
|
});
|
||||||
|
|
||||||
attach(image, 0, 0, 1, 1);
|
attach(image, 1, 2);
|
||||||
attach(label, 1, 0, 1, 1);
|
attach(label, 2, 2);
|
||||||
attach(dismiss, 2, 0, 1, 1);
|
attach(dismiss_button, 3, 2);
|
||||||
show_all();
|
show_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,11 +44,16 @@ public class Tootle.NotificationWidget : Gtk.Grid {
|
||||||
if (notification.status != null){
|
if (notification.status != null){
|
||||||
status_widget = new StatusWidget (this.notification.status);
|
status_widget = new StatusWidget (this.notification.status);
|
||||||
status_widget.rebind (this.notification.status);
|
status_widget.rebind (this.notification.status);
|
||||||
attach(status_widget, 0, 1, 3, 1);
|
attach(status_widget, 1, 3, 3, 1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Soup.Message dismiss_notification (Notification notification){
|
destroy.connect (() => {
|
||||||
|
if(separator != null)
|
||||||
|
separator.destroy ();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Soup.Message dismiss (Notification notification){
|
||||||
var url = Settings.instance.instance_url;
|
var url = Settings.instance.instance_url;
|
||||||
url += "api/v1/notifications/dismiss";
|
url += "api/v1/notifications/dismiss";
|
||||||
url += "?id=" + notification.id.to_string ();
|
url += "?id=" + notification.id.to_string ();
|
||||||
|
|
|
@ -5,6 +5,7 @@ public class Tootle.StatusWidget : Gtk.Grid {
|
||||||
|
|
||||||
public Status status;
|
public Status status;
|
||||||
|
|
||||||
|
public Gtk.Separator? separator;
|
||||||
public Granite.Widgets.Avatar avatar;
|
public Granite.Widgets.Avatar avatar;
|
||||||
Gtk.Label user;
|
Gtk.Label user;
|
||||||
Gtk.Label content;
|
Gtk.Label content;
|
||||||
|
@ -59,16 +60,21 @@ public class Tootle.StatusWidget : Gtk.Grid {
|
||||||
counters.add(favorites);
|
counters.add(favorites);
|
||||||
counters.show_all ();
|
counters.show_all ();
|
||||||
|
|
||||||
attach(avatar, 0, 0, 1, 3);
|
attach(avatar, 1, 0, 1, 3);
|
||||||
attach(user, 1, 1, 1, 1);
|
attach(user, 2, 1, 1, 1);
|
||||||
attach(content, 1, 2, 1, 1);
|
attach(content, 2, 2, 1, 1);
|
||||||
attach(counters, 1, 3, 1, 1);
|
attach(counters, 2, 3, 1, 1);
|
||||||
show_all(); //TODO: display conversations
|
show_all(); //TODO: display conversations
|
||||||
}
|
}
|
||||||
|
|
||||||
public StatusWidget (Status status) {
|
public StatusWidget (Status status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
get_style_context ().add_class ("status");
|
get_style_context ().add_class ("status");
|
||||||
|
|
||||||
|
destroy.connect (() => {
|
||||||
|
if(separator != null)
|
||||||
|
separator.destroy ();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rebind (Status status = this.status){
|
public void rebind (Status status = this.status){
|
||||||
|
|
Loading…
Reference in New Issue