[monet/vala: 1/5] Convert Monet to Vala
- From: Thomas Wood <thos src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [monet/vala: 1/5] Convert Monet to Vala
- Date: Mon, 21 Dec 2009 23:07:01 +0000 (UTC)
commit 1b13bec0cc7ecff3ab982afefaff2dca6fab1c37
Author: Thomas Wood <thos gnome org>
Date: Mon Dec 21 22:34:52 2009 +0000
Convert Monet to Vala
Experiment using the Vala language, to ease creation of classes.
configure.ac | 1 +
monet/Makefile.am | 86 +----
monet/mn-color.c | 812 ------------------------------------
monet/mn-color.h | 143 -------
monet/mn-enum-types.c.in | 30 --
monet/mn-enum-types.h.in | 29 --
monet/mn-marshal.list | 12 -
monet/mn-palette.c | 102 -----
monet/mn-palette.h | 55 ---
monet/mn-private.h | 7 -
monet/mn-theme-engine.c | 83 ----
monet/mn-theme-engine.h | 64 ---
monet/mn-theme.vala | 9 +
monet/{monet.h => mn-types.vala} | 53 ++-
monet/mn-widget.c | 145 -------
monet/mn-widget.h | 54 ---
monet/{monet.c => mn-widgets.vala} | 27 +-
monet/widgets/mn-button.c | 94 -----
monet/widgets/mn-button.h | 76 ----
19 files changed, 72 insertions(+), 1810 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 00e2196..ea34037 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,6 +12,7 @@ AM_PROG_CC_STDC
AC_HEADER_STDC
AM_PROG_LIBTOOL
+AM_PROG_VALAC
AM_PATH_GLIB_2_0
PKG_CHECK_MODULES(MONET, [cairo glib-2.0 gobject-2.0])
diff --git a/monet/Makefile.am b/monet/Makefile.am
index 47f2a16..62f89da 100644
--- a/monet/Makefile.am
+++ b/monet/Makefile.am
@@ -1,95 +1,17 @@
AM_CFLAGS = $(MONET_CFLAGS) $(MONET_MAINTAINER_CFLAGS) -DMONET_COMPILATION
INCLUDES = -I$(top_srcdir)
-BUILT_SOURCES = \
- mn-marshal.h \
- mn-marshal.c \
- mn-enum-types.h \
- mn-enum-types.c
-
-STAMP_FILES = \
- stamp-mn-enum-types.h \
- stamp-mn-marshal.h
-
-source_h = \
- mn-color.h \
- mn-palette.h \
- mn-parts.h \
- mn-theme-engine.h \
- mn-types.h \
- mn-widget.h \
- widgets/mn-button.h \
- monet.h
-
-source_h_priv = mn-private.h
-
-mn-enum-types.h: stamp-mn-enum-types.h Makefile
- @true
-
-# glib-mkenums seems really picky about how it parses files...
-enum_source_h = mn-types.h mn-parts.h
-stamp-mn-enum-types.h: $(source_h) mn-enum-types.h.in
- ( cd $(srcdir) && \
- $(GLIB_MKENUMS) \
- --template mn-enum-types.h.in \
- $(enum_source_h) ) >> xgen-teth && \
- (cmp -s xgen-teth mn-enum-types.h || cp xgen-teth mn-enum-types.h) && \
- rm -f xgen-teth && \
- echo timestamp > $(@F)
-
-mn-enum-types.c: stamp-mn-enum-types.h mn-enum-types.c.in
- ( cd $(srcdir) && \
- $(GLIB_MKENUMS) \
- --template mn-enum-types.c.in \
- $(enum_source_h) ) >> xgen-tetc && \
- cp xgen-tetc mn-enum-types.c && \
- rm -f xgen-tetc
-
-# marshal files
-mn-marshal.h: stamp-mn-marshal.h
- @true
-stamp-mn-marshal.h: Makefile mn-marshal.list
- $(GLIB_GENMARSHAL) \
- --prefix=_mn_marshal \
- --header \
- $(srcdir)/mn-marshal.list > xgen-tmh && \
- (cmp -s xgen-tmh mn-marshal.h || cp -f xgen-tmh mn-marshal.h) && \
- rm -f xgen-tmh && \
- echo timestamp > $(@F)
-
-mn-marshal.c: Makefile mn-marshal.list
- (echo "#include \"mn-marshal.h\"" ; \
- $(GLIB_GENMARSHAL) \
- --prefix=_mn_marshal \
- --body \
- $(srcdir)/mn-marshal.list ) > xgen-tmc && \
- cp -f xgen-tmc mn-marshal.c && \
- rm -f xgen-tmc
-
+VALAFLAGS=--pkg cairo --header=monet.h
lib_LTLIBRARIES = libmonet.la
libmonet_la_SOURCES = \
- $(BUILT_SOURCES) \
- $(source_h) \
- $(source_h_priv) \
- mn-color.c \
- mn-palette.c \
- mn-theme-engine.c\
- mn-widget.c \
- widgets/mn-button.c \
- monet.c
+ mn-types.vala \
+ mn-theme.vala \
+ mn-widgets.vala
libmonet_la_LIBADD = $(MONET_LIBS)
monetincludedir = $(includedir)/monet-1.0/monet
-monetinclude_DATA = \
- $(source_h) \
- $(top_builddir)/monet/mn-enum-types.h
-
-EXTRA_DIST = \
- mn-marshal.list \
- mn-enum-types.h.in \
- mn-enum-types.c.in
CLEANFILES = $(BUILT_SOURCES) $(STAMP_FILES)
diff --git a/monet/mn-theme.vala b/monet/mn-theme.vala
new file mode 100644
index 0000000..2961ab3
--- /dev/null
+++ b/monet/mn-theme.vala
@@ -0,0 +1,9 @@
+using Cairo;
+
+namespace Monet
+{
+ public abstract class Theme
+ {
+ public abstract bool paint_widget (Widget widget, Cairo.Context cr);
+ }
+}
diff --git a/monet/monet.h b/monet/mn-types.vala
similarity index 59%
rename from monet/monet.h
rename to monet/mn-types.vala
index 60d0964..b1532ee 100644
--- a/monet/monet.h
+++ b/monet/mn-types.vala
@@ -1,5 +1,5 @@
/*
- * monet.h: a toolkit independent widget drawing library
+ * mn-types.h: type definitions used in monet
*
* Copyright 2009 Intel Corporation
*
@@ -20,24 +20,45 @@
*
* Author: Thomas Wood <thos gnome org>
*/
-#include <glib-object.h>
-#ifndef MONET_H
-#define MONET_H
+namespace Monet
+{
+ public enum State
+ {
+ MN_STATE_NORMAL,
+ MN_STATE_HOVER,
+ MN_STATE_ACTIVE,
+ MN_STATE_DISABLED
+ }
-#define MONET_H_INSIDE
+ public enum Flags
+ {
+ MN_FLAGS_FOCUS = 1 << 0,
+ MN_FLAGS_CHECKED = 1 << 1
+ }
-#include <monet/mn-color.h>
-#include <monet/mn-enum-types.h>
-#include <monet/mn-marshal.h>
-#include <monet/mn-parts.h>
-#include <monet/mn-types.h>
-#include <monet/mn-widget.h>
-#include <monet/mn-theme-engine.h>
-#include <monet/mn-palette.h>
+ public struct Rectangle
+ {
+ double x;
+ double y;
+ double width;
+ double height;
+ }
-#undef MONET_H_INSIDE
+ public struct Border
+ {
+ double top;
+ double right;
+ double bottom;
+ double left;
+ }
-void monet_init (gint *argc, gchar ***argv);
+ public struct Color
+ {
+ double red;
+ double green;
+ double blue;
+ double alpha;
+ }
-#endif /* MONET_H */
+} /* namespace */
diff --git a/monet/monet.c b/monet/mn-widgets.vala
similarity index 57%
rename from monet/monet.c
rename to monet/mn-widgets.vala
index ad186bf..429dba7 100644
--- a/monet/monet.c
+++ b/monet/mn-widgets.vala
@@ -1,5 +1,5 @@
/*
- * monet.c: a toolkit independent widget drawing library
+ * mn-widgets.vala: parameters required for drawing widgets
*
* Copyright 2009 Intel Corporation
*
@@ -20,11 +20,26 @@
*
* Author: Thomas Wood <thos gnome org>
*/
-#include "monet.h"
-void
-monet_init (gint *argc,
- gchar ***argv)
+namespace Monet
{
- g_type_init ();
+
+ public abstract class Widget : Object
+ {
+ public Rectangle area { get; set; }
+ public Border border { get; set; }
+ public State state { get; set; }
+ public Flags flags { get; set; }
+ public Color bg_color { get; set; }
+ public Color fg_color { get; set; }
+ public Color border_color { get; set; }
+ public Color hilight_bg_color { get; set; }
+ public Color hilight_fg_color { get; set; }
+ }
+
+ public class Button : Widget
+ {
+ public bool is_default { get; set; }
+ }
+
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]