Skip to content

Commit

Permalink
start on dialog stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed Oct 16, 2023
1 parent 48ce689 commit a45ecf8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Plug.vala
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class About.Plug : Switchboard.Plug {

var stack_switcher = new Gtk.StackSwitcher () {
halign = Gtk.Align.CENTER,
homogeneous = true,
// homogeneous = true,
margin_top = 24,
stack = stack
};
Expand Down
32 changes: 19 additions & 13 deletions src/Views/FirmwareView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public class About.FirmwareView : Granite.SimpleSettingsPage {
if (LoginManager.get_instance ().can_reboot_to_firmware_setup ()) {
var reboot_to_firmware_setup_button = new Gtk.Button.with_label (_("Restart to Firmware Setup…"));
reboot_to_firmware_setup_button.clicked.connect (reboot_to_firmware_setup_clicked);
action_area.add (reboot_to_firmware_setup_button);
action_area.append (reboot_to_firmware_setup_button);
}

fwupd_client = new Fwupd.Client ();
Expand Down Expand Up @@ -226,8 +226,11 @@ public class About.FirmwareView : Granite.SimpleSettingsPage {

construct {
xalign = 0;
margin = 3;
get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL);
margin_top = 3;
margin_end = 3;
margin_bottom = 3;
margin_start = 3;
add_css_class (Granite.STYLE_CLASS_H4_LABEL);
}
}

Expand Down Expand Up @@ -333,7 +336,7 @@ public class About.FirmwareView : Granite.SimpleSettingsPage {
};

var suggested_button = (Gtk.Button) message_dialog.add_button (_("Continue"), Gtk.ResponseType.ACCEPT);
suggested_button.get_style_context ().add_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
suggested_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);

if (detach_image != null) {
var custom_widget = new Gtk.Image.from_file (detach_image);
Expand All @@ -359,13 +362,16 @@ public class About.FirmwareView : Granite.SimpleSettingsPage {
};

var suggested_button = (Gtk.Button) message_dialog.add_button (_("Restart"), Gtk.ResponseType.ACCEPT);
suggested_button.get_style_context ().add_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
suggested_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);

if (message_dialog.run () == Gtk.ResponseType.ACCEPT) {
LoginManager.get_instance ().reboot ();
}
message_dialog.response.connect ((response) => {
if (response == ACCEPT) {
LoginManager.get_instance ().reboot ();
}
message_dialog.destroy ();
});

message_dialog.destroy ();
message_dialog.present ();
}

private void show_shutdown_dialog () {
Expand All @@ -380,7 +386,7 @@ public class About.FirmwareView : Granite.SimpleSettingsPage {
};

var suggested_button = (Gtk.Button) message_dialog.add_button (_("Shut Down"), Gtk.ResponseType.ACCEPT);
suggested_button.get_style_context ().add_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION);
suggested_button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION);

if (message_dialog.run () == Gtk.ResponseType.ACCEPT) {
LoginManager.get_instance ().shutdown ();
Expand All @@ -398,11 +404,11 @@ public class About.FirmwareView : Granite.SimpleSettingsPage {
) {
badge_icon = new ThemedIcon ("application-x-firmware"),
modal = true,
transient_for = (Gtk.Window) get_toplevel ()
transient_for = (Gtk.Window) get_root ()
};

var continue_button = dialog.add_button (_("Restart"), Gtk.ResponseType.ACCEPT);
continue_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION);
continue_button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION);

dialog.response.connect ((result) => {
dialog.destroy ();
Expand All @@ -423,7 +429,7 @@ public class About.FirmwareView : Granite.SimpleSettingsPage {
) {
badge_icon = new ThemedIcon ("dialog-error"),
modal = true,
transient_for = (Gtk.Window) get_toplevel ()
transient_for = (Gtk.Window) get_root ()
};
message_dialog.show_error_details (error.message);
message_dialog.present ();
Expand Down

0 comments on commit a45ecf8

Please sign in to comment.