Skip to content

Commit

Permalink
New button stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
lainsce committed Jul 30, 2024
1 parent 8303731 commit 3d928a7
Show file tree
Hide file tree
Showing 17 changed files with 119 additions and 63 deletions.
2 changes: 1 addition & 1 deletion data/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
po_extra_dir = join_paths(meson.source_root(), 'po', 'extra')
po_extra_dir = join_paths(meson.project_source_root(), 'po', 'extra')

install_data(
'settings.gschema.xml',
Expand Down
16 changes: 9 additions & 7 deletions fuses/about/OSView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,12 @@ public class About.OSView : Gtk.Box {
}
hostname_image.icon_name = icon_name;
hostname_image.add_css_class ("rounded-icon");
var hostname_button = new Gtk.Button () {
icon_name = "pan-end-symbolic",
var hostname_button = new He.Button (null, null) {
icon = "pan-end-symbolic",
is_disclosure = true,
hexpand = true,
halign = Gtk.Align.END
};
hostname_button.add_css_class ("flat");
hostname_button.add_css_class ("circular");
var hostname_action_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
hostname_action_box.append (hostname_title);
hostname_action_box.append (hostname_button);
Expand Down Expand Up @@ -269,8 +268,9 @@ public class About.OSView : Gtk.Box {
});

hostname_button.clicked.connect (() => {
var rename_button = new He.FillButton (_("Rename")) {
sensitive = false
var rename_button = new He.Button (null, _("Rename")) {
sensitive = false,
is_fill = true
};
var title_label = new Gtk.Label ("Rename Your Computer") {
halign = Gtk.Align.CENTER
Expand Down Expand Up @@ -308,7 +308,9 @@ public class About.OSView : Gtk.Box {
main_box.append (t_label);
main_box.append (rename_entry);

var cancel_button = new He.TextButton ("Cancel");
var cancel_button = new He.Button (null, "Cancel") {
is_textual = true
};

var action_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6) {
homogeneous = true
Expand Down
16 changes: 12 additions & 4 deletions fuses/accounts/AccountRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public class Accounts.AccountRow : Gtk.ListBoxRow {
};
main_box.append (button_box);

var delete_button = new He.DisclosureButton ("user-trash-symbolic");
var delete_button = new He.Button ("user-trash-symbolic", null) {
is_disclosure = true
};
delete_button.visible = GLib.Environment.get_user_name () != user.user_name;
delete_button.add_css_class ("bg-meson-red");
delete_button.clicked.connect (() => {
Expand All @@ -41,7 +43,9 @@ public class Accounts.AccountRow : Gtk.ListBoxRow {
"Are you sure you want to delete this account?",
"You cannot undo this action, and will delete " + user.real_name + "'s data.",
"dialog-warning-symbolic",
new He.FillButton ("Delete"),
new He.Button (null, "Delete") {
is_fill = true
},
null
);

Expand All @@ -58,14 +62,18 @@ public class Accounts.AccountRow : Gtk.ListBoxRow {
});
button_box.append (delete_button);

var change_password_button = new He.DisclosureButton ("dialog-password-symbolic");
var change_password_button = new He.Button ("dialog-password-symbolic", null) {
is_disclosure = true
};
change_password_button.clicked.connect (() => {
var dialog = new Accounts.ChangePassword (user, He.Misc.find_ancestor_of_type<He.ApplicationWindow> (this));
dialog.present ();
});
button_box.append (change_password_button);

var edit_button = new He.DisclosureButton ("document-edit-symbolic");
var edit_button = new He.Button ("document-edit-symbolic", null) {
is_disclosure = true
};
edit_button.clicked.connect (() => {
var dialog = new Accounts.EditAccount (user, He.Misc.find_ancestor_of_type<He.ApplicationWindow> (this));
dialog.present ();
Expand Down
7 changes: 5 additions & 2 deletions fuses/accounts/ChangePassword.vala
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ class Accounts.ChangePassword : He.Window {
};
main.append (button_box);

var cancel_button = new He.TextButton (_("Cancel"));
var cancel_button = new He.Button (null, _("Cancel")) {
is_textual = true
};
cancel_button.set_size_request (200, -1);
cancel_button.clicked.connect (() => {
this.destroy ();
});
button_box.append (cancel_button);

var apply_button = new He.FillButton (_("Update")) {
var apply_button = new He.Button (null, _("Update")) {
sensitive = false,
is_fill = true
};
apply_button.set_size_request (200, -1);
apply_button.clicked.connect (() => {
Expand Down
10 changes: 7 additions & 3 deletions fuses/accounts/CreateAccount.vala
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ class Accounts.CreateAccount : He.Window {
main_box.append (avatar_box);

var avatar = new He.Avatar (96, null, "New User", false);
var avatar_edit_button = new He.DisclosureButton ("document-edit-symbolic") {
var avatar_edit_button = new He.Button ("document-edit-symbolic", null) {
valign = Gtk.Align.END,
halign = Gtk.Align.END,
is_disclosure = true
};

var avatar_overlay = new Gtk.Overlay () {
Expand Down Expand Up @@ -110,15 +111,18 @@ class Accounts.CreateAccount : He.Window {
};
main_box.append (button_box);

var cancel_button = new He.TextButton (_("Cancel"));
var cancel_button = new He.Button (null, _("Cancel")) {
is_textual = true
};
cancel_button.set_size_request (200, -1);
cancel_button.clicked.connect (() => {
this.destroy ();
});
button_box.append (cancel_button);

var apply_button = new He.FillButton (_("Create Account")) {
var apply_button = new He.Button (null, _("Create Account")) {
sensitive = false,
is_fill = true
};
apply_button.clicked.connect (() => {
create_user (
Expand Down
10 changes: 7 additions & 3 deletions fuses/accounts/EditAccount.vala
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ class Accounts.EditAccount : He.Window {
main_box.append (avatar_box);

var avatar = new He.Avatar (96, user.icon_file != null ? "file://" + user.icon_file : null, user.real_name, false);
var avatar_edit_button = new He.DisclosureButton ("document-edit-symbolic") {
var avatar_edit_button = new He.Button ("document-edit-symbolic", null) {
valign = Gtk.Align.END,
halign = Gtk.Align.END,
is_disclosure = true
};

var avatar_overlay = new Gtk.Overlay () {
Expand Down Expand Up @@ -106,15 +107,18 @@ class Accounts.EditAccount : He.Window {
};
main_box.append (button_box);

var cancel_button = new He.TextButton (_("Cancel"));
var cancel_button = new He.Button (null, _("Cancel")) {
is_textual = true
};
cancel_button.set_size_request (200, -1);
cancel_button.clicked.connect (() => {
this.destroy ();
});
button_box.append (cancel_button);

var apply_button = new He.FillButton (_("Edit Account")) {
var apply_button = new He.Button (null, _("Edit Account")) {
sensitive = false,
is_fill = true
};
apply_button.clicked.connect (() => {
this.update_user ();
Expand Down
15 changes: 9 additions & 6 deletions fuses/appearance/AppearanceView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,12 @@ public class AppearanceView : Gtk.Box {
wallpaper_box.append (wallpaper_label);
wallpaper_box.append (wallpaper_sublabel);

var wallpaper_grid_button = new He.IconicButton ("pan-end-symbolic") {
var wallpaper_grid_button = new He.Button ("pan-end-symbolic", null) {
hexpand = true,
vexpand = true,
halign = Gtk.Align.END,
valign = Gtk.Align.START
valign = Gtk.Align.START,
is_iconic = true
};

var wallpaper_header_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 24);
Expand Down Expand Up @@ -354,11 +355,12 @@ public class AppearanceView : Gtk.Box {
};
contrast_label.add_css_class ("cb-title");

var contrast_grid_button = new He.IconicButton ("pan-end-symbolic") {
var contrast_grid_button = new He.Button ("pan-end-symbolic", null) {
hexpand = true,
vexpand = true,
halign = Gtk.Align.END,
valign = Gtk.Align.START
valign = Gtk.Align.START,
is_iconic = true
};

var contrast_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 12);
Expand Down Expand Up @@ -486,8 +488,9 @@ public class AppearanceView : Gtk.Box {
grid.attach (accent_main_box, 0, 1);
grid.attach (wallpaper_accent_box, 0, 2);
grid.attach (ensor_main_box, 0, 3);
grid.attach (contrast_box, 0, 4);
grid.attach (roundness_box, 0, 5);
grid.attach (roundness_box, 0, 4);

grid.attach (contrast_box, 0, 6);
grid.add_css_class ("mini-content-block");

fusebox_appearance_settings.bind ("wallpaper-accent", wp_switch.iswitch, "active", SettingsBindFlags.DEFAULT);
Expand Down
5 changes: 3 additions & 2 deletions fuses/appearance/ContrastView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ public class Appearance.ContrastView : Gtk.Box {
can_target = false,
margin_start = margin_end = 18
};
var contrast_preview_button = new He.PillButton (_("Action")) {
can_target = false
var contrast_preview_button = new He.Button (null, _("Action")) {
can_target = false,
is_pill = true
};
contrast_preview_box.primary_button = (contrast_preview_button);
var contrast_preview_mbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 0) {
Expand Down
14 changes: 8 additions & 6 deletions fuses/appearance/WallpaperGrid.vala
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public class Appearance.WallpaperGrid : Gtk.Grid {

private Gtk.ScrolledWindow wallpaper_scrolled_window;
private Gtk.FlowBox wallpaper_view;
private He.TextButton wallpaper_add_button;
private He.TextButton wallpaper_removal_button;
private He.Button wallpaper_add_button;
private He.Button wallpaper_removal_button;

public He.AppBar wappbar;

Expand Down Expand Up @@ -104,19 +104,21 @@ public class Appearance.WallpaperGrid : Gtk.Grid {
halign = Gtk.Align.END
};

wallpaper_add_button = new He.TextButton ("") {
wallpaper_add_button = new He.Button (null, "") {
is_textual = true,
child = new He.ButtonContent () {
label = "Add Wallpaper…",
icon = "list-add-symbolic"
}
};
wallpaper_add_button.clicked.connect (show_wallpaper_chooser);

wallpaper_removal_button = new He.TextButton ("") {
wallpaper_removal_button = new He.Button (null, "") {
hexpand = true,
halign = Gtk.Align.END,
icon = "user-trash-symbolic",
visible = false
visible = false,
is_textual = true
};
wallpaper_removal_button.clicked.connect (() => {
var wallpaper = (Appearance.WallpaperContainer) wallpaper_view.get_selected_children ().data;
Expand Down Expand Up @@ -163,7 +165,7 @@ public class Appearance.WallpaperGrid : Gtk.Grid {
settings.set_string ("picture-uri-dark", furi);
if (appearance_view.wp_switch.iswitch.active)
appearance_view.accent_setup.begin ();

appearance_view.wallpaper_preview.file = furi;

try {
Expand Down
12 changes: 7 additions & 5 deletions fuses/bluetooth/src/DeviceRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public class Bluetooth.DeviceRow : Gtk.ListBoxRow {
}
}

private He.FillButton connect_button;
private He.TintButton forget_button;
private He.Button connect_button;
private He.Button forget_button;
private He.ModifierBadge state;
private Gtk.Label state_label;
private Gtk.LinkButton settings_button;
Expand Down Expand Up @@ -136,17 +136,19 @@ public class Bluetooth.DeviceRow : Gtk.ListBoxRow {
};
settings_button.add_css_class ("disclosure-button");

forget_button = new He.TintButton ("") {
forget_button = new He.Button (null, "") {
margin_end = 3,
is_tint = true,
label = _("Forget"),
visible = false,
valign = Gtk.Align.CENTER,
color = He.Colors.RED,
tooltip_text = _("Forget this device")
};

connect_button = new He.FillButton ("") {
valign = Gtk.Align.CENTER
connect_button = new He.Button (null, "") {
valign = Gtk.Align.CENTER,
is_fill = true
};

size_group.add_widget (connect_button);
Expand Down
12 changes: 9 additions & 3 deletions fuses/bluetooth/src/PairDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,18 @@ public class PairDialog : He.Dialog {
case AuthType.REQUEST_CONFIRMATION:
info = _("See if the code displayed on “%s” matches below.").printf (device_name);

var confirm_button = new He.FillButton (_("Pair"));
var confirm_button = new He.Button (null, _("Pair")) {
is_fill = true
};
primary_button = confirm_button;
break;
case AuthType.DISPLAY_PASSKEY:
info = _("%s” wants to pair with this device. See if the code displayed on “%s” matches below.")
.printf (device_name, device_name);

var confirm_button = new He.FillButton (_("Pair"));
var confirm_button = new He.Button (null, _("Pair")) {
is_fill = true
};
primary_button = confirm_button;
break;
case AuthType.DISPLAY_PIN_CODE:
Expand All @@ -115,7 +119,9 @@ public class PairDialog : He.Dialog {
case AuthType.REQUEST_AUTHORIZATION:
info = _("%s” wants to pair with this device.").printf (device_name);

var confirm_button = new He.FillButton (_("Pair"));
var confirm_button = new He.Button (null, _("Pair")) {
is_fill = true
};
primary_button = confirm_button;
break;
}
Expand Down
5 changes: 3 additions & 2 deletions fuses/datetime/WorldLocationFinder.vala
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class DateTime.WorldLocationFinder : Gtk.Box {
private Gtk.Stack search_stack;
private Gtk.ListBox listbox;
private Gtk.SearchEntry search_entry;
private He.PillButton add_button;
private He.Button add_button;

construct {
var main_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 12);
Expand Down Expand Up @@ -119,8 +119,9 @@ public class DateTime.WorldLocationFinder : Gtk.Box {
search_stack.add_named (search_label, "empty");
search_stack.add_named (listbox, "results");

add_button = new He.PillButton ("") {
add_button = new He.Button (null, "") {
margin_bottom = 18,
is_pill = true,
label = _("Add Location")
};

Expand Down
7 changes: 5 additions & 2 deletions fuses/locale/FormatPicker.vala
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,18 @@ class Locale.FormatPicker : He.Window {
};
main.append (button_box);

var cancel_button = new He.TextButton (_("Cancel"));
var cancel_button = new He.Button (null, _("Cancel")) {
is_textual = true
};
cancel_button.set_size_request (200, -1);
cancel_button.clicked.connect (() => {
this.destroy ();
});
button_box.append (cancel_button);

var apply_button = new He.FillButton (_("Set Format")) {
var apply_button = new He.Button (null, _("Set Format")) {
sensitive = false,
is_fill = true
};
apply_button.set_size_request (200, -1);
apply_button.clicked.connect (() => {
Expand Down
Loading

0 comments on commit 3d928a7

Please sign in to comment.