diff --git a/src/API/Entity.vala b/src/API/Entity.vala index 5046ad7b8..2477bedf7 100644 --- a/src/API/Entity.vala +++ b/src/API/Entity.vala @@ -1,5 +1,3 @@ -using Json; - public class Tuba.Entity : GLib.Object, Widgetizable, Json.Serializable { public virtual bool is_local (InstanceAccount account) { @@ -164,7 +162,7 @@ public class Tuba.Entity : GLib.Object, Widgetizable, Json.Serializable { static Json.Node ser_list (string prop, Value val, ParamSpec spec) { var list = (Gee.ArrayList) val; if (list == null) - return new Json.Node (NodeType.NULL); + return new Json.Node (Json.NodeType.NULL); var arr = new Json.Array (); list.@foreach (e => { @@ -173,7 +171,7 @@ public class Tuba.Entity : GLib.Object, Widgetizable, Json.Serializable { return true; }); - var node = new Json.Node (NodeType.ARRAY); + var node = new Json.Node (Json.NodeType.ARRAY); node.set_array (arr); return node; } diff --git a/src/API/List.vala b/src/API/List.vala index 8192fb2a6..89592811c 100644 --- a/src/API/List.vala +++ b/src/API/List.vala @@ -1,7 +1,4 @@ -using Gtk; - public class Tuba.API.List : Entity, Widgetizable { - public string id { get; set; } public string title { get; set; } public string? replies_policy { get; set; default = null; } diff --git a/src/API/Poll.vala b/src/API/Poll.vala index 7eab52bfd..261499a81 100644 --- a/src/API/Poll.vala +++ b/src/API/Poll.vala @@ -1,6 +1,3 @@ -using Gee; -using Json; - public class Tuba.API.Poll : GLib.Object, Json.Serializable { public string id { get; set; } public string expires_at { get; set; } @@ -8,8 +5,8 @@ public class Tuba.API.Poll : GLib.Object, Json.Serializable { public bool multiple { get; set; } public int64 votes_count { get; set; } public bool voted { get; set; default = true;} - public ArrayList own_votes { get; set; } - public ArrayList? options { get; set; default = null; } + public Gee.ArrayList own_votes { get; set; } + public Gee.ArrayList? options { get; set; default = null; } public Poll (string _id) { id = _id; @@ -49,8 +46,8 @@ public class Tuba.API.Poll : GLib.Object, Json.Serializable { } public static Request vote ( InstanceAccount acc, - ArrayList options, - ArrayList selection, + Gee.ArrayList options, + Gee.ArrayList selection, string id ) { message (@"Voting poll $(id)…"); diff --git a/src/API/SearchResults.vala b/src/API/SearchResults.vala index 19a9c885a..24e38c54b 100644 --- a/src/API/SearchResults.vala +++ b/src/API/SearchResults.vala @@ -1,10 +1,8 @@ -using Gee; - public class Tuba.API.SearchResults : Entity { - public ArrayList accounts { get; set; } - public ArrayList statuses { get; set; } - public ArrayList hashtags { get; set; } + public Gee.ArrayList accounts { get; set; } + public Gee.ArrayList statuses { get; set; } + public Gee.ArrayList hashtags { get; set; } public static SearchResults from (Json.Node node) throws Error { return Entity.from_json (typeof (SearchResults), node) as SearchResults; diff --git a/src/API/Status.vala b/src/API/Status.vala index b155b6355..8a1b40676 100644 --- a/src/API/Status.vala +++ b/src/API/Status.vala @@ -1,5 +1,3 @@ -using Gee; - public class Tuba.API.Status : Entity, Widgetizable { ~Status () { @@ -29,11 +27,11 @@ public class Tuba.API.Status : Entity, Widgetizable { public API.Status? reblog { get; set; default = null; } public API.Status? quote { get; set; default = null; } // public API.Akkoma? akkoma { get; set; default = null; } - public ArrayList? mentions { get; set; default = null; } - public ArrayList? reactions { get; set; default = null; } - public ArrayList? emoji_reactions { get; set; default = null; } + public Gee.ArrayList? mentions { get; set; default = null; } + public Gee.ArrayList? reactions { get; set; default = null; } + public Gee.ArrayList? emoji_reactions { get; set; default = null; } public API.Pleroma.Status? pleroma { get; set; default = null; } - public ArrayList? media_attachments { get; set; default = null; } + public Gee.ArrayList? media_attachments { get; set; default = null; } public API.Poll? poll { get; set; default = null; } public Gee.ArrayList? emojis { get; set; } public API.PreviewCard? card { get; set; default = null; } @@ -76,7 +74,7 @@ public class Tuba.API.Status : Entity, Widgetizable { return res; } - public ArrayList? compat_status_reactions { + public Gee.ArrayList? compat_status_reactions { get { if (emoji_reactions != null) { return emoji_reactions; diff --git a/src/API/Tag.vala b/src/API/Tag.vala index 2ba01de34..1f24304a7 100644 --- a/src/API/Tag.vala +++ b/src/API/Tag.vala @@ -1,5 +1,3 @@ -using Gtk; - public class Tuba.API.Tag : Entity, Widgetizable { public string name { get; set; } @@ -35,7 +33,7 @@ public class Tuba.API.Tag : Entity, Widgetizable { return _("%d per week").printf (used_times); } - public override Widget to_widget () { + public override Gtk.Widget to_widget () { var w = new Adw.ActionRow () { title = @"#$name", activatable = true diff --git a/src/Application.vala b/src/Application.vala index 283c01459..33e8df271 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -1,5 +1,3 @@ -using Gtk; - namespace Tuba { public errordomain Oopsie { USER, @@ -293,7 +291,7 @@ namespace Tuba { application_name = Build.NAME, version = Build.VERSION, support_url = Build.SUPPORT_WEBSITE, - license_type = License.GPL_3_0_ONLY, + license_type = Gtk.License.GPL_3_0_ONLY, copyright = COPYRIGHT, developers = DEVELOPERS, artists = ARTISTS, diff --git a/src/Dialogs/Composer/AttachmentsPage.vala b/src/Dialogs/Composer/AttachmentsPage.vala index 9d705778c..f669c69d5 100644 --- a/src/Dialogs/Composer/AttachmentsPage.vala +++ b/src/Dialogs/Composer/AttachmentsPage.vala @@ -1,5 +1,3 @@ -using Gtk; - public class Tuba.AttachmentsPage : ComposerPage { ~AttachmentsPage () { context_menu.unparent (); @@ -36,7 +34,7 @@ public class Tuba.AttachmentsPage : ComposerPage { public GLib.ListStore attachments; public Adw.ToastOverlay toast_overlay; public bool media_sensitive { get; set; default = false; } - private FileFilter filter = new FileFilter () { + private Gtk.FileFilter filter = new Gtk.FileFilter () { name = _("All Supported Files") }; private Gee.ArrayList supported_mimes = new Gee.ArrayList.wrap (SUPPORTED_MIMES); @@ -52,7 +50,7 @@ public class Tuba.AttachmentsPage : ComposerPage { } } - protected PopoverMenu context_menu { get; set; } + protected Gtk.PopoverMenu context_menu { get; set; } private const GLib.ActionEntry[] ACTION_ENTRIES = { {"paste-from-clipboard", on_clipboard_paste} }; @@ -77,7 +75,7 @@ public class Tuba.AttachmentsPage : ComposerPage { var menu_model = new GLib.Menu (); menu_model.append (_("Paste"), "attachmentspage.paste-from-clipboard"); - context_menu = new PopoverMenu.from_model (menu_model); + context_menu = new Gtk.PopoverMenu.from_model (menu_model); context_menu.set_parent (this); var dnd_controller = new Gtk.DropTarget (typeof (Gdk.FileList), Gdk.DragAction.COPY); @@ -105,13 +103,13 @@ public class Tuba.AttachmentsPage : ComposerPage { private void on_click (int n_press, double x, double y) { if (!show_context_menu (x, y)) return; - click_controller.set_state (EventSequenceState.CLAIMED); + click_controller.set_state (Gtk.EventSequenceState.CLAIMED); } private void on_long_press (double x, double y) { if (!show_context_menu (x, y)) return; - long_press_controller.set_state (EventSequenceState.CLAIMED); + long_press_controller.set_state (Gtk.EventSequenceState.CLAIMED); } private bool show_context_menu (double x, double y) { @@ -207,7 +205,7 @@ public class Tuba.AttachmentsPage : ComposerPage { protected Adw.ViewStack stack; protected Adw.StatusPage empty_state; - protected ListBox list; + protected Gtk.ListBox list; protected Gtk.Button add_media_action_button; public override void dispose () { @@ -219,8 +217,8 @@ public class Tuba.AttachmentsPage : ComposerPage { public override void on_build () { base.on_build (); - var attach_button = new Button.with_label (_("Add Media")) { - halign = Align.CENTER, + var attach_button = new Gtk.Button.with_label (_("Add Media")) { + halign = Gtk.Align.CENTER, sensitive = accounts.active.instance_info.compat_status_max_media_attachments > 0, // Empty state css_classes = { "pill" } @@ -236,8 +234,8 @@ public class Tuba.AttachmentsPage : ComposerPage { }; // Non-empty state - list = new ListBox () { - selection_mode = SelectionMode.NONE + list = new Gtk.ListBox () { + selection_mode = Gtk.SelectionMode.NONE }; list.bind_model (attachments, on_create_list_item); @@ -312,7 +310,7 @@ public class Tuba.AttachmentsPage : ComposerPage { on_attachments_changed (); } - Widget on_create_list_item (Object item) { + Gtk.Widget on_create_list_item (Object item) { var attachment = item as API.Attachment; var attachment_widget = new AttachmentsPageAttachment ( attachment.id, @@ -368,7 +366,7 @@ public class Tuba.AttachmentsPage : ComposerPage { } void show_file_selector () { - var chooser = new FileDialog () { + var chooser = new Gtk.FileDialog () { // translators: Open file title = _("Open"), modal = true, diff --git a/src/Dialogs/Composer/Completion/CompletionProvider.vala b/src/Dialogs/Composer/Completion/CompletionProvider.vala index cab9e7918..88dc1cdcc 100644 --- a/src/Dialogs/Composer/Completion/CompletionProvider.vala +++ b/src/Dialogs/Composer/Completion/CompletionProvider.vala @@ -1,5 +1,3 @@ -using Gtk; - public abstract class Tuba.CompletionProvider: Object, GtkSource.CompletionProvider { public static GLib.ListStore EMPTY = new GLib.ListStore (typeof (Object)); // vala-lint=naming-convention @@ -35,8 +33,8 @@ public abstract class Tuba.CompletionProvider: Object, GtkSource.CompletionProvi } public virtual void activate (GtkSource.CompletionContext context, GtkSource.CompletionProposal proposal) { - TextIter start; - TextIter end; + Gtk.TextIter start; + Gtk.TextIter end; context.get_bounds (out start, out end); var buffer = start.get_buffer (); @@ -58,7 +56,7 @@ public abstract class Tuba.CompletionProvider: Object, GtkSource.CompletionProvi // If it's not capturing, // check if the character before the word // is the trigger - TextIter start; + Gtk.TextIter start; context.get_bounds (out start, null); if (start.backward_char ()) is_trigger (start, start.get_char ()); diff --git a/src/Dialogs/Composer/Completion/EmojiProvider.vala b/src/Dialogs/Composer/Completion/EmojiProvider.vala index b7e900c01..ba04456aa 100644 --- a/src/Dialogs/Composer/Completion/EmojiProvider.vala +++ b/src/Dialogs/Composer/Completion/EmojiProvider.vala @@ -1,5 +1,3 @@ -using Gtk; - public class Tuba.EmojiProvider: Tuba.CompletionProvider { public EmojiProvider () { diff --git a/src/Dialogs/Composer/Completion/HandleProvider.vala b/src/Dialogs/Composer/Completion/HandleProvider.vala index bee8feb62..051751a14 100644 --- a/src/Dialogs/Composer/Completion/HandleProvider.vala +++ b/src/Dialogs/Composer/Completion/HandleProvider.vala @@ -1,5 +1,3 @@ -using Gtk; - public class Tuba.HandleProvider: Tuba.CompletionProvider { public HandleProvider () { diff --git a/src/Dialogs/Composer/Completion/HashtagProvider.vala b/src/Dialogs/Composer/Completion/HashtagProvider.vala index f3b84cfd7..de798d23e 100644 --- a/src/Dialogs/Composer/Completion/HashtagProvider.vala +++ b/src/Dialogs/Composer/Completion/HashtagProvider.vala @@ -1,5 +1,3 @@ -using Gtk; - public class Tuba.HashtagProvider: Tuba.CompletionProvider { public HashtagProvider () { diff --git a/src/Dialogs/Composer/Dialog.vala b/src/Dialogs/Composer/Dialog.vala index af622e4a9..c53a8b652 100644 --- a/src/Dialogs/Composer/Dialog.vala +++ b/src/Dialogs/Composer/Dialog.vala @@ -1,6 +1,3 @@ -using Gtk; -using Gee; - [GtkTemplate (ui = "/dev/geopjr/Tuba/ui/dialogs/compose.ui")] public class Tuba.Dialogs.Compose : Adw.Window { public class BasicStatus : Object { @@ -256,7 +253,7 @@ public class Tuba.Dialogs.Compose : Adw.Window { } [GtkChild] unowned Adw.ViewSwitcherTitle title_switcher; - [GtkChild] unowned Button commit_button; + [GtkChild] unowned Gtk.Button commit_button; [GtkChild] unowned Adw.ViewStack stack; diff --git a/src/Dialogs/Composer/EditorPage.vala b/src/Dialogs/Composer/EditorPage.vala index 12ce9a469..9757f088a 100644 --- a/src/Dialogs/Composer/EditorPage.vala +++ b/src/Dialogs/Composer/EditorPage.vala @@ -1,5 +1,3 @@ -using Gtk; - public class Tuba.EditorPage : ComposerPage { protected int64 char_limit { get; set; default = 500; } @@ -24,9 +22,9 @@ public class Tuba.EditorPage : ComposerPage { install_overlay (status.status); install_visibility (status.visibility); install_languages (status.language); - add_button (new Gtk.Separator (Orientation.VERTICAL)); + add_button (new Gtk.Separator (Gtk.Orientation.VERTICAL)); install_cw (status.spoiler_text); - add_button (new Gtk.Separator (Orientation.VERTICAL)); + add_button (new Gtk.Separator (Gtk.Orientation.VERTICAL)); install_emoji_picker (); validate (); @@ -76,7 +74,7 @@ public class Tuba.EditorPage : ComposerPage { } protected GtkSource.View editor; - protected Label char_counter; + protected Gtk.Label char_counter; public void editor_grab_focus () { editor.grab_focus (); @@ -109,7 +107,7 @@ public class Tuba.EditorPage : ComposerPage { left_margin = 6, pixels_below_lines = 6, accepts_tab = false, - wrap_mode = WrapMode.WORD_CHAR + wrap_mode = Gtk.WrapMode.WORD_CHAR }; #if LIBSPELLING @@ -147,7 +145,7 @@ public class Tuba.EditorPage : ComposerPage { remaining_chars -= editor.buffer.get_char_count (); }); - char_counter = new Label (char_limit.to_string ()) { + char_counter = new Gtk.Label (char_limit.to_string ()) { margin_end = 6, tooltip_text = _("Characters Left"), css_classes = { "heading" } @@ -163,15 +161,15 @@ public class Tuba.EditorPage : ComposerPage { buffer.style_scheme = scheme; } - protected Overlay overlay; - protected Label placeholder; + protected Gtk.Overlay overlay; + protected Gtk.Label placeholder; protected void install_overlay (string t_content) { - overlay = new Overlay (); - placeholder = new Label (_("What's on your mind?")) { - valign = Align.START, - halign = Align.START, - justify = Justification.FILL, + overlay = new Gtk.Overlay (); + placeholder = new Gtk.Label (_("What's on your mind?")) { + valign = Gtk.Align.START, + halign = Gtk.Align.START, + justify = Gtk.Justification.FILL, margin_top = 6, margin_start = 6, wrap = true, @@ -179,7 +177,7 @@ public class Tuba.EditorPage : ComposerPage { }; overlay.add_overlay (placeholder); - overlay.child = new ScrolledWindow () { + overlay.child = new Gtk.ScrolledWindow () { hexpand = true, vexpand = true, child = editor @@ -189,10 +187,10 @@ public class Tuba.EditorPage : ComposerPage { editor.buffer.text = t_content; } - protected EmojiChooser emoji_picker; + protected Gtk.EmojiChooser emoji_picker; protected void install_emoji_picker () { - emoji_picker = new EmojiChooser (); - var emoji_button = new MenuButton () { + emoji_picker = new Gtk.EmojiChooser (); + var emoji_button = new Gtk.MenuButton () { icon_name = "tuba-smile-symbolic", popover = emoji_picker, tooltip_text = _("Emoji Picker") @@ -202,7 +200,7 @@ public class Tuba.EditorPage : ComposerPage { if (accounts.active.instance_emojis?.size > 0) { var custom_emoji_picker = new Widgets.CustomEmojiChooser (); - var custom_emoji_button = new MenuButton () { + var custom_emoji_button = new Gtk.MenuButton () { icon_name = "tuba-cat-symbolic", popover = custom_emoji_picker, tooltip_text = _("Custom Emoji Picker") @@ -217,8 +215,8 @@ public class Tuba.EditorPage : ComposerPage { editor.buffer.insert_at_cursor (emoji_unicode, emoji_unicode.data.length); } - protected ToggleButton cw_button; - protected Entry cw_entry; + protected Gtk.ToggleButton cw_button; + protected Gtk.Entry cw_entry; protected void install_cw (string? cw_text) { cw_entry = new Gtk.Entry () { @@ -235,7 +233,7 @@ public class Tuba.EditorPage : ComposerPage { revealer.add_css_class ("view"); content.prepend (revealer); - cw_button = new ToggleButton () { + cw_button = new Gtk.ToggleButton () { icon_name = "tuba-warning-symbolic", tooltip_text = _("Content Warning") }; @@ -256,8 +254,8 @@ public class Tuba.EditorPage : ComposerPage { - protected DropDown visibility_button; - protected DropDown language_button; + protected Gtk.DropDown visibility_button; + protected Gtk.DropDown language_button; private bool _edit_mode = false; public override bool edit_mode { @@ -272,10 +270,10 @@ public class Tuba.EditorPage : ComposerPage { } protected void install_visibility (string default_visibility = settings.default_post_visibility) { - visibility_button = new DropDown (accounts.active.visibility_list, null) { - expression = new PropertyExpression (typeof (InstanceAccount.Visibility), null, "name"), - factory = new BuilderListItemFactory.from_resource (null, @"$(Build.RESOURCES)gtk/dropdown/icon.ui"), - list_factory = new BuilderListItemFactory.from_resource (null, @"$(Build.RESOURCES)gtk/dropdown/full.ui"), + visibility_button = new Gtk.DropDown (accounts.active.visibility_list, null) { + expression = new Gtk.PropertyExpression (typeof (InstanceAccount.Visibility), null, "name"), + factory = new Gtk.BuilderListItemFactory.from_resource (null, @"$(Build.RESOURCES)gtk/dropdown/icon.ui"), + list_factory = new Gtk.BuilderListItemFactory.from_resource (null, @"$(Build.RESOURCES)gtk/dropdown/full.ui"), tooltip_text = _("Post Privacy"), sensitive = !edit_mode }; @@ -301,10 +299,10 @@ public class Tuba.EditorPage : ComposerPage { store.append (locale); } - language_button = new DropDown (store, null) { - expression = new PropertyExpression (typeof (Tuba.Locale), null, "name"), - factory = new BuilderListItemFactory.from_resource (null, @"$(Build.RESOURCES)gtk/dropdown/language_title.ui"), - list_factory = new BuilderListItemFactory.from_resource (null, @"$(Build.RESOURCES)gtk/dropdown/language.ui"), + language_button = new Gtk.DropDown (store, null) { + expression = new Gtk.PropertyExpression (typeof (Tuba.Locale), null, "name"), + factory = new Gtk.BuilderListItemFactory.from_resource (null, @"$(Build.RESOURCES)gtk/dropdown/language_title.ui"), + list_factory = new Gtk.BuilderListItemFactory.from_resource (null, @"$(Build.RESOURCES)gtk/dropdown/language.ui"), tooltip_text = _("Post Language"), enable_search = true }; diff --git a/src/Dialogs/Composer/Page.vala b/src/Dialogs/Composer/Page.vala index 9f5062e0d..d5673a1dd 100644 --- a/src/Dialogs/Composer/Page.vala +++ b/src/Dialogs/Composer/Page.vala @@ -1,5 +1,3 @@ -using Gtk; - public class Tuba.ComposerPage : Gtk.Box { public string title { get; set; } @@ -11,9 +9,9 @@ public class Tuba.ComposerPage : Gtk.Box { public weak Dialogs.Compose dialog; public Tuba.Dialogs.Compose.BasicStatus status; - ScrolledWindow scroller; - protected Box content; - protected ActionBar bottom_bar; + Gtk.ScrolledWindow scroller; + protected Gtk.Box content; + protected Gtk.ActionBar bottom_bar; private bool _action_bar_on_top = false; public bool action_bar_on_top { @@ -34,18 +32,18 @@ public class Tuba.ComposerPage : Gtk.Box { } construct { - orientation = Orientation.VERTICAL; + orientation = Gtk.Orientation.VERTICAL; - scroller = new ScrolledWindow () { + scroller = new Gtk.ScrolledWindow () { hexpand = true, vexpand = true }; append (scroller); - content = new Box (Orientation.VERTICAL, 0); + content = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); scroller.child = content; - bottom_bar = new ActionBar () { + bottom_bar = new Gtk.ActionBar () { visible = false }; @@ -56,7 +54,7 @@ public class Tuba.ComposerPage : Gtk.Box { } } - protected void add_button (Widget widget) { + protected void add_button (Gtk.Widget widget) { bottom_bar.pack_start (widget); widget.add_css_class ("flat"); diff --git a/src/Dialogs/MainWindow.vala b/src/Dialogs/MainWindow.vala index 8ae81a99b..341b6c3eb 100644 --- a/src/Dialogs/MainWindow.vala +++ b/src/Dialogs/MainWindow.vala @@ -1,6 +1,3 @@ -using Gtk; -using Gdk; - [GtkTemplate (ui = "/dev/geopjr/Tuba/ui/dialogs/main.ui")] public class Tuba.Dialogs.MainWindow: Adw.ApplicationWindow, Saveable { public const string ZOOM_CLASS = "ttl-scalable"; @@ -8,7 +5,7 @@ public class Tuba.Dialogs.MainWindow: Adw.ApplicationWindow, Saveable { [GtkChild] public unowned Adw.Flap flap; [GtkChild] unowned Adw.Leaflet leaflet; [GtkChild] unowned Views.Sidebar sidebar; - [GtkChild] unowned Stack main_stack; + [GtkChild] unowned Gtk.Stack main_stack; [GtkChild] unowned Views.MediaViewer media_viewer; Views.Base? last_view = null; @@ -46,7 +43,7 @@ public class Tuba.Dialogs.MainWindow: Adw.ApplicationWindow, Saveable { media_viewer.scroll_to (pos); } - public void show_media_viewer (string url, string? alt_text, bool video, Paintable? preview, int? pos) { + public void show_media_viewer (string url, string? alt_text, bool video, Gdk.Paintable? preview, int? pos) { if (!is_media_viewer_visible ()) { main_stack.visible_child_name = "media_viewer"; media_viewer.clear.connect (hide_media_viewer); @@ -59,7 +56,7 @@ public class Tuba.Dialogs.MainWindow: Adw.ApplicationWindow, Saveable { } } - public void show_media_viewer_single (string? url, Paintable? paintable) { + public void show_media_viewer_single (string? url, Gdk.Paintable? paintable) { if (paintable == null) return; if (!is_media_viewer_visible ()) { @@ -70,7 +67,7 @@ public class Tuba.Dialogs.MainWindow: Adw.ApplicationWindow, Saveable { media_viewer.set_single_paintable (url, paintable); } - public void show_media_viewer_remote_video (string url, Paintable? preview, string? user_friendly_url = null) { + public void show_media_viewer_remote_video (string url, Gdk.Paintable? preview, string? user_friendly_url = null) { if (!is_media_viewer_visible ()) { main_stack.visible_child_name = "media_viewer"; media_viewer.clear.connect (hide_media_viewer); @@ -91,7 +88,7 @@ public class Tuba.Dialogs.MainWindow: Adw.ApplicationWindow, Saveable { var clamp = new Adw.Clamp () { child = book_widget, tightening_threshold = 100, - valign = Align.START + valign = Gtk.Align.START }; var scroller = new Gtk.ScrolledWindow () { hexpand = true, @@ -204,7 +201,7 @@ public class Tuba.Dialogs.MainWindow: Adw.ApplicationWindow, Saveable { if (leaflet.child_transition_running) return; - Widget unused_child = null; + Gtk.Widget unused_child = null; while ((unused_child = leaflet.get_adjacent_child (Adw.NavigationDirection.FORWARD)) != null) { leaflet.remove (unused_child); unused_child.dispose (); diff --git a/src/Dialogs/NewAccount.vala b/src/Dialogs/NewAccount.vala index f46872ebc..66ca4f8d8 100644 --- a/src/Dialogs/NewAccount.vala +++ b/src/Dialogs/NewAccount.vala @@ -1,5 +1,3 @@ -using Gtk; - [GtkTemplate (ui = "/dev/geopjr/Tuba/ui/dialogs/new_account.ui")] public class Tuba.Dialogs.NewAccount: Adw.Window { const string AUTO_AUTH_DESCRIPTION = _("Allow access to your account in the browser."); @@ -13,15 +11,15 @@ public class Tuba.Dialogs.NewAccount: Adw.Window { protected InstanceAccount account { get; set; default = new InstanceAccount.empty (""); } [GtkChild] unowned Adw.Leaflet deck; - [GtkChild] unowned Box instance_step; - [GtkChild] unowned Box code_step; - [GtkChild] unowned Box done_step; + [GtkChild] unowned Gtk.Box instance_step; + [GtkChild] unowned Gtk.Box code_step; + [GtkChild] unowned Gtk.Box done_step; [GtkChild] unowned Adw.EntryRow instance_entry; - [GtkChild] unowned Label instance_entry_error; + [GtkChild] unowned Gtk.Label instance_entry_error; [GtkChild] unowned Adw.EntryRow code_entry; - [GtkChild] unowned Label code_entry_error; + [GtkChild] unowned Gtk.Label code_entry_error; [GtkChild] unowned Adw.StatusPage auth_page; [GtkChild] unowned Adw.StatusPage done_page; diff --git a/src/Dialogs/Preferences.vala b/src/Dialogs/Preferences.vala index 298b161ff..3cc35a86e 100644 --- a/src/Dialogs/Preferences.vala +++ b/src/Dialogs/Preferences.vala @@ -1,25 +1,23 @@ -using Gtk; - [GtkTemplate (ui = "/dev/geopjr/Tuba/ui/dialogs/preferences.ui")] public class Tuba.Dialogs.Preferences : Adw.PreferencesWindow { [GtkChild] unowned Adw.ComboRow scheme_combo_row; [GtkChild] unowned Adw.ComboRow post_visibility_combo_row; [GtkChild] unowned Adw.ComboRow default_language_combo_row; - [GtkChild] unowned Switch autostart; - [GtkChild] unowned Switch work_in_background; - [GtkChild] unowned SpinButton timeline_page_size; - [GtkChild] unowned Switch live_updates; - [GtkChild] unowned Switch public_live_updates; - [GtkChild] unowned Switch show_spoilers; - [GtkChild] unowned Switch hide_preview_cards; - [GtkChild] unowned Switch larger_font_size; - [GtkChild] unowned Switch larger_line_height; - [GtkChild] unowned Switch scale_emoji_hover; - [GtkChild] unowned Switch strip_tracking; - [GtkChild] unowned Switch letterbox_media; - [GtkChild] unowned Switch media_viewer_expand_pictures; - [GtkChild] unowned Switch enlarge_custom_emojis; + [GtkChild] unowned Gtk.Switch autostart; + [GtkChild] unowned Gtk.Switch work_in_background; + [GtkChild] unowned Gtk.SpinButton timeline_page_size; + [GtkChild] unowned Gtk.Switch live_updates; + [GtkChild] unowned Gtk.Switch public_live_updates; + [GtkChild] unowned Gtk.Switch show_spoilers; + [GtkChild] unowned Gtk.Switch hide_preview_cards; + [GtkChild] unowned Gtk.Switch larger_font_size; + [GtkChild] unowned Gtk.Switch larger_line_height; + [GtkChild] unowned Gtk.Switch scale_emoji_hover; + [GtkChild] unowned Gtk.Switch strip_tracking; + [GtkChild] unowned Gtk.Switch letterbox_media; + [GtkChild] unowned Gtk.Switch media_viewer_expand_pictures; + [GtkChild] unowned Gtk.Switch enlarge_custom_emojis; private bool lang_changed { get; set; default=false; } @@ -105,7 +103,7 @@ public class Tuba.Dialogs.Preferences : Adw.PreferencesWindow { store.append (locale); } - default_language_combo_row.list_factory = new BuilderListItemFactory.from_resource ( + default_language_combo_row.list_factory = new Gtk.BuilderListItemFactory.from_resource ( null, @"$(Build.RESOURCES)gtk/dropdown/language.ui" ); diff --git a/src/Dialogs/Saveable.vala b/src/Dialogs/Saveable.vala index 337edc690..5ef98cfa4 100644 --- a/src/Dialogs/Saveable.vala +++ b/src/Dialogs/Saveable.vala @@ -1,6 +1,4 @@ -using Gtk; - -public interface Tuba.Dialogs.Saveable : Window { +public interface Tuba.Dialogs.Saveable : Gtk.Window { protected void construct_saveable (GLib.Settings settings) { settings.bind ("window-w", this, "default-width", SettingsBindFlags.DEFAULT); settings.bind ("window-h", this, "default-height", SettingsBindFlags.DEFAULT); diff --git a/src/Services/Accounts/AccountStore.vala b/src/Services/Accounts/AccountStore.vala index a533023ef..14cef67e2 100644 --- a/src/Services/Accounts/AccountStore.vala +++ b/src/Services/Accounts/AccountStore.vala @@ -1,11 +1,9 @@ -using Gee; - public abstract class Tuba.AccountStore : GLib.Object { - public ArrayList saved { get; set; default = new ArrayList (); } + public Gee.ArrayList saved { get; set; default = new Gee.ArrayList (); } public InstanceAccount? active { get; set; default = null; } - public signal void changed (ArrayList accounts); + public signal void changed (Gee.ArrayList accounts); public signal void switched (InstanceAccount? account); public bool ensure_active_account () { diff --git a/src/Services/Accounts/InstanceAccount.vala b/src/Services/Accounts/InstanceAccount.vala index 2d8e860ca..2eaece3bc 100644 --- a/src/Services/Accounts/InstanceAccount.vala +++ b/src/Services/Accounts/InstanceAccount.vala @@ -1,6 +1,3 @@ -using GLib; -using Gee; - public class Tuba.InstanceAccount : API.Account, Streamable { public const string EVENT_NEW_POST = "update"; @@ -20,7 +17,7 @@ public class Tuba.InstanceAccount : API.Account, Streamable { public string? backend { set; get; } public API.Instance? instance_info { get; set; } - public ArrayList? instance_emojis { get; set; } + public Gee.ArrayList? instance_emojis { get; set; } public string? instance { get; set; } public string? client_id { get; set; } public string? client_secret { get; set; } @@ -29,7 +26,7 @@ public class Tuba.InstanceAccount : API.Account, Streamable { public GLib.ListStore known_places = new GLib.ListStore (typeof (Place)); - public HashMap type_overrides = new HashMap (); + public Gee.HashMap type_overrides = new Gee.HashMap (); public new string handle_short { owned get { return @"@$username"; } @@ -94,7 +91,7 @@ public class Tuba.InstanceAccount : API.Account, Streamable { } } } - public HashMap visibility = new HashMap (); + public Gee.HashMap visibility = new Gee.HashMap (); public ListStore visibility_list = new ListStore (typeof (Visibility)); public void set_visibility (Visibility obj) { this.visibility[obj.id] = obj; diff --git a/src/Services/Accounts/SecretAccountStore.vala b/src/Services/Accounts/SecretAccountStore.vala index c80bb157c..cc046a74e 100644 --- a/src/Services/Accounts/SecretAccountStore.vala +++ b/src/Services/Accounts/SecretAccountStore.vala @@ -1,18 +1,16 @@ -using Secret; - public class Tuba.SecretAccountStore : AccountStore { const string VERSION = "1"; Secret.Schema schema; - GLib.HashTable schema_attributes; + GLib.HashTable schema_attributes; public override void init () throws GLib.Error { message (@"Using libsecret v$(Secret.MAJOR_VERSION).$(Secret.MINOR_VERSION).$(Secret.MICRO_VERSION)"); - schema_attributes = new GLib.HashTable (str_hash, str_equal); - schema_attributes["login"] = SchemaAttributeType.STRING; - schema_attributes["version"] = SchemaAttributeType.STRING; + schema_attributes = new GLib.HashTable (str_hash, str_equal); + schema_attributes["login"] = Secret.SchemaAttributeType.STRING; + schema_attributes["version"] = Secret.SchemaAttributeType.STRING; schema = new Secret.Schema.newv ( Build.DOMAIN, Secret.SchemaFlags.DONT_MATCH_NAME, diff --git a/src/Services/Cache/AbstractCache.vala b/src/Services/Cache/AbstractCache.vala index 1efedbf13..c79ddf688 100644 --- a/src/Services/Cache/AbstractCache.vala +++ b/src/Services/Cache/AbstractCache.vala @@ -1,11 +1,9 @@ -using Gee; - public class Tuba.AbstractCache : Object { public const string DATA_MIN_REF_COUNT = "refs"; - protected Map items; - protected Map items_in_progress; + protected Gee.Map items; + protected Gee.Map items_in_progress; private uint timeout_source; private int _maintenance_secs = 5; @@ -25,8 +23,8 @@ public class Tuba.AbstractCache : Object { } construct { - items = new HashMap (); - items_in_progress = new HashMap (); + items = new Gee.HashMap (); + items_in_progress = new Gee.HashMap (); setup_maintenance (); } diff --git a/src/Services/Cache/ImageCache.vala b/src/Services/Cache/ImageCache.vala index 01f5996be..9042990bb 100644 --- a/src/Services/Cache/ImageCache.vala +++ b/src/Services/Cache/ImageCache.vala @@ -1,17 +1,15 @@ -using Gdk; - public class Tuba.ImageCache : AbstractCache { - public delegate void OnItemChangedFn (bool is_loaded, owned Paintable? data); + public delegate void OnItemChangedFn (bool is_loaded, owned Gdk.Paintable? data); - protected async Paintable decode (owned Soup.Message msg, owned InputStream in_stream) throws Error { + protected async Gdk.Paintable decode (owned Soup.Message msg, owned InputStream in_stream) throws Error { var code = msg.status_code; if (code != Soup.Status.OK) { var error = msg.reason_phrase; throw new Oopsie.INSTANCE (@"Server returned $error"); } - var pixbuf = yield new Pixbuf.from_stream_async (in_stream); + var pixbuf = yield new Gdk.Pixbuf.from_stream_async (in_stream); return Gdk.Texture.for_pixbuf (pixbuf); } @@ -22,7 +20,7 @@ public class Tuba.ImageCache : AbstractCache { var key = get_key (url); if (contains (key)) { - cb (true, lookup (key) as Paintable); + cb (true, lookup (key) as Gdk.Paintable); return; } @@ -34,7 +32,7 @@ public class Tuba.ImageCache : AbstractCache { download_msg = new Soup.Message ("GET", url); network.queue (download_msg, null, (sess, mess, t_in_stream) => { decode.begin (download_msg, t_in_stream, (obj, async_res) => { - Paintable? paintable = null; + Gdk.Paintable? paintable = null; try { paintable = decode.end (async_res); } @@ -65,7 +63,7 @@ public class Tuba.ImageCache : AbstractCache { //message ("[/]: %s", key); ulong id = 0; id = download_msg.finished.connect (() => { - cb (true, lookup (key) as Paintable); + cb (true, lookup (key) as Gdk.Paintable); download_msg.disconnect (id); }); diff --git a/src/Services/Network/Network.vala b/src/Services/Network/Network.vala index 18e3d1489..16d1e7aab 100644 --- a/src/Services/Network/Network.vala +++ b/src/Services/Network/Network.vala @@ -1,16 +1,11 @@ -using Soup; -using GLib; -using Gdk; -using Json; - public class Tuba.Network : GLib.Object { public signal void started (); public signal void finished (); public delegate void ErrorCallback (int32 code, string reason); - public delegate void SuccessCallback (Session session, Message msg, InputStream in_stream) throws Error; - public delegate void NodeCallback (Json.Node node, Message msg) throws Error; + public delegate void SuccessCallback (Soup.Session session, Soup.Message msg, InputStream in_stream) throws Error; + public delegate void NodeCallback (Json.Node node, Soup.Message msg) throws Error; public delegate void ObjectCallback (Json.Object node) throws Error; public Soup.Session session { get; set; } diff --git a/src/Services/Network/Request.vala b/src/Services/Network/Request.vala index 5bac1b78e..70cf80c43 100644 --- a/src/Services/Network/Request.vala +++ b/src/Services/Network/Request.vala @@ -1,6 +1,3 @@ -using Soup; -using Gee; - public class Tuba.Request : GLib.Object { private Soup.Message _msg; public Soup.Message msg { @@ -31,7 +28,7 @@ public class Tuba.Request : GLib.Object { public weak InstanceAccount? account { get; set; default = null; } Network.SuccessCallback? cb; Network.ErrorCallback? error_cb; - HashMap? pars; + Gee.HashMap? pars; Soup.Multipart? form_data; public GLib.Cancellable cancellable; @@ -118,21 +115,21 @@ public class Tuba.Request : GLib.Object { public Request with_param (string name, string val) { if (pars == null) - pars = new HashMap (); + pars = new Gee.HashMap (); pars[name] = val; return this; } public Request with_form_data (string name, string val) { if (form_data == null) - form_data = new Soup.Multipart (FORM_MIME_TYPE_MULTIPART); + form_data = new Soup.Multipart (Soup.FORM_MIME_TYPE_MULTIPART); form_data.append_form_string (name, val); return this; } public Request with_form_data_file (string name, string mime, Bytes buffer) { if (form_data == null) - form_data = new Soup.Multipart (FORM_MIME_TYPE_MULTIPART); + form_data = new Soup.Multipart (Soup.FORM_MIME_TYPE_MULTIPART); form_data.append_form_file (name, mime.replace ("/", "."), mime, buffer); return this; } diff --git a/src/Services/Network/Streams.vala b/src/Services/Network/Streams.vala index 3b4883c7c..2d0ac84f6 100644 --- a/src/Services/Network/Streams.vala +++ b/src/Services/Network/Streams.vala @@ -1,6 +1,3 @@ -using Soup; -using Gee; - public class Tuba.Streams : Object { protected HashTable connections { @@ -45,9 +42,9 @@ public class Tuba.Streams : Object { // } protected class Connection : Object { - public ArrayList subscribers; - protected WebsocketConnection socket; - protected Message msg; + public Gee.ArrayList subscribers; + protected Soup.WebsocketConnection socket; + protected Soup.Message msg; protected bool closing = false; protected int timeout = 1; @@ -60,8 +57,8 @@ public class Tuba.Streams : Object { } public Connection (string url) { - this.subscribers = new ArrayList (); - this.msg = new Message ("GET", url); + this.subscribers = new Gee.ArrayList (); + this.msg = new Soup.Message ("GET", url); } public bool start () { diff --git a/src/Services/Settings.vala b/src/Services/Settings.vala index 4ca56e4cc..951cb61b2 100644 --- a/src/Services/Settings.vala +++ b/src/Services/Settings.vala @@ -1,5 +1,3 @@ -using GLib; - public class Tuba.Settings : GLib.Settings { public string active_account { get; set; } diff --git a/src/Utils/DateTime.vala b/src/Utils/DateTime.vala index 21ecc35f9..f4ba82ea0 100644 --- a/src/Utils/DateTime.vala +++ b/src/Utils/DateTime.vala @@ -1,5 +1,3 @@ -using GLib; - public class Tuba.DateTime { public static string humanize_left (string iso8601) { diff --git a/src/Utils/Host.vala b/src/Utils/Host.vala index 313acc1fe..a828a977f 100644 --- a/src/Utils/Host.vala +++ b/src/Utils/Host.vala @@ -1,6 +1,3 @@ -using GLib; -using Gdk; - public class Tuba.Host { // Open a URI in the user's default application @@ -31,7 +28,7 @@ public class Tuba.Host { } public static void copy (string str) { - Display display = Display.get_default (); + Gdk.Display display = Gdk.Display.get_default (); if (display == null) return; display.get_clipboard ().set_text (str); diff --git a/src/Views/Base.vala b/src/Views/Base.vala index 4504d135c..e63b6b018 100644 --- a/src/Views/Base.vala +++ b/src/Views/Base.vala @@ -1,7 +1,5 @@ -using Gtk; - [GtkTemplate (ui = "/dev/geopjr/Tuba/ui/views/base.ui")] -public class Tuba.Views.Base : Box { +public class Tuba.Views.Base : Gtk.Box { // translators: Shown when there are 0 results public static string STATUS_EMPTY = _("Nothing to see here"); // vala-lint=naming-convention @@ -31,21 +29,21 @@ public class Tuba.Views.Base : Box { } [GtkChild] protected unowned Adw.HeaderBar header; - [GtkChild] protected unowned Button back_button; + [GtkChild] protected unowned Gtk.Button back_button; - [GtkChild] protected unowned ScrolledWindow scrolled; - [GtkChild] protected unowned Overlay scrolled_overlay; - [GtkChild] protected unowned Button scroll_to_top; - [GtkChild] protected unowned Box view; + [GtkChild] protected unowned Gtk.ScrolledWindow scrolled; + [GtkChild] protected unowned Gtk.Overlay scrolled_overlay; + [GtkChild] protected unowned Gtk.Button scroll_to_top; + [GtkChild] protected unowned Gtk.Box view; [GtkChild] protected unowned Adw.Clamp clamp; - [GtkChild] protected unowned Box column_view; - [GtkChild] protected unowned Stack states; - [GtkChild] protected unowned Box content_box; - [GtkChild] protected unowned Button status_button; - [GtkChild] unowned Stack status_stack; - [GtkChild] unowned Label status_title_label; - [GtkChild] unowned Label status_message_label; - [GtkChild] unowned Spinner status_spinner; + [GtkChild] protected unowned Gtk.Box column_view; + [GtkChild] protected unowned Gtk.Stack states; + [GtkChild] protected unowned Gtk.Box content_box; + [GtkChild] protected unowned Gtk.Button status_button; + [GtkChild] unowned Gtk.Stack status_stack; + [GtkChild] unowned Gtk.Label status_title_label; + [GtkChild] unowned Gtk.Label status_message_label; + [GtkChild] unowned Gtk.Spinner status_spinner; public class StatusMessage : Object { public string title = STATUS_EMPTY; diff --git a/src/Views/ContentBase.vala b/src/Views/ContentBase.vala index 0d1abbda7..7cd511ffe 100644 --- a/src/Views/ContentBase.vala +++ b/src/Views/ContentBase.vala @@ -1,9 +1,7 @@ -using Gtk; - public class Tuba.Views.ContentBase : Views.Base { public GLib.ListStore model; - protected ListBox content; + protected Gtk.ListBox content; private bool bottom_reached_locked = false; protected signal void reached_close_to_top (); @@ -15,8 +13,8 @@ public class Tuba.Views.ContentBase : Views.Base { model = new GLib.ListStore (typeof (Widgetizable)); model.items_changed.connect (on_content_changed); - content = new ListBox () { - selection_mode = SelectionMode.NONE, + content = new Gtk.ListBox () { + selection_mode = Gtk.SelectionMode.NONE, css_classes = { "content", "ttl-content" } }; content_box.append (content); @@ -65,7 +63,7 @@ public class Tuba.Views.ContentBase : Views.Base { } - public virtual Widget on_create_model_widget (Object obj) { + public virtual Gtk.Widget on_create_model_widget (Object obj) { var obj_widgetable = obj as Widgetizable; if (obj_widgetable == null) Process.exit (0); @@ -87,7 +85,7 @@ public class Tuba.Views.ContentBase : Views.Base { }, Priority.LOW); } - public virtual void on_content_item_activated (ListBoxRow row) { + public virtual void on_content_item_activated (Gtk.ListBoxRow row) { Signal.emit_by_name (row, "open"); } diff --git a/src/Views/Lists.vala b/src/Views/Lists.vala index ae3508166..b9f95240a 100644 --- a/src/Views/Lists.vala +++ b/src/Views/Lists.vala @@ -1,26 +1,24 @@ -using Gtk; - public class Tuba.Views.Lists : Views.Timeline { public class Row : Adw.ActionRow { public API.List? list; - Button delete_button; - Button edit_button; + Gtk.Button delete_button; + Gtk.Button edit_button; construct { - var action_box = new Box (Orientation.HORIZONTAL, 6); + var action_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6); - edit_button = new Button () { + edit_button = new Gtk.Button () { icon_name = "document-edit-symbolic", - valign = Align.CENTER, - halign = Align.CENTER, + valign = Gtk.Align.CENTER, + halign = Gtk.Align.CENTER, css_classes = { "flat", "circular" } }; - delete_button = new Button () { + delete_button = new Gtk.Button () { icon_name = "tuba-trash-symbolic", - valign = Align.CENTER, - halign = Align.CENTER, + valign = Gtk.Align.CENTER, + halign = Gtk.Align.CENTER, css_classes = { "flat", "circular", "error" } }; @@ -96,7 +94,7 @@ public class Tuba.Views.Lists : Views.Timeline { get { return false; } } - public override Widget on_create_model_widget (Object obj) { + public override Gtk.Widget on_create_model_widget (Object obj) { var widget = base.on_create_model_widget (obj); var widget_row = widget as Row; @@ -137,25 +135,25 @@ public class Tuba.Views.Lists : Views.Timeline { .exec (); } - public void on_action_bar_activate (EntryBuffer buffer) { + public void on_action_bar_activate (Gtk.EntryBuffer buffer) { if (buffer.length > 0) create_list (buffer.text); buffer.set_text ("".data); } - Entry child_entry = new Entry () { - input_purpose = InputPurpose.FREE_FORM, + Gtk.Entry child_entry = new Gtk.Entry () { + input_purpose = Gtk.InputPurpose.FREE_FORM, placeholder_text = _("New list title") }; construct { - var add_action_bar = new ActionBar () { + var add_action_bar = new Gtk.ActionBar () { css_classes = { "ttl-box-no-shadow" } }; - var child_box = new Box (Orientation.HORIZONTAL, 6); + var child_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6); - var add_button = new Button.with_label (_("Add list")) { + var add_button = new Gtk.Button.with_label (_("Add list")) { sensitive = false }; diff --git a/src/Views/Main.vala b/src/Views/Main.vala index b36a086ff..f74b20a2c 100644 --- a/src/Views/Main.vala +++ b/src/Views/Main.vala @@ -1,5 +1,3 @@ -using Gtk; - public class Tuba.Views.Main : Views.TabbedBase { public Main () { @@ -14,13 +12,13 @@ public class Tuba.Views.Main : Views.TabbedBase { base.build_header (); back_button.hide (); - var search_button = new Button (); + var search_button = new Gtk.Button (); search_button.icon_name = "tuba-loupe-large-symbolic"; search_button.tooltip_text = _("Search"); search_button.clicked.connect (open_search); header.pack_end (search_button); - var sidebar_button = new ToggleButton (); + var sidebar_button = new Gtk.ToggleButton (); header.pack_start (sidebar_button); sidebar_button.icon_name = "tuba-dock-left-symbolic"; diff --git a/src/Views/Notifications.vala b/src/Views/Notifications.vala index a6cfd9a2e..b26018c49 100644 --- a/src/Views/Notifications.vala +++ b/src/Views/Notifications.vala @@ -1,6 +1,3 @@ -using Gtk; -using Gdk; - public class Tuba.Views.Notifications : Views.Timeline, AccountHolder, Streamable { protected InstanceAccount? last_account = null; diff --git a/src/Views/Profile.vala b/src/Views/Profile.vala index bdcef7225..4b49c4306 100644 --- a/src/Views/Profile.vala +++ b/src/Views/Profile.vala @@ -1,5 +1,3 @@ -using Gtk; - public class Tuba.Views.Profile : Views.Timeline { public API.Account profile { get; construct set; } @@ -9,7 +7,7 @@ public class Tuba.Views.Profile : Views.Timeline { public string source { get; set; default = "statuses"; } protected Cover cover; - protected MenuButton menu_button; + protected Gtk.MenuButton menu_button; protected SimpleAction media_action; protected SimpleAction replies_action; @@ -68,7 +66,7 @@ public class Tuba.Views.Profile : Views.Timeline { return GLib.Source.REMOVE; } - public override Widget on_create_model_widget (Object obj) { + public override Gtk.Widget on_create_model_widget (Object obj) { var widget = base.on_create_model_widget (obj); var widget_status = widget as Widgets.Status; @@ -86,15 +84,15 @@ public class Tuba.Views.Profile : Views.Timeline { } [GtkTemplate (ui = "/dev/geopjr/Tuba/ui/views/profile_header.ui")] - protected class Cover : Box { + protected class Cover : Gtk.Box { [GtkChild] unowned Widgets.Background background; - [GtkChild] unowned Label cover_badge; - [GtkChild] unowned Image cover_bot_badge; - [GtkChild] unowned Box cover_badge_box; - [GtkChild] public unowned ListBox info; + [GtkChild] unowned Gtk.Label cover_badge; + [GtkChild] unowned Gtk.Image cover_bot_badge; + [GtkChild] unowned Gtk.Box cover_badge_box; + [GtkChild] public unowned Gtk.ListBox info; [GtkChild] unowned Widgets.EmojiLabel display_name; - [GtkChild] unowned Label handle; + [GtkChild] unowned Gtk.Label handle; [GtkChild] unowned Widgets.Avatar avatar; [GtkChild] unowned Widgets.MarkupView note; [GtkChild] public unowned Widgets.RelationshipButton rsbtn; @@ -239,9 +237,9 @@ public class Tuba.Views.Profile : Views.Timeline { } } - protected void build_profile_stats (ListBox info) { + protected void build_profile_stats (Gtk.ListBox info) { var row = new Gtk.ListBoxRow (); - var box = new Box (Orientation.HORIZONTAL, 0) { + var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0) { homogeneous = true }; @@ -265,14 +263,14 @@ public class Tuba.Views.Profile : Views.Timeline { info.append (row); } - protected Button build_profile_stats_button (string btn_label) { - var btn = new Button.with_label (btn_label) { + protected Gtk.Button build_profile_stats_button (string btn_label) { + var btn = new Gtk.Button.with_label (btn_label) { css_classes = { "flat", "ttl-profile-stat-button" } }; - var child_label = btn.child as Label; + var child_label = btn.child as Gtk.Label; child_label.wrap = true; - child_label.justify = Justification.CENTER; + child_label.justify = Gtk.Justification.CENTER; return btn; } @@ -288,8 +286,8 @@ public class Tuba.Views.Profile : Views.Timeline { protected override void build_header () { base.build_header (); - menu_button = new MenuButton (); - var menu_builder = new Builder.from_resource (@"$(Build.RESOURCES)ui/menus.ui"); + menu_button = new Gtk.MenuButton (); + var menu_builder = new Gtk.Builder.from_resource (@"$(Build.RESOURCES)ui/menus.ui"); var menu = "profile-menu"; menu_button.menu_model = menu_builder.get_object (menu) as MenuModel; menu_button.popover.width_request = 250; @@ -522,25 +520,25 @@ public class Tuba.Views.Profile : Views.Timeline { network.on_error); } - public class RowButton : Button { + public class RowButton : Gtk.Button { public bool remove { get; set; default = false; } } public Adw.Window create_ar_list_dialog () { - var spinner = new Spinner () { + var spinner = new Gtk.Spinner () { spinning = true, - halign = Align.CENTER, - valign = Align.CENTER, + halign = Gtk.Align.CENTER, + valign = Gtk.Align.CENTER, vexpand = true, hexpand = true, width_request = 32, height_request = 32 }; - var box = new Box (Orientation.VERTICAL, 6); + var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 6); var headerbar = new Adw.HeaderBar (); var toast_overlay = new Adw.ToastOverlay () { vexpand = true, - valign = Align.CENTER + valign = Gtk.Align.CENTER }; toast_overlay.child = spinner; @@ -598,8 +596,8 @@ public class Tuba.Views.Profile : Views.Timeline { tooltip_text = is_already ? _("Remove \"%s\" from \"%s\"").printf (profile.handle, list.title) : _("Add \"%s\" to \"%s\"").printf (profile.handle, list.title), - halign = Align.CENTER, - valign = Align.CENTER, + halign = Gtk.Align.CENTER, + valign = Gtk.Align.CENTER, css_classes = { "flat", "circular" } }; add_button.remove = is_already; @@ -621,7 +619,7 @@ public class Tuba.Views.Profile : Views.Timeline { preferences_page.add (preferences_group); toast_overlay.child = preferences_page; - toast_overlay.valign = Align.FILL; + toast_overlay.valign = Gtk.Align.FILL; } else { toast_overlay.child = no_lists_page; } diff --git a/src/Views/Search.vala b/src/Views/Search.vala index 78ca07f15..dc684ec46 100644 --- a/src/Views/Search.vala +++ b/src/Views/Search.vala @@ -1,11 +1,9 @@ -using Gtk; - public class Tuba.Views.Search : Views.TabbedBase { public string query { get; set; default = ""; } - protected SearchBar bar; + protected Gtk.SearchBar bar; protected Adw.Clamp bar_clamp; - protected SearchEntry entry; + protected Gtk.SearchEntry entry; Views.ContentBase all_tab; Views.ContentBase accounts_tab; @@ -15,13 +13,13 @@ public class Tuba.Views.Search : Views.TabbedBase { public Search () { Object (label: _("Search")); - bar = new SearchBar () { + bar = new Gtk.SearchBar () { search_mode_enabled = true }; prepend (bar); reorder_child_after (bar, header); - entry = new SearchEntry () { + entry = new Gtk.SearchEntry () { width_chars = 25, text = query }; diff --git a/src/Views/Sidebar.vala b/src/Views/Sidebar.vala index 0e6be80c9..4efd85290 100644 --- a/src/Views/Sidebar.vala +++ b/src/Views/Sidebar.vala @@ -1,16 +1,14 @@ -using Gtk; - [GtkTemplate (ui = "/dev/geopjr/Tuba/ui/views/sidebar/view.ui")] -public class Tuba.Views.Sidebar : Box, AccountHolder { +public class Tuba.Views.Sidebar : Gtk.Box, AccountHolder { - [GtkChild] unowned ToggleButton accounts_button; - [GtkChild] unowned Stack mode; - [GtkChild] unowned ListBox items; - [GtkChild] unowned ListBox saved_accounts; + [GtkChild] unowned Gtk.ToggleButton accounts_button; + [GtkChild] unowned Gtk.Stack mode; + [GtkChild] unowned Gtk.ListBox items; + [GtkChild] unowned Gtk.ListBox saved_accounts; [GtkChild] unowned Widgets.Avatar avatar; [GtkChild] unowned Widgets.EmojiLabel title; - [GtkChild] unowned Label subtitle; + [GtkChild] unowned Gtk.Label subtitle; [GtkChild] unowned Adw.HeaderBar sb_header; private bool _show_window_controls = false; @@ -27,8 +25,8 @@ public class Tuba.Views.Sidebar : Box, AccountHolder { protected InstanceAccount? account { get; set; default = null; } protected GLib.ListStore app_items; - protected SliceListModel account_items; - protected FlattenListModel item_model; + protected Gtk.SliceListModel account_items; + protected Gtk.FlattenListModel item_model; public static Place KEYBOARD_SHORTCUTS = new Place () { // vala-lint=naming-convention @@ -65,12 +63,12 @@ public class Tuba.Views.Sidebar : Box, AccountHolder { app_items.append (KEYBOARD_SHORTCUTS); app_items.append (ABOUT); - account_items = new SliceListModel (null, 0, 15); + account_items = new Gtk.SliceListModel (null, 0, 15); var models = new GLib.ListStore (typeof (Object)); models.append (account_items); models.append (app_items); - item_model = new FlattenListModel (models); + item_model = new Gtk.FlattenListModel (models); items.bind_model (item_model, on_item_create); items.set_header_func (on_item_header_update); @@ -160,11 +158,11 @@ public class Tuba.Views.Sidebar : Box, AccountHolder { // Item [GtkTemplate (ui = "/dev/geopjr/Tuba/ui/views/sidebar/item.ui")] - protected class ItemRow : ListBoxRow { + protected class ItemRow : Gtk.ListBoxRow { public Place place; - [GtkChild] unowned Image icon; - [GtkChild] unowned Label label; + [GtkChild] unowned Gtk.Image icon; + [GtkChild] unowned Gtk.Label label; // [GtkChild] unowned Label badge; public ItemRow (Place place) { @@ -181,11 +179,11 @@ public class Tuba.Views.Sidebar : Box, AccountHolder { } } - Widget on_item_create (Object obj) { + Gtk.Widget on_item_create (Object obj) { return new ItemRow (obj as Place); } - [GtkCallback] void on_item_activated (ListBoxRow _row) { + [GtkCallback] void on_item_activated (Gtk.ListBoxRow _row) { var row = _row as ItemRow; if (row.place.open_func != null) row.place.open_func (app.main_window); @@ -195,14 +193,14 @@ public class Tuba.Views.Sidebar : Box, AccountHolder { flap.reveal_flap = false; } - void on_item_header_update (ListBoxRow _row, ListBoxRow? _before) { + void on_item_header_update (Gtk.ListBoxRow _row, Gtk.ListBoxRow? _before) { var row = _row as ItemRow; var before = _before as ItemRow; row.set_header (null); if (row.place.separated && before != null && !before.place.separated) { - row.set_header (new Separator (Orientation.HORIZONTAL)); + row.set_header (new Gtk.Separator (Gtk.Orientation.HORIZONTAL)); } } @@ -215,7 +213,7 @@ public class Tuba.Views.Sidebar : Box, AccountHolder { public InstanceAccount? account; [GtkChild] unowned Widgets.Avatar avatar; - [GtkChild] unowned Button forget; + [GtkChild] unowned Gtk.Button forget; private Binding switcher_display_name; private Binding switcher_handle; @@ -280,16 +278,16 @@ public class Tuba.Views.Sidebar : Box, AccountHolder { } - void on_account_header_update (ListBoxRow _row, ListBoxRow? _before) { + void on_account_header_update (Gtk.ListBoxRow _row, Gtk.ListBoxRow? _before) { var row = _row as AccountRow; row.set_header (null); if (row.account == null && _before != null) - row.set_header (new Separator (Orientation.HORIZONTAL)); + row.set_header (new Gtk.Separator (Gtk.Orientation.HORIZONTAL)); } - [GtkCallback] void on_account_activated (ListBoxRow _row) { + [GtkCallback] void on_account_activated (Gtk.ListBoxRow _row) { var row = _row as AccountRow; if (row.account != null) accounts.activate (row.account); diff --git a/src/Views/TabbedBase.vala b/src/Views/TabbedBase.vala index daf8c2628..891219b52 100644 --- a/src/Views/TabbedBase.vala +++ b/src/Views/TabbedBase.vala @@ -1,5 +1,3 @@ -using Gtk; - public class Tuba.Views.TabbedBase : Views.Base { static int id_counter = 0; @@ -14,12 +12,12 @@ public class Tuba.Views.TabbedBase : Views.Base { construct { base_status = null; - var states_box = states.get_parent () as Box; + var states_box = states.get_parent () as Gtk.Box; if (states_box != null) states_box.remove (states); view.remove_css_class ("ttl-view"); - var scrolled_overlay_box = scrolled_overlay.get_parent () as Box; + var scrolled_overlay_box = scrolled_overlay.get_parent () as Gtk.Box; if (scrolled_overlay_box != null) scrolled_overlay_box.remove (scrolled_overlay); insert_child_after (states, header); diff --git a/src/Views/Thread.vala b/src/Views/Thread.vala index 69694d343..fc4857a3f 100644 --- a/src/Views/Thread.vala +++ b/src/Views/Thread.vala @@ -1,5 +1,3 @@ -using Gtk; - public class Tuba.Views.Thread : Views.ContentBase, AccountHolder { protected InstanceAccount? account { get; set; } diff --git a/src/Views/Timeline.vala b/src/Views/Timeline.vala index 737eaae72..ea31f422a 100644 --- a/src/Views/Timeline.vala +++ b/src/Views/Timeline.vala @@ -1,6 +1,3 @@ -using Gtk; -using Gdk; - public class Tuba.Views.Timeline : AccountHolder, Streamable, Views.ContentBase { public string url { get; construct set; } diff --git a/src/Widgets/Attachment/Box.vala b/src/Widgets/Attachment/Box.vala index 59ceaf074..83a65109a 100644 --- a/src/Widgets/Attachment/Box.vala +++ b/src/Widgets/Attachment/Box.vala @@ -1,11 +1,7 @@ -using Gtk; -using GLib; -using Gee; - public class Tuba.Widgets.Attachment.Box : Adw.Bin { - ArrayList? _list = null; - public ArrayList? list { + Gee.ArrayList? _list = null; + public Gee.ArrayList? list { get { return _list; } @@ -54,12 +50,12 @@ public class Tuba.Widgets.Attachment.Box : Adw.Bin { visible = false; hexpand = true; - box = new FlowBox () { + box = new Gtk.FlowBox () { homogeneous = true, activate_on_single_click = true, column_spacing = 6, row_spacing = 6, - selection_mode = SelectionMode.NONE + selection_mode = Gtk.SelectionMode.NONE }; spoiler_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0) { diff --git a/src/Widgets/Attachment/Image.vala b/src/Widgets/Attachment/Image.vala index 7e5652301..5368d0e15 100644 --- a/src/Widgets/Attachment/Image.vala +++ b/src/Widgets/Attachment/Image.vala @@ -1,12 +1,9 @@ -using Gtk; -using Gdk; - public class Tuba.Widgets.Attachment.Image : Widgets.Attachment.Item { const string[] ALLOWED_TYPES = {"IMAGE", "VIDEO", "GIFV", "AUDIO"}; const string[] VIDEO_TYPES = {"GIFV", "VIDEO", "AUDIO"}; protected Gtk.Picture pic; - protected Overlay media_overlay; + protected Gtk.Overlay media_overlay; private bool _spoiler = false; public bool spoiler { @@ -31,7 +28,7 @@ public class Tuba.Widgets.Attachment.Image : Widgets.Attachment.Item { } construct { - pic = new Picture () { + pic = new Gtk.Picture () { hexpand = true, vexpand = true, can_shrink = true, @@ -43,7 +40,7 @@ public class Tuba.Widgets.Attachment.Image : Widgets.Attachment.Item { update_pic_content_fit (); settings.notify["letterbox-media"].connect (update_pic_content_fit); - media_overlay = new Overlay (); + media_overlay = new Gtk.Overlay (); media_overlay.child = pic; button.child = media_overlay; @@ -75,7 +72,7 @@ public class Tuba.Widgets.Attachment.Image : Widgets.Attachment.Item { } } - protected virtual void on_cache_response (bool is_loaded, owned Paintable? data) { + protected virtual void on_cache_response (bool is_loaded, owned Gdk.Paintable? data) { pic.paintable = data; } diff --git a/src/Widgets/Attachment/Item.vala b/src/Widgets/Attachment/Item.vala index 7dae4f61b..16b8e1904 100644 --- a/src/Widgets/Attachment/Item.vala +++ b/src/Widgets/Attachment/Item.vala @@ -1,11 +1,9 @@ -using Gtk; - public class Tuba.Widgets.Attachment.Item : Adw.Bin { public API.Attachment entity { get; set; default = null; } - protected GestureClick gesture_click_controller { get; set; } - protected GestureLongPress gesture_lp_controller { get; set; } - protected PopoverMenu context_menu { get; set; } + protected Gtk.GestureClick gesture_click_controller { get; set; } + protected Gtk.GestureLongPress gesture_lp_controller { get; set; } + protected Gtk.PopoverMenu context_menu { get; set; } private const GLib.ActionEntry[] ACTION_ENTRIES = { {"copy-url", copy_url}, {"open-in-browser", open_in_browser}, @@ -13,9 +11,9 @@ public class Tuba.Widgets.Attachment.Item : Adw.Bin { }; private GLib.SimpleActionGroup actions; - protected Overlay overlay; - protected Button button; - protected Button alt_btn; + protected Gtk.Overlay overlay; + protected Gtk.Button button; + protected Gtk.Button alt_btn; protected Gtk.Box badge_box; protected ulong alt_btn_clicked_id; protected string media_kind; @@ -33,7 +31,7 @@ public class Tuba.Widgets.Attachment.Item : Adw.Bin { } public static void save_media_as (string url) { - var chooser = new FileDialog () { + var chooser = new Gtk.FileDialog () { title = _("Save Attachment"), modal = true, initial_name = Path.get_basename (url) @@ -85,15 +83,15 @@ public class Tuba.Widgets.Attachment.Item : Adw.Bin { notify["entity"].connect (on_rebind); add_css_class ("flat"); - button = new Button () { + button = new Gtk.Button () { css_classes = { "frame" }, - overflow = Overflow.HIDDEN + overflow = Gtk.Overflow.HIDDEN }; button.clicked.connect (on_click); create_context_menu (); - gesture_click_controller = new GestureClick (); - gesture_lp_controller = new GestureLongPress (); + gesture_click_controller = new Gtk.GestureClick (); + gesture_lp_controller = new Gtk.GestureLongPress (); add_controller (gesture_click_controller); add_controller (gesture_lp_controller); gesture_click_controller.button = Gdk.BUTTON_SECONDARY; @@ -102,13 +100,13 @@ public class Tuba.Widgets.Attachment.Item : Adw.Bin { gesture_click_controller.pressed.connect (on_secondary_click); gesture_lp_controller.pressed.connect (on_secondary_click); - badge_box = new Gtk.Box (Orientation.HORIZONTAL, 1) { - valign = Align.END, - halign = Align.START, + badge_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 1) { + valign = Gtk.Align.END, + halign = Gtk.Align.START, css_classes = { "linked", "ttl-status-badge" } }; - alt_btn = new Button.with_label ("ALT") { + alt_btn = new Gtk.Button.with_label ("ALT") { tooltip_text = _("View Alt Text"), css_classes = { "heading", "flat" } }; @@ -120,7 +118,7 @@ public class Tuba.Widgets.Attachment.Item : Adw.Bin { badge_box.append (alt_btn); - overlay = new Overlay () { + overlay = new Gtk.Overlay () { css_classes = { "attachment" } }; overlay.child = button; @@ -134,23 +132,23 @@ public class Tuba.Widgets.Attachment.Item : Adw.Bin { } protected Adw.Window create_alt_text_window (string alt_text, bool show = false) { - var alt_label = new Label (alt_text) { + var alt_label = new Gtk.Label (alt_text) { wrap = true }; var clamp = new Adw.Clamp () { child = alt_label, tightening_threshold = 100, - valign = Align.START + valign = Gtk.Align.START }; - var scrolledwindow = new ScrolledWindow () { + var scrolledwindow = new Gtk.ScrolledWindow () { child = clamp, vexpand = true, hexpand = true }; - var box = new Gtk.Box (Orientation.VERTICAL, 6); + var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 6); var headerbar = new Adw.HeaderBar (); var window = new Adw.Window () { modal = true, @@ -176,7 +174,7 @@ public class Tuba.Widgets.Attachment.Item : Adw.Bin { menu_model.append (_("Copy URL"), "attachment.copy-url"); menu_model.append (_("Save Media"), "attachment.save-as"); - context_menu = new PopoverMenu.from_model (menu_model); + context_menu = new Gtk.PopoverMenu.from_model (menu_model); context_menu.set_parent (this); } @@ -198,8 +196,8 @@ public class Tuba.Widgets.Attachment.Item : Adw.Bin { } protected virtual void on_secondary_click () { - gesture_click_controller.set_state (EventSequenceState.CLAIMED); - gesture_lp_controller.set_state (EventSequenceState.CLAIMED); + gesture_click_controller.set_state (Gtk.EventSequenceState.CLAIMED); + gesture_lp_controller.set_state (Gtk.EventSequenceState.CLAIMED); if (app.main_window.is_media_viewer_visible ()) return; context_menu.popup (); diff --git a/src/Widgets/Avatar.vala b/src/Widgets/Avatar.vala index c368f1fc7..d1224c16b 100644 --- a/src/Widgets/Avatar.vala +++ b/src/Widgets/Avatar.vala @@ -1,8 +1,4 @@ -using Gtk; -using Gdk; - -public class Tuba.Widgets.Avatar : Button { - +public class Tuba.Widgets.Avatar : Gtk.Button { public API.Account? account { set { on_invalidated (value); @@ -14,7 +10,7 @@ public class Tuba.Widgets.Avatar : Button { set { avatar.size = value; } } - public Paintable? custom_image { + public Gdk.Paintable? custom_image { get { return avatar.custom_image; } } @@ -39,7 +35,7 @@ public class Tuba.Widgets.Avatar : Button { construct { child = new Adw.Avatar (48, null, true); - halign = valign = Align.CENTER; + halign = valign = Gtk.Align.CENTER; css_classes = { "flat", "circular", "image-button", "ttl-flat-button" }; on_invalidated (); @@ -56,8 +52,7 @@ public class Tuba.Widgets.Avatar : Button { } } - void on_cache_response (bool is_loaded, owned Paintable? data) { + void on_cache_response (bool is_loaded, owned Gdk.Paintable? data) { avatar.custom_image = data; } - } diff --git a/src/Widgets/Conversation.vala b/src/Widgets/Conversation.vala index 6086c80bd..8066f7adb 100644 --- a/src/Widgets/Conversation.vala +++ b/src/Widgets/Conversation.vala @@ -1,5 +1,3 @@ -using Gtk; - public class Tuba.Widgets.Conversation : Widgets.Status { public API.Conversation conversation { get; construct set; } diff --git a/src/Widgets/Emoji.vala b/src/Widgets/Emoji.vala index 895838f1c..35c625fc5 100644 --- a/src/Widgets/Emoji.vala +++ b/src/Widgets/Emoji.vala @@ -1,9 +1,6 @@ -using Gtk; -using Gdk; - public class Tuba.Widgets.Emoji : Adw.Bin { - protected Image image; + protected Gtk.Image image; public string? shortcode { get; set; } public int pixel_size { get { return image.pixel_size; } @@ -33,7 +30,7 @@ public class Tuba.Widgets.Emoji : Adw.Bin { }); } - void on_cache_response (bool is_loaded, owned Paintable? data) { + void on_cache_response (bool is_loaded, owned Gdk.Paintable? data) { if (image != null) image.paintable = data; } diff --git a/src/Widgets/LockableToggleButton.vala b/src/Widgets/LockableToggleButton.vala index 787ebfda4..1addd729f 100644 --- a/src/Widgets/LockableToggleButton.vala +++ b/src/Widgets/LockableToggleButton.vala @@ -1,11 +1,9 @@ -using Gtk; - // This button prevents changes to its "active" property while it's locked. // // This widget is intended to be used with Statuses where their properties // can be used to drive network requests. -public abstract class Tuba.LockableToggleButton : ToggleButton { +public abstract class Tuba.LockableToggleButton : Gtk.ToggleButton { uint _locks = 0; public bool locked { diff --git a/src/Widgets/MarkupView.vala b/src/Widgets/MarkupView.vala index 8bf32b05b..25816af80 100644 --- a/src/Widgets/MarkupView.vala +++ b/src/Widgets/MarkupView.vala @@ -1,6 +1,4 @@ -using Gtk; - -public class Tuba.Widgets.MarkupView : Box { +public class Tuba.Widgets.MarkupView : Gtk.Box { public delegate void NodeFn (Xml.Node* node); public delegate void NodeHandlerFn (MarkupView view, Xml.Node* node); @@ -38,7 +36,7 @@ public class Tuba.Widgets.MarkupView : Box { } construct { - orientation = Orientation.VERTICAL; + orientation = Gtk.Orientation.VERTICAL; spacing = 12; } diff --git a/src/Widgets/Notification.vala b/src/Widgets/Notification.vala index 9388ddd60..03770428e 100644 --- a/src/Widgets/Notification.vala +++ b/src/Widgets/Notification.vala @@ -1,5 +1,3 @@ -using Gtk; - public class Tuba.Widgets.Notification : Widgets.Status { public API.Notification notification { get; construct set; } diff --git a/src/Widgets/RelationshipButton.vala b/src/Widgets/RelationshipButton.vala index c6e8ea054..6852d5118 100644 --- a/src/Widgets/RelationshipButton.vala +++ b/src/Widgets/RelationshipButton.vala @@ -1,6 +1,4 @@ -using Gtk; - -public class Tuba.Widgets.RelationshipButton : Button { +public class Tuba.Widgets.RelationshipButton : Gtk.Button { public API.Relationship? rs { get; set; } protected SourceFunc? fn = null; diff --git a/src/Widgets/RichLabel.vala b/src/Widgets/RichLabel.vala index 184fa6310..792ad90b1 100644 --- a/src/Widgets/RichLabel.vala +++ b/src/Widgets/RichLabel.vala @@ -1,12 +1,9 @@ -using Gtk; -using Gee; - public class Tuba.Widgets.RichLabel : Adw.Bin { Widgets.EmojiLabel widget; // TODO: We can parse tags and extract resolvable URIs now - public weak ArrayList? mentions; + public weak Gee.ArrayList? mentions; public string label { get { return widget.content; } diff --git a/src/Widgets/Status.vala b/src/Widgets/Status.vala index 695984fc2..1e1cbf87c 100644 --- a/src/Widgets/Status.vala +++ b/src/Widgets/Status.vala @@ -1,8 +1,5 @@ -using Gtk; -using Gdk; - [GtkTemplate (ui = "/dev/geopjr/Tuba/ui/widgets/status.ui")] -public class Tuba.Widgets.Status : ListBoxRow { +public class Tuba.Widgets.Status : Gtk.ListBoxRow { API.Status? _bound_status = null; public API.Status? status { @@ -62,56 +59,56 @@ public class Tuba.Widgets.Status : ListBoxRow { public Dialogs.Compose.SuccessCallback? reply_cb; - [GtkChild] protected unowned Box status_box; - [GtkChild] protected unowned Box avatar_side; - [GtkChild] protected unowned Box title_box; - [GtkChild] protected unowned Box content_side; - [GtkChild] protected unowned FlowBox name_flowbox; - [GtkChild] public unowned MenuButton menu_button; + [GtkChild] protected unowned Gtk.Box status_box; + [GtkChild] protected unowned Gtk.Box avatar_side; + [GtkChild] protected unowned Gtk.Box title_box; + [GtkChild] protected unowned Gtk.Box content_side; + [GtkChild] protected unowned Gtk.FlowBox name_flowbox; + [GtkChild] public unowned Gtk.MenuButton menu_button; - [GtkChild] protected unowned Image header_icon; + [GtkChild] protected unowned Gtk.Image header_icon; [GtkChild] protected unowned Widgets.RichLabel header_label; - [GtkChild] protected unowned Button header_button; - [GtkChild] public unowned Image thread_line_top; - [GtkChild] public unowned Image thread_line_bottom; + [GtkChild] protected unowned Gtk.Button header_button; + [GtkChild] public unowned Gtk.Image thread_line_top; + [GtkChild] public unowned Gtk.Image thread_line_bottom; [GtkChild] public unowned Widgets.Avatar avatar; - [GtkChild] public unowned Overlay avatar_overlay; - [GtkChild] protected unowned Button name_button; + [GtkChild] public unowned Gtk.Overlay avatar_overlay; + [GtkChild] protected unowned Gtk.Button name_button; [GtkChild] protected unowned Widgets.RichLabel name_label; - [GtkChild] protected unowned Label handle_label; - [GtkChild] protected unowned Box indicators; - [GtkChild] protected unowned Label date_label; - [GtkChild] protected unowned Image pin_indicator; - [GtkChild] protected unowned Image edited_indicator; - [GtkChild] protected unowned Image visibility_indicator; - - [GtkChild] protected unowned Box content_column; - [GtkChild] protected unowned Stack spoiler_stack; - [GtkChild] protected unowned Box content_box; + [GtkChild] protected unowned Gtk.Label handle_label; + [GtkChild] protected unowned Gtk.Box indicators; + [GtkChild] protected unowned Gtk.Label date_label; + [GtkChild] protected unowned Gtk.Image pin_indicator; + [GtkChild] protected unowned Gtk.Image edited_indicator; + [GtkChild] protected unowned Gtk.Image visibility_indicator; + + [GtkChild] protected unowned Gtk.Box content_column; + [GtkChild] protected unowned Gtk.Stack spoiler_stack; + [GtkChild] protected unowned Gtk.Box content_box; [GtkChild] public unowned Widgets.MarkupView content; [GtkChild] protected unowned Widgets.Attachment.Box attachments; - [GtkChild] protected unowned Button spoiler_button; - [GtkChild] protected unowned Label spoiler_label; - [GtkChild] protected unowned Label spoiler_label_rev; - [GtkChild] protected unowned Box spoiler_status_con; + [GtkChild] protected unowned Gtk.Button spoiler_button; + [GtkChild] protected unowned Gtk.Label spoiler_label; + [GtkChild] protected unowned Gtk.Label spoiler_label_rev; + [GtkChild] protected unowned Gtk.Box spoiler_status_con; - [GtkChild] public unowned FlowBox emoji_reactions; - [GtkChild] public unowned Box actions; - [GtkChild] public unowned Box fr_actions; + [GtkChild] public unowned Gtk.FlowBox emoji_reactions; + [GtkChild] public unowned Gtk.Box actions; + [GtkChild] public unowned Gtk.Box fr_actions; - [GtkChild] public unowned Button accept_fr_button; - [GtkChild] public unowned Button decline_fr_button; + [GtkChild] public unowned Gtk.Button accept_fr_button; + [GtkChild] public unowned Gtk.Button decline_fr_button; [GtkChild] public unowned Widgets.VoteBox poll; - protected Button reply_button; + protected Gtk.Button reply_button; protected Adw.ButtonContent reply_button_content; protected StatusActionButton reblog_button; protected StatusActionButton favorite_button; protected StatusActionButton bookmark_button; - protected PopoverMenu context_menu { get; set; } + protected Gtk.PopoverMenu context_menu { get; set; } private const GLib.ActionEntry[] ACTION_ENTRIES = { {"copy-url", copy_url}, {"open-in-browser", open_in_browser} @@ -129,7 +126,7 @@ public class Tuba.Widgets.Status : ListBoxRow { if (value == null) return; var i = 0; - FlowBoxChild? fb_child = null; + Gtk.FlowBoxChild? fb_child = null; while ((fb_child = emoji_reactions.get_child_at_index (i)) != null) { emoji_reactions.remove (fb_child); i = i + 1; @@ -138,19 +135,19 @@ public class Tuba.Widgets.Status : ListBoxRow { foreach (API.EmojiReaction p in value) { if (p.count <= 0) return; - var badge_button = new Button () { + var badge_button = new Gtk.Button () { // translators: the variable is the emoji or its name if it's custom tooltip_text = _("React with %s").printf (p.name) }; - var badge = new Box (Orientation.HORIZONTAL, 6); + var badge = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6); if (p.url != null) { badge.append (new Widgets.Emoji (p.url)); } else { - badge.append (new Label (p.name)); + badge.append (new Gtk.Label (p.name)); } - badge.append (new Label (p.count.to_string ())); + badge.append (new Gtk.Label (p.count.to_string ())); badge_button.child = badge; if (p.me == true) { @@ -290,7 +287,7 @@ public class Tuba.Widgets.Status : ListBoxRow { menu_model.append (_("Delete"), "status.delete-status"); } - context_menu = new PopoverMenu.from_model (menu_model); + context_menu = new Gtk.PopoverMenu.from_model (menu_model); } private void copy_url () { @@ -633,7 +630,7 @@ public class Tuba.Widgets.Status : ListBoxRow { } protected virtual void append_actions () { - reply_button = new Button (); + reply_button = new Gtk.Button (); reply_button_content = new Adw.ButtonContent () { css_classes = { "ttl-status-action-reply" }, tooltip_text = _("Reply") @@ -687,7 +684,7 @@ public class Tuba.Widgets.Status : ListBoxRow { for (var w = actions.get_first_child (); w != null; w = w.get_next_sibling ()) { w.add_css_class ("flat"); w.add_css_class ("circular"); - w.halign = Align.START; + w.halign = Gtk.Align.START; w.hexpand = true; } @@ -746,7 +743,7 @@ public class Tuba.Widgets.Status : ListBoxRow { var bottom_info = new Gtk.FlowBox () { max_children_per_line = 150, margin_top = 6, - selection_mode = SelectionMode.NONE + selection_mode = Gtk.SelectionMode.NONE }; // Insert it after the post content @@ -782,7 +779,7 @@ public class Tuba.Widgets.Status : ListBoxRow { } // Adds *separator* between all *flowbox* children - private void add_separators_to_expanded_bottom (FlowBox flowbox, string separator = "·") { + private void add_separators_to_expanded_bottom (Gtk.FlowBox flowbox, string separator = "·") { var i = 0; var child = flowbox.get_child_at_index (i); while (child != null) { diff --git a/src/Widgets/VoteBox.vala b/src/Widgets/VoteBox.vala index 33cd697f5..2497c6a73 100644 --- a/src/Widgets/VoteBox.vala +++ b/src/Widgets/VoteBox.vala @@ -1,17 +1,13 @@ -using Gtk; -using Gdk; -using Gee; - [GtkTemplate (ui = "/dev/geopjr/Tuba/ui/widgets/votebox.ui")] -public class Tuba.Widgets.VoteBox: Box { - [GtkChild] protected unowned ListBox poll_box; - [GtkChild] protected unowned Button button_vote; - [GtkChild] protected unowned Label people_label; - [GtkChild] protected unowned Label expires_label; +public class Tuba.Widgets.VoteBox : Gtk.Box { + [GtkChild] protected unowned Gtk.ListBox poll_box; + [GtkChild] protected unowned Gtk.Button button_vote; + [GtkChild] protected unowned Gtk.Label people_label; + [GtkChild] protected unowned Gtk.Label expires_label; public API.Poll? poll { get; set;} public API.Status? status_parent { get; set; } - protected ArrayList selected_index = new ArrayList (); + protected Gee.ArrayList selected_index = new Gee.ArrayList (); construct { button_vote.set_label (_("Vote")); @@ -37,7 +33,7 @@ public class Tuba.Widgets.VoteBox: Box { Widgets.VoteCheckButton group_radio_option = null; //clear all existing entries - Widget entry = poll_box.get_first_child (); + Gtk.Widget entry = poll_box.get_first_child (); while (entry != null) { poll_box.remove (entry); entry = poll_box.get_first_child (); @@ -82,7 +78,7 @@ public class Tuba.Widgets.VoteBox: Box { foreach (int own_vote in poll.own_votes) { if (own_vote == row_number) { - row.add_suffix (new Image.from_icon_name ("tuba-check-round-outline-symbolic")); + row.add_suffix (new Gtk.Image.from_icon_name ("tuba-check-round-outline-symbolic")); } } @@ -115,7 +111,7 @@ public class Tuba.Widgets.VoteBox: Box { foreach (int own_vote in poll.own_votes) { if (own_vote == row_number) { check_option.set_active (true); - row.add_suffix (new Image.from_icon_name ("tuba-check-round-outline-symbolic")); + row.add_suffix (new Gtk.Image.from_icon_name ("tuba-check-round-outline-symbolic")); if (!selected_index.contains (p.title)) { selected_index.add (p.title); } diff --git a/src/Widgets/VoteCheckButton.vala b/src/Widgets/VoteCheckButton.vala index 120dd6ef6..cca13122f 100644 --- a/src/Widgets/VoteCheckButton.vala +++ b/src/Widgets/VoteCheckButton.vala @@ -1,11 +1,8 @@ -using Gtk; -using Gdk; - -public class Tuba.Widgets.VoteCheckButton : CheckButton { +public class Tuba.Widgets.VoteCheckButton : Gtk.CheckButton { public string poll_title { get; set;} construct { - valign = Align.CENTER; + valign = Gtk.Align.CENTER; css_classes = { "selection-mode" }; } } diff --git a/tests/Celebrate.test.vala b/tests/Celebrate.test.vala index caa5745b0..093ec0a0d 100644 --- a/tests/Celebrate.test.vala +++ b/tests/Celebrate.test.vala @@ -1,5 +1,3 @@ -using GLib; - struct TestCelebrate { public DateTime date; public string[] css_classes; diff --git a/tests/DateTime.test.vala b/tests/DateTime.test.vala index 5ec573cdc..4be993cf9 100644 --- a/tests/DateTime.test.vala +++ b/tests/DateTime.test.vala @@ -1,5 +1,3 @@ -using GLib; - struct TestDate { public string iso8601; public string left; diff --git a/tests/Html.test.vala b/tests/Html.test.vala index 6fe4e46b3..c6ca4a326 100644 --- a/tests/Html.test.vala +++ b/tests/Html.test.vala @@ -1,5 +1,3 @@ -using GLib; - struct TestContent { public string original; public string sanitized; diff --git a/tests/Tracking.test.vala b/tests/Tracking.test.vala index b11e3c8f2..64b66abe0 100644 --- a/tests/Tracking.test.vala +++ b/tests/Tracking.test.vala @@ -1,5 +1,3 @@ -using GLib; - struct TestUrl { public string original; public string result; diff --git a/tests/Units.test.vala b/tests/Units.test.vala index f8309b461..bb7b61703 100644 --- a/tests/Units.test.vala +++ b/tests/Units.test.vala @@ -1,5 +1,3 @@ -using GLib; - struct TestUnits { public int64 original; public string result;