Used GcalFloatingContainer in the window.
Added styles. Passed make-distcheck
This commit is contained in:
@@ -1,3 +1,30 @@
|
|||||||
|
/*******
|
||||||
|
* OSD *
|
||||||
|
*******/
|
||||||
|
@define-color osd_highlight #ffffff;
|
||||||
|
@define-color osd_base #212526;
|
||||||
|
|
||||||
|
@define-color osd_fg #ededed;
|
||||||
|
@define-color osd_bg alpha(@osd_base, 0.80);
|
||||||
|
|
||||||
|
@define-color osd_toolbar_bg_a alpha(@osd_base, 0.80);
|
||||||
|
@define-color osd_toolbar_bg_b alpha(#101010, 0.80);
|
||||||
|
@define-color osd_toolbar_bg_c alpha(shade(@osd_base, 1.02), 0.80);
|
||||||
|
|
||||||
|
.sources-views {
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
border-style: none;
|
||||||
|
|
||||||
|
background-image: -gtk-gradient(linear, left top, left bottom,
|
||||||
|
from(@osd_toolbar_bg_a),
|
||||||
|
color-stop(0.63, @osd_toolbar_bg_b),
|
||||||
|
to(@osd_toolbar_bg_c));
|
||||||
|
|
||||||
|
color: @osd_fg;
|
||||||
|
background-color: @osd_bg;
|
||||||
|
}
|
||||||
|
|
||||||
.views {
|
.views {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ AM_CPPFLAGS = \
|
|||||||
-DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
|
-DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
|
||||||
-DUI_DATA_DIR=\""$(pkgdatadir)/style"\" \
|
-DUI_DATA_DIR=\""$(pkgdatadir)/style"\" \
|
||||||
$(MAINTAINER_COMPILER_FLAGS) \
|
$(MAINTAINER_COMPILER_FLAGS) \
|
||||||
|
-Wall \
|
||||||
|
-g -O0 \
|
||||||
$(CALENDAR_CFLAGS)
|
$(CALENDAR_CFLAGS)
|
||||||
|
|
||||||
AM_CFLAGS = \
|
AM_CFLAGS = \
|
||||||
@@ -17,12 +19,17 @@ gnome_calendar_SOURCES = \
|
|||||||
main.c \
|
main.c \
|
||||||
gcal-application.h \
|
gcal-application.h \
|
||||||
gcal-application.c \
|
gcal-application.c \
|
||||||
|
gcal-floating-container.c \
|
||||||
|
gcal-floating-container.h \
|
||||||
gcal-main-toolbar.h \
|
gcal-main-toolbar.h \
|
||||||
gcal-main-toolbar.c \
|
gcal-main-toolbar.c \
|
||||||
gcal-window.h \
|
gcal-window.h \
|
||||||
gcal-window.c \
|
gcal-window.c \
|
||||||
gcal-month-view.c \
|
gcal-month-view.c \
|
||||||
gcal-month-view.h \
|
gcal-month-view.h \
|
||||||
|
gcal-manager.c \
|
||||||
|
gcal-manager.h \
|
||||||
|
gcal-utils.c \
|
||||||
gcal-utils.h
|
gcal-utils.h
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
|
||||||
|
/*
|
||||||
|
* gcal-utils.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - Erick Pérez Castellanos
|
||||||
|
*
|
||||||
|
* This program 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 <string.h>
|
||||||
|
|
||||||
|
#include <libedataserverui/e-cell-renderer-color.h>
|
||||||
|
|
||||||
|
#include "gcal-utils.h"
|
||||||
|
|
||||||
|
/* taken from eel/eel-gtk-extensions.c */
|
||||||
|
static gboolean
|
||||||
|
tree_view_button_press_callback (GtkWidget *tree_view,
|
||||||
|
GdkEventButton *event,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
GtkTreePath *path;
|
||||||
|
GtkTreeViewColumn *column;
|
||||||
|
|
||||||
|
if (event->button == 1 && event->type == GDK_BUTTON_PRESS) {
|
||||||
|
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (tree_view),
|
||||||
|
event->x, event->y,
|
||||||
|
&path,
|
||||||
|
&column,
|
||||||
|
NULL,
|
||||||
|
NULL)) {
|
||||||
|
gtk_tree_view_row_activated
|
||||||
|
(GTK_TREE_VIEW (tree_view), path, column);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gcal_gtk_tree_view_set_activate_on_single_click (GtkTreeView *tree_view,
|
||||||
|
gboolean should_activate)
|
||||||
|
{
|
||||||
|
guint button_press_id;
|
||||||
|
|
||||||
|
button_press_id = GPOINTER_TO_UINT
|
||||||
|
(g_object_get_data (G_OBJECT (tree_view),
|
||||||
|
"gd-tree-view-activate"));
|
||||||
|
|
||||||
|
if (button_press_id && !should_activate) {
|
||||||
|
g_signal_handler_disconnect (tree_view, button_press_id);
|
||||||
|
g_object_set_data (G_OBJECT (tree_view),
|
||||||
|
"gd-tree-view-activate",
|
||||||
|
NULL);
|
||||||
|
} else if (!button_press_id && should_activate) {
|
||||||
|
button_press_id = g_signal_connect
|
||||||
|
(tree_view,
|
||||||
|
"button_press_event",
|
||||||
|
G_CALLBACK (tree_view_button_press_callback),
|
||||||
|
NULL);
|
||||||
|
g_object_set_data (G_OBJECT (tree_view),
|
||||||
|
"gd-tree-view-activate",
|
||||||
|
GUINT_TO_POINTER (button_press_id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const gchar*
|
||||||
|
gcal_get_group_name (const gchar *base_uri)
|
||||||
|
{
|
||||||
|
if (g_strcmp0 (base_uri, "local:") == 0)
|
||||||
|
return "Local";
|
||||||
|
else
|
||||||
|
return "External";
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gcal_print_date (gchar *str,
|
||||||
|
GDate *date)
|
||||||
|
{
|
||||||
|
gchar s [200];
|
||||||
|
g_date_strftime (s, sizeof (s), "%a, %d %b %Y", date);
|
||||||
|
g_print ("%s %s\n", str, s);
|
||||||
|
}
|
||||||
@@ -17,6 +17,11 @@
|
|||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __GCAL_UTILS_H__
|
||||||
|
#define __GCAL_UTILS_H__
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GCAL_VIEW_TYPE_DAILY = 0,
|
GCAL_VIEW_TYPE_DAILY = 0,
|
||||||
@@ -25,3 +30,14 @@ typedef enum
|
|||||||
GCAL_VIEW_TYPE_YEARLY,
|
GCAL_VIEW_TYPE_YEARLY,
|
||||||
GCAL_VIEW_TYPE_LIST,
|
GCAL_VIEW_TYPE_LIST,
|
||||||
} GcalViewType;
|
} GcalViewType;
|
||||||
|
|
||||||
|
void gcal_gtk_tree_view_set_activate_on_single_click (GtkTreeView *tree_view,
|
||||||
|
gboolean should_activate);
|
||||||
|
|
||||||
|
|
||||||
|
const gchar* gcal_get_group_name (const gchar *base_uri);
|
||||||
|
|
||||||
|
void gcal_print_date (gchar *str,
|
||||||
|
GDate *date);
|
||||||
|
|
||||||
|
#endif // __GCAL_UTILS_H__
|
||||||
|
|||||||
+181
-36
@@ -18,6 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gcal-window.h"
|
#include "gcal-window.h"
|
||||||
|
#include "gcal-manager.h"
|
||||||
|
#include "gcal-floating-container.h"
|
||||||
#include "gcal-main-toolbar.h"
|
#include "gcal-main-toolbar.h"
|
||||||
#include "gcal-month-view.h"
|
#include "gcal-month-view.h"
|
||||||
#include "gcal-utils.h"
|
#include "gcal-utils.h"
|
||||||
@@ -25,50 +27,76 @@
|
|||||||
#include <clutter/clutter.h>
|
#include <clutter/clutter.h>
|
||||||
#include <clutter-gtk/clutter-gtk.h>
|
#include <clutter-gtk/clutter-gtk.h>
|
||||||
|
|
||||||
|
#include <libedataserverui/e-cell-renderer-color.h>
|
||||||
|
|
||||||
struct _GcalWindowPrivate
|
struct _GcalWindowPrivate
|
||||||
{
|
{
|
||||||
ClutterActor *main_toolbar;
|
ClutterActor *main_toolbar;
|
||||||
|
ClutterActor *notebook_actor;
|
||||||
|
ClutterActor *sources_actor;
|
||||||
|
|
||||||
GtkWidget *notebook;
|
GtkWidget *notebook;
|
||||||
|
GtkWidget *sources_view;
|
||||||
GtkWidget *views [5];
|
GtkWidget *views [5];
|
||||||
};
|
};
|
||||||
|
|
||||||
static void _gcal_window_view_changed (GcalMainToolbar *main_toolbar,
|
static void gcal_window_constructed (GObject *object);
|
||||||
GcalViewType view_type,
|
|
||||||
gpointer user_data);
|
static void _gcal_window_set_sources_view (GcalWindow *window);
|
||||||
static void _gcal_window_sources_shown (GcalMainToolbar *main_toolbar,
|
|
||||||
gboolean visible,
|
static void _gcal_window_view_changed (GcalMainToolbar *main_toolbar,
|
||||||
gpointer user_data);
|
GcalViewType view_type,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
static void _gcal_window_sources_shown (GcalMainToolbar *main_toolbar,
|
||||||
|
gboolean visible,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
static void _gcal_window_sources_row_activated (GtkTreeView *tree_view,
|
||||||
|
GtkTreePath *path,
|
||||||
|
GtkTreeViewColumn *column,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
G_DEFINE_TYPE(GcalWindow, gcal_window, GTK_TYPE_APPLICATION_WINDOW)
|
G_DEFINE_TYPE(GcalWindow, gcal_window, GTK_TYPE_APPLICATION_WINDOW)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gcal_window_class_init(GcalWindowClass *klass)
|
gcal_window_class_init(GcalWindowClass *klass)
|
||||||
{
|
{
|
||||||
|
G_OBJECT_CLASS (klass)->constructed = gcal_window_constructed;
|
||||||
|
|
||||||
g_type_class_add_private((gpointer)klass, sizeof(GcalWindowPrivate));
|
g_type_class_add_private((gpointer)klass, sizeof(GcalWindowPrivate));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gcal_window_init(GcalWindow *self)
|
static void gcal_window_init(GcalWindow *self)
|
||||||
{
|
{
|
||||||
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self,
|
||||||
|
GCAL_TYPE_WINDOW,
|
||||||
|
GcalWindowPrivate);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gcal_window_constructed (GObject *object)
|
||||||
|
{
|
||||||
|
GcalWindowPrivate *priv;
|
||||||
GtkWidget *embed;
|
GtkWidget *embed;
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
ClutterActor *base;
|
ClutterActor *base;
|
||||||
ClutterLayoutManager *base_layout_manager;
|
ClutterLayoutManager *base_layout_manager;
|
||||||
ClutterActor *body_actor;
|
ClutterActor *body_actor;
|
||||||
ClutterLayoutManager *body_layout_manager;
|
ClutterLayoutManager *body_layout_manager;
|
||||||
ClutterActor *main_toolbar;
|
|
||||||
ClutterActor *contents_actor;
|
ClutterActor *contents_actor;
|
||||||
ClutterLayoutManager *contents_layout_manager;
|
ClutterLayoutManager *contents_layout_manager;
|
||||||
ClutterActor *notebook_actor;
|
GtkWidget *holder;
|
||||||
|
|
||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
|
|
||||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self,
|
if (G_OBJECT_CLASS (gcal_window_parent_class)->constructed != NULL)
|
||||||
GCAL_TYPE_WINDOW,
|
G_OBJECT_CLASS (gcal_window_parent_class)->constructed (object);
|
||||||
GcalWindowPrivate);
|
|
||||||
|
priv = GCAL_WINDOW (object)->priv;
|
||||||
|
|
||||||
embed = gtk_clutter_embed_new ();
|
embed = gtk_clutter_embed_new ();
|
||||||
gtk_container_add (GTK_CONTAINER (self), embed);
|
gtk_container_add (GTK_CONTAINER (object), embed);
|
||||||
stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (embed));
|
stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (embed));
|
||||||
|
|
||||||
/* base */
|
/* base */
|
||||||
@@ -98,9 +126,10 @@ static void gcal_window_init(GcalWindow *self)
|
|||||||
CLUTTER_BOX_ALIGNMENT_CENTER,
|
CLUTTER_BOX_ALIGNMENT_CENTER,
|
||||||
CLUTTER_BOX_ALIGNMENT_CENTER);
|
CLUTTER_BOX_ALIGNMENT_CENTER);
|
||||||
|
|
||||||
main_toolbar = gcal_main_toolbar_new ();
|
/* main_toolbar */
|
||||||
|
priv->main_toolbar = gcal_main_toolbar_new ();
|
||||||
clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (body_layout_manager),
|
clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (body_layout_manager),
|
||||||
main_toolbar,
|
priv->main_toolbar,
|
||||||
FALSE,
|
FALSE,
|
||||||
TRUE,
|
TRUE,
|
||||||
FALSE,
|
FALSE,
|
||||||
@@ -117,45 +146,131 @@ static void gcal_window_init(GcalWindow *self)
|
|||||||
TRUE,
|
TRUE,
|
||||||
TRUE,
|
TRUE,
|
||||||
TRUE,
|
TRUE,
|
||||||
CLUTTER_BOX_ALIGNMENT_START,
|
CLUTTER_BOX_ALIGNMENT_CENTER,
|
||||||
CLUTTER_BOX_ALIGNMENT_START);
|
CLUTTER_BOX_ALIGNMENT_CENTER);
|
||||||
|
|
||||||
self->priv->notebook = gtk_notebook_new ();
|
/* notebook widget for holding views */
|
||||||
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (self->priv->notebook), FALSE);
|
priv->notebook = gtk_notebook_new ();
|
||||||
gtk_notebook_set_show_border (GTK_NOTEBOOK (self->priv->notebook), FALSE);
|
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
|
||||||
gtk_widget_show (self->priv->notebook);
|
gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
|
||||||
|
gtk_widget_show (priv->notebook);
|
||||||
|
|
||||||
notebook_actor = gtk_clutter_actor_new_with_contents (self->priv->notebook);
|
priv->notebook_actor = gtk_clutter_actor_new_with_contents (priv->notebook);
|
||||||
|
|
||||||
clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (contents_layout_manager),
|
clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (contents_layout_manager),
|
||||||
notebook_actor,
|
priv->notebook_actor,
|
||||||
CLUTTER_BIN_ALIGNMENT_FILL,
|
CLUTTER_BIN_ALIGNMENT_FILL,
|
||||||
CLUTTER_BIN_ALIGNMENT_FILL);
|
CLUTTER_BIN_ALIGNMENT_FILL);
|
||||||
|
|
||||||
GDate *date = g_date_new ();
|
GDate *date = g_date_new ();
|
||||||
g_date_set_time_t (date, time (NULL));
|
g_date_set_time_t (date, time (NULL));
|
||||||
self->priv->views[GCAL_VIEW_TYPE_MONTHLY] = gcal_month_view_new (date);
|
priv->views[GCAL_VIEW_TYPE_MONTHLY] = gcal_month_view_new (date);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (self->priv->views[GCAL_VIEW_TYPE_MONTHLY]);
|
context = gtk_widget_get_style_context (priv->views[GCAL_VIEW_TYPE_MONTHLY]);
|
||||||
gtk_style_context_add_class (context, "views");
|
gtk_style_context_add_class (context, "views");
|
||||||
|
|
||||||
gtk_widget_show (self->priv->views[GCAL_VIEW_TYPE_MONTHLY]);
|
gtk_widget_show (priv->views[GCAL_VIEW_TYPE_MONTHLY]);
|
||||||
gtk_notebook_append_page (GTK_NOTEBOOK (self->priv->notebook),
|
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
|
||||||
self->priv->views[GCAL_VIEW_TYPE_MONTHLY],
|
priv->views[GCAL_VIEW_TYPE_MONTHLY],
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_signal_connect (main_toolbar,
|
/* sources view */
|
||||||
|
holder = gcal_floating_container_new ();
|
||||||
|
|
||||||
|
context = gtk_widget_get_style_context (holder);
|
||||||
|
gtk_style_context_add_class (context, "sources-views");
|
||||||
|
|
||||||
|
gtk_widget_show_all (holder);
|
||||||
|
|
||||||
|
priv->sources_actor = gtk_clutter_actor_new_with_contents (holder);
|
||||||
|
clutter_actor_set_margin_left (priv->sources_actor, 10);
|
||||||
|
clutter_actor_set_margin_top (priv->sources_actor, 10);
|
||||||
|
clutter_actor_set_opacity (priv->sources_actor, 0);
|
||||||
|
clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (contents_layout_manager),
|
||||||
|
priv->sources_actor,
|
||||||
|
CLUTTER_BIN_ALIGNMENT_START,
|
||||||
|
CLUTTER_BIN_ALIGNMENT_START);
|
||||||
|
|
||||||
|
/* signals connection/handling */
|
||||||
|
g_signal_connect (priv->main_toolbar,
|
||||||
"view-changed",
|
"view-changed",
|
||||||
G_CALLBACK (_gcal_window_view_changed),
|
G_CALLBACK (_gcal_window_view_changed),
|
||||||
self);
|
object);
|
||||||
g_signal_connect (main_toolbar,
|
g_signal_connect (priv->main_toolbar,
|
||||||
"sources-shown",
|
"sources-shown",
|
||||||
G_CALLBACK (_gcal_window_sources_shown),
|
G_CALLBACK (_gcal_window_sources_shown),
|
||||||
self);
|
object);
|
||||||
|
|
||||||
gtk_widget_show (embed);
|
gtk_widget_show (embed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_gcal_window_set_sources_view (GcalWindow *window)
|
||||||
|
{
|
||||||
|
GcalWindowPrivate *priv;
|
||||||
|
GcalApplication *app;
|
||||||
|
GcalManager *manager;
|
||||||
|
|
||||||
|
GtkCellRenderer *renderer;
|
||||||
|
GtkTreeViewColumn *column;
|
||||||
|
|
||||||
|
priv = window->priv;
|
||||||
|
app = GCAL_APPLICATION (gtk_window_get_application (GTK_WINDOW (window)));
|
||||||
|
|
||||||
|
manager = gcal_application_get_manager (app);
|
||||||
|
priv->sources_view = gtk_tree_view_new_with_model (
|
||||||
|
GTK_TREE_MODEL (gcal_manager_get_sources_model (manager)));
|
||||||
|
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->sources_view),
|
||||||
|
FALSE);
|
||||||
|
gtk_tree_selection_set_mode (
|
||||||
|
gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->sources_view)),
|
||||||
|
GTK_SELECTION_NONE);
|
||||||
|
gcal_gtk_tree_view_set_activate_on_single_click (
|
||||||
|
GTK_TREE_VIEW (priv->sources_view),
|
||||||
|
TRUE);
|
||||||
|
|
||||||
|
renderer = gtk_cell_renderer_toggle_new ();
|
||||||
|
gtk_cell_renderer_toggle_set_radio (GTK_CELL_RENDERER_TOGGLE (renderer),
|
||||||
|
TRUE);
|
||||||
|
column = gtk_tree_view_column_new_with_attributes ("",
|
||||||
|
renderer,
|
||||||
|
"active",
|
||||||
|
2,
|
||||||
|
NULL);
|
||||||
|
gtk_tree_view_append_column (GTK_TREE_VIEW (priv->sources_view),
|
||||||
|
column);
|
||||||
|
|
||||||
|
renderer = gtk_cell_renderer_text_new ();
|
||||||
|
column = gtk_tree_view_column_new_with_attributes ("",
|
||||||
|
renderer,
|
||||||
|
"text",
|
||||||
|
1,
|
||||||
|
NULL);
|
||||||
|
gtk_tree_view_append_column (GTK_TREE_VIEW (priv->sources_view),
|
||||||
|
column);
|
||||||
|
|
||||||
|
renderer = e_cell_renderer_color_new ();
|
||||||
|
column = gtk_tree_view_column_new_with_attributes ("",
|
||||||
|
renderer,
|
||||||
|
"color",
|
||||||
|
3,
|
||||||
|
NULL);
|
||||||
|
gtk_tree_view_append_column (GTK_TREE_VIEW (priv->sources_view),
|
||||||
|
column);
|
||||||
|
|
||||||
|
gtk_container_add (
|
||||||
|
GTK_CONTAINER (gtk_clutter_actor_get_contents (
|
||||||
|
GTK_CLUTTER_ACTOR (priv->sources_actor))),
|
||||||
|
priv->sources_view);
|
||||||
|
gtk_widget_show (priv->sources_view);
|
||||||
|
|
||||||
|
/* signals */
|
||||||
|
g_signal_connect (priv->sources_view,
|
||||||
|
"row-activated",
|
||||||
|
G_CALLBACK (_gcal_window_sources_row_activated),
|
||||||
|
window);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_gcal_window_view_changed (GcalMainToolbar *main_toolbar,
|
_gcal_window_view_changed (GcalMainToolbar *main_toolbar,
|
||||||
GcalViewType view_type,
|
GcalViewType view_type,
|
||||||
@@ -169,11 +284,41 @@ _gcal_window_sources_shown (GcalMainToolbar *main_toolbar,
|
|||||||
gboolean visible,
|
gboolean visible,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
g_print ("Visible: %s\n", visible ? "yes" : "no");
|
GcalWindowPrivate *priv;
|
||||||
|
priv = ((GcalWindow*) user_data)->priv;
|
||||||
|
|
||||||
|
if (visible)
|
||||||
|
{
|
||||||
|
clutter_actor_animate (priv->sources_actor,
|
||||||
|
CLUTTER_LINEAR, 150,
|
||||||
|
"opacity", 255,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
clutter_actor_animate (priv->sources_actor,
|
||||||
|
CLUTTER_LINEAR, 150,
|
||||||
|
"opacity", 0,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_gcal_window_sources_row_activated (GtkTreeView *tree_view,
|
||||||
|
GtkTreePath *path,
|
||||||
|
GtkTreeViewColumn *column,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
g_print ("Activated row\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
gcal_window_new (void)
|
gcal_window_new (GcalApplication *app)
|
||||||
{
|
{
|
||||||
return g_object_new (GCAL_TYPE_WINDOW, NULL);
|
GcalWindow *win = g_object_new (GCAL_TYPE_WINDOW,
|
||||||
|
"application",
|
||||||
|
GTK_APPLICATION (app),
|
||||||
|
NULL);
|
||||||
|
_gcal_window_set_sources_view (win);
|
||||||
|
return GTK_WIDGET (win);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -20,6 +20,8 @@
|
|||||||
#ifndef __GCAL_WINDOW_H__
|
#ifndef __GCAL_WINDOW_H__
|
||||||
#define __GCAL_WINDOW_H__
|
#define __GCAL_WINDOW_H__
|
||||||
|
|
||||||
|
#include "gcal-application.h"
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
@@ -50,7 +52,8 @@ struct _GcalWindowClass
|
|||||||
|
|
||||||
|
|
||||||
GType gcal_window_get_type (void);
|
GType gcal_window_get_type (void);
|
||||||
GtkWidget* gcal_window_new (void);
|
|
||||||
|
GtkWidget* gcal_window_new (GcalApplication *app);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user