Commit e59d8d07 authored by Jonathan Michalon's avatar Jonathan Michalon

Merge branch 'ovccgtk-gtk3' into master as this is the most useful version

parents 0a1c05e0 c8e6d37e
......@@ -15,25 +15,28 @@ ovccgtkdatadir="${datadir}/ovcc-gtk/"
AC_SUBST([ovccgtkdatadir])
# Checks for programs.
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_SED
AC_PROG_CC
AM_PROG_VALAC([0.7])
AC_CHECK_PROGS([GLIB_GENMARSHAL], [glib-genmarshal], [NONE])
AC_CHECK_PROGS([GLIB_COMPILE_RESOURCES], [glib-compile-resources], [NONE])
AC_CHECK_PROGS([GLIB_MKENUMS], [glib-mkenums], [NONE])
# check for gtk-doc
#GTK_DOC_CHECK(1.11)
# Checks for libraries.
GLIB_REQUIRE=2.12
GLIB_REQUIRE=2.38
GMODULE_REQUIRE=2.0
GTK_REQUIRE=2.20
GTK_REQUIRE=3.10
OVCC_REQUIRE=0.0
PKG_CHECK_MODULES([OVCCGTK], [glib-2.0 >= ${GLIB_REQUIRE}
gthread-2.0 >= ${GLIB_REQUIRE}
gmodule-export-2.0 >= ${GMODULE_REQUIRE}
gtk+-2.0 >= ${GTK_REQUIRE}
gtk+-3.0 >= ${GTK_REQUIRE}
ovcc >= ${OVCC_REQUIRE}
ovccclient >= ${OVCC_REQUIRE}])
......
......@@ -2,13 +2,17 @@
iconsdir = $(datadir)
nobase_dist_icons_DATA = icons/hicolor/scalable/apps/ovccgtk.svg
dist_pkgdata_DATA = ovcc-gtk.ui
dist_noinst_DATA = ovccgtk-application.ui \
ovccgtk-connection-dialog.ui
# we add directory $(pkgdatadir)/icons to our lookup path, so make sure it
# exists in case we aren't installed in a default prefix where icons are
# already searched for
install-data-hook:
( cd "$(pkgdatadir)" && $(RM) icons && $(LN_S) ../icons icons )
( $(INSTALL) -d "$(pkgdatadir)" && \
cd "$(pkgdatadir)" && \
$(RM) icons && \
$(LN_S) ../icons icons )
uninstall-hook:
( test ! -d "$(pkgdatadir)" || ( cd "$(pkgdatadir)" && $(RM) icons ) )
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">65535</property>
<property name="value">57005</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<template class="OVCCGtkConnectionDialog" parent="GtkDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button-cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button-connect">
<property name="label">gtk-connect</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="can_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="OVCCGtkMessageInfo" type-func="ovccgtk_message_info_get_type" id="messageinfo">
<property name="visible">True</property>
<property name="message-type">GTK_MESSAGE_INFO</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Host:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="host">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="activates_default">True</property>
<signal name="notify::text" handler="host_notify_handler" />
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Port:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="port">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activates_default">True</property>
<property name="adjustment">adjustment1</property>
<signal name="notify::value" handler="port_notify_handler" />
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Server</property>
<property name="use_markup">True</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Name:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="username">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<signal name="notify::text" handler="username_notify_handler" />
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Password:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="password">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">User</property>
<property name="use_markup">True</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-6">button-cancel</action-widget>
<action-widget response="-5">button-connect</action-widget>
</action-widgets>
</template>
<object class="GtkSizeGroup" id="sizegroup1">
<widgets>
<widget name="label2"/>
<widget name="label5"/>
<widget name="label6"/>
</widgets>
</object>
</interface>
......@@ -27,8 +27,10 @@ headers = ovccgtk-board.h \
tiles.h
autogen_sources = ovccgtk-marshal.c \
ovccgtk-resources.c \
ovccgtk-enum-types.c
autogen_headers = ovccgtk-marshal.h \
ovccgtk-resources.h \
ovccgtk-enum-types.h
CLEANFILES = $(autogen_sources) \
......@@ -36,11 +38,12 @@ CLEANFILES = $(autogen_sources) \
EXTRA_DIST = ovccgtk-marshal.list \
ovccgtk-enum-types.c.tpl \
ovccgtk-enum-types.h.tpl
ovccgtk-enum-types.h.tpl \
ovccgtk-resources.gresource.xml
ovcc_gtk_CFLAGS = $(OVCCGTK_CFLAGS) -Wl,--export-dynamic \
-DDATADIR='"$(ovccgtkdatadir)"'
ovcc_gtk_CFLAGS = $(OVCCGTK_CFLAGS) -DDATADIR='"$(ovccgtkdatadir)"'
ovcc_gtk_LDFLAGS = -Wl,--export-dynamic
ovcc_gtk_LDADD = $(OVCCGTK_LIBS) -lm
ovcc_gtk_SOURCES = $(autogen_sources) \
$(autogen_headers) \
......@@ -48,20 +51,57 @@ ovcc_gtk_SOURCES = $(autogen_sources) \
$(headers)
ovccgtk-marshal.h: $(srcdir)/ovccgtk-marshal.list
$(AM_V_GEN) $(GLIB_GENMARSHAL) $< --header --prefix=ovccgtk_marshal > $@
GLIB_GENMARSHAL_FLAGS = --prefix=ovccgtk_marshal
ovccgtk-marshal.c: $(srcdir)/ovccgtk-marshal.list ovccgtk-marshal.h
$(AM_V_GEN) echo '#include "ovccgtk-marshal.h"' > $@ && \
$(GLIB_GENMARSHAL) $< --body --prefix=ovccgtk_marshal >> $@
GLIB_COMPILE_RESOURCES_SOURCEDIR = $(top_srcdir)/data
GLIB_COMPILE_RESOURCES_FLAGS = --internal --manual-register --c-name=ovccgtk
SUFFIXES = .list .c.tpl .h.tpl .gresource.xml .c .h
.list.h:
$(AM_V_GEN) $(GLIB_GENMARSHAL) $< --header $(GLIB_GENMARSHAL_FLAGS) > $@
.list.c:
$(AM_V_GEN) ( echo '#include "$@"' | $(SED) 's/.c"/.h"/' && \
$(GLIB_GENMARSHAL) $< --body $(GLIB_GENMARSHAL_FLAGS) ) > $@
# we need to hack since our prefix (OVCCGtk) is incorrectly detected as mapping
# to prefix=o sub-prefix=vcc_gtk
ovccgtk-enum-types.c: $(srcdir)/ovccgtk-enum-types.c.tpl ovccgtk-enum-types.h $(headers) Makefile
.c.tpl.c:
$(AM_V_GEN)$(GLIB_MKENUMS) --template $< $(headers:%=$(srcdir)/%) | \
sed s%o_vcc_gtk_%ovccgtk_%g | \
sed s%O_TYPE_VCC_GTK_%OVCCGTK_TYPE_%g > $@
ovccgtk-enum-types.h: $(srcdir)/ovccgtk-enum-types.h.tpl $(headers) Makefile
$(SED) s%o_vcc_gtk_%ovccgtk_%g | \
$(SED) s%O_TYPE_VCC_GTK_%OVCCGTK_TYPE_%g > $@
.h.tpl.h:
$(AM_V_GEN)$(GLIB_MKENUMS) --template $< $(headers:%=$(srcdir)/%) | \
sed s%o_vcc_gtk_%ovccgtk_%g | \
sed s%O_TYPE_VCC_GTK_%OVCCGTK_TYPE_%g > $@
$(SED) s%o_vcc_gtk_%ovccgtk_%g | \
$(SED) s%O_TYPE_VCC_GTK_%OVCCGTK_TYPE_%g > $@
.gresource.xml.h:
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ --generate-header \
$(GLIB_COMPILE_RESOURCES_FLAGS) \
--sourcedir=$(GLIB_COMPILE_RESOURCES_SOURCEDIR) && \
(echo $@: && $(GLIB_COMPILE_RESOURCES) $< \
--sourcedir=$(GLIB_COMPILE_RESOURCES_SOURCEDIR) \
--generate-dependencies) | $(SED) 's/$$/\\/' > .deps/$@.deps
.gresource.xml.c:
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ --generate-source \
$(GLIB_COMPILE_RESOURCES_FLAGS) \
--sourcedir=$(GLIB_COMPILE_RESOURCES_SOURCEDIR) && \
(echo $@: && $(GLIB_COMPILE_RESOURCES) $< \
--sourcedir=$(GLIB_COMPILE_RESOURCES_SOURCEDIR) \
--generate-dependencies) | $(SED) 's/$$/\\/' > .deps/$@.deps
# explicit dependencies of our generated files
$(autogen_headers) $(autogen_sources): Makefile
ovccgtk-marshal.c: ovccgtk-marshal.h
ovccgtk-enum-types.c: ovccgtk-enum-types.h $(headers)
ovccgtk-enum-types.h: $(headers)
-include .deps/ovccgtk-resources.h.deps
-include .deps/ovccgtk-resources.c.deps
ovccgtk-resources.c: ovccgtk-resources.h
......@@ -27,13 +27,13 @@
#include "utils.h"
#include "tiles.h"
#include "ovccgtk-resources.h"
#include "ovccgtk-board.h"
#include "ovccgtk-client.h"
#include "ovccgtk-connection-dialog.h"
#include "ovccgtk-player-list.h"
#define UI_FILE "ovcc-gtk.ui"
#define GAME_TILES "tiles.xml"
#define GAME_TILESET "tileset.xml"
......@@ -410,9 +410,9 @@ load_ui (GtkBuilder *builder,
{
GError *err = NULL;
gboolean loaded = FALSE;
gchar *path = data_get_path (filename);
gchar *path = g_build_filename ("/org/ovccgtk/widgets", filename, NULL);
loaded = gtk_builder_add_from_file (builder, path, &err) > 0;
loaded = gtk_builder_add_from_resource (builder, path, &err) > 0;
if (! loaded) {
show_message (NULL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
err->message, _("Failed to load UI file \"%s\""), path);
......@@ -881,8 +881,8 @@ help_about_activate_handler (GtkAction *action,
"program-name", _("OVCCGtk"),
"version", VERSION,
"comments", _("A GTK client for OVCC"),
"copyright", _("\xc2\xa9 2009-2011 Colomban Wendling"),
"license", "GPLv3+",
"copyright", _("Copyright \xc2\xa9 2009-2013 Colomban Wendling"),
"license-type", GTK_LICENSE_GPL_3_0,
"translator-credits", _("translator-credits"),
"authors", authors,
NULL);
......@@ -903,7 +903,7 @@ ovcc_gtk (int argc,
g_free (icon_path);
builder = gtk_builder_new ();
if (load_ui (builder, UI_FILE)) {
if (load_ui (builder, "ovccgtk-application.ui")) {
GtkWidget *players_cnt;
GtkWidget *board_cnt;
App *app;
......@@ -971,7 +971,9 @@ main (int argc,
int rv = 1;
gtk_init (&argc, &argv);
ovccgtk_register_resource ();
rv = ovcc_gtk (argc, argv) ? 0 : 1;
ovccgtk_unregister_resource ();
return rv;
}
......
This diff is collapsed.
......@@ -63,9 +63,6 @@ struct _OVCCGtkBoardClass
const OVCCPosition *pos,
OVCCTileObject *obj,
OVCCPawnKind kind);
void (*set_scroll_adjustments) (OVCCGtkBoard *board,
GtkAdjustment *hadjustment,
GtkAdjustment *vadjustment);
};
......
......@@ -43,33 +43,33 @@ enum
};
static void ovccgtk_cell_renderer_color_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void ovccgtk_cell_renderer_color_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void ovccgtk_cell_renderer_color_get_size (GtkCellRenderer *cell,
GtkWidget *widget,
GdkRectangle *cell_area,
gint *x_offset,
gint *y_offset,
gint *width,
gint *height);
static void ovccgtk_cell_renderer_color_render (GtkCellRenderer *cell,
GdkDrawable *window,
GtkWidget *widget,
GdkRectangle *background_area,
GdkRectangle *cell_area,
GdkRectangle *expose_area,
GtkCellRendererState flags);
static void ovccgtk_cell_renderer_color_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void ovccgtk_cell_renderer_color_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void ovccgtk_cell_renderer_color_get_preferred_width (GtkCellRenderer *cell,
GtkWidget *widget,
gint *minimum_width,
gint *natural_width);
static void ovccgtk_cell_renderer_color_get_preferred_height (GtkCellRenderer *cell,
GtkWidget *widget,
gint *minimum_height,
gint *natural_height);
static void ovccgtk_cell_renderer_color_render (GtkCellRenderer *cell,
cairo_t *cr,
GtkWidget *widget,
const GdkRectangle *background_area,
const GdkRectangle *cell_area,
GtkCellRendererState flags);
G_DEFINE_TYPE (OVCCGtkCellRendererColor,
ovccgtk_cell_renderer_color,
GTK_TYPE_CELL_RENDERER)
G_DEFINE_TYPE_WITH_PRIVATE (OVCCGtkCellRendererColor,
ovccgtk_cell_renderer_color,
GTK_TYPE_CELL_RENDERER)
static void
......@@ -81,8 +81,9 @@ ovccgtk_cell_renderer_color_class_init (OVCCGtkCellRendererColorClass *klass)
object_class->set_property = ovccgtk_cell_renderer_color_set_property;
object_class->get_property = ovccgtk_cell_renderer_color_get_property;
renderer_class->get_size = ovccgtk_cell_renderer_color_get_size;
renderer_class->render = ovccgtk_cell_renderer_color_render;
renderer_class->get_preferred_width = ovccgtk_cell_renderer_color_get_preferred_width;
renderer_class->get_preferred_height = ovccgtk_cell_renderer_color_get_preferred_height;
renderer_class->render = ovccgtk_cell_renderer_color_render;
g_object_class_install_property (object_class, PROP_COLOR,
g_param_spec_boxed ("color",
......@@ -108,17 +109,12 @@ ovccgtk_cell_renderer_color_class_init (OVCCGtkCellRendererColorClass *klass)
24,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_type_class_add_private ((gpointer) klass,
sizeof (OVCCGtkCellRendererColorPrivate));
}
static void
ovccgtk_cell_renderer_color_init (OVCCGtkCellRendererColor *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
OVCCGTK_TYPE_CELL_RENDERER_COLOR,
OVCCGtkCellRendererColorPrivate);
self->priv = ovccgtk_cell_renderer_color_get_instance_private (self);
self->priv->shape = OVCCGTK_CELL_RENDERER_COLOR_SHAPE_FILL;
self->priv->size = 24;
......@@ -190,57 +186,65 @@ ovccgtk_cell_renderer_color_get_property (GObject *object,
}
static void
ovccgtk_cell_renderer_color_get_size (GtkCellRenderer *cell,
GtkWidget *widget,
GdkRectangle *cell_area,
gint *x_offset,
gint *y_offset,
gint *width,
gint *height)
ovccgtk_cell_renderer_color_get_preferred_width (GtkCellRenderer *cell,
GtkWidget *widget,
gint *minimum_width,
gint *natural_width)
{
OVCCGtkCellRendererColor *self = OVCCGTK_CELL_RENDERER_COLOR (cell);
gint w = cell->xpad * 2 + self->priv->size;
gint h = cell->ypad * 2 + self->priv->size;
gint xpad;
gint width;
if (cell_area && w > 0 && h > 0 &&
self->priv->shape != OVCCGTK_CELL_RENDERER_COLOR_SHAPE_FILL) {
if (x_offset) {
*x_offset = ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?