LCOV - code coverage report
Current view: top level - libmalcontent - manager.h (source / functions) Hit Total Coverage
Test: unnamed Lines: 1 1 100.0 %
Date: 2020-12-09 07:02:21 Functions: 2 4 50.0 %
Branches: 3 6 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
       2                 :            :  *
       3                 :            :  * Copyright © 2019 Endless Mobile, Inc.
       4                 :            :  *
       5                 :            :  * This library is free software; you can redistribute it and/or
       6                 :            :  * modify it under the terms of the GNU Lesser General Public
       7                 :            :  * License as published by the Free Software Foundation; either
       8                 :            :  * version 2.1 of the License, or (at your option) any later version.
       9                 :            :  *
      10                 :            :  * This library is distributed in the hope that it will be useful,
      11                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      12                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13                 :            :  * Lesser General Public License for more details.
      14                 :            :  *
      15                 :            :  * You should have received a copy of the GNU Lesser General Public
      16                 :            :  * License along with this library; if not, write to the Free Software
      17                 :            :  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
      18                 :            :  *
      19                 :            :  * Authors:
      20                 :            :  *  - Philip Withnall <withnall@endlessm.com>
      21                 :            :  */
      22                 :            : 
      23                 :            : #pragma once
      24                 :            : 
      25                 :            : #include <gio/gio.h>
      26                 :            : #include <glib.h>
      27                 :            : #include <glib-object.h>
      28                 :            : 
      29                 :            : G_BEGIN_DECLS
      30                 :            : 
      31                 :            : /**
      32                 :            :  * MctManagerGetValueFlags:
      33                 :            :  * @MCT_MANAGER_GET_VALUE_FLAGS_NONE: No flags set.
      34                 :            :  * @MCT_MANAGER_GET_VALUE_FLAGS_INTERACTIVE: Allow interactive polkit dialogs
      35                 :            :  *    when requesting authorization.
      36                 :            :  *
      37                 :            :  * Flags to control the behaviour of getter functions like
      38                 :            :  * mct_manager_get_app_filter() and mct_manager_get_app_filter_async().
      39                 :            :  *
      40                 :            :  * Since: 0.5.0
      41                 :            :  */
      42                 :            : typedef enum
      43                 :            : {
      44                 :            :   MCT_MANAGER_GET_VALUE_FLAGS_NONE = 0,
      45                 :            :   MCT_MANAGER_GET_VALUE_FLAGS_INTERACTIVE = (1 << 0),
      46                 :            : } MctManagerGetValueFlags;
      47                 :            : 
      48                 :            : /* FIXME: Eventually deprecate these compatibility fallbacks. */
      49                 :            : typedef MctManagerGetValueFlags MctGetAppFilterFlags;
      50                 :            : #define MCT_GET_APP_FILTER_FLAGS_NONE MCT_MANAGER_GET_VALUE_FLAGS_NONE
      51                 :            : #define MCT_GET_APP_FILTER_FLAGS_INTERACTIVE MCT_MANAGER_GET_VALUE_FLAGS_INTERACTIVE
      52                 :            : 
      53                 :            : /**
      54                 :            :  * MctManagerSetValueFlags:
      55                 :            :  * @MCT_MANAGER_SET_VALUE_FLAGS_NONE: No flags set.
      56                 :            :  * @MCT_MANAGER_SET_VALUE_FLAGS_INTERACTIVE: Allow interactive polkit dialogs
      57                 :            :  *    when requesting authorization.
      58                 :            :  *
      59                 :            :  * Flags to control the behaviour of setter functions like
      60                 :            :  * mct_manager_set_app_filter() and mct_manager_set_app_filter_async().
      61                 :            :  *
      62                 :            :  * Since: 0.5.0
      63                 :            :  */
      64                 :            : typedef enum
      65                 :            : {
      66                 :            :   MCT_MANAGER_SET_VALUE_FLAGS_NONE = 0,
      67                 :            :   MCT_MANAGER_SET_VALUE_FLAGS_INTERACTIVE = (1 << 0),
      68                 :            : } MctManagerSetValueFlags;
      69                 :            : 
      70                 :            : /* FIXME: Eventually deprecate these compatibility fallbacks. */
      71                 :            : typedef MctManagerSetValueFlags MctSetAppFilterFlags;
      72                 :            : #define MCT_SET_APP_FILTER_FLAGS_NONE MCT_MANAGER_SET_VALUE_FLAGS_NONE
      73                 :            : #define MCT_SET_APP_FILTER_FLAGS_INTERACTIVE MCT_MANAGER_SET_VALUE_FLAGS_INTERACTIVE
      74                 :            : 
      75                 :            : /**
      76                 :            :  * MctManagerError:
      77                 :            :  * @MCT_MANAGER_ERROR_INVALID_USER: Given user ID doesn’t exist
      78                 :            :  * @MCT_MANAGER_ERROR_PERMISSION_DENIED: Not authorized to query properties of
      79                 :            :  *     the given user
      80                 :            :  * @MCT_MANAGER_ERROR_INVALID_DATA: The data stored in a property of the given
      81                 :            :  *     user is inconsistent or invalid
      82                 :            :  * @MCT_MANAGER_ERROR_DISABLED: Parental controls are disabled for all users
      83                 :            :  *
      84                 :            :  * Errors relating to get/set operations on an #MctManager instance.
      85                 :            :  *
      86                 :            :  * Since: 0.5.0
      87                 :            :  */
      88                 :            : typedef enum
      89                 :            : {
      90                 :            :   MCT_MANAGER_ERROR_INVALID_USER,
      91                 :            :   MCT_MANAGER_ERROR_PERMISSION_DENIED,
      92                 :            :   MCT_MANAGER_ERROR_INVALID_DATA,
      93                 :            :   MCT_MANAGER_ERROR_DISABLED,
      94                 :            : } MctManagerError;
      95                 :            : 
      96                 :            : GQuark mct_manager_error_quark (void);
      97                 :            : #define MCT_MANAGER_ERROR mct_manager_error_quark ()
      98                 :            : 
      99                 :            : #include <libmalcontent/app-filter.h>
     100                 :            : #include <libmalcontent/session-limits.h>
     101                 :            : 
     102                 :            : #define MCT_TYPE_MANAGER mct_manager_get_type ()
     103   [ -  +  +  -  :        184 : G_DECLARE_FINAL_TYPE (MctManager, mct_manager, MCT, MANAGER, GObject)
                   +  - ]
     104                 :            : 
     105                 :            : MctManager   *mct_manager_new (GDBusConnection *connection);
     106                 :            : 
     107                 :            : MctAppFilter *mct_manager_get_app_filter        (MctManager            *self,
     108                 :            :                                                  uid_t                  user_id,
     109                 :            :                                                  MctManagerGetValueFlags flags,
     110                 :            :                                                  GCancellable          *cancellable,
     111                 :            :                                                  GError               **error);
     112                 :            : void          mct_manager_get_app_filter_async  (MctManager            *self,
     113                 :            :                                                  uid_t                  user_id,
     114                 :            :                                                  MctManagerGetValueFlags flags,
     115                 :            :                                                  GCancellable          *cancellable,
     116                 :            :                                                  GAsyncReadyCallback    callback,
     117                 :            :                                                  gpointer               user_data);
     118                 :            : MctAppFilter *mct_manager_get_app_filter_finish (MctManager            *self,
     119                 :            :                                                  GAsyncResult          *result,
     120                 :            :                                                  GError               **error);
     121                 :            : 
     122                 :            : gboolean      mct_manager_set_app_filter        (MctManager            *self,
     123                 :            :                                                  uid_t                  user_id,
     124                 :            :                                                  MctAppFilter          *app_filter,
     125                 :            :                                                  MctManagerSetValueFlags flags,
     126                 :            :                                                  GCancellable          *cancellable,
     127                 :            :                                                  GError               **error);
     128                 :            : void          mct_manager_set_app_filter_async  (MctManager            *self,
     129                 :            :                                                  uid_t                  user_id,
     130                 :            :                                                  MctAppFilter          *app_filter,
     131                 :            :                                                  MctManagerSetValueFlags flags,
     132                 :            :                                                  GCancellable          *cancellable,
     133                 :            :                                                  GAsyncReadyCallback    callback,
     134                 :            :                                                  gpointer               user_data);
     135                 :            : gboolean      mct_manager_set_app_filter_finish (MctManager            *self,
     136                 :            :                                                  GAsyncResult          *result,
     137                 :            :                                                  GError               **error);
     138                 :            : 
     139                 :            : MctSessionLimits *mct_manager_get_session_limits        (MctManager                *self,
     140                 :            :                                                          uid_t                      user_id,
     141                 :            :                                                          MctManagerGetValueFlags    flags,
     142                 :            :                                                          GCancellable              *cancellable,
     143                 :            :                                                          GError                   **error);
     144                 :            : void              mct_manager_get_session_limits_async  (MctManager                *self,
     145                 :            :                                                          uid_t                      user_id,
     146                 :            :                                                          MctManagerGetValueFlags    flags,
     147                 :            :                                                          GCancellable              *cancellable,
     148                 :            :                                                          GAsyncReadyCallback        callback,
     149                 :            :                                                          gpointer                   user_data);
     150                 :            : MctSessionLimits *mct_manager_get_session_limits_finish (MctManager                *self,
     151                 :            :                                                          GAsyncResult              *result,
     152                 :            :                                                          GError                   **error);
     153                 :            : 
     154                 :            : gboolean      mct_manager_set_session_limits        (MctManager                *self,
     155                 :            :                                                      uid_t                      user_id,
     156                 :            :                                                      MctSessionLimits          *session_limits,
     157                 :            :                                                      MctManagerSetValueFlags    flags,
     158                 :            :                                                      GCancellable              *cancellable,
     159                 :            :                                                      GError                   **error);
     160                 :            : void          mct_manager_set_session_limits_async  (MctManager                *self,
     161                 :            :                                                      uid_t                      user_id,
     162                 :            :                                                      MctSessionLimits          *session_limits,
     163                 :            :                                                      MctManagerSetValueFlags    flags,
     164                 :            :                                                      GCancellable              *cancellable,
     165                 :            :                                                      GAsyncReadyCallback        callback,
     166                 :            :                                                      gpointer                   user_data);
     167                 :            : gboolean      mct_manager_set_session_limits_finish (MctManager                *self,
     168                 :            :                                                      GAsyncResult              *result,
     169                 :            :                                                      GError                   **error);
     170                 :            : 
     171                 :            : G_END_DECLS

Generated by: LCOV version 1.14