File: screem-link-view-image.c

package info (click to toggle)
screem 0.12.1-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 19,728 kB
  • ctags: 8,333
  • sloc: ansic: 98,234; sh: 8,278; xml: 2,278; makefile: 1,054
file content (115 lines) | stat: -rw-r--r-- 3,095 bytes parent folder | download
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*  Screem:  screem-link-view-image.c
 *
 *  The link view widget
 *
 *  Copyright (C) 2001  Matt Colyer, David A Knight
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *  For contact information with the author of this source code please see
 *  the AUTHORS file.  If there is no AUTHORS file present then check the
 *  about box under the help menu for a contact address
 */

#include "screem-link-view-image.h"

static void screem_link_view_image_class_init(ScreemLinkViewImageClass *klass);
static void screem_link_view_image_init( ScreemLinkViewImage *link_view_image);
static void screem_link_view_image_finalize( GObject *link_view_image );


ScreemLinkViewImage *screem_link_view_image_new( const gchar *pathname )
{
	ScreemLinkViewImage *image;
	GType type;

	type = screem_link_view_image_get_type();

	image = SCREEM_LINK_VIEW_IMAGE( g_object_new( type, NULL ) );

	image->name = g_strdup( pathname );
	image->filename = g_strdup( pathname );
	image->external = TRUE;	
	image->next = NULL;

	return image;
}

/* G Object stuff */
#define PARENT_TYPE G_TYPE_OBJECT

static gpointer parent_class;

static void screem_link_view_image_class_init(ScreemLinkViewImageClass *klass )
{
	GObjectClass *object_class;

	object_class = G_OBJECT_CLASS( klass );
	parent_class = g_type_class_peek_parent( klass );


	object_class->finalize = screem_link_view_image_finalize;
}

static void screem_link_view_image_init( ScreemLinkViewImage *link_view_image )
{

}

static void screem_link_view_image_finalize( GObject *link_view_image )
{
	ScreemLinkViewImage *image;

	image = SCREEM_LINK_VIEW_IMAGE( link_view_image );

	if( image->name ) {
		g_free( image->name );
	}
	if( image->filename ) {
		g_free( image->filename );
	}
	if( image->next ) {
		g_object_unref( image->next );
	}

	G_OBJECT_CLASS( parent_class )->finalize( G_OBJECT( image ) );
}

GType screem_link_view_image_get_type()
{
	static guint type = 0;

	if( ! type ) {
		static const GTypeInfo info = {
			sizeof( ScreemLinkViewImageClass ),
			NULL, /* base init */
			NULL, /* base finalise */
			(GClassInitFunc)screem_link_view_image_class_init,
			NULL, /* class finalise */
			NULL, /* class data */
			sizeof( ScreemLinkViewImage ),
			0, /* n_preallocs */
			(GInstanceInitFunc)screem_link_view_image_init
		};
		
		type = g_type_register_static( PARENT_TYPE,
					       "ScreemLinkViewImage",
					       &info, 0 );
	}

	return type;
}