Document previous patch
[viking.git] / src / vikwebtool.c
blob706313a549f405886f76e0c4bb5a5dc62158f20f
1 /*
2 * viking -- GPS Data and Topo Analyzer, Explorer, and Manager
4 * Copyright (C) 2008, Guilhem Bonnefille <guilhem.bonnefille@gmail.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifdef HAVE_CONFIG_H
23 #include "config.h"
24 #endif
26 #include "vikwebtool.h"
28 #include <string.h>
30 #include <glib/gi18n.h>
32 #include "util.h"
34 static void webtool_class_init ( VikWebtoolClass *klass );
35 static void webtool_init ( VikWebtool *vwd );
37 static GObjectClass *parent_class;
39 static void webtool_finalize ( GObject *gob );
41 static void webtool_open ( VikExtTool *self, VikWindow *vwindow );
43 GType vik_webtool_get_type()
45 static GType w_type = 0;
47 if (!w_type)
49 static const GTypeInfo w_info =
51 sizeof (VikWebtoolClass),
52 NULL, /* base_init */
53 NULL, /* base_finalize */
54 (GClassInitFunc) webtool_class_init,
55 NULL, /* class_finalize */
56 NULL, /* class_data */
57 sizeof (VikWebtool),
59 (GInstanceInitFunc) webtool_init,
61 w_type = g_type_register_static ( VIK_EXT_TOOL_TYPE, "VikWebtool", &w_info, G_TYPE_FLAG_ABSTRACT );
64 return w_type;
67 static void webtool_class_init ( VikWebtoolClass *klass )
69 GObjectClass *object_class;
70 VikExtToolClass *ext_tool_class;
72 object_class = G_OBJECT_CLASS (klass);
74 object_class->finalize = webtool_finalize;
76 parent_class = g_type_class_peek_parent (klass);
78 ext_tool_class = VIK_EXT_TOOL_CLASS ( klass );
79 ext_tool_class->open = webtool_open;
82 VikWebtool *vik_webtool_new ()
84 return VIK_WEBTOOL ( g_object_new ( VIK_WEBTOOL_TYPE, NULL ) );
87 static void webtool_init ( VikWebtool *vlp )
91 static void webtool_finalize ( GObject *gob )
93 // VikWebtool *w = VIK_WEBTOOL ( gob );
94 G_OBJECT_CLASS(parent_class)->finalize(gob);
97 static void webtool_open ( VikExtTool *self, VikWindow *vwindow )
99 VikWebtool *vwd = VIK_WEBTOOL ( self );
100 gchar *url = vik_webtool_get_url ( vwd, vwindow );
101 open_url ( NULL, url );
102 g_free ( url );
105 gchar *vik_webtool_get_url ( VikWebtool *self, VikWindow *vwindow )
107 return VIK_WEBTOOL_GET_CLASS( self )->get_url( self, vwindow );