Clean up and separate VAPI files.

Note to other developers: you might have to do `make clean;./autogen.sh`
after this commit.

* Use a GtkCheese namespace to be constistent with other vapi's (such as
GtkClutter).

* Put each library in a separate vapi-file (this will come in handy when
porting to Meson).

* Clean up config.vapi:
  * get rid of unused CCode prefix-attribute (removes warning)
  * be consistent with braces
This commit is contained in:
Niels De Graef 2017-06-30 12:34:10 +02:00
parent 44f21d6ff1
commit d4dbd4374f
8 changed files with 82 additions and 73 deletions

View file

@ -44,8 +44,7 @@ pkg_modules="gtk+-3.0 >= 3.20.0
"
PKG_CHECK_MODULES(CONTACTS, [$pkg_modules])
CONTACTS_PACKAGES="--pkg gtk+-3.0 --pkg gio-2.0 --pkg gio-unix-2.0 --pkg folks --pkg folks-telepathy --pkg folks-eds --pkg clutter-1.0 --pkg clutter-gtk-1.0 --pkg champlain-0.12 --pkg geocode-glib-1.0"
AC_SUBST(CONTACTS_PACKAGES)
CONTACTS_PACKAGES="--pkg gtk+-3.0 --pkg gio-2.0 --pkg gio-unix-2.0 --pkg gnome-desktop-3.0 --pkg folks --pkg folks-telepathy --pkg folks-eds --pkg clutter-1.0 --pkg clutter-gtk-1.0 --pkg champlain-0.12 --pkg geocode-glib-1.0"
# Optional dependency for the user accounts panel
AC_ARG_WITH([cheese],
@ -56,6 +55,7 @@ if test x"$with_cheese" != x"no" ; then
PKG_CHECK_MODULES(CHEESE, cheese-gtk >= 3.3.91 cheese, [have_cheese=yes], [have_cheese=no])
if test x${have_cheese} = xyes; then
AC_DEFINE(HAVE_CHEESE, 1, [Define to 1 to enable cheese webcam support])
CONTACTS_PACKAGES+=" --pkg cheese --pkg cheese-gtk"
fi
if test x${with_cheese} = xyes && test x${have_cheese} = xno; then
AC_MSG_ERROR([Cheese configured but not found])
@ -65,6 +65,9 @@ else
fi
AM_CONDITIONAL(BUILD_CHEESE, test x${have_cheese} = xyes)
AC_SUBST(CONTACTS_PACKAGES)
#############
# Resources #
#############

View file

@ -26,7 +26,7 @@ main (string[] args) {
Intl.textdomain (Config.GETTEXT_PACKAGE);
#if HAVE_CHEESE
Cheese.gtk_init (ref args);
GtkCheese.init (ref args);
#else
GtkClutter.init (ref args);
#endif

View file

@ -1,4 +1,9 @@
noinst_DATA = config.vapi custom.vapi
noinst_DATA = \
cheese.vapi \
cheese-gtk.vapi \
config.vapi \
custom.vapi \
gnome-desktop-3.0.vapi
EXTRA_DIST = $(noinst_DATA)

5
vapi/cheese-gtk.vapi Normal file
View file

@ -0,0 +1,5 @@
[CCode (cprefix = "Cheese", lower_case_cprefix = "cheese_", cheader_filename = "cheese/cheese-gtk.h")]
namespace GtkCheese {
[CCode (cheader_filename = "cheese/cheese-camera-device.h", cname = "cheese_gtk_init")]
public static void init ([CCode (array_length_pos = 0.9)] ref unowned string[] argv);
}

45
vapi/cheese.vapi Normal file
View file

@ -0,0 +1,45 @@
[CCode (cprefix = "Cheese", lower_case_cprefix = "cheese_", cheader_filename = "cheese/cheese-gtk.h")]
namespace Cheese {
[CCode (cheader_filename = "cheese/cheese-camera-device.h")]
public class CameraDevice : GLib.Object {
[CCode (has_construct_function = false, type = "CheeseCameraDevice*")]
public CameraDevice (string uuid, string device_node, string name, uint v4l_api_version) throws GLib.Error;
}
[CCode (cheader_filename = "cheese/cheese-camera-device-monitor.h")]
public class CameraDeviceMonitor : GLib.Object {
[CCode (has_construct_function = false, type = "CheeseCameraDeviceMonitor*")]
public CameraDeviceMonitor ();
public void coldplug ();
public signal void added (CameraDevice device);
public signal void removed (string uuid);
}
[CCode (cheader_filename = "cheese/cheese-avatar-chooser.h")]
public class AvatarChooser : Gtk.Dialog {
[CCode (has_construct_function = false, type = "CheeseAvatarChooser*")]
public AvatarChooser ();
public Gdk.Pixbuf get_picture ();
}
public enum WidgetState {
NONE,
READY,
ERROR
}
[CCode (cheader_filename = "cheese/cheese-widget.h")]
public class Widget : Gtk.Widget {
[CCode (has_construct_function = false, type = "CheeseWidget*")]
public Widget ();
public WidgetState state { get; }
public unowned GLib.Object get_camera ();
}
[CCode (cheader_filename = "cheese/cheese-camera.h")]
public class Camera : GLib.Object {
public bool take_photo_pixbuf ();
public signal void photo_taken (Gdk.Pixbuf pixbuf);
}
[CCode (cheader_filename = "cheese-flash.h")]
public class Flash : Gtk.Window {
[CCode (has_construct_function = false, type = "CheeseFlash*")]
public Flash (Gtk.Widget parent);
public void fire ();
}
}

View file

@ -1,6 +1,5 @@
[CCode (prefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
namespace Config
{
[CCode (lower_case_cprefix = "", cheader_filename = "config.h")]
namespace Config {
/* Package information */
public const string PACKAGE_NAME;
public const string PACKAGE_STRING;

View file

@ -1,22 +1,3 @@
namespace Gnome {
[CCode (cheader_filename = "libgnome-desktop/gnome-desktop-thumbnail.h")]
public class DesktopThumbnailFactory : GLib.Object {
[CCode (has_construct_function = false)]
public DesktopThumbnailFactory (Gnome.ThumbnailSize size);
public bool can_thumbnail (string uri, string mime_type, ulong mtime);
public void create_failed_thumbnail (string uri, ulong mtime);
public unowned Gdk.Pixbuf generate_thumbnail (string uri, string mime_type);
public bool has_valid_failed_thumbnail (string uri, ulong mtime);
public unowned string lookup (string uri, ulong mtime);
public void save_thumbnail (Gdk.Pixbuf thumbnail, string uri, ulong original_mtime);
}
[CCode (cheader_filename = "libgnome-desktop/gnome-desktop-thumbnail.h", cprefix = "GNOME_DESKTOP_THUMBNAIL_SIZE_")]
public enum ThumbnailSize {
NORMAL,
LARGE
}
}
[CCode (cprefix = "Contacts", lower_case_cprefix = "contacts_", cheader_filename = "contacts-esd-setup.h")]
namespace Contacts {
[CCode (cname = "contacts_ensure_eds_accounts")]
@ -46,50 +27,3 @@ namespace Cc {
public Gdk.Pixbuf get_picture ();
}
}
[CCode (cprefix = "Cheese", lower_case_cprefix = "cheese_", cheader_filename = "cheese/cheese-gtk.h")]
namespace Cheese {
public static void gtk_init ([CCode (array_length_pos = 0.9)] ref unowned string[] argv);
[CCode (cheader_filename = "cheese/cheese-camera-device.h")]
public class CameraDevice : GLib.Object {
[CCode (has_construct_function = false, type = "CheeseCameraDevice*")]
public CameraDevice (string uuid, string device_node, string name, uint v4l_api_version) throws GLib.Error;
}
[CCode (cheader_filename = "cheese/cheese-camera-device-monitor.h")]
public class CameraDeviceMonitor : GLib.Object {
[CCode (has_construct_function = false, type = "CheeseCameraDeviceMonitor*")]
public CameraDeviceMonitor ();
public void coldplug ();
public signal void added (CameraDevice device);
public signal void removed (string uuid);
}
[CCode (cheader_filename = "cheese/cheese-avatar-chooser.h")]
public class AvatarChooser : Gtk.Dialog {
[CCode (has_construct_function = false, type = "CheeseAvatarChooser*")]
public AvatarChooser ();
public Gdk.Pixbuf get_picture ();
}
public enum WidgetState {
NONE,
READY,
ERROR
}
[CCode (cheader_filename = "cheese/cheese-widget.h")]
public class Widget : Gtk.Widget {
[CCode (has_construct_function = false, type = "CheeseWidget*")]
public Widget ();
public WidgetState state { get; }
public unowned GLib.Object get_camera ();
}
[CCode (cheader_filename = "cheese/cheese-camera.h")]
public class Camera : GLib.Object {
public bool take_photo_pixbuf ();
public signal void photo_taken (Gdk.Pixbuf pixbuf);
}
[CCode (cheader_filename = "cheese-flash.h")]
public class Flash : Gtk.Window {
[CCode (has_construct_function = false, type = "CheeseFlash*")]
public Flash (Gtk.Widget parent);
public void fire ();
}
}

View file

@ -0,0 +1,18 @@
[CCode (cheader_filename = "libgnome-desktop/gnome-desktop-thumbnail.h")]
namespace Gnome {
public class DesktopThumbnailFactory : GLib.Object {
[CCode (has_construct_function = false)]
public DesktopThumbnailFactory (Gnome.ThumbnailSize size);
public bool can_thumbnail (string uri, string mime_type, ulong mtime);
public void create_failed_thumbnail (string uri, ulong mtime);
public unowned Gdk.Pixbuf generate_thumbnail (string uri, string mime_type);
public bool has_valid_failed_thumbnail (string uri, ulong mtime);
public unowned string lookup (string uri, ulong mtime);
public void save_thumbnail (Gdk.Pixbuf thumbnail, string uri, ulong original_mtime);
}
[CCode (cprefix = "GNOME_DESKTOP_THUMBNAIL_SIZE_")]
public enum ThumbnailSize {
NORMAL,
LARGE
}
}