A bunch of changes.
Added GcalWindow, and GcalMainToolbar initia skels Added a bunch of annoying compilation flags.
This commit is contained in:
@@ -69,3 +69,4 @@ gnome_calendar.anjuta
|
||||
/ltmain.sh
|
||||
/missing
|
||||
/mkinstalldirs
|
||||
Debug*
|
||||
|
||||
+3
-3
@@ -18,8 +18,8 @@ EXTRA_DIST = \
|
||||
$(gnome_calendardoc_DATA) \
|
||||
$(INTLTOOL_FILES) \
|
||||
THANKS \
|
||||
TODO \
|
||||
autogen.sh
|
||||
TODO \
|
||||
autogen.sh
|
||||
|
||||
|
||||
DISTCLEANFILES = \
|
||||
@@ -31,4 +31,4 @@ DISTCLEANFILES = \
|
||||
|
||||
# Remove doc directory on uninstall
|
||||
uninstall-local:
|
||||
-rm -r $(gnome_calendardocdir)
|
||||
-rm -r $(gnome_calendardocdir)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
TODO
|
||||
|
||||
- Connect keyboard-shortcuts like Ctrl+Q
|
||||
- Check for the real need of adding timezone, and check everywhere
|
||||
- Create GcalView interface or superclass of all views.
|
||||
- Connect all dconf options to the program
|
||||
- Remove _bodyContainer if there's no need of it in the end.
|
||||
- Remove body_actor if there's no need of it in the end.
|
||||
- Remove g_print()/log()
|
||||
|
||||
+19
-2
@@ -47,6 +47,23 @@ LT_INIT
|
||||
|
||||
GLIB_GSETTINGS
|
||||
|
||||
GNOME_COMPILE_WARNINGS(maximum)
|
||||
GNOME_COMMON_INIT
|
||||
GNOME_MAINTAINER_MODE_DEFINES
|
||||
|
||||
MAINTAINER_COMPILER_FLAGS="$MAINTAINER_COMPILER_FLAGS \
|
||||
-Wall -Wcast-align -Wuninitialized \
|
||||
-Wno-strict-aliasing -Wempty-body -Wformat \
|
||||
-Wformat-security -Wformat-nonliteral -Winit-self \
|
||||
-Wdeclaration-after-statement -Wvla \
|
||||
-Wpointer-arith -Wmissing-declarations \
|
||||
-Wcast-align \
|
||||
-Wredundant-decls"
|
||||
|
||||
# strip leading spaces
|
||||
MAINTAINER_COMPILER_FLAGS=${MAINTAINER_COMPILER_FLAGS#* }
|
||||
AC_SUBST(MAINTAINER_COMPILER_FLAGS)
|
||||
|
||||
GLIB_MIN_VERSION=2.30.0
|
||||
GTK_MIN_VERSION=3.4.0
|
||||
CLUTTER_MIN_VERSION=1.10
|
||||
@@ -58,8 +75,8 @@ EDATASERVERUI_REQUIRED=3.1.5
|
||||
PKG_CHECK_MODULES(CALENDAR,
|
||||
glib-2.0 >= $GLIB_MIN_VERSION
|
||||
gtk+-3.0 >= $GTK_MIN_VERSION
|
||||
clutter-1.0 >= CLUTTER_MIN_VERSION
|
||||
clutter-gtk-1.0 >= CLUTTER_GTK_MIN_VERSION
|
||||
clutter-1.0 >= CLUTTER_MIN_VERSION
|
||||
clutter-gtk-1.0 >= CLUTTER_GTK_MIN_VERSION
|
||||
libecal-1.2 >= $ECAL_REQUIRED
|
||||
libedataserver-1.2 >= EDATASERVER_REQUIRED
|
||||
libedataserverui-3.0 >= EDATASERVERUI_REQUIRED)
|
||||
|
||||
+2
-2
@@ -80,9 +80,9 @@ Rough description of some internals of Gnome Calendar Application
|
||||
|
||||
+- GtkClutter.Embed::ClutterBox(BoxLayout) ----------------------------------+
|
||||
| |
|
||||
| +- _bodyContainer::ClutterBox(BoxLayout) -----------------------------+ |
|
||||
| +- _body_actor::ClutterBox(BoxLayout) --------------------------------+ |
|
||||
| | | |
|
||||
| | +- _mainToolbar ------------------------------------------------+ | |
|
||||
| | +- _main_toolbar -----------------------------------------------+ | |
|
||||
| | | | | |
|
||||
| | +---------------------------------------------------------------+ | |
|
||||
| | +- _contentsContainer::ClutterBox(BinLayout) -------------------+ | |
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
|
||||
src/main.c
|
||||
src/gcal-application.c
|
||||
src/gcal-main-toolbar.c
|
||||
|
||||
+10
-3
@@ -1,19 +1,26 @@
|
||||
AM_CPPFLAGS = \
|
||||
-DCLUTTER_VERSION_MIN_REQUIRED=CLUTTER_VERSION_1_10 \
|
||||
-DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
|
||||
-DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
|
||||
-DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
|
||||
$(MAINTAINER_COMPILER_FLAGS) \
|
||||
$(CALENDAR_CFLAGS)
|
||||
|
||||
AM_CFLAGS = \
|
||||
-Wall \
|
||||
-g
|
||||
-Wall -Wextra \
|
||||
-g -O0
|
||||
|
||||
bin_PROGRAMS = gnome-calendar
|
||||
|
||||
gnome_calendar_SOURCES = \
|
||||
main.c \
|
||||
gcal-application.h \
|
||||
gcal-application.c
|
||||
gcal-application.c \
|
||||
gcal-main-toolbar.h \
|
||||
gcal-main-toolbar.c \
|
||||
gcal-window.h \
|
||||
gcal-window.c
|
||||
|
||||
|
||||
gnome_calendar_LDFLAGS = \
|
||||
-Wl,--export-dynamic
|
||||
|
||||
+14
-4
@@ -16,13 +16,17 @@
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "gcal-application.h"
|
||||
#include "gcal-window.h"
|
||||
|
||||
#include <clutter-gtk/clutter-gtk.h>
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
struct _GcalApplicationPrivate
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *window;
|
||||
};
|
||||
|
||||
static void gcal_application_startup (GApplication *app);
|
||||
@@ -46,7 +50,9 @@ gcal_application_activate (GApplication *application)
|
||||
gtk_window_present (GTK_WINDOW (app->priv->window));
|
||||
else
|
||||
{
|
||||
app->priv->window = gtk_application_window_new (GTK_APPLICATION (app));
|
||||
app->priv->window = gcal_window_new ();
|
||||
gtk_window_set_application (GTK_WINDOW (app->priv->window),
|
||||
GTK_APPLICATION (app));
|
||||
gtk_window_set_title (GTK_WINDOW (app->priv->window), _("Calendar"));
|
||||
gtk_window_set_hide_titlebar_when_maximized (
|
||||
GTK_WINDOW (app->priv->window),
|
||||
@@ -87,6 +93,8 @@ gcal_application_startup (GApplication *app)
|
||||
{
|
||||
G_APPLICATION_CLASS (gcal_application_parent_class)->startup (app);
|
||||
|
||||
gtk_clutter_init (NULL, NULL);
|
||||
|
||||
_gcal_application_set_app_menu (app);
|
||||
}
|
||||
|
||||
@@ -94,8 +102,10 @@ static void
|
||||
_gcal_application_set_app_menu (GApplication *app)
|
||||
{
|
||||
GMenu *app_menu = g_menu_new ();
|
||||
GSimpleAction *about;
|
||||
GSimpleAction *quit;
|
||||
|
||||
GSimpleAction *about = g_simple_action_new ("about", NULL);
|
||||
about = g_simple_action_new ("about", NULL);
|
||||
g_signal_connect (about,
|
||||
"activate",
|
||||
G_CALLBACK (_gcal_application_show_about),
|
||||
@@ -103,7 +113,7 @@ _gcal_application_set_app_menu (GApplication *app)
|
||||
g_action_map_add_action ( G_ACTION_MAP (app), G_ACTION (about));
|
||||
g_menu_append (app_menu, _("About"), "app.about");
|
||||
|
||||
GSimpleAction *quit = g_simple_action_new ("quit", NULL);
|
||||
quit = g_simple_action_new ("quit", NULL);
|
||||
g_signal_connect (quit,
|
||||
"activate",
|
||||
G_CALLBACK (_gcal_application_quit),
|
||||
|
||||
+11
-11
@@ -17,23 +17,23 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _GCAL_APPLICATION_
|
||||
#define _GCAL_APPLICATION_
|
||||
#ifndef _GCAL_APPLICATION_H_
|
||||
#define _GCAL_APPLICATION_H_
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GCAL_TYPE_APPLICATION (gcal_application_get_type ())
|
||||
#define GCAL_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCAL_TYPE_APPLICATION, GcalApplication))
|
||||
#define GCAL_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCAL_TYPE_APPLICATION, GcalApplicationClass))
|
||||
#define GCAL_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCAL_TYPE_APPLICATION))
|
||||
#define GCAL_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCAL_TYPE_APPLICATION))
|
||||
#define GCAL_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCAL_TYPE_APPLICATION, GcalApplicationClass))
|
||||
#define GCAL_TYPE_APPLICATION (gcal_application_get_type ())
|
||||
#define GCAL_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCAL_TYPE_APPLICATION, GcalApplication))
|
||||
#define GCAL_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCAL_TYPE_APPLICATION, GcalApplicationClass))
|
||||
#define GCAL_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCAL_TYPE_APPLICATION))
|
||||
#define GCAL_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCAL_TYPE_APPLICATION))
|
||||
#define GCAL_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCAL_TYPE_APPLICATION, GcalApplicationClass))
|
||||
|
||||
typedef struct _GcalApplicationClass GcalApplicationClass;
|
||||
typedef struct _GcalApplication GcalApplication;
|
||||
typedef struct _GcalApplicationPrivate GcalApplicationPrivate;
|
||||
typedef struct _GcalApplicationClass GcalApplicationClass;
|
||||
typedef struct _GcalApplication GcalApplication;
|
||||
typedef struct _GcalApplicationPrivate GcalApplicationPrivate;
|
||||
|
||||
struct _GcalApplicationClass
|
||||
{
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* gcal-main-toolbar.c
|
||||
* Copyright (C) 2012 Erick Pérez Castellanos <erickpc@gnome.org>
|
||||
*
|
||||
* gnome-calendar 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.
|
||||
*
|
||||
* gnome-calendar 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/>.
|
||||
*/
|
||||
|
||||
#include "gcal-main-toolbar.h"
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
struct _GcalMainToolbarPrivate
|
||||
{
|
||||
GtkWidget *widget;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GcalMainToolbar, gcal_main_toolbar, GTK_CLUTTER_TYPE_ACTOR);
|
||||
|
||||
static void
|
||||
gcal_main_toolbar_init (GcalMainToolbar *self)
|
||||
{
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||
GCAL_TYPE_MAIN_TOOLBAR,
|
||||
GcalMainToolbarPrivate);
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_main_toolbar_constructed (GObject *object)
|
||||
{
|
||||
GcalMainToolbarPrivate *priv;
|
||||
|
||||
GtkWidget *button;
|
||||
GtkStyleContext *context;
|
||||
GtkToolItem *item;
|
||||
GtkToolItem *spacer;
|
||||
GtkWidget *views_box;
|
||||
GtkWidget *bin;
|
||||
|
||||
priv = GCAL_MAIN_TOOLBAR (object)->priv;
|
||||
if (G_OBJECT_CLASS (gcal_main_toolbar_parent_class)->constructed != NULL)
|
||||
G_OBJECT_CLASS (gcal_main_toolbar_parent_class)->constructed (object);
|
||||
|
||||
priv->widget = gtk_toolbar_new ();
|
||||
gtk_widget_set_hexpand (priv->widget, TRUE);
|
||||
gtk_widget_set_vexpand (priv->widget, TRUE);
|
||||
gtk_toolbar_set_icon_size (GTK_TOOLBAR (priv->widget),
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
|
||||
context = gtk_widget_get_style_context (priv->widget);
|
||||
gtk_style_context_add_class (context, "gcal-main-toolbar");
|
||||
|
||||
/* sources */
|
||||
button = gtk_toggle_button_new ();
|
||||
gtk_container_add (GTK_CONTAINER (button),
|
||||
gtk_image_new_from_icon_name ("emblem-documents-symbolic",
|
||||
GTK_ICON_SIZE_MENU));
|
||||
|
||||
context = gtk_widget_get_style_context (button);
|
||||
gtk_style_context_add_class (context, "raised");
|
||||
|
||||
item = gtk_tool_item_new ();
|
||||
gtk_container_add (GTK_CONTAINER (item), button);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (priv->widget), item, 0);
|
||||
|
||||
/* spacer */
|
||||
spacer = gtk_tool_item_new ();
|
||||
gtk_tool_item_set_expand (spacer, TRUE);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (priv->widget), spacer, -1);
|
||||
|
||||
/* views_box */
|
||||
views_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_set_hexpand (views_box, TRUE);
|
||||
|
||||
context = gtk_widget_get_style_context (views_box);
|
||||
gtk_style_context_add_class (context, "linked");
|
||||
|
||||
item = gtk_tool_item_new ();
|
||||
gtk_container_add (GTK_CONTAINER (item), views_box);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (priv->widget), item, -1);
|
||||
|
||||
/* day */
|
||||
button = gtk_button_new_with_label (_("Day"));
|
||||
gtk_widget_set_size_request (button, 80, -1);
|
||||
|
||||
context = gtk_widget_get_style_context (button);
|
||||
gtk_style_context_add_class (context, "raised");
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (views_box), button);
|
||||
|
||||
/* week */
|
||||
button = gtk_button_new_with_label (_("Week"));
|
||||
gtk_widget_set_size_request (button, 80, -1);
|
||||
|
||||
context = gtk_widget_get_style_context (button);
|
||||
gtk_style_context_add_class (context, "raised");
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (views_box), button);
|
||||
|
||||
/* month */
|
||||
button = gtk_button_new_with_label (_("Month"));
|
||||
gtk_widget_set_size_request (button, 80, -1);
|
||||
|
||||
context = gtk_widget_get_style_context (button);
|
||||
gtk_style_context_add_class (context, "raised");
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (views_box), button);
|
||||
|
||||
/* year */
|
||||
button = gtk_button_new_with_label (_("Year"));
|
||||
gtk_widget_set_size_request (button, 80, -1);
|
||||
|
||||
context = gtk_widget_get_style_context (button);
|
||||
gtk_style_context_add_class (context, "raised");
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (views_box), button);
|
||||
|
||||
/* list */
|
||||
button = gtk_button_new_with_label (_("List"));
|
||||
gtk_widget_set_size_request (button, 80, -1);
|
||||
|
||||
context = gtk_widget_get_style_context (button);
|
||||
gtk_style_context_add_class (context, "raised");
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (views_box), button);
|
||||
|
||||
/* spacer */
|
||||
spacer = gtk_tool_item_new ();
|
||||
gtk_tool_item_set_expand (spacer, TRUE);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (priv->widget), spacer, -1);
|
||||
|
||||
/* add */
|
||||
button = gtk_toggle_button_new ();
|
||||
gtk_container_add (GTK_CONTAINER (button),
|
||||
gtk_image_new_from_icon_name ("list-add-symbolic",
|
||||
GTK_ICON_SIZE_MENU));
|
||||
|
||||
context = gtk_widget_get_style_context (button);
|
||||
gtk_style_context_add_class (context, "raised");
|
||||
|
||||
item = gtk_tool_item_new ();
|
||||
gtk_container_add (GTK_CONTAINER (item), button);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (priv->widget), item, -1);
|
||||
|
||||
/* adding toolbar */
|
||||
bin = gtk_clutter_actor_get_widget (GTK_CLUTTER_ACTOR (object));
|
||||
gtk_container_add (GTK_CONTAINER (bin), priv->widget);
|
||||
|
||||
gtk_widget_show_all (bin);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_main_toolbar_finalize (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (gcal_main_toolbar_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gcal_main_toolbar_class_init (GcalMainToolbarClass *klass)
|
||||
{
|
||||
G_OBJECT_CLASS (klass)->constructed = gcal_main_toolbar_constructed;
|
||||
G_OBJECT_CLASS (klass)->finalize = gcal_main_toolbar_finalize;
|
||||
|
||||
g_type_class_add_private ((gpointer) klass, sizeof(GcalMainToolbarPrivate));
|
||||
}
|
||||
|
||||
ClutterActor*
|
||||
gcal_main_toolbar_new (void)
|
||||
{
|
||||
return g_object_new (gcal_main_toolbar_get_type (), NULL);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* gcal-main-toolbar.h
|
||||
* Copyright (C) 2012 Erick Pérez Castellanos <erickpc@gnome.org>
|
||||
*
|
||||
* gnome-calendar 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.
|
||||
*
|
||||
* gnome-calendar 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/>.
|
||||
*/
|
||||
|
||||
#ifndef _GCAL_MAIN_TOOLBAR_H_
|
||||
#define _GCAL_MAIN_TOOLBAR_H_
|
||||
|
||||
#include <clutter-gtk/clutter-gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GCAL_TYPE_MAIN_TOOLBAR (gcal_main_toolbar_get_type ())
|
||||
#define GCAL_MAIN_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCAL_TYPE_MAIN_TOOLBAR, GcalMainToolbar))
|
||||
#define GCAL_MAIN_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCAL_TYPE_MAIN_TOOLBAR, GcalMainToolbarClass))
|
||||
#define GCAL_IS_MAIN_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCAL_TYPE_MAIN_TOOLBAR))
|
||||
#define GCAL_IS_MAIN_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCAL_TYPE_MAIN_TOOLBAR))
|
||||
#define GCAL_MAIN_TOOLBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCAL_TYPE_MAIN_TOOLBAR, GcalMainToolbarClass))
|
||||
|
||||
typedef struct _GcalMainToolbarClass GcalMainToolbarClass;
|
||||
typedef struct _GcalMainToolbar GcalMainToolbar;
|
||||
typedef struct _GcalMainToolbarPrivate GcalMainToolbarPrivate;
|
||||
|
||||
struct _GcalMainToolbarClass
|
||||
{
|
||||
GtkClutterActorClass parent_class;
|
||||
};
|
||||
|
||||
struct _GcalMainToolbar
|
||||
{
|
||||
GtkClutterActor parent_instance;
|
||||
|
||||
GcalMainToolbarPrivate *priv;
|
||||
};
|
||||
|
||||
GType gcal_main_toolbar_get_type (void) G_GNUC_CONST;
|
||||
ClutterActor* gcal_main_toolbar_new (void);
|
||||
|
||||
/* Callbacks */
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* _GCAL_MAIN_TOOLBAR_H_ */
|
||||
@@ -0,0 +1,100 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* gcal-window.c
|
||||
* Copyright (C) 2012 Erick Pérez Castellanos <erickpc@gnome.org>
|
||||
*
|
||||
* gnome-calendar 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.
|
||||
*
|
||||
* gnome-calendar 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/>.
|
||||
*/
|
||||
|
||||
#include "gcal-window.h"
|
||||
#include "gcal-main-toolbar.h"
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
#include <clutter-gtk/clutter-gtk.h>
|
||||
|
||||
struct _GcalWindowPrivate
|
||||
{
|
||||
ClutterActor *main_toolbar;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(GcalWindow, gcal_window, GTK_TYPE_APPLICATION_WINDOW)
|
||||
|
||||
static void
|
||||
gcal_window_class_init(GcalWindowClass *klass)
|
||||
{
|
||||
g_type_class_add_private((gpointer)klass, sizeof(GcalWindowPrivate));
|
||||
}
|
||||
|
||||
static void gcal_window_init(GcalWindow *self)
|
||||
{
|
||||
GtkWidget *embed;
|
||||
ClutterActor *stage;
|
||||
ClutterActor *base;
|
||||
ClutterLayoutManager *base_layout_manager;
|
||||
ClutterActor *body_actor;
|
||||
ClutterLayoutManager *body_layout_manager;
|
||||
ClutterActor *main_toolbar;
|
||||
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self,
|
||||
GCAL_TYPE_WINDOW,
|
||||
GcalWindowPrivate);
|
||||
|
||||
embed = gtk_clutter_embed_new ();
|
||||
gtk_container_add (GTK_CONTAINER (self), embed);
|
||||
stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (embed));
|
||||
|
||||
/* base */
|
||||
base_layout_manager = clutter_box_layout_new ();
|
||||
clutter_box_layout_set_vertical (CLUTTER_BOX_LAYOUT (base_layout_manager),
|
||||
TRUE);
|
||||
base = clutter_actor_new ();
|
||||
clutter_actor_set_layout_manager (base, base_layout_manager);
|
||||
clutter_actor_add_constraint (base,
|
||||
clutter_bind_constraint_new (stage,
|
||||
CLUTTER_BIND_SIZE,
|
||||
0));
|
||||
clutter_actor_add_child (stage, base);
|
||||
|
||||
/* body_actor */
|
||||
body_layout_manager = clutter_box_layout_new ();
|
||||
clutter_box_layout_set_vertical (CLUTTER_BOX_LAYOUT (body_layout_manager),
|
||||
TRUE);
|
||||
|
||||
body_actor = clutter_actor_new ();
|
||||
clutter_actor_set_layout_manager (body_actor, body_layout_manager);
|
||||
clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (base_layout_manager),
|
||||
body_actor,
|
||||
TRUE,
|
||||
TRUE,
|
||||
TRUE,
|
||||
CLUTTER_BOX_ALIGNMENT_CENTER,
|
||||
CLUTTER_BOX_ALIGNMENT_CENTER);
|
||||
|
||||
main_toolbar = gcal_main_toolbar_new ();
|
||||
clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (body_layout_manager),
|
||||
main_toolbar,
|
||||
FALSE,
|
||||
TRUE,
|
||||
FALSE,
|
||||
CLUTTER_BOX_ALIGNMENT_START,
|
||||
CLUTTER_BOX_ALIGNMENT_START);
|
||||
|
||||
gtk_widget_show (embed);
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gcal_window_new (void)
|
||||
{
|
||||
return g_object_new (GCAL_TYPE_WINDOW, NULL);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* gcal-window.h
|
||||
* Copyright (C) 2012 Erick Pérez Castellanos <erickpc@gnome.org>
|
||||
*
|
||||
* gnome-calendar 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.
|
||||
*
|
||||
* gnome-calendar 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/>.
|
||||
*/
|
||||
|
||||
#ifndef __GCAL_WINDOW_H__
|
||||
#define __GCAL_WINDOW_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GCAL_TYPE_WINDOW (gcal_window_get_type ())
|
||||
#define GCAL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GCAL_TYPE_WINDOW, GcalWindow))
|
||||
#define GCAL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GCAL_TYPE_WINDOW, GcalWindowClass))
|
||||
#define GCAL_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GCAL_TYPE_WINDOW))
|
||||
#define GCAL_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GCAL_TYPE_WINDOW))
|
||||
#define GCAL_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GCAL_TYPE_WINDOW, GcalWindowClass))
|
||||
|
||||
typedef struct _GcalWindow GcalWindow;
|
||||
typedef struct _GcalWindowClass GcalWindowClass;
|
||||
typedef struct _GcalWindowPrivate GcalWindowPrivate;
|
||||
|
||||
struct _GcalWindow
|
||||
{
|
||||
GtkApplicationWindow parent;
|
||||
|
||||
GcalWindowPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GcalWindowClass
|
||||
{
|
||||
GtkApplicationWindowClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gcal_window_get_type (void);
|
||||
GtkWidget* gcal_window_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GCAL_WINDOW_H__ */
|
||||
Reference in New Issue
Block a user