From 83ced714d72e30b761351675d058036c6443830c Mon Sep 17 00:00:00 2001 From: Vivianne Langdon Date: Fri, 18 Mar 2022 00:13:47 -0700 Subject: [PATCH] recreated python fully --- src/application.vala | 9 ++++++--- src/window.ui | 2 +- src/window.vala | 8 +++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/application.vala b/src/application.vala index 15892d9..3fffb30 100644 --- a/src/application.vala +++ b/src/application.vala @@ -3,16 +3,19 @@ namespace Deskcandy { public class Application : Gtk.Application { private Gtk.Window window; + public bool enabled { get; set; } + public Application() { Object(application_id: "moe.solarpunk.Deskcandy"); - var xwinwrap_enabled_prop = new PropertyAction("xwinwrap-enabled", this, "xwinwrap-enabled"); - xwinwrap_enabled_prop.notify.connect(this.on_xwinwrap_enabled_changed); + var toggle_enabled = new PropertyAction("toggle-enabled", this, "enabled"); + toggle_enabled.notify.connect(this.on_toggle_enabled); + this.add_action(toggle_enabled); this.set_up_actions(); } - private void on_xwinwrap_enabled_changed() { + private void on_toggle_enabled() { } private void set_up_actions() { diff --git a/src/window.ui b/src/window.ui index df01565..b5eb53f 100644 --- a/src/window.ui +++ b/src/window.ui @@ -906,7 +906,7 @@ True True Start or stop the desktop effects - app.xwinwrap-enabled + app.toggle-enabled 1 diff --git a/src/window.vala b/src/window.vala index d4ca03c..1fd208d 100644 --- a/src/window.vala +++ b/src/window.vala @@ -23,6 +23,7 @@ namespace Deskcandy { var create_preset = new SimpleAction("create", null); preset_action_group.add_action(create_preset); create_preset.activate.connect(this.on_create_preset); + var delete_preset = new SimpleAction("delete", null); delete_preset.activate.connect(this.on_delete_preset); preset_action_group.add_action(delete_preset); @@ -33,7 +34,7 @@ namespace Deskcandy { var menu = (GLib.MenuModel)builder.get_object("main_menu"); this.open_menu_button.menu_model = menu; - app.connect("notify::xwinwrap-enabled", this.on_notify_xwinwrap_enabled); + app.notify["enabled"].connect(this.on_notify_enabled); this.refresh_socket(); } @@ -87,8 +88,9 @@ namespace Deskcandy { message("delete"); } - private void on_notify_xwinwrap_enabled(Gtk.Widget w, Gtk.Application app, GLib.PropertyAction prop) { - this.headerbar.subtitle = prop.enabled ? "started" : "stopped"; + private void on_notify_enabled(Object o, GLib.ParamSpec param) { + var val = ((Application)o).enabled; + this.headerbar.subtitle = val ? "started" : "stopped"; } } }