Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Remove usermanager #175

Closed
wants to merge 1 commit into from
Closed
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: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

You'll need the following dependencies:

libaccountsservice-dev
libgirepository1.0-dev
libglib2.0-dev
libgranite-dev >= 5.3.0
Expand Down
4 changes: 0 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@ shared_module(
meson.project_name(),
'src/Indicator.vala',
'src/Widgets/EndSessionDialog.vala',
'src/Widgets/UserBox.vala',
'src/Widgets/UserListBox.vala',
'src/Services/DbusInterfaces.vala',
'src/Services/UserManager.vala',
'src/Services/EndSessionDialogServer.vala',
config_vala,
dependencies: [
dependency('accountsservice'),
dependency('glib-2.0'),
dependency('gobject-2.0'),
dependency('granite', version: '>=5.3.0'),
Expand Down
3 changes: 0 additions & 3 deletions po/POTFILES
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
src/Indicator.vala
src/Widgets/EndSessionDialog.vala
src/Widgets/UserBox.vala
src/Widgets/UserListBox.vala
src/Services/DbusInterfaces.vala
src/Services/UserManager.vala
90 changes: 3 additions & 87 deletions src/Indicator.vala
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ public class Session.Indicator : Wingpanel.Indicator {
private Gtk.ModelButton shutdown;
private Gtk.ModelButton log_out;

private Session.Services.UserManager manager;
private Widgets.EndSessionDialog? current_dialog = null;

private Gtk.Box? main_box;
private string active_user_real_name;

private static GLib.Settings? keybinding_settings;

Expand All @@ -51,8 +49,6 @@ public class Session.Indicator : Wingpanel.Indicator {

EndSessionDialogServer.init ();
EndSessionDialogServer.get_default ().show_dialog.connect ((type) => show_dialog ((Widgets.EndSessionDialogType)type));

manager = new Session.Services.UserManager ();
}

static construct {
Expand All @@ -65,13 +61,10 @@ public class Session.Indicator : Wingpanel.Indicator {
if (indicator_icon == null) {
indicator_icon = new Gtk.Image () {
icon_name = ICON_NAME,
pixel_size = 24
pixel_size = 24,
tooltip_markup = Granite.TOOLTIP_SECONDARY_TEXT_MARKUP.printf (_("Middle-click to prompt to shut down"))
};

manager.changed.connect (() => {
update_tooltip.begin ();
});

indicator_icon.button_press_event.connect ((e) => {
if (e.button == Gdk.BUTTON_MIDDLE) {
if (session_interface == null) {
Expand Down Expand Up @@ -132,25 +125,6 @@ public class Session.Indicator : Wingpanel.Indicator {
};

if (server_type == Wingpanel.IndicatorManager.ServerType.SESSION) {
if (!is_running_in_demo_mode ()) {
var users_separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL) {
margin_top = 3,
margin_bottom = 3
};

var scrolled_box = new Gtk.ScrolledWindow (null, null) {
hexpand = true,
hscrollbar_policy = Gtk.PolicyType.NEVER,
max_content_height = 300,
propagate_natural_height = true
};
scrolled_box.add (manager.user_grid);

main_box.add (scrolled_box);
main_box.add (user_settings);
main_box.add (users_separator);
}

var logout_separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL) {
margin_top = 3,
margin_bottom = 3
Expand Down Expand Up @@ -192,8 +166,6 @@ public class Session.Indicator : Wingpanel.Indicator {
}
}

manager.close.connect (() => close ());

user_settings.clicked.connect (() => {
close ();

Expand Down Expand Up @@ -291,13 +263,7 @@ public class Session.Indicator : Wingpanel.Indicator {
}
}

public override void opened () {
if (server_type == Wingpanel.IndicatorManager.ServerType.SESSION && !is_running_in_demo_mode ()) {
manager.update_all ();
}

main_box.show_all ();
}
public override void opened () {}

public override void closed () {}

Expand Down Expand Up @@ -356,56 +322,6 @@ public class Session.Indicator : Wingpanel.Indicator {

current_dialog.show_all ();
}

private async void update_tooltip () {
string description;

if (server_type == Wingpanel.IndicatorManager.ServerType.SESSION && !is_running_in_demo_mode ()) {
if (active_user_real_name == null) {
active_user_real_name = Environment.get_real_name ();
}

int n_online_users = (yield manager.get_n_active_and_online_users ()) - 1;

if (n_online_users > 0) {
description = dngettext (
GETTEXT_PACKAGE,
"Logged in as “%s”, %i other user logged in",
"Logged in as “%s”, %i other users logged in",
n_online_users
);
description = description.printf (active_user_real_name, n_online_users);
} else {
description = _("Logged in as “%s”").printf (active_user_real_name);
}
} else {
description = _("Not logged in");
}

string accel_label = Granite.TOOLTIP_SECONDARY_TEXT_MARKUP.printf (_("Middle-click to prompt to shut down"));

indicator_icon.tooltip_markup = "%s\n%s".printf (
description,
accel_label
);
}

private bool is_running_in_demo_mode () {
var proc_cmdline = File.new_for_path ("/proc/cmdline");
try {
var @is = proc_cmdline.read ();
var dis = new DataInputStream (@is);

var line = dis.read_line ();
if ("boot=casper" in line || "boot=live" in line || "rd.live.image" in line) {
return true;
}
} catch (Error e) {
critical ("Couldn't detect if running in Demo Mode: %s", e.message);
}

return false;
}
}

public Wingpanel.Indicator? get_indicator (Module module, Wingpanel.IndicatorManager.ServerType server_type) {
Expand Down
22 changes: 1 addition & 21 deletions src/Services/DbusInterfaces.vala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 elementary LLC. (http://launchpad.net/wingpanel)
* Copyright 2011-2023 elementary, Inc. (http://launchpad.net/wingpanel)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
Expand All @@ -17,12 +17,6 @@
* Boston, MA 02110-1301 USA
*/

struct UserInfo {
uint32 uid;
string user_name;
ObjectPath? user_object;
}

[DBus (name = "org.gnome.SessionManager")]
interface SessionInterface : Object {
public abstract async void logout (uint type) throws GLib.Error;
Expand All @@ -41,18 +35,4 @@ interface SystemInterface : Object {
public abstract void suspend (bool interactive) throws GLib.Error;
public abstract void reboot (bool interactive) throws GLib.Error;
public abstract void power_off (bool interactive) throws GLib.Error;

public abstract UserInfo[] list_users () throws GLib.Error;
}

[DBus (name = "org.freedesktop.login1.User")]
interface UserInterface : Object {
public abstract string state { owned get; }
}

[DBus (name = "org.freedesktop.DisplayManager.Seat")]
interface SeatInterface : Object {
public abstract bool has_guest_account { get; }
public abstract void switch_to_guest (string session_name) throws GLib.Error;
public abstract void switch_to_user (string username, string session_name) throws GLib.Error;
}
Loading