polkit: Port to G_DECLARE_FINAL_CLASS
So we can remove this old boilerplate code. In order to be able to use that, the autoptr function for PolkitAgentListener was added as well. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/66
This commit is contained in:
parent
b96cc9a161
commit
72fa44d0fd
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
|
||||||
#define POLKIT_AGENT_I_KNOW_API_IS_SUBJECT_TO_CHANGE
|
|
||||||
#include <polkitagent/polkitagent.h>
|
|
||||||
#include "shell-polkit-authentication-agent.h"
|
#include "shell-polkit-authentication-agent.h"
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
@ -49,12 +47,6 @@ print_debug (const gchar *str, ...)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
struct _ShellPolkitAuthenticationAgentClass
|
|
||||||
{
|
|
||||||
PolkitAgentListenerClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _AuthRequest;
|
struct _AuthRequest;
|
||||||
typedef struct _AuthRequest AuthRequest;
|
typedef struct _AuthRequest AuthRequest;
|
||||||
|
|
||||||
|
@ -6,25 +6,23 @@
|
|||||||
* Author: David Zeuthen <davidz@redhat.com>
|
* Author: David Zeuthen <davidz@redhat.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __SHELL_POLKIT_AUTHENTICATION_AGENT_H__
|
#pragma once
|
||||||
#define __SHELL_POLKIT_AUTHENTICATION_AGENT_H__
|
|
||||||
|
|
||||||
|
#define POLKIT_AGENT_I_KNOW_API_IS_SUBJECT_TO_CHANGE
|
||||||
|
#include <polkitagent/polkitagent.h>
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
typedef struct _ShellPolkitAuthenticationAgent ShellPolkitAuthenticationAgent;
|
/* Polkit doesn't have g_autoptr support, thus we have to manually set the autoptr function here */
|
||||||
typedef struct _ShellPolkitAuthenticationAgentClass ShellPolkitAuthenticationAgentClass;
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitAgentListener, g_object_unref)
|
||||||
|
|
||||||
#define SHELL_TYPE_POLKIT_AUTHENTICATION_AGENT (shell_polkit_authentication_agent_get_type ())
|
#define SHELL_TYPE_POLKIT_AUTHENTICATION_AGENT (shell_polkit_authentication_agent_get_type())
|
||||||
#define SHELL_POLKIT_AUTHENTICATION_AGENT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), SHELL_TYPE_POLKIT_AUTHENTICATION_AGENT, ShellPolkitAuthenticationAgent))
|
|
||||||
#define SHELL_POLKIT_AUTHENTICATION_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_POLKIT_AUTHENTICATION_AGENT, ShellPolkitAuthenticationAgentClass))
|
G_DECLARE_FINAL_TYPE (ShellPolkitAuthenticationAgent, shell_polkit_authentication_agent, SHELL, POLKIT_AUTHENTICATION_AGENT, PolkitAgentListener)
|
||||||
#define SHELL_IS_POLKIT_AUTHENTICATION_AGENT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), SHELL_TYPE_POLKIT_AUTHENTICATION_AGENT))
|
|
||||||
#define SHELL_IS_POLKIT_AUTHENTICATION_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_POLKIT_AUTHENTICATION_AGENT))
|
|
||||||
#define SHELL_POLKIT_AUTHENTICATION_AGENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_POLKIT_AUTHENTICATION_AGENT, ShellPolkitAuthenticationAgentClass))
|
|
||||||
|
|
||||||
GType shell_polkit_authentication_agent_get_type (void) G_GNUC_CONST;
|
|
||||||
ShellPolkitAuthenticationAgent *shell_polkit_authentication_agent_new (void);
|
ShellPolkitAuthenticationAgent *shell_polkit_authentication_agent_new (void);
|
||||||
|
|
||||||
void shell_polkit_authentication_agent_complete (ShellPolkitAuthenticationAgent *agent,
|
void shell_polkit_authentication_agent_complete (ShellPolkitAuthenticationAgent *agent,
|
||||||
gboolean dismissed);
|
gboolean dismissed);
|
||||||
void shell_polkit_authentication_agent_register (ShellPolkitAuthenticationAgent *agent,
|
void shell_polkit_authentication_agent_register (ShellPolkitAuthenticationAgent *agent,
|
||||||
@ -33,4 +31,3 @@ void shell_polkit_authentication_agent_unregister (Sh
|
|||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __SHELL_POLKIT_AUTHENTICATION_AGENT_H__ */
|
|
||||||
|
Loading…
Reference in New Issue
Block a user