Blame src/goaidentity/main.c

Packit 79f644
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
Packit 79f644
/*
Packit 79f644
 * Copyright © 2014 – 2017 Red Hat, Inc.
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 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
Packit 79f644
 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit 79f644
 */
Packit 79f644
Packit 79f644
#include "config.h"
Packit 79f644
Packit 79f644
#include <glib-unix.h>
Packit 79f644
Packit 79f644
#include <locale.h>
Packit 79f644
#include <gio/gio.h>
Packit 79f644
#include <libintl.h>
Packit 79f644
Packit 79f644
#include "goaidentityservice.h"
Packit 79f644
Packit 79f644
int
Packit 79f644
main (int    argc,
Packit 79f644
      char **argv)
Packit 79f644
{
Packit 79f644
  GMainLoop *loop;
Packit 79f644
  GoaIdentityService *service;
Packit 79f644
  GError *error;
Packit 79f644
  int ret = 1;
Packit 79f644
Packit 79f644
  setlocale (LC_ALL, "");
Packit 79f644
  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
Packit 79f644
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
Packit 79f644
  textdomain (GETTEXT_PACKAGE);
Packit 79f644
Packit 79f644
  loop = g_main_loop_new (NULL, FALSE);
Packit 79f644
  service = goa_identity_service_new ();
Packit 79f644
Packit 79f644
  error = NULL;
Packit 79f644
  goa_identity_service_activate (service, &error);
Packit 79f644
Packit 79f644
  if (error != NULL) {
Packit 79f644
      g_warning ("couldn't activate identity service: %s", error->message);
Packit 79f644
      g_error_free (error);
Packit 79f644
      goto out;
Packit 79f644
  }
Packit 79f644
Packit 79f644
  g_main_loop_run (loop);
Packit 79f644
Packit 79f644
  goa_identity_service_deactivate (service);
Packit 79f644
Packit 79f644
  ret = 0;
Packit 79f644
out:
Packit 79f644
  g_object_unref (service);
Packit 79f644
  g_main_loop_unref (loop);
Packit 79f644
Packit 79f644
  return ret;
Packit 79f644
}