From 20ab6550fbf88b6e89d7243c08fe1ba12bf44fdf Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Fri, 10 Jan 2020 14:47:40 +0100 Subject: auth-provider: refactor and simplify The auth provider setup is a bit over-engineered. Simplify it by making a single MMAuthProvider object that may or may not use polkit, depending on configure options. This object is also setup as a singleton object using the helper MM_DEFINE_SINGLETON_GETTER(). --- src/mm-auth.c | 53 ----------------------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 src/mm-auth.c (limited to 'src/mm-auth.c') diff --git a/src/mm-auth.c b/src/mm-auth.c deleted file mode 100644 index 9b1beea9..00000000 --- a/src/mm-auth.c +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details: - * - * Copyright (C) 2010 - 2012 Red Hat, Inc. - * Copyright (C) 2012 Google, Inc. - */ - -#include - -#include "config.h" - -#include "mm-auth.h" -#include "mm-auth-provider.h" - -#if defined WITH_POLKIT -# include "mm-auth-provider-polkit.h" -#endif - -static MMAuthProvider *authp = NULL; - -MMAuthProvider * -mm_auth_get_provider (void) -{ - if (!authp) { -#if defined WITH_POLKIT - authp = mm_auth_provider_polkit_new (); -#else - authp = mm_auth_provider_new (); -#endif - } - - g_assert (authp); - - /* We'll keep the refcount of this object controlled, in order to have - * clean shutdowns */ - return g_object_ref (authp); -} - -void -mm_auth_shutdown (void) -{ - /* Clear the last reference of the auth provider if it was ever set */ - g_clear_object (&authp); -} -- cgit v1.2.3-70-g09d2