Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle own titlebuttons #263

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
You'll need the following dependencies:

* gio-2.0 (>=2.74)
* libadwaita-1-dev
* libdbus-1-dev
* libswitchboard-3-dev
* libgranite-7-dev
Expand Down
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ conf_file = configure_file(
configuration: conf_data
)

adw_dep = dependency('libadwaita-1')
dbus_dep = dependency('dbus-1')
glib_dep = dependency('glib-2.0')
gio_dep = dependency('gio-2.0', version: '>=2.74')
Expand Down
20 changes: 17 additions & 3 deletions src/Plug.vala
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace Power {
private GLib.Settings settings;

public class Plug : Switchboard.Plug {
private Gtk.Box box;
private MainView main_view;

public Plug () {
Expand All @@ -39,11 +40,24 @@ namespace Power {
}

public override Gtk.Widget get_widget () {
if (main_view == null) {
if (box == null) {
Gtk.IconTheme.get_for_display (Gdk.Display.get_default ()).add_resource_path ("/io/elementary/settings/power");
main_view = new MainView ();

var headerbar = new Adw.HeaderBar () {
show_title = false
};
headerbar.add_css_class (Granite.STYLE_CLASS_FLAT);

main_view = new MainView () {
vexpand = true
};

box = new Gtk.Box (VERTICAL, 0);
box.append (headerbar);
box.append (main_view);
}
return main_view;

return box;
}

public override void shown () {
Expand Down
1 change: 1 addition & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ shared_module(
conf_file,
interfaces_file,
dependencies: [
adw_dep,
glib_dep,
gio_dep,
dependency('gobject-2.0'),
Expand Down
Loading