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

Start Gtk4 port #448

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft
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
9 changes: 4 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@ on:

jobs:
build:

runs-on: ubuntu-22.04

container:
image: elementary/docker:next-unstable
image: elementary/docker:stable

steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: |
apt update
apt install -y libgala-dev libgee-0.8-dev libgirepository1.0-dev libglib2.0-dev libgranite-dev libgtk-3-dev meson valac
apt install -y libgala-dev libgee-0.8-dev libgirepository1.0-dev libglib2.0-dev libgranite-7-dev libgtk-4-dev meson valac
- name: Build
env:
DESTDIR: out
Expand All @@ -32,10 +31,10 @@ jobs:
lint:

runs-on: ubuntu-latest

container:
image: valalang/lint

steps:
- uses: actions/checkout@v3
- name: Lint
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ You'll need the following dependencies:
* libgala-dev
* libgee-0.8-dev
* libglib2.0-dev
* libgranite-dev >= 5.4.0
* libgtk-3-dev
* libgranite-7-dev
* libgtk4-dev
* meson
* libmutter-2-dev
* valac
Expand Down
19 changes: 1 addition & 18 deletions lib/Widgets/Container.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,4 @@
*/

[Version (deprecated = true, deprecated_since = "3.0.0", replacement = "Gtk.ModelButton")]
public class Wingpanel.Widgets.Container : Gtk.Button {
public Gtk.Grid content_widget { owned get; construct; }

public extern Gtk.Grid get_content_widget ();

public Container () {}

construct {
content_widget = new Gtk.Grid ();
content_widget.hexpand = true;
add (content_widget);

var style_context = this.get_style_context ();
style_context.add_class (Gtk.STYLE_CLASS_MENUITEM);
style_context.remove_class (Gtk.STYLE_CLASS_BUTTON);
style_context.remove_class ("text-button");
}
}
public class Wingpanel.Widgets.Container : Gtk.Button {}
67 changes: 2 additions & 65 deletions lib/Widgets/OverlayIcon.vala
Original file line number Diff line number Diff line change
Expand Up @@ -17,68 +17,5 @@
* Boston, MA 02110-1301 USA.
*/

public class Wingpanel.Widgets.OverlayIcon : Gtk.Overlay {
private Gtk.Image main_image;
private Gtk.Image overlay_image;

public OverlayIcon (string icon_name) {
set_main_icon_name (icon_name);
}

public OverlayIcon.from_pixbuf (Gdk.Pixbuf pixbuf) {
set_main_pixbuf (pixbuf);
}

construct {
main_image = new Gtk.Image ();
main_image.icon_size = 24;
main_image.pixel_size = 24;

overlay_image = new Gtk.Image ();
overlay_image.icon_size = 24;
overlay_image.pixel_size = 24;

add (main_image);
add_overlay (overlay_image);
}

public void set_main_pixbuf (Gdk.Pixbuf? pixbuf) {
main_image.set_from_pixbuf (pixbuf);
}

public Gdk.Pixbuf? get_main_pixbuf () {
return main_image.get_pixbuf ();
}

public void set_overlay_pixbuf (Gdk.Pixbuf? pixbuf) {
overlay_image.set_from_pixbuf (pixbuf);
}

public Gdk.Pixbuf? get_overlay_pixbuf () {
return overlay_image.get_pixbuf ();
}

public void set_main_icon_name (string icon_name) {
main_image.icon_name = icon_name;
}

public string get_main_icon_name () {
return main_image.icon_name;
}

public void set_overlay_icon_name (string icon_name) {
overlay_image.icon_name = icon_name;
}

public string get_overlay_icon_name () {
return overlay_image.icon_name;
}

public Gtk.Image get_main_image () {
return main_image;
}

public Gtk.Image get_overlay_image () {
return overlay_image;
}
}
[Version (deprecated = true, deprecated_since = "3.0.0", replacement = "Gtk.Overlay")]
public class Wingpanel.Widgets.OverlayIcon : Gtk.Box { }
61 changes: 1 addition & 60 deletions lib/Widgets/Switch.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,63 +18,4 @@
*/

