summaryrefslogtreecommitdiff
path: root/tests/tease-the-minotaur.c
blob: 1db9d0a26052860c6737c7422e84de1098dd403d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
/*
 * tease-the-minotaur: a simple interactive test app for McdConnectivityMonitor
 *
 * Copyright © 2009–2011 Collabora Ltd.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * Authors:
 *   Will Thompson <will.thompson@collabora.co.uk>
 */

#include "connectivity-monitor.h"

static void
state_change_cb (
    McdConnectivityMonitor *minotaur,
    gboolean connected,
    gpointer user_data)
{
  g_print (connected ? "connected\n" : "disconnected\n");
}

int
main (
    int argc,
    char *argv[])
{
  McdConnectivityMonitor *minotaur;
  GMainLoop *im_feeling_loopy;

  g_type_init ();

  minotaur = mcd_connectivity_monitor_new ();
  g_signal_connect (minotaur, "state-change", (GCallback) state_change_cb, NULL);
  state_change_cb (minotaur, mcd_connectivity_monitor_is_online (minotaur), NULL);

  im_feeling_loopy = g_main_loop_new (NULL, FALSE);
  g_main_loop_run (im_feeling_loopy);
  return 0;
}