File indexing completed on 2024-04-21 05:47:46
0001 /******************************************************************************* 0002 * Copyright (C) 2016 Ragnar Thomsen <rthomsen6@gmail.com> * 0003 * * 0004 * This program is free software: you can redistribute it and/or modify it * 0005 * under the terms of the GNU General Public License as published by the Free * 0006 * Software Foundation, either version 2 of the License, or (at your option) * 0007 * any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT * 0010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 0011 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 0012 * more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License along * 0015 * with this program. If not, see <http://www.gnu.org/licenses/>. * 0016 *******************************************************************************/ 0017 0018 #ifndef SYSTEMDUNIT_H 0019 #define SYSTEMDUNIT_H 0020 0021 #include <QString> 0022 #include <QDBusObjectPath> 0023 0024 // struct for storing units retrieved from systemd via DBus 0025 struct SystemdUnit 0026 { 0027 QString id, description, load_state, active_state, sub_state, following, job_type, unit_file, unit_file_status; 0028 QDBusObjectPath unit_path, job_path; 0029 uint job_id; 0030 0031 // The == operator must be provided to use contains() and indexOf() 0032 // on QLists of this struct 0033 bool operator==(const SystemdUnit& right) const 0034 { 0035 if (id == right.id) 0036 return true; 0037 else 0038 return false; 0039 } 0040 SystemdUnit(){} 0041 0042 SystemdUnit(QString newId) 0043 { 0044 id = newId; 0045 } 0046 }; 0047 Q_DECLARE_METATYPE(SystemdUnit) 0048 0049 // struct for storing sessions retrieved from logind via DBus 0050 struct SystemdSession 0051 { 0052 QString session_id, user_name, seat_id, session_state; 0053 QDBusObjectPath session_path; 0054 uint user_id; 0055 0056 // The == operator must be provided to use contains() and indexOf() 0057 // on QLists of this struct 0058 bool operator==(const SystemdSession& right) const 0059 { 0060 if (session_id == right.session_id) 0061 return true; 0062 else 0063 return false; 0064 } 0065 }; 0066 Q_DECLARE_METATYPE(SystemdSession) 0067 0068 enum dbusBus 0069 { 0070 sys, session, user 0071 }; 0072 0073 #endif // SYSTEMDUNIT_H