~ubuntu-desktop/indicator-network/ubuntu

« back to all changes in this revision

Viewing changes to src/agent/main.c

  • Committer: Ken VanDine
  • Date: 2010-12-01 19:43:44 UTC
  • mfrom: (1.48.36 trunk)
  • Revision ID: ken.vandine@canonical.com-20101201194344-s0858n07v2vc0lz8
Tags: 0.3.0-0ubuntu1
releasing version 0.3.0-0ubuntu1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * indicator-network - user interface for connman
 
3
 * Copyright 2010 Canonical Ltd.
 
4
 *
 
5
 * Authors:
 
6
 * Kalle Valo <kalle.valo@canonical.com>
 
7
 *
 
8
 * This program is free software: you can redistribute it and/or modify it
 
9
 * under the terms of the GNU General Public License version 3, as published
 
10
 * by the Free Software Foundation.
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful, but
 
13
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 
14
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
15
 * PURPOSE.  See the GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License along
 
18
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
 */
 
20
 
 
21
#ifdef HAVE_CONFIG_H
 
22
#include <config.h>
 
23
#endif
 
24
 
 
25
#include <glib/gi18n.h>
 
26
#include <gtk/gtk.h>
 
27
#include <locale.h>
 
28
 
 
29
#include "agent.h"
 
30
#include "log.h"
 
31
 
 
32
static gboolean debug = FALSE;
 
33
 
 
34
static GOptionEntry entries[] = {
 
35
  { "debug", 'd', 0, G_OPTION_ARG_NONE, &debug, "Enable debug mode", NULL },
 
36
  { NULL }
 
37
};
 
38
 
 
39
int main(int argc, char **argv)
 
40
{
 
41
  GOptionContext *context;
 
42
  GError *error = NULL;
 
43
  NetworkAgent *agent;
 
44
 
 
45
  g_debug("%s()", __func__);
 
46
 
 
47
  g_type_init();
 
48
 
 
49
  gtk_init(&argc, &argv);
 
50
 
 
51
  context = g_option_context_new("- UI for Network Menu");
 
52
  g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE);
 
53
 
 
54
  if (!g_option_context_parse(context, &argc, &argv, &error)) {
 
55
    g_print("option parsing failed: %s\n", error->message);
 
56
    return 1;
 
57
  }
 
58
 
 
59
  if (debug)
 
60
    log_set_debug(TRUE);
 
61
 
 
62
  log_init("indicator-network-agent");
 
63
 
 
64
  agent = g_object_new(NETWORK_AGENT_TYPE, NULL);
 
65
 
 
66
  setlocale(LC_ALL, "");
 
67
  bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR);
 
68
  textdomain(GETTEXT_PACKAGE);
 
69
 
 
70
  /* run the loop */
 
71
  gtk_main();
 
72
 
 
73
  g_object_unref(agent);
 
74
  agent = NULL;
 
75
 
 
76
  return 0;
 
77
}