LCOV - code coverage report
Current view: top level - libmalcontent-timer - extension-agent-object.h (source / functions) Coverage Total Hit
Test: 2 coverage DB files Lines: 100.0 % 1 1
Test Date: 2025-11-20 19:57:30 Functions: 100.0 % 4 4
Branches: 50.0 % 6 3

             Branch data     Line data    Source code
       1                 :             : /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
       2                 :             :  *
       3                 :             :  * Copyright 2025 GNOME Foundation, Inc.
       4                 :             :  *
       5                 :             :  * SPDX-License-Identifier: LGPL-2.1-or-later
       6                 :             :  *
       7                 :             :  * This library is free software; you can redistribute it and/or
       8                 :             :  * modify it under the terms of the GNU Lesser General Public
       9                 :             :  * License as published by the Free Software Foundation; either
      10                 :             :  * version 2.1 of the License, or (at your option) any later version.
      11                 :             :  *
      12                 :             :  * This library is distributed in the hope that it will be useful,
      13                 :             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      14                 :             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      15                 :             :  * Lesser General Public License for more details.
      16                 :             :  *
      17                 :             :  * You should have received a copy of the GNU Lesser General Public
      18                 :             :  * License along with this library; if not, write to the Free Software
      19                 :             :  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
      20                 :             :  *
      21                 :             :  * Authors:
      22                 :             :  *  - Philip Withnall <pwithnall@gnome.org>
      23                 :             :  */
      24                 :             : 
      25                 :             : #pragma once
      26                 :             : 
      27                 :             : #include <glib.h>
      28                 :             : #include <glib-object.h>
      29                 :             : #include <gio/gio.h>
      30                 :             : #include <libmalcontent/user-manager.h>
      31                 :             : 
      32                 :             : G_BEGIN_DECLS
      33                 :             : 
      34                 :             : /**
      35                 :             :  * MctExtensionAgentObjectError:
      36                 :             :  * @MCT_EXTENSION_AGENT_OBJECT_ERROR_FAILED: Unknown internal error.
      37                 :             :  * @MCT_EXTENSION_AGENT_OBJECT_ERROR_IDENTIFYING_USER: The requesting user could
      38                 :             :  *   not be identified.
      39                 :             :  * @MCT_EXTENSION_AGENT_OBJECT_ERROR_CANCELLED: The request was cancelled before
      40                 :             :  *   it could be answered.
      41                 :             :  * @MCT_EXTENSION_AGENT_OBJECT_ERROR_INVALID_QUERY: A query parameter was
      42                 :             :  *   invalid.
      43                 :             :  *
      44                 :             :  * Errors which can be returned by [class@Malcontent.ExtensionAgentObject].
      45                 :             :  *
      46                 :             :  * Since: 0.14.0
      47                 :             :  */
      48                 :             : typedef enum
      49                 :             : {
      50                 :             :   MCT_EXTENSION_AGENT_OBJECT_ERROR_FAILED = 0,
      51                 :             :   MCT_EXTENSION_AGENT_OBJECT_ERROR_IDENTIFYING_USER,
      52                 :             :   MCT_EXTENSION_AGENT_OBJECT_ERROR_CANCELLED,
      53                 :             :   MCT_EXTENSION_AGENT_OBJECT_ERROR_INVALID_QUERY,
      54                 :             : } MctExtensionAgentObjectError;
      55                 :             : #define MCT_EXTENSION_AGENT_OBJECT_N_ERRORS (MCT_EXTENSION_AGENT_OBJECT_ERROR_INVALID_QUERY + 1)
      56                 :             : 
      57                 :             : GQuark mct_extension_agent_object_error_quark (void);
      58                 :             : #define MCT_EXTENSION_AGENT_OBJECT_ERROR mct_extension_agent_object_error_quark ()
      59                 :             : 
      60                 :             : #define MCT_TYPE_EXTENSION_AGENT_OBJECT mct_extension_agent_object_get_type ()
      61   [ -  +  +  -  :         894 : G_DECLARE_DERIVABLE_TYPE (MctExtensionAgentObject, mct_extension_agent_object, MCT,
                   -  + ]
      62                 :             :                           EXTENSION_AGENT_OBJECT, GObject)
      63                 :             : 
      64                 :             : /**
      65                 :             :  * MctExtensionAgentObjectClass:
      66                 :             :  * @request_extension_async: Virtual method called when an extension request
      67                 :             :  *   is made to the agent. Agents should implement their main logic in this
      68                 :             :  *   virtual method, including returning a value or error via @invocation.
      69                 :             :  * @request_extension_finish: Virtual method called to extract results from a
      70                 :             :  *   completed @request_extension_async closure.
      71                 :             :  *
      72                 :             :  * Since: 0.14.0
      73                 :             :  */
      74                 :             : struct _MctExtensionAgentObjectClass
      75                 :             : {
      76                 :             :   GObjectClass parent_class;
      77                 :             : 
      78                 :             :   void (* request_extension_async)  (MctExtensionAgentObject *agent,
      79                 :             :                                      const char              *record_type,
      80                 :             :                                      const char              *identifier,
      81                 :             :                                      uint64_t                 duration_secs,
      82                 :             :                                      GVariant                *extra_data,
      83                 :             :                                      GVariant                *subject,
      84                 :             :                                      GUnixFDList             *subject_fd_list,
      85                 :             :                                      GDBusMethodInvocation   *invocation,
      86                 :             :                                      GCancellable            *cancellable,
      87                 :             :                                      GAsyncReadyCallback      callback,
      88                 :             :                                      void                    *user_data);
      89                 :             :   gboolean (* request_extension_finish) (MctExtensionAgentObject  *agent,
      90                 :             :                                          GAsyncResult             *result,
      91                 :             :                                          gboolean                 *out_granted,  /* (optional) */
      92                 :             :                                          GVariant                **out_extra_data,  /* (nullable) (optional) */
      93                 :             :                                          GError                  **error);
      94                 :             : 
      95                 :             :   void *padding[12];
      96                 :             : };
      97                 :             : 
      98                 :             : gboolean mct_extension_agent_object_register (MctExtensionAgentObject  *self,
      99                 :             :                                               GError                  **error);
     100                 :             : void     mct_extension_agent_object_unregister (MctExtensionAgentObject *self);
     101                 :             : 
     102                 :             : gboolean mct_extension_agent_object_get_busy (MctExtensionAgentObject *self);
     103                 :             : 
     104                 :             : GDBusConnection *mct_extension_agent_object_get_connection (MctExtensionAgentObject *self);
     105                 :             : 
     106                 :             : G_END_DECLS
        

Generated by: LCOV version 2.0-1