[Version (deprecated = true, deprecated_since = "3.0.0", replacement = "Granite.SwitchModelButton")]
public class Wingpanel.Widgets.Switch : Gtk.Bin {
public bool active { get; set; }
public string caption { owned get; set; }

private Gtk.Label button_label;
private Gtk.Switch button_switch;

public Switch (string caption, bool active = false) {
Object (caption: caption, active: active);
}

public Switch.with_mnemonic (string caption, bool active = false) {
Object (caption: caption, active: active);
button_label.set_text_with_mnemonic (caption);
button_label.set_mnemonic_widget (this);
}

construct {
button_switch = new Gtk.Switch ();
button_switch.active = active;
button_switch.halign = Gtk.Align.END;
button_switch.hexpand = true;
button_switch.valign = Gtk.Align.CENTER;

button_label = new Gtk.Label (null);
button_label.halign = Gtk.Align.START;

var grid = new Gtk.Grid ();
grid.column_spacing = 12;
grid.attach (button_label, 0, 0);
grid.attach (button_switch, 1, 0);

var modelbutton = new Gtk.ModelButton ();
modelbutton.get_child ().destroy ();
modelbutton.add (grid);

add (modelbutton);

modelbutton.button_release_event.connect (() => {
toggle_switch ();
// Stop modelbutton from closing the popover
return Gdk.EVENT_STOP;
});

bind_property ("active", button_switch, "active", GLib.BindingFlags.SYNC_CREATE | GLib.BindingFlags.BIDIRECTIONAL);
bind_property ("caption", button_label, "label", GLib.BindingFlags.SYNC_CREATE | GLib.BindingFlags.BIDIRECTIONAL);
}

public new Gtk.Label get_label () {
return button_label;
}

public Gtk.Switch get_switch () {
return button_switch;
}

public void toggle_switch () {
button_switch.activate ();
}
}
public class Wingpanel.Widgets.Switch : Gtk.Box {}
2 changes: 1 addition & 1 deletion lib/wingpanel.deps
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
glib-2.0
gee-0.8
gmodule-2.0
gtk+-3.0
gtk4
9 changes: 3 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project(
'io.elementary.wingpanel',
'c', 'vala',
version: '3.0.3',
version: '4.0.0',
)

add_project_arguments([
Expand All @@ -25,12 +25,9 @@ glib_dep = dependency('glib-2.0', version: '>=2.32')
gio_dep = dependency('gio-2.0')
gio_unix_dep = dependency('gio-unix-2.0')
gmodule_dep = dependency('gmodule-2.0')
# GDK X11 dep is for detecting whether we're on Wayland or not ONLY, we don't actually have
# a hard X11 dependency here
gdk_x11_dep = dependency('gdk-x11-3.0')
gtk_dep = dependency('gtk+-3.0', version: '>=3.10')
gtk_dep = dependency('gtk4')
gee_dep = dependency('gee-0.8')
granite_dep = dependency('granite', version: '>=5.4.0')
granite_dep = dependency('granite-7')
posix_dep = meson.get_compiler('vala').find_library('posix')

subdir('data')
Expand Down
5 changes: 2 additions & 3 deletions sample/SampleIndicator.vala
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,15 @@ public class Sample.Indicator : Wingpanel.Indicator {

/* Create a new composited icon */
display_widget = new Gtk.Overlay ();
display_widget.add (main_image);
display_widget.child = main_image;
display_widget.add_overlay (overlay_image);

var separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL) {
margin_top = 3,
margin_bottom = 3
};

var hide_button = new Gtk.ModelButton ();
hide_button.text = _("Hide me!");
var hide_button = new Gtk.Button.with_label (_("Hide me!"));

var compositing_switch = new Granite.SwitchModelButton (_("Composited Icon"));

Expand Down
4 changes: 2 additions & 2 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class Wingpanel.Application : Gtk.Application {

construct {
flags = ApplicationFlags.HANDLES_COMMAND_LINE;
application_id = "org.elementary.wingpanel";
application_id = "io.elementary.wingpanel";

add_main_option_entries (OPTIONS);

Expand Down Expand Up @@ -112,7 +112,7 @@ public class Wingpanel.Application : Gtk.Application {
base.startup ();

panel_window = new PanelWindow (this);
panel_window.show_all ();
panel_window.present ();

register_actions ();
}
Expand Down
Loading