~ubuntu-branches/debian/stretch/gnome-builder/stretch

« back to all changes in this revision

Viewing changes to libide/devhelp/ide-devhelp-search-result.c

  • Committer: Package Import Robot
  • Author(s): Andreas Henriksson
  • Date: 2015-10-11 12:38:45 UTC
  • Revision ID: package-import@ubuntu.com-20151011123845-a0hvkz01se0p1p5a
Tags: upstream-3.16.3
ImportĀ upstreamĀ versionĀ 3.16.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ide-devhelp-search-result.c
 
2
 *
 
3
 * Copyright (C) 2015 Christian Hergert <christian@hergert.me>
 
4
 *
 
5
 * This program is free software: you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation, either version 3 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 */
 
18
 
 
19
#include <glib/gi18n.h>
 
20
 
 
21
#include "ide-devhelp-search-result.h"
 
22
 
 
23
struct _IdeDevhelpSearchResult
 
24
{
 
25
  IdeSearchResult  parent_instance;
 
26
  gchar           *uri;
 
27
};
 
28
 
 
29
enum
 
30
{
 
31
  PROP_0,
 
32
  PROP_URI,
 
33
  LAST_PROP
 
34
};
 
35
 
 
36
G_DEFINE_TYPE (IdeDevhelpSearchResult, ide_devhelp_search_result, IDE_TYPE_SEARCH_RESULT)
 
37
 
 
38
static GParamSpec *gParamSpecs [LAST_PROP];
 
39
 
 
40
static void
 
41
ide_devhelp_search_result_finalize (GObject *object)
 
42
{
 
43
  IdeDevhelpSearchResult *self = (IdeDevhelpSearchResult *)object;
 
44
 
 
45
  g_clear_pointer (&self->uri, g_free);
 
46
 
 
47
  G_OBJECT_CLASS (ide_devhelp_search_result_parent_class)->finalize (object);
 
48
}
 
49
 
 
50
static void
 
51
ide_devhelp_search_result_get_property (GObject    *object,
 
52
                                        guint       prop_id,
 
53
                                        GValue     *value,
 
54
                                        GParamSpec *pspec)
 
55
{
 
56
  IdeDevhelpSearchResult *self = IDE_DEVHELP_SEARCH_RESULT (object);
 
57
 
 
58
  switch (prop_id)
 
59
    {
 
60
    case PROP_URI:
 
61
      g_value_set_string (value, self->uri);
 
62
      break;
 
63
 
 
64
    default:
 
65
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 
66
    }
 
67
}
 
68
 
 
69
static void
 
70
ide_devhelp_search_result_set_property (GObject      *object,
 
71
                                        guint         prop_id,
 
72
                                        const GValue *value,
 
73
                                        GParamSpec   *pspec)
 
74
{
 
75
  IdeDevhelpSearchResult *self = IDE_DEVHELP_SEARCH_RESULT (object);
 
76
 
 
77
  switch (prop_id)
 
78
    {
 
79
    case PROP_URI:
 
80
      self->uri = g_value_dup_string (value);
 
81
      break;
 
82
 
 
83
    default:
 
84
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 
85
    }
 
86
}
 
87
 
 
88
static void
 
89
ide_devhelp_search_result_class_init (IdeDevhelpSearchResultClass *klass)
 
90
{
 
91
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
92
 
 
93
  object_class->finalize = ide_devhelp_search_result_finalize;
 
94
  object_class->get_property = ide_devhelp_search_result_get_property;
 
95
  object_class->set_property = ide_devhelp_search_result_set_property;
 
96
 
 
97
  gParamSpecs [PROP_URI] =
 
98
    g_param_spec_string ("uri",
 
99
                         _("URI"),
 
100
                         _("The URI to the Devhelp document."),
 
101
                         NULL,
 
102
                         (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
 
103
 
 
104
  g_object_class_install_properties (object_class, LAST_PROP, gParamSpecs);
 
105
}
 
106
 
 
107
static void
 
108
ide_devhelp_search_result_init (IdeDevhelpSearchResult *result)
 
109
{
 
110
}