feat(AttachmentsPage): mark media as sensitive

This commit is contained in:
Evangelos Paterakis 2023-02-19 17:57:55 +02:00
parent beff68c681
commit cba8078930
No known key found for this signature in database
GPG Key ID: FE5185F095BFC8C9
4 changed files with 29 additions and 2 deletions

View File

@ -48,6 +48,8 @@
<file preprocess="xml-stripblanks">icons/scalable/actions/tooth-minus-large-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/scalable/actions/tooth-cross-large-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/scalable/actions/tooth-address-book-new-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/scalable/actions/tooth-eye-open-negative-filled-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/scalable/actions/tooth-eye-not-looking-symbolic.svg</file>
<file>gtk/dropdown/icon.ui</file>
<file>gtk/dropdown/full.ui</file>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 13.980469 1.988281 c -0.261719 0.007813 -0.507813 0.117188 -0.6875 0.304688 l -0.984375 0.984375 c -1.285156 -0.828125 -2.78125 -1.273438 -4.308594 -1.277344 c -3.648438 0.003906 -6.832031 2.476562 -7.738281 6.011719 c 0.460937 1.746093 1.496093 3.285156 2.945312 4.371093 l -0.914062 0.910157 c -0.261719 0.25 -0.367188 0.625 -0.273438 0.972656 c 0.089844 0.351563 0.363281 0.625 0.714844 0.714844 c 0.347656 0.09375 0.722656 -0.011719 0.972656 -0.273438 l 11 -11 c 0.296875 -0.289062 0.382813 -0.726562 0.222657 -1.105469 c -0.160157 -0.382812 -0.535157 -0.625 -0.949219 -0.613281 z m -5.980469 2.011719 c 0.960938 0 1.886719 0.347656 2.613281 0.976562 l -1.421875 1.417969 c -0.34375 -0.257812 -0.761718 -0.394531 -1.191406 -0.394531 c -1.105469 0 -2 0.894531 -2 2 c 0 0.429688 0.140625 0.847656 0.394531 1.1875 l -1.417969 1.421875 c -0.628906 -0.726563 -0.972656 -1.652344 -0.976562 -2.609375 c 0 -2.210938 1.789062 -4 4 -4 z m 7.03125 2.207031 l -3.34375 3.34375 c -0.40625 0.960938 -1.171875 1.722657 -2.128906 2.128907 l -2.277344 2.277343 c 0.238281 0.027344 0.476562 0.039063 0.71875 0.042969 c 3.648438 -0.003906 6.832031 -2.476562 7.738281 -6.011719 c -0.164062 -0.617187 -0.402343 -1.214843 -0.707031 -1.78125 z m -7.53125 0.792969 c 0.277344 0 0.5 0.222656 0.5 0.5 s -0.222656 0.5 -0.5 0.5 s -0.5 -0.222656 -0.5 -0.5 s 0.222656 -0.5 0.5 -0.5 z m 0 0" fill="#222222"/></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#222222"><path d="m 8 2 c -3.648438 0.003906 -6.832031 2.476562 -7.738281 6.007812 c 0.914062 3.527344 4.097656 5.988282 7.738281 5.992188 c 3.648438 -0.003906 6.832031 -2.476562 7.738281 -6.011719 c -0.914062 -3.523437 -4.097656 -5.984375 -7.738281 -5.988281 z m 0 2 c 2.210938 0 4 1.789062 4 4 s -1.789062 4 -4 4 s -4 -1.789062 -4 -4 s 1.789062 -4 4 -4 z m 0 0"/><path d="m 10 8 c 0 1.105469 -0.894531 2 -2 2 s -2 -0.894531 -2 -2 s 0.894531 -2 2 -2 s 2 0.894531 2 2 z m 0 0"/></g></svg>

After

Width:  |  Height:  |  Size: 624 B

View File

@ -32,6 +32,7 @@ public class Tooth.AttachmentsPage : ComposerPage {
public GLib.ListStore attachments;
public Adw.ToastOverlay toast_overlay;
public bool can_publish { get; set; default = false; }
public bool media_sensitive { get; set; default = false; }
public AttachmentsPage () {
Object (
@ -75,12 +76,28 @@ public class Tooth.AttachmentsPage : ComposerPage {
icon_name = "tooth-plus-large-symbolic",
valign = Gtk.Align.CENTER,
halign = Gtk.Align.CENTER,
tooltip_text = _("Add Media")
tooltip_text = _("Add Media"),
css_classes = {"flat"}
};
add_media_action_button.add_css_class ("flat");
add_media_action_button.clicked.connect(show_file_selector);
var sensitive_media_button = new Gtk.ToggleButton() {
icon_name = "tooth-eye-open-negative-filled-symbolic",
valign = Gtk.Align.CENTER,
halign = Gtk.Align.CENTER,
tooltip_text = _("Mark media as sensitive"),
css_classes = {"flat"}
};
sensitive_media_button.bind_property ("active", this, "media_sensitive", GLib.BindingFlags.SYNC_CREATE, (b, src, ref target) => {
var sensitive_media_button_active = src.get_boolean ();
target.set_boolean (sensitive_media_button_active);
sensitive_media_button.icon_name = sensitive_media_button_active ? "tooth-eye-not-looking-symbolic" : "tooth-eye-open-negative-filled-symbolic";
sensitive_media_button.tooltip_text = sensitive_media_button_active ? _("Unmark media as sensitive") : _("Mark media as sensitive");
return true;
});
bottom_bar.pack_start (add_media_action_button);
bottom_bar.pack_start (sensitive_media_button);
// State stack
stack = new Adw.ViewStack ();
@ -215,6 +232,10 @@ public class Tooth.AttachmentsPage : ComposerPage {
var attachment = attachments.get_item (i) as API.Attachment;
req.with_form_data ("media_ids[]", attachment.id);
}
if (media_sensitive) {
req.with_form_data ("sensitive", "true");
}
}
}
}