Skip to content

Instantly share code, notes, and snippets.

@smspillaz
Created July 31, 2018 02:29
Show Gist options
  • Save smspillaz/d0f06ee72f50a3c5e05885efebcea1d1 to your computer and use it in GitHub Desktop.
Save smspillaz/d0f06ee72f50a3c5e05885efebcea1d1 to your computer and use it in GitHub Desktop.
/* Copyright 2018 Your name
*
* {{project}} is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* {{project}} 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with eos-discovery-feed. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include <gio/gio.h>
#include "{{class-name}}.h"
struct _{{ClassName}}
{
GObject parent_instance;
};
typedef struct _{{ClassName}}Private
{
} {{ClassName}}Private;
enum {
PROP_0,
NPROPS
};
static GParamSpec *{{class_name}}_props[NPROPS];
G_DEFINE_TYPE_WITH_PRIVATE ({{ClassName}},
{{class_name}},
{{PARENT_TYPE}})
static void
{{class_name}}_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
{{ClassName}} *{{object_name}} = {{NAMESPACE_NAME}}_{{CLASS_NANE}} (object);
{{ClassName}}Private *priv =
{{class_name}}_get_instance_private ({{object_name}});
switch (prop_id)
{
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
{{class_name}}_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
{{ClassName}} *{{object_name}} = {{NAMESPACE_NAME}}_{{CLASS_NANE}} (object);
{{ClassName}}Private *priv =
{{class_name}}_get_instance_private ({{object_name}});
switch (prop_id)
{
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
{{class_name}}_dispose (GObject *object)
{
{{ClassName}} *{{object_name} = {{NAMESPACE_NAME}}_{{CLASS_NANE}} (object);
{{ClassName}}Private *priv = {{class_name}}_get_instance_private ({{object_name}});
G_OBJECT_CLASS ({{class_name}}_parent_class)->dispose (object);
}
static void
{{class_name}}_finalize (GObject *object)
{
{{ClassName}} *{{object_name}} = {{NAMESPACE_NAME}}_{{CLASS_NANE}} (object);
{{ClassName}}Private *priv = {{class_name}}_get_instance_private ({{object_name}});
G_OBJECT_CLASS ({{class_name}}_parent_class)->finalize (object);
}
static void
{{class_name}}_init ({{ClassName}} *{{object_name}})
{
{{ClassName}}Private *priv = {{object_name}}_get_instance_private ({{object_name}});
}
static void
{{class_name}}_class_init ({{ClassName}}Class *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = {{class_name}}_get_property;
object_class->set_property = {{class_name}}_set_property;
object_class->dispose = {{class_name}}_dispose;
object_class->finalize = {{class_name}}_finalize;
g_object_class_install_properties (object_class,
NPROPS,
{{class_name}}_props);
}
void
{{class_name}}_new ()
{
g_object_new ({{NAMESPACE_NAME}}_TYPE_{{CLASS_NAME}},
NULL);
}
/* Copyright 2018 Endless Mobile, Inc.
*
* {{project}} is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* {{project}} 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with eos-discovery-feed. If not, see
* <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <glib-object.h>
G_BEGIN_DECLS
#define {{NAMESPACE_NAME}}_TYPE_{{CLASS_NAME}} animations_dbus_server_get_type ()
G_DECLARE_FINAL_TYPE ({{ClassName}}, {{class_name}}, {{NAMESPACE_NAME}}, {{CLASS_NAME}}, {{ParentType}})
{{ClassName}} {{class_name}}_new (void);
G_END_DECLS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment