Skip to content

Commit

Permalink
Fix meson post install
Browse files Browse the repository at this point in the history
Enable cpupower-gui services with systemctl to install the required
symlinks.

Add error message if libhandy is not installed.
  • Loading branch information
vagnum08 committed Nov 9, 2020
1 parent 669f3a5 commit a01fbba
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
4 changes: 3 additions & 1 deletion build-aux/meson/postinstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@
print('Compiling GSettings schemas...')
call(['glib-compile-schemas', path.join(datadir, 'glib-2.0', 'schemas')])


print('Enabling systemd services...')
call(['systemctl', 'enable', 'cpupower-gui-helper.service'])
call(['systemctl', 'enable', 'cpupower-gui.service'])
35 changes: 18 additions & 17 deletions cpupower_gui/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
import dbus
import gi

gi.require_version("Handy", "1")
try:
gi.require_version("Handy", "1")
from gi.repository import Handy
except (ValueError, ImportError):
Handy = None

from gi.repository import Gio, GLib, GObject, Gtk, Handy
from gi.repository import Gio, GLib, GObject, Gtk

from .config import CpuPowerConfig, CpuSettings
from .utils import read_available_frequencies, read_current_freq
Expand Down Expand Up @@ -101,23 +105,20 @@ def settings(self):
return []


def dialog_response(widget, response_id):
""" Error message dialog """
# if the button clicked gives response OK (-5)
# if response_id == Gtk.ResponseType.OK:
# print("OK")
# if the messagedialog is destroyed (by pressing ESC)
# elif response_id == Gtk.ResponseType.DELETE_EVENT:
# print("dialog closed or cancelled")
widget.destroy()
def error_message(msg, transient=None):
message = Gtk.MessageDialog(
parent=transient, type=Gtk.MessageType.ERROR, buttons=Gtk.ButtonsType.OK
)
message.set_markup(msg)
resp = message.run()
message.destroy()


def error_message(msg, transient):
message = Gtk.MessageDialog(type=Gtk.MessageType.ERROR, buttons=Gtk.ButtonsType.OK)
message.set_markup(msg)
message.set_transient_for(transient)
message.show()
message.connect("response", dialog_response)
if Handy is None:
error_message(
"Error! Libhandy is not installed.\nPlease install libhandy-1 and its gi bindings."
)
exit(1)


@Gtk.Template(resource_path="/org/rnd2/cpupower_gui/window.ui")
Expand Down

0 comments on commit a01fbba

Please sign in to comment.