File: gs-channel.c

package info (click to toggle)
gnome-software 3.30.6-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 18,340 kB
  • sloc: ansic: 59,190; xml: 2,406; python: 268; makefile: 79; sh: 24
file content (116 lines) | stat: -rw-r--r-- 2,592 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
116
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
 *
 * Copyright (C) 2017 Canonical Ltd.
 *
 * Licensed under the GNU General Public License Version 2
 *
 * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#include "config.h"

#include <glib/gi18n.h>

#include "gs-channel.h"

struct _GsChannel
{
	GObject	 parent_instance;

	gchar	*name;
	gchar	*version;
};

G_DEFINE_TYPE (GsChannel, gs_channel, G_TYPE_OBJECT)

/**
 * gs_channel_get_name:
 * @channel: a #GsChannel
 *
 * Get the channel name.
 *
 * Returns: a channel name.
 *
 * Since: 3.28
 */
const gchar *
gs_channel_get_name (GsChannel *channel)
{
	g_return_val_if_fail (GS_IS_CHANNEL (channel), NULL);
	return channel->name;
}

/**
 * gs_channel_get_version:
 * @channel: a #GsChannel
 *
 * Get the channel version.
 *
 * Returns: a channel version.
 *
 * Since: 3.28
 */
const gchar *
gs_channel_get_version (GsChannel *channel)
{
	g_return_val_if_fail (GS_IS_CHANNEL (channel), NULL);
	return channel->version;
}

static void
gs_channel_finalize (GObject *object)
{
	GsChannel *channel = GS_CHANNEL (object);

	g_free (channel->name);
	g_free (channel->version);

	G_OBJECT_CLASS (gs_channel_parent_class)->finalize (object);
}

static void
gs_channel_class_init (GsChannelClass *klass)
{
	GObjectClass *object_class = G_OBJECT_CLASS (klass);
	object_class->finalize = gs_channel_finalize;
}

static void
gs_channel_init (GsChannel *channel)
{
}

/**
 * gs_channel_new:
 * @name: the name of the channel.
 * @version: the version this channel is providing.
 *
 * Creates a new channel object.
 *
 * Return value: a new #GsChannel object.
 *
 * Since: 3.28
 **/
GsChannel *
gs_channel_new (const gchar *name, const gchar *version)
{
	GsChannel *channel;
	channel = g_object_new (GS_TYPE_CHANNEL, NULL);
	channel->name = g_strdup (name);
	channel->version = g_strdup (version);
	return GS_CHANNEL (channel);
}

/* vim: set noexpandtab: */