Blame telepathy-account-widgets/tp-account-widgets/tpaw-uoa-utils.c

Packit 79f644
/*
Packit 79f644
 * tpaw-uoa-utils.c - Source for UOA utilities
Packit 79f644
 * Copyright (C) 2012 Collabora Ltd.
Packit 79f644
 * @author Xavier Claessens <xavier.claessens@collabora.co.uk>
Packit 79f644
 *
Packit 79f644
 * This library is free software; you can redistribute it and/or
Packit 79f644
 * modify it under the terms of the GNU Lesser General Public
Packit 79f644
 * License as published by the Free Software Foundation; either
Packit 79f644
 * version 2.1 of the License, or (at your option) any later version.
Packit 79f644
 *
Packit 79f644
 * This library is distributed in the hope that it will be useful,
Packit 79f644
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 79f644
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 79f644
 * Lesser General Public License for more details.
Packit 79f644
 *
Packit 79f644
 * You should have received a copy of the GNU Lesser General Public
Packit 79f644
 * License along with this library; if not, write to the Free Software
Packit 79f644
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
Packit 79f644
 */
Packit 79f644
Packit 79f644
#include "config.h"
Packit 79f644
#include "tpaw-uoa-utils.h"
Packit 79f644
Packit 79f644
#define DEBUG_FLAG TPAW_DEBUG_ACCOUNT
Packit 79f644
#include "tpaw-debug.h"
Packit 79f644
Packit 79f644
static AgManager *singleton = NULL;
Packit 79f644
Packit 79f644
void
Packit 79f644
tpaw_uoa_manager_set_default (AgManager *manager)
Packit 79f644
{
Packit 79f644
  if (singleton != NULL)
Packit 79f644
    return;
Packit 79f644
Packit 79f644
  singleton = manager;
Packit 79f644
  g_object_add_weak_pointer ((GObject *) singleton, (gpointer) &singleton);
Packit 79f644
}
Packit 79f644
Packit 79f644
AgManager *
Packit 79f644
tpaw_uoa_manager_dup (void)
Packit 79f644
{
Packit 79f644
  if (singleton != NULL)
Packit 79f644
    return g_object_ref (singleton);
Packit 79f644
Packit 79f644
  singleton = ag_manager_new_for_service_type (TPAW_UOA_SERVICE_TYPE);
Packit 79f644
  g_object_add_weak_pointer ((GObject *) singleton, (gpointer) &singleton);
Packit 79f644
Packit 79f644
  return singleton;
Packit 79f644
}