Commit 824ad004 authored by Alberts Muktupāvels's avatar Alberts Muktupāvels

backends: initial version

parent 53707176
......@@ -2,6 +2,7 @@ NULL =
SUBDIRS = \
data \
backends \
gnome-flashback \
po \
$(NULL)
......
NULL =
noinst_LTLIBRARIES = \
libbackends.la \
$(NULL)
libbackends_la_CPPFLAGS = \
-DG_LOG_DOMAIN=\"gf-backends\" \
-DG_LOG_USE_STRUCTURED=1 \
-I$(top_srcdir) \
$(AM_CPPFLAGS) \
$(NULL)
libbackends_la_CFLAGS = \
$(BACKENDS_CFLAGS) \
$(WARN_CFLAGS) \
$(AM_CFLAGS) \
$(NULL)
libbackends_la_SOURCES = \
gf-backend-native-private.h \
gf-backend-native.c \
gf-backend-private.h \
gf-backend-x11-cm-private.h \
gf-backend-x11-cm.c \
gf-backend-x11-nested-private.h \
gf-backend-x11-nested.c \
gf-backend-x11-private.h \
gf-backend-x11.c \
gf-backend.c \
gf-backend.h \
$(BUILT_SOURCES) \
$(NULL)
libbackends_la_LDFLAGS = \
$(WARN_LDFLAGS) \
$(AM_LDFLAGS) \
$(NULL)
libbackends_la_LIBADD = \
$(BACKENDS_LIBS) \
$(LIBM) \
$(NULL)
BUILT_SOURCES = \
$(NULL)
EXTRA_DIST = \
$(NULL)
CLEANFILES = \
$(BUILT_SOURCES) \
$(NULL)
-include $(top_srcdir)/git.mk
/*
* Copyright (C) 2014 Red Hat
* Copyright (C) 2017 Alberts Muktupāvels
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* Authors:
* Alberts Muktupāvels <alberts.muktupavels@gmail.com>
* Jasper St. Pierre <jstpierre@mecheye.net>
*
* Adapted from mutter:
* - src/backends/native/meta-backend-native.h
*/
#ifndef GF_BACKEND_NATIVE_PRIVATE_H
#define GF_BACKEND_NATIVE_PRIVATE_H
#include "gf-backend-private.h"
G_BEGIN_DECLS
#define GF_TYPE_BACKEND_NATIVE (gf_backend_native_get_type ())
G_DECLARE_FINAL_TYPE (GfBackendNative, gf_backend_native,
GF, BACKEND_NATIVE, GfBackend)
G_END_DECLS
#endif
/*
* Copyright (C) 2014 Red Hat
* Copyright (C) 2017 Alberts Muktupāvels
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* Authors:
* Alberts Muktupāvels <alberts.muktupavels@gmail.com>
* Jasper St. Pierre <jstpierre@mecheye.net>
*
* Adapted from mutter:
* - src/backends/native/meta-backend-native.c
*/
#include "config.h"
#include "gf-backend-native-private.h"
struct _GfBackendNative
{
GfBackend parent;
};
G_DEFINE_TYPE (GfBackendNative, gf_backend_native, GF_TYPE_BACKEND)
static void
gf_backend_native_class_init (GfBackendNativeClass *native_class)
{
}
static void
gf_backend_native_init (GfBackendNative *native)
{
}
/*
* Copyright (C) 2014 Red Hat
* Copyright (C) 2017 Alberts Muktupāvels
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* Authors:
* Alberts Muktupāvels <alberts.muktupavels@gmail.com>
* Jasper St. Pierre <jstpierre@mecheye.net>
*
* Adapted from mutter:
* - src/backends/meta-backend-private.h
*/
#ifndef GF_BACKEND_PRIVATE_H
#define GF_BACKEND_PRIVATE_H
#include "gf-backend.h"
G_BEGIN_DECLS
struct _GfBackendClass
{
GObjectClass parent_class;
};
G_END_DECLS
#endif
/*
* Copyright (C) 2017 Alberts Muktupāvels
* Copyright (C) 2017 Red Hat
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* Adapted from mutter:
* - src/backends/x11/cm/meta-backend-x11-cm.h
*/
#ifndef GF_BACKEND_X11_CM_PRIVATE_H
#define GF_BACKEND_X11_CM_PRIVATE_H
#include "gf-backend-x11-private.h"
G_BEGIN_DECLS
#define GF_TYPE_BACKEND_X11_CM (gf_backend_x11_cm_get_type ())
G_DECLARE_FINAL_TYPE (GfBackendX11Cm, gf_backend_x11_cm,
GF, BACKEND_X11_CM, GfBackendX11)
G_END_DECLS
#endif
/*
* Copyright (C) 2017 Alberts Muktupāvels
* Copyright (C) 2017 Red Hat
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* Adapted from mutter:
* - src/backends/x11/cm/meta-backend-x11-cm.c
*/
#include "config.h"
#include "gf-backend-x11-cm-private.h"
struct _GfBackendX11Cm
{
GfBackendX11 parent;
};
G_DEFINE_TYPE (GfBackendX11Cm, gf_backend_x11_cm, GF_TYPE_BACKEND_X11)
static void
gf_backend_x11_cm_class_init (GfBackendX11CmClass *x11_cm_class)
{
}
static void
gf_backend_x11_cm_init (GfBackendX11Cm *x11_cm)
{
}
/*
* Copyright (C) 2017 Alberts Muktupāvels
* Copyright (C) 2017 Red Hat
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* Adapted from mutter:
* - src/backends/x11/nested/meta-backend-x11-nested.h
*/
#ifndef GF_BACKEND_X11_NESTED_PRIVATE_H
#define GF_BACKEND_X11_NESTED_PRIVATE_H
#include "gf-backend-x11-private.h"
G_BEGIN_DECLS
#define GF_TYPE_BACKEND_X11_NESTED (gf_backend_x11_nested_get_type ())
G_DECLARE_FINAL_TYPE (GfBackendX11Nested, gf_backend_x11_nested,
GF, BACKEND_X11_NESTED, GfBackendX11)
G_END_DECLS
#endif
/*
* Copyright (C) 2017 Alberts Muktupāvels
* Copyright (C) 2017 Red Hat
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* Adapted from mutter:
* - src/backends/x11/nested/meta-backend-x11-nested.c
*/
#include "config.h"
#include "gf-backend-x11-nested-private.h"
struct _GfBackendX11Nested
{
GfBackendX11 parent;
};
G_DEFINE_TYPE (GfBackendX11Nested, gf_backend_x11_nested, GF_TYPE_BACKEND_X11)
static void
gf_backend_x11_nested_class_init (GfBackendX11NestedClass *x11_nested_class)
{
}
static void
gf_backend_x11_nested_init (GfBackendX11Nested *x11_nested)
{
}
/*
* Copyright (C) 2014 Red Hat
* Copyright (C) 2017 Alberts Muktupāvels
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* Authors:
* Alberts Muktupāvels <alberts.muktupavels@gmail.com>
* Jasper St. Pierre <jstpierre@mecheye.net>
*
* Adapted from mutter:
* - src/backends/x11/meta-backend-x11.h
*/
#ifndef GF_BACKEND_X11_PRIVATE_H
#define GF_BACKEND_X11_PRIVATE_H
#include "gf-backend-private.h"
G_BEGIN_DECLS
#define GF_TYPE_BACKEND_X11 (gf_backend_x11_get_type ())
G_DECLARE_DERIVABLE_TYPE (GfBackendX11, gf_backend_x11,
GF, BACKEND_X11, GfBackend)
struct _GfBackendX11Class
{
GfBackendClass parent_class;
};
G_END_DECLS
#endif
/*
* Copyright (C) 2014 Red Hat
* Copyright (C) 2017 Alberts Muktupāvels
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* Authors:
* Alberts Muktupāvels <alberts.muktupavels@gmail.com>
* Jasper St. Pierre <jstpierre@mecheye.net>
*
* Adapted from mutter:
* - src/backends/x11/meta-backend-x11.c
*/
#include "config.h"
#include <gio/gio.h>
#include "gf-backend-x11-private.h"
static void
initable_iface_init (GInitableIface *initable_iface);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GfBackendX11, gf_backend_x11, GF_TYPE_BACKEND,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
initable_iface_init))
static gboolean
gf_backend_x11_initable_init (GInitable *initable,
GCancellable *cancellable,
GError **error)
{
GfBackendX11 *x11;
GInitableIface *parent_iface;
x11 = GF_BACKEND_X11 (initable);
parent_iface = g_type_interface_peek_parent (G_INITABLE_GET_IFACE (x11));
return parent_iface->init (initable, cancellable, error);
}
static void
initable_iface_init (GInitableIface *initable_iface)
{
initable_iface->init = gf_backend_x11_initable_init;
}
static void
gf_backend_x11_class_init (GfBackendX11Class *x11_class)
{
}
static void
gf_backend_x11_init (GfBackendX11 *x11)
{
}
/*
* Copyright (C) 2014 Red Hat
* Copyright (C) 2017 Alberts Muktupāvels
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* Authors:
* Alberts Muktupāvels <alberts.muktupavels@gmail.com>
* Jasper St. Pierre <jstpierre@mecheye.net>
*
* Adapted from mutter:
* - src/backends/meta-backend.c
*/
#include "config.h"
#include <gio/gio.h>
#include "gf-backend-native-private.h"
#include "gf-backend-x11-cm-private.h"
#include "gf-backend-x11-nested-private.h"
static void
initable_iface_init (GInitableIface *initable_iface);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GfBackend, gf_backend, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
initable_iface_init))
static gboolean
gf_backend_initable_init (GInitable *initable,
GCancellable *cancellable,
GError **error)
{
return TRUE;
}
static void
initable_iface_init (GInitableIface *initable_iface)
{
initable_iface->init = gf_backend_initable_init;
}
static void
gf_backend_class_init (GfBackendClass *backend_class)
{
}
static void
gf_backend_init (GfBackend *backend)
{
}
GfBackend *
gf_backend_new (GfBackendType type)
{
GType gtype;
GfBackend *backend;
GError *error;
switch (type)
{
case GF_BACKEND_TYPE_X11_CM:
gtype = GF_TYPE_BACKEND_X11_CM;
break;
case GF_BACKEND_TYPE_X11_NESTED:
gtype = GF_TYPE_BACKEND_X11_NESTED;
break;
case GF_BACKEND_TYPE_NATIVE:
gtype = GF_TYPE_BACKEND_NATIVE;
break;
default:
g_assert_not_reached ();
break;
}
backend = g_object_new (gtype, NULL);
error = NULL;
if (!g_initable_init (G_INITABLE (backend), NULL, &error))
{
g_warning ("Failed to create backend: %s", error->message);
g_object_unref (backend);
g_error_free (error);
return NULL;
}
return backend;
}
/*
* Copyright (C) 2014 Red Hat
* Copyright (C) 2017 Alberts Muktupāvels
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
* Authors:
* Alberts Muktupāvels <alberts.muktupavels@gmail.com>
* Jasper St. Pierre <jstpierre@mecheye.net>
*
* Adapted from mutter:
* - src/meta/meta-backend.h
*/
#ifndef GF_BACKEND_H
#define GF_BACKEND_H
#include <glib-object.h>
G_BEGIN_DECLS
#define GF_TYPE_BACKEND (gf_backend_get_type ())
G_DECLARE_DERIVABLE_TYPE (GfBackend, gf_backend, GF, BACKEND, GObject)
typedef enum
{
GF_BACKEND_TYPE_X11_CM,
GF_BACKEND_TYPE_X11_NESTED,
GF_BACKEND_TYPE_NATIVE
} GfBackendType;
GfBackend *gf_backend_new (GfBackendType type);
G_END_DECLS
#endif
......@@ -98,6 +98,12 @@ POLKIT_GOBJECT_REQUIRED=0.97
IBUS_REQUIRED=1.5.2
UPOWER_GLIB_REQUIRED=0.99.0
PKG_CHECK_MODULES([BACKENDS], [
gio-2.0 >= $GLIB_REQUIRED
gio-unix-2.0 >= $GLIB_REQUIRED
glib-2.0 >= $GLIB_REQUIRED
])
PKG_CHECK_MODULES([GNOME_FLASHBACK], [
gtk+-3.0 >= $GTK_REQUIRED
])
......@@ -259,6 +265,8 @@ dnl **************************************************************************
AC_CONFIG_FILES([
Makefile
backends/Makefile
data/Makefile
data/applications/Makefile
data/autostart/Makefile
......
......@@ -30,14 +30,16 @@ bin_PROGRAMS = \
gnome_flashback_CPPFLAGS = \
-DG_LOG_DOMAIN=\"gnome-flashback\" \
-DG_LOG_USE_STRUCTURED=1 \
-DLOCALE_DIR=\""$(localedir)"\" \
-I$(top_builddir)/gnome-flashback \
-I$(top_srcdir) \
$(AM_CPPFLAGS) \
$(NULL)
gnome_flashback_CFLAGS = \
$(GNOME_FLASHBACK_CFLAGS) \
$(WARN_CFLAGS) \
$(AM_CFLAGS) \
-I$(top_builddir)/gnome-flashback \
-DLOCALE_DIR=\""$(localedir)"\" \
$(NULL)
gnome_flashback_SOURCES = \
......@@ -56,6 +58,7 @@ gnome_flashback_LDFLAGS = \
gnome_flashback_LDADD = \
$(GNOME_FLASHBACK_LIBS) \
$(top_builddir)/backends/libbackends.la \
$(top_builddir)/gnome-flashback/libaudio-device-selection/libaudio-device-selection.la \
$(top_builddir)/gnome-flashback/libautomount-manager/libautomount-manager.la \
$(top_builddir)/gnome-flashback/libbluetooth-applet/libbluetooth-applet.la \
......
/*
* Copyright (C) 2014-2016 Alberts Muktupāvels
* Copyright (C) 2014-2017 Alberts Muktupāvels
*
* 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
......@@ -21,6 +21,7 @@
#include <gtk/gtk.h>
#include "gf-application.h"
#include "backends/gf-backend.h"
#include "libaudio-device-selection/gf-audio-device-selection.h"
#include "libautomount-manager/gsd-automount-manager.h"
#include "libbluetooth-applet/gf-bluetooth-applet.h"
......@@ -45,6 +46,8 @@ struct _GfApplication
{
GObject parent;
GfBackend *backend;
gint bus_name;
GSettings *settings;
......@@ -213,6 +216,8 @@ gf_application_dispose (GObject *object)
g_clear_object (&application->status_notifier_watcher);
g_clear_object (&application->workarounds);
g_clear_object (&application->backend);
G_OBJECT_CLASS (gf_application_parent_class)->dispose (object);
}
......@@ -221,6 +226,8 @@ gf_application_init (GfApplication *application)
{
GtkSettings *settings;
application->backend = gf_backend_new (GF_BACKEND_TYPE_X11_CM);
application->settings = g_settings_new ("org.gnome.gnome-flashback");
settings = gtk_settings_get_default ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment