Started EventView coding.
This commit is contained in:
@@ -38,6 +38,18 @@
|
|||||||
background-color: #555753;
|
background-color: #555753;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.event-view .frame {
|
||||||
|
border-style: solid;
|
||||||
|
border-color: @borders;
|
||||||
|
border-width: 0.5px;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO: not working */
|
||||||
|
.event-view .view {
|
||||||
|
box-shadow: 40 40 black;
|
||||||
|
}
|
||||||
|
|
||||||
.event {
|
.event {
|
||||||
padding-top: 2px;
|
padding-top: 2px;
|
||||||
padding-bottom: 2px;
|
padding-bottom: 2px;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ src/main.c
|
|||||||
src/gcal-application.c
|
src/gcal-application.c
|
||||||
src/gcal-main-toolbar.c
|
src/gcal-main-toolbar.c
|
||||||
src/gcal-month-view.c
|
src/gcal-month-view.c
|
||||||
|
src/gcal-event-view.c
|
||||||
|
|
||||||
data/gnome-calendar.desktop.in.in
|
data/gnome-calendar.desktop.in.in
|
||||||
data/org.gnome.calendar.gschema.xml.in
|
data/org.gnome.calendar.gschema.xml.in
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ gnome_calendar_SOURCES = \
|
|||||||
gcal-month-view.h \
|
gcal-month-view.h \
|
||||||
gcal-event-widget.c \
|
gcal-event-widget.c \
|
||||||
gcal-event-widget.h \
|
gcal-event-widget.h \
|
||||||
|
gcal-event-view.c \
|
||||||
|
gcal-event-view.h \
|
||||||
gcal-manager.c \
|
gcal-manager.c \
|
||||||
gcal-manager.h \
|
gcal-manager.h \
|
||||||
gcal-utils.c \
|
gcal-utils.c \
|
||||||
|
|||||||
@@ -0,0 +1,203 @@
|
|||||||
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
|
||||||
|
/*
|
||||||
|
* gcal-event-view.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-event-view.h"
|
||||||
|
|
||||||
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
|
struct _GcalEventViewPrivate
|
||||||
|
{
|
||||||
|
gboolean edit_mode;
|
||||||
|
|
||||||
|
GtkWidget *e_what;
|
||||||
|
GtkWidget *e_host;
|
||||||
|
|
||||||
|
GtkWidget *e_since;
|
||||||
|
GtkWidget *e_until;
|
||||||
|
GtkWidget *c_all_day;
|
||||||
|
|
||||||
|
GtkWidget *e_where;
|
||||||
|
|
||||||
|
GtkWidget *cb_cal;
|
||||||
|
|
||||||
|
GtkWidget *t_desc;
|
||||||
|
|
||||||
|
GtkWidget *attending_yes;
|
||||||
|
GtkWidget *attending_maybe;
|
||||||
|
GtkWidget *attending_no;
|
||||||
|
|
||||||
|
GcalManager *manager;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void gcal_event_view_constructed (GObject *object);
|
||||||
|
|
||||||
|
static void gcal_event_view_set_combo_box (GcalEventView *view);
|
||||||
|
|
||||||
|
G_DEFINE_TYPE(GcalEventView, gcal_event_view, GTK_TYPE_GRID)
|
||||||
|
|
||||||
|
static void
|
||||||
|
gcal_event_view_class_init(GcalEventViewClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class;
|
||||||
|
|
||||||
|
object_class = G_OBJECT_CLASS (klass);
|
||||||
|
object_class->constructed = gcal_event_view_constructed;
|
||||||
|
|
||||||
|
g_type_class_add_private((gpointer)klass, sizeof(GcalEventViewPrivate));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gcal_event_view_init(GcalEventView *self)
|
||||||
|
{
|
||||||
|
GtkStyleContext *context;
|
||||||
|
|
||||||
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self,
|
||||||
|
GCAL_TYPE_EVENT_VIEW,
|
||||||
|
GcalEventViewPrivate);
|
||||||
|
|
||||||
|
context = gtk_widget_get_style_context (GTK_WIDGET (self));
|
||||||
|
gtk_style_context_add_class (context, "event-view");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gcal_event_view_constructed (GObject *object)
|
||||||
|
{
|
||||||
|
GcalEventViewPrivate *priv;
|
||||||
|
GtkWidget *what;
|
||||||
|
GtkWidget *host;
|
||||||
|
GtkWidget *when;
|
||||||
|
GtkWidget *to;
|
||||||
|
GtkWidget *calendar;
|
||||||
|
GtkWidget *where;
|
||||||
|
GtkWidget *desc;
|
||||||
|
GtkWidget *desc_frame;
|
||||||
|
GtkWidget *attending;
|
||||||
|
GtkWidget *attending_box;
|
||||||
|
|
||||||
|
priv = GCAL_EVENT_VIEW (object)->priv;
|
||||||
|
if (G_OBJECT_CLASS (gcal_event_view_parent_class)->constructed != NULL)
|
||||||
|
G_OBJECT_CLASS (gcal_event_view_parent_class)->constructed (object);
|
||||||
|
|
||||||
|
priv->e_what = gtk_entry_new ();
|
||||||
|
priv->e_host = gtk_entry_new ();
|
||||||
|
|
||||||
|
priv->e_since = gtk_entry_new ();
|
||||||
|
priv->e_until = gtk_entry_new ();
|
||||||
|
priv->c_all_day = gtk_check_button_new_with_label (_("All day"));
|
||||||
|
|
||||||
|
priv->e_where = gtk_entry_new ();
|
||||||
|
|
||||||
|
priv->cb_cal = gtk_combo_box_new ();
|
||||||
|
gtk_widget_set_halign (priv->cb_cal, GTK_ALIGN_START);
|
||||||
|
|
||||||
|
priv->t_desc = gtk_text_view_new ();
|
||||||
|
|
||||||
|
priv->attending_yes = gtk_toggle_button_new_with_label (_("Yes"));
|
||||||
|
priv->attending_maybe = gtk_toggle_button_new_with_label (_("Maybe"));
|
||||||
|
priv->attending_no = gtk_toggle_button_new_with_label (_("No"));
|
||||||
|
|
||||||
|
attending_box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
|
||||||
|
gtk_box_set_spacing (GTK_BOX (attending_box), 2);
|
||||||
|
gtk_button_box_set_layout (GTK_BUTTON_BOX (attending_box), GTK_BUTTONBOX_SPREAD);
|
||||||
|
gtk_widget_set_halign (attending_box, GTK_ALIGN_START);
|
||||||
|
gtk_container_add (GTK_CONTAINER (attending_box), priv->attending_yes);
|
||||||
|
gtk_container_add (GTK_CONTAINER (attending_box), priv->attending_maybe);
|
||||||
|
gtk_container_add (GTK_CONTAINER (attending_box), priv->attending_no);
|
||||||
|
|
||||||
|
what = gtk_label_new (_("What"));
|
||||||
|
gtk_widget_set_halign (what, GTK_ALIGN_END);
|
||||||
|
gtk_grid_attach (GTK_GRID (object), what, 0, 0, 1, 1);
|
||||||
|
gtk_grid_attach (GTK_GRID (object), priv->e_what, 1, 0, 3, 1);
|
||||||
|
|
||||||
|
host = gtk_label_new (_("Host"));
|
||||||
|
gtk_widget_set_halign (host, GTK_ALIGN_END);
|
||||||
|
gtk_grid_attach (GTK_GRID (object), host, 4, 0, 1, 1);
|
||||||
|
gtk_grid_attach (GTK_GRID (object), priv->e_host, 5, 0, 1, 1);
|
||||||
|
|
||||||
|
when = gtk_label_new (_("When"));
|
||||||
|
gtk_widget_set_halign (when, GTK_ALIGN_END);
|
||||||
|
gtk_grid_attach (GTK_GRID (object), when, 0, 1, 1, 1);
|
||||||
|
gtk_grid_attach (GTK_GRID (object), priv->e_since, 1, 1, 1, 1);
|
||||||
|
to = gtk_label_new (_("to"));
|
||||||
|
gtk_grid_attach (GTK_GRID (object), to, 2, 1, 1, 1);
|
||||||
|
gtk_grid_attach (GTK_GRID (object), priv->e_until, 3, 1, 1, 1);
|
||||||
|
gtk_grid_attach (GTK_GRID (object), priv->c_all_day, 1, 2, 1, 1);
|
||||||
|
|
||||||
|
where = gtk_label_new (_("Where"));
|
||||||
|
gtk_widget_set_halign (where, GTK_ALIGN_END);
|
||||||
|
gtk_grid_attach (GTK_GRID (object), where, 0, 3, 1, 1);
|
||||||
|
gtk_grid_attach (GTK_GRID (object), priv->e_where, 1, 3, 3, 1);
|
||||||
|
|
||||||
|
calendar = gtk_label_new (_("Calendar"));
|
||||||
|
gtk_widget_set_halign (calendar, GTK_ALIGN_END);
|
||||||
|
gtk_grid_attach (GTK_GRID (object), calendar, 0, 4, 1, 1);
|
||||||
|
gtk_grid_attach (GTK_GRID (object), priv->cb_cal, 1, 4, 3, 1);
|
||||||
|
|
||||||
|
desc = gtk_label_new (_("Description"));
|
||||||
|
gtk_widget_set_halign (desc, GTK_ALIGN_END);
|
||||||
|
gtk_widget_set_valign (desc, GTK_ALIGN_START);
|
||||||
|
gtk_grid_attach (GTK_GRID (object), desc, 0, 5, 1, 1);
|
||||||
|
desc_frame = gtk_frame_new (NULL);
|
||||||
|
gtk_container_add (GTK_CONTAINER (desc_frame), priv->t_desc);
|
||||||
|
gtk_widget_set_size_request (desc_frame, -1, 200);
|
||||||
|
gtk_grid_attach (GTK_GRID (object), desc_frame, 1, 5, 3, 1);
|
||||||
|
|
||||||
|
attending = gtk_label_new (_("Attending"));
|
||||||
|
gtk_widget_set_halign (attending, GTK_ALIGN_END);
|
||||||
|
gtk_grid_attach (GTK_GRID (object), attending, 0, 6, 1, 1);
|
||||||
|
gtk_grid_attach (GTK_GRID (object), attending_box, 1, 6, 3, 1);
|
||||||
|
|
||||||
|
gtk_grid_set_row_spacing (GTK_GRID (object), 10);
|
||||||
|
gtk_grid_set_column_spacing (GTK_GRID (object), 6);
|
||||||
|
gtk_widget_show_all (GTK_WIDGET (object));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gcal_event_view_set_combo_box (GcalEventView *view)
|
||||||
|
{
|
||||||
|
GcalEventViewPrivate *priv;
|
||||||
|
GtkCellRenderer *renderer;
|
||||||
|
|
||||||
|
priv = view->priv;
|
||||||
|
|
||||||
|
gtk_combo_box_set_model (
|
||||||
|
GTK_COMBO_BOX (priv->cb_cal),
|
||||||
|
GTK_TREE_MODEL (gcal_manager_get_sources_model (priv->manager)));
|
||||||
|
renderer = gtk_cell_renderer_text_new ();
|
||||||
|
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (priv->cb_cal), renderer, TRUE);
|
||||||
|
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (priv->cb_cal),
|
||||||
|
renderer,
|
||||||
|
"text",
|
||||||
|
1,
|
||||||
|
NULL);
|
||||||
|
gtk_combo_box_set_active (GTK_COMBO_BOX (priv->cb_cal), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
GtkWidget*
|
||||||
|
gcal_event_view_new_with_manager (GcalManager *manager)
|
||||||
|
{
|
||||||
|
GtkWidget *view;
|
||||||
|
GcalEventViewPrivate *priv;
|
||||||
|
|
||||||
|
view = g_object_new (GCAL_TYPE_EVENT_VIEW, NULL);
|
||||||
|
priv = GCAL_EVENT_VIEW (view)->priv;
|
||||||
|
priv->manager = manager;
|
||||||
|
gcal_event_view_set_combo_box (GCAL_EVENT_VIEW (view));
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
|
||||||
|
/*
|
||||||
|
* gcal-event-view.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_EVENT_VIEW_H__
|
||||||
|
#define __GCAL_EVENT_VIEW_H__
|
||||||
|
|
||||||
|
#include "gcal-manager.h"
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define GCAL_TYPE_EVENT_VIEW (gcal_event_view_get_type ())
|
||||||
|
#define GCAL_EVENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GCAL_TYPE_EVENT_VIEW, GcalEventView))
|
||||||
|
#define GCAL_EVENT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GCAL_TYPE_EVENT_VIEW, GcalEventViewClass))
|
||||||
|
#define GCAL_IS_EVENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GCAL_TYPE_EVENT_VIEW))
|
||||||
|
#define GCAL_IS_EVENT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GCAL_TYPE_EVENT_VIEW))
|
||||||
|
#define GCAL_EVENT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GCAL_TYPE_EVENT_VIEW, GcalEventViewClass))
|
||||||
|
|
||||||
|
typedef struct _GcalEventView GcalEventView;
|
||||||
|
typedef struct _GcalEventViewClass GcalEventViewClass;
|
||||||
|
typedef struct _GcalEventViewPrivate GcalEventViewPrivate;
|
||||||
|
|
||||||
|
struct _GcalEventView
|
||||||
|
{
|
||||||
|
GtkGrid parent;
|
||||||
|
|
||||||
|
GcalEventViewPrivate *priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GcalEventViewClass
|
||||||
|
{
|
||||||
|
GtkGridClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
GType gcal_event_view_get_type (void);
|
||||||
|
|
||||||
|
GtkWidget* gcal_event_view_new_with_manager (GcalManager *manager);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GCAL_EVENT_VIEW_H__ */
|
||||||
+1
-1
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
COLUMN_UID, //corresponding source uid
|
COLUMN_UID = 0, //corresponding source uid
|
||||||
COLUMN_NAME,
|
COLUMN_NAME,
|
||||||
COLUMN_ACTIVE,
|
COLUMN_ACTIVE,
|
||||||
COLUMN_COLOR,
|
COLUMN_COLOR,
|
||||||
|
|||||||
+40
-2
@@ -24,6 +24,7 @@
|
|||||||
#include "gcal-month-view.h"
|
#include "gcal-month-view.h"
|
||||||
#include "gcal-view.h"
|
#include "gcal-view.h"
|
||||||
#include "gcal-event-widget.h"
|
#include "gcal-event-widget.h"
|
||||||
|
#include "gcal-event-view.h"
|
||||||
#include "gcal-utils.h"
|
#include "gcal-utils.h"
|
||||||
|
|
||||||
#include <clutter/clutter.h>
|
#include <clutter/clutter.h>
|
||||||
@@ -311,11 +312,23 @@ _gcal_window_view_changed (GcalMainToolbar *main_toolbar,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GcalWindowPrivate *priv;
|
GcalWindowPrivate *priv;
|
||||||
|
gint activated_page;
|
||||||
|
|
||||||
priv = GCAL_WINDOW (user_data)->priv;
|
priv = GCAL_WINDOW (user_data)->priv;
|
||||||
priv->active_view = view_type;
|
priv->active_view = view_type;
|
||||||
|
|
||||||
g_debug ("GcalViewTypeEnum in GcalWindow %d", priv->active_view);
|
if ((activated_page = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook),
|
||||||
|
priv->views[view_type]))
|
||||||
|
!= -1)
|
||||||
|
{
|
||||||
|
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook),
|
||||||
|
activated_page);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//TODO create view
|
||||||
|
g_debug ("GcalViewTypeEnum in GcalWindow %d", priv->active_view);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -348,7 +361,32 @@ static void
|
|||||||
_gcal_window_add_event (GcalMainToolbar *main_toolbar,
|
_gcal_window_add_event (GcalMainToolbar *main_toolbar,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
g_debug ("Catched signal add-event");
|
GcalWindowPrivate *priv;
|
||||||
|
|
||||||
|
priv = GCAL_WINDOW (user_data)->priv;
|
||||||
|
if (priv->add_view == NULL)
|
||||||
|
{
|
||||||
|
priv->add_view = gcal_event_view_new_with_manager (
|
||||||
|
_gcal_window_get_manager (GCAL_WINDOW (user_data)));
|
||||||
|
gtk_widget_set_hexpand (priv->add_view, TRUE);
|
||||||
|
gtk_widget_set_vexpand (priv->add_view, TRUE);
|
||||||
|
gtk_widget_set_margin_top (priv->add_view, 10);
|
||||||
|
gtk_widget_set_margin_left (priv->add_view, 20);
|
||||||
|
gtk_widget_set_margin_right (priv->add_view, 20);
|
||||||
|
|
||||||
|
gtk_widget_show (priv->add_view);
|
||||||
|
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
|
||||||
|
priv->add_view,
|
||||||
|
NULL);
|
||||||
|
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), -1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//TODO: Reload/clean/reinitialize status
|
||||||
|
gtk_notebook_set_current_page (
|
||||||
|
GTK_NOTEBOOK (priv->notebook),
|
||||||
|
gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), priv->add_view));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user