[gnome-calendar] Removing _gcal prefix to indicate internal functions instead of static modifier.
- From: Erick PÃrez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] Removing _gcal prefix to indicate internal functions instead of static modifier.
- Date: Tue, 3 Jul 2012 19:53:04 +0000 (UTC)
commit 2bda18e55e6a154cf1c7156eb59f17993aa0dff5
Author: Erick PÃrez Castellanos <erick red gmail com>
Date: Sat May 26 18:04:03 2012 -0400
Removing _gcal prefix to indicate internal functions instead of static modifier.
TODO | 2 +-
po/POTFILES.in | 2 +-
src/Makefile.am | 4 +-
src/gcal-application.c | 37 ++++---
src/gcal-floating-container.c | 16 ++--
src/gcal-main-toolbar.h | 62 -----------
src/gcal-manager.c | 123 +++++++++++-----------
src/gcal-month-view.c | 26 +++---
src/{gcal-main-toolbar.c => gcal-toolbar.c} | 155 ++++++++++++++++----------
src/gcal-toolbar.h | 66 +++++++++++
src/gcal-utils.h | 6 +
src/gcal-window.c | 56 +++++-----
12 files changed, 300 insertions(+), 255 deletions(-)
---
diff --git a/TODO b/TODO
index aae319f..9ef003f 100644
--- a/TODO
+++ b/TODO
@@ -1,6 +1,6 @@
TODO
- - Reorder GcalMainToolbar
+ - Rewrite GcalToolbar
- Rethink signals from GcalManager
- Order events for starting hour in GcalMonthView, and the others
- Review static modifiers
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 107624d..29d63ee 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,7 +2,7 @@
src/main.c
src/gcal-application.c
-src/gcal-main-toolbar.c
+src/gcal-toolbar.c
src/gcal-month-view.c
src/gcal-event-view.c
diff --git a/src/Makefile.am b/src/Makefile.am
index a06e837..c120fc0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,8 +21,8 @@ gnome_calendar_SOURCES = \
gcal-application.c \
gcal-floating-container.c \
gcal-floating-container.h \
- gcal-main-toolbar.h \
- gcal-main-toolbar.c \
+ gcal-toolbar.h \
+ gcal-toolbar.c \
gcal-window.h \
gcal-window.c \
gcal-view.c \
diff --git a/src/gcal-application.c b/src/gcal-application.c
index 162c043..6cceed4 100644
--- a/src/gcal-application.c
+++ b/src/gcal-application.c
@@ -38,13 +38,13 @@ struct _GcalApplicationPrivate
static void gcal_application_startup (GApplication *app);
-static void _gcal_application_set_app_menu (GApplication *app);
-static void _gcal_application_show_about (GSimpleAction *simple,
- GVariant *parameter,
- gpointer user_data);
-static void _gcal_application_quit (GSimpleAction *simple,
- GVariant *parameter,
- gpointer user_data);
+static void gcal_application_set_app_menu (GApplication *app);
+static void gcal_application_show_about (GSimpleAction *simple,
+ GVariant *parameter,
+ gpointer user_data);
+static void gcal_application_quit (GSimpleAction *simple,
+ GVariant *parameter,
+ gpointer user_data);
G_DEFINE_TYPE (GcalApplication, gcal_application, GTK_TYPE_APPLICATION);
@@ -123,11 +123,11 @@ gcal_application_startup (GApplication *app)
priv->manager = gcal_manager_new ();
- _gcal_application_set_app_menu (app);
+ gcal_application_set_app_menu (app);
}
static void
-_gcal_application_set_app_menu (GApplication *app)
+gcal_application_set_app_menu (GApplication *app)
{
GMenu *app_menu = g_menu_new ();
GSimpleAction *about;
@@ -136,7 +136,7 @@ _gcal_application_set_app_menu (GApplication *app)
about = g_simple_action_new ("about", NULL);
g_signal_connect (about,
"activate",
- G_CALLBACK (_gcal_application_show_about),
+ G_CALLBACK (gcal_application_show_about),
app);
g_action_map_add_action ( G_ACTION_MAP (app), G_ACTION (about));
g_menu_append (app_menu, _("About"), "app.about");
@@ -144,7 +144,7 @@ _gcal_application_set_app_menu (GApplication *app)
quit = g_simple_action_new ("quit", NULL);
g_signal_connect (quit,
"activate",
- G_CALLBACK (_gcal_application_quit),
+ G_CALLBACK (gcal_application_quit),
app);
g_action_map_add_action ( G_ACTION_MAP (app), G_ACTION (quit));
g_menu_append (app_menu, _("Quit"), "app.quit");
@@ -153,9 +153,9 @@ _gcal_application_set_app_menu (GApplication *app)
}
static void
-_gcal_application_show_about (GSimpleAction *simple,
- GVariant *parameter,
- gpointer user_data)
+gcal_application_show_about (GSimpleAction *simple,
+ GVariant *parameter,
+ gpointer user_data)
{
GcalApplication *app = GCAL_APPLICATION (user_data);
@@ -164,16 +164,17 @@ _gcal_application_show_about (GSimpleAction *simple,
NULL);
}
-static void _gcal_application_quit (GSimpleAction *simple,
- GVariant *parameter,
- gpointer user_data)
+static void
+gcal_application_quit (GSimpleAction *simple,
+ GVariant *parameter,
+ gpointer user_data)
{
GApplication *app = G_APPLICATION (user_data);
g_application_quit (app);
}
-GcalApplication *
+GcalApplication*
gcal_application_new (void)
{
g_type_init ();
diff --git a/src/gcal-floating-container.c b/src/gcal-floating-container.c
index 1446dca..0317f1e 100644
--- a/src/gcal-floating-container.c
+++ b/src/gcal-floating-container.c
@@ -55,7 +55,7 @@ static void gcal_floating_container_style_updated (GtkWidge
static void gcal_floating_container_add (GtkContainer *container,
GtkWidget *child);
-static void _gcal_floating_container_get_padding_and_border (GtkWidget *widget,
+static void gcal_floating_container_get_padding_and_border (GtkWidget *widget,
GtkBorder *border);
G_DEFINE_TYPE(GcalFloatingContainer, gcal_floating_container, GTK_TYPE_BIN)
@@ -109,7 +109,7 @@ gcal_floating_container_get_preferred_width (GtkWidget *widget,
GtkBorder padding;
gint minimum, natural;
- _gcal_floating_container_get_padding_and_border (widget, &padding);
+ gcal_floating_container_get_padding_and_border (widget, &padding);
minimum = 0;
natural = 0;
@@ -145,7 +145,7 @@ gcal_floating_container_get_preferred_height_for_width (GtkWidget *widget,
gint minimum;
gint natural;
- _gcal_floating_container_get_padding_and_border (widget, &padding);
+ gcal_floating_container_get_padding_and_border (widget, &padding);
minimum = 0;
natural = 0;
@@ -182,7 +182,7 @@ gcal_floating_container_get_preferred_height (GtkWidget *widget,
gint minimum;
gint natural;
- _gcal_floating_container_get_padding_and_border (widget, &padding);
+ gcal_floating_container_get_padding_and_border (widget, &padding);
minimum = 0;
natural = 0;
@@ -218,7 +218,7 @@ gcal_floating_container_get_preferred_width_for_height (GtkWidget *widget,
gint minimum;
gint natural;
- _gcal_floating_container_get_padding_and_border (widget, &padding);
+ gcal_floating_container_get_padding_and_border (widget, &padding);
minimum = 0;
natural = 0;
@@ -254,7 +254,7 @@ gcal_floating_container_size_allocate (GtkWidget *widget,
gtk_widget_set_allocation (widget, allocation);
- _gcal_floating_container_get_padding_and_border (widget, &padding);
+ gcal_floating_container_get_padding_and_border (widget, &padding);
if (gtk_widget_get_realized (widget))
{
@@ -341,8 +341,8 @@ gcal_floating_container_add (GtkContainer *container,
}
static void
-_gcal_floating_container_get_padding_and_border (GtkWidget *widget,
- GtkBorder *border)
+gcal_floating_container_get_padding_and_border (GtkWidget *widget,
+ GtkBorder *border)
{
GtkStyleContext *context;
GtkStateFlags state;
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index 9b7dcc7..d861dec 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -106,40 +106,40 @@ static void gcal_manager_constructed (GObject *obje
static void gcal_manager_finalize (GObject *object);
-void _gcal_manager_free_unit_data (gpointer data);
+void gcal_manager_free_unit_data (gpointer data);
-static void _gcal_manager_on_client_opened (GObject *source_object,
+static void gcal_manager_on_client_opened (GObject *source_object,
GAsyncResult *result,
gpointer user_data);
-static gboolean _gcal_manager_retry_open_on_timeout (gpointer user_data);
+static gboolean gcal_manager_retry_open_on_timeout (gpointer user_data);
-static void _gcal_manager_free_retry_open_data (gpointer user_data);
+static void gcal_manager_free_retry_open_data (gpointer user_data);
-void _gcal_manager_remove_client (GcalManager *manager,
+void gcal_manager_remove_client (GcalManager *manager,
ECalClient *client);
-static void _gcal_manager_load_source (GcalManager *manager,
+static void gcal_manager_load_source (GcalManager *manager,
ESource *source);
-static void _gcal_manager_reload_events (GcalManager *manager);
+static void gcal_manager_reload_events (GcalManager *manager);
-static void _gcal_manager_reload_view (GcalManager *manager,
+static void gcal_manager_reload_view (GcalManager *manager,
GcalManagerUnit *unit);
-static void _gcal_manager_on_view_objects_added (ECalClientView *view,
+static void gcal_manager_on_view_objects_added (ECalClientView *view,
gpointer objects,
gpointer user_data);
-static void _gcal_manager_on_view_objects_removed (ECalClientView *view,
+static void gcal_manager_on_view_objects_removed (ECalClientView *view,
gpointer objects,
gpointer user_data);
-static void _gcal_manager_on_view_objects_modified (ECalClientView *view,
+static void gcal_manager_on_view_objects_modified (ECalClientView *view,
gpointer objects,
gpointer user_data);
-static void _gcal_manager_on_sources_row_changed (GtkTreeModel *store,
+static void gcal_manager_on_sources_row_changed (GtkTreeModel *store,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer user_data);
@@ -205,7 +205,7 @@ gcal_manager_init (GcalManager *self)
g_signal_connect (priv->sources_model,
"row-changed",
- G_CALLBACK (_gcal_manager_on_sources_row_changed),
+ G_CALLBACK (gcal_manager_on_sources_row_changed),
self);
priv->initial_date = g_new(icaltimetype, 1);
@@ -217,7 +217,7 @@ gcal_manager_init (GcalManager *self)
priv->clients = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
- _gcal_manager_free_unit_data);
+ gcal_manager_free_unit_data);
}
static void
@@ -250,7 +250,7 @@ gcal_manager_constructed (GObject *object)
l != NULL;
l = l->next)
{
- _gcal_manager_load_source (GCAL_MANAGER (object), l->data);
+ gcal_manager_load_source (GCAL_MANAGER (object), l->data);
}
}
}
@@ -267,7 +267,7 @@ gcal_manager_finalize (GObject *object)
}
void
-_gcal_manager_free_unit_data (gpointer data)
+gcal_manager_free_unit_data (gpointer data)
{
GcalManagerUnit *unit;
@@ -281,9 +281,9 @@ _gcal_manager_free_unit_data (gpointer data)
}
static void
-_gcal_manager_on_client_opened (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
+gcal_manager_on_client_opened (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
{
ECalClient *client;
GcalManagerPrivate *priv;
@@ -305,7 +305,7 @@ _gcal_manager_on_client_opened (GObject *source_object,
unit = (GcalManagerUnit*) g_hash_table_lookup (priv->clients, uid);
/* setting view */
- _gcal_manager_reload_view (GCAL_MANAGER (user_data), unit);
+ gcal_manager_reload_view (GCAL_MANAGER (user_data), unit);
}
}
else
@@ -334,9 +334,9 @@ _gcal_manager_on_client_opened (GObject *source_object,
/* postpone for 1/2 of a second, backend is busy now */
g_timeout_add_full (G_PRIORITY_DEFAULT,
500,
- _gcal_manager_retry_open_on_timeout,
+ gcal_manager_retry_open_on_timeout,
rod,
- _gcal_manager_free_retry_open_data);
+ gcal_manager_free_retry_open_data);
g_error_free (error);
@@ -345,12 +345,11 @@ _gcal_manager_on_client_opened (GObject *source_object,
/* in any other case, remove it*/
source = e_client_get_source (E_CLIENT (client));
- _gcal_manager_remove_client (GCAL_MANAGER (user_data), client);
- g_warning (
- "%s: Failed to open '%s': %s",
- G_STRFUNC,
- e_source_peek_name (source),
- error->message);
+ gcal_manager_remove_client (GCAL_MANAGER (user_data), client);
+ g_warning ("%s: Failed to open '%s': %s",
+ G_STRFUNC,
+ e_source_peek_name (source),
+ error->message);
g_error_free (error);
return;
@@ -364,7 +363,7 @@ _gcal_manager_on_client_opened (GObject *source_object,
}
static gboolean
-_gcal_manager_retry_open_on_timeout (gpointer user_data)
+gcal_manager_retry_open_on_timeout (gpointer user_data)
{
RetryOpenData *rod = user_data;
@@ -375,14 +374,14 @@ _gcal_manager_retry_open_on_timeout (gpointer user_data)
e_client_open (rod->client,
TRUE,
rod->cancellable,
- _gcal_manager_on_client_opened,
+ gcal_manager_on_client_opened,
rod->manager);
return FALSE;
}
static void
-_gcal_manager_free_retry_open_data (gpointer user_data)
+gcal_manager_free_retry_open_data (gpointer user_data)
{
RetryOpenData *rod = user_data;
@@ -395,8 +394,8 @@ _gcal_manager_free_retry_open_data (gpointer user_data)
}
void
-_gcal_manager_remove_client (GcalManager *manager,
- ECalClient *client)
+gcal_manager_remove_client (GcalManager *manager,
+ ECalClient *client)
{
GcalManagerPrivate *priv;
@@ -410,8 +409,8 @@ _gcal_manager_remove_client (GcalManager *manager,
}
static void
-_gcal_manager_load_source (GcalManager *manager,
- ESource *source)
+gcal_manager_load_source (GcalManager *manager,
+ ESource *source)
{
GcalManagerPrivate *priv;
ECalClient *new_client;
@@ -456,12 +455,12 @@ _gcal_manager_load_source (GcalManager *manager,
e_client_open (E_CLIENT (unit->client),
TRUE,
priv->loading_clients,
- _gcal_manager_on_client_opened,
+ gcal_manager_on_client_opened,
manager);
}
/**
- * _gcal_manager_reload_events:
+ * gcal_manager_reload_events:
*
* @manager: Self
*
@@ -480,7 +479,7 @@ _gcal_manager_load_source (GcalManager *manager,
* </itemizedlist>
*/
static void
-_gcal_manager_reload_events (GcalManager *manager)
+gcal_manager_reload_events (GcalManager *manager)
{
GcalManagerPrivate *priv;
GHashTableIter iter;
@@ -491,13 +490,13 @@ _gcal_manager_reload_events (GcalManager *manager)
g_hash_table_iter_init (&iter, priv->clients);
while (g_hash_table_iter_next (&iter, &key, &value))
{
- _gcal_manager_reload_view (manager, (GcalManagerUnit*) value);
+ gcal_manager_reload_view (manager, (GcalManagerUnit*) value);
}
}
static void
-_gcal_manager_reload_view (GcalManager *manager,
- GcalManagerUnit *unit)
+gcal_manager_reload_view (GcalManager *manager,
+ GcalManagerUnit *unit)
{
GcalManagerPrivate *priv;
GError *error;
@@ -519,17 +518,17 @@ _gcal_manager_reload_view (GcalManager *manager,
/*hooking signals */
g_signal_connect (unit->view,
"objects-added",
- G_CALLBACK (_gcal_manager_on_view_objects_added),
+ G_CALLBACK (gcal_manager_on_view_objects_added),
manager);
g_signal_connect (unit->view,
"objects-removed",
- G_CALLBACK (_gcal_manager_on_view_objects_removed),
+ G_CALLBACK (gcal_manager_on_view_objects_removed),
manager);
g_signal_connect (unit->view,
"objects-modified",
- G_CALLBACK (_gcal_manager_on_view_objects_modified),
+ G_CALLBACK (gcal_manager_on_view_objects_modified),
manager);
error = NULL;
@@ -551,15 +550,15 @@ _gcal_manager_reload_view (GcalManager *manager,
}
/**
- * _gcal_manager_on_view_objects_added
+ * gcal_manager_on_view_objects_added
* @view: the view emitting the signal
* @objects: a GSList of icalcomponent*
* @user_data: The data passed when connecting the signal, here GcalManager
*/
static void
-_gcal_manager_on_view_objects_added (ECalClientView *view,
- gpointer objects,
- gpointer user_data)
+gcal_manager_on_view_objects_added (ECalClientView *view,
+ gpointer objects,
+ gpointer user_data)
{
GcalManagerPrivate *priv;
GcalManagerUnit *unit;
@@ -614,36 +613,36 @@ _gcal_manager_on_view_objects_added (ECalClientView *view,
}
/**
- * _gcal_manager_on_view_objects_removed
+ * gcal_manager_on_view_objects_removed
* @view: the view emitting the signal
* @objects: a GSList of ECalComponentId*
* @user_data: The data passed when connecting the signal, here GcalManager
*/
static void
-_gcal_manager_on_view_objects_removed (ECalClientView *view,
- gpointer objects,
- gpointer user_data)
+gcal_manager_on_view_objects_removed (ECalClientView *view,
+ gpointer objects,
+ gpointer user_data)
{
}
/**
- * _gcal_manager_on_view_objects_modified
+ * gcal_manager_on_view_objects_modified
* @view: the view emitting the signal
* @objects: a GSList of icalcomponent*
* @user_data: The data passed when connecting the signal, here GcalManager
*/
static void
-_gcal_manager_on_view_objects_modified (ECalClientView *view,
- gpointer objects,
- gpointer user_data)
+gcal_manager_on_view_objects_modified (ECalClientView *view,
+ gpointer objects,
+ gpointer user_data)
{
}
static void
-_gcal_manager_on_sources_row_changed (GtkTreeModel *store,
- GtkTreePath *path,
- GtkTreeIter *iter,
- gpointer user_data)
+gcal_manager_on_sources_row_changed (GtkTreeModel *store,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer user_data)
{
GcalManagerPrivate *priv;
GcalManagerUnit *unit;
@@ -753,7 +752,7 @@ gcal_manager_add_source (GcalManager *manager,
source = e_source_new (name, relative_uri);
e_source_group_add_source (selected_group, source, -1);
- _gcal_manager_load_source (manager, source);
+ gcal_manager_load_source (manager, source);
return g_strdup (e_source_peek_uid (source));
}
@@ -826,7 +825,7 @@ gcal_manager_set_new_range (GcalManager *manager,
g_debug ("Query %s", priv->query);
/* redoing query */
- _gcal_manager_reload_events (manager);
+ gcal_manager_reload_events (manager);
}
}
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index 2c881f0..4d9d1aa 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -66,7 +66,7 @@ const char* weekdays [] =
"Sat"
};
-static void _gcal_view_interface_init (GcalViewIface *iface);
+static void gcal_view_interface_init (GcalViewIface *iface);
static void gcal_month_view_constructed (GObject *object);
@@ -113,12 +113,12 @@ static void gcal_month_view_forall (GtkContainer *contain
GtkCallback callback,
gpointer callback_data);
-static void _gcal_month_view_draw_month_grid (GcalMonthView *mont_view,
+static void gcal_month_view_draw_month_grid (GcalMonthView *mont_view,
cairo_t *cr,
gint x,
gint y);
-static gboolean _gcal_month_view_is_in_range (GcalView *view,
+static gboolean gcal_month_view_is_in_range (GcalView *view,
icaltimetype *date);
@@ -126,7 +126,7 @@ G_DEFINE_TYPE_WITH_CODE (GcalMonthView,
gcal_month_view,
GTK_TYPE_CONTAINER,
G_IMPLEMENT_INTERFACE (GCAL_TYPE_VIEW,
- _gcal_view_interface_init));
+ gcal_view_interface_init));
static void gcal_month_view_class_init (GcalMonthViewClass *klass)
@@ -189,9 +189,9 @@ static void gcal_month_view_init (GcalMonthView *self)
}
static void
-_gcal_view_interface_init (GcalViewIface *iface)
+gcal_view_interface_init (GcalViewIface *iface)
{
- iface->is_in_range = _gcal_month_view_is_in_range;
+ iface->is_in_range = gcal_month_view_is_in_range;
}
static void
@@ -454,7 +454,7 @@ gcal_month_view_draw (GtkWidget *widget,
/* getting allocation, and so on */
gtk_widget_get_allocation (widget, &alloc);
- _gcal_month_view_draw_month_grid (
+ gcal_month_view_draw_month_grid (
GCAL_MONTH_VIEW (widget),
cr,
alloc.x + padding.left,
@@ -621,10 +621,10 @@ gcal_month_view_forall (GtkContainer *container,
}
static void
-_gcal_month_view_draw_month_grid (GcalMonthView *month_view,
- cairo_t *cr,
- gint x,
- gint y)
+gcal_month_view_draw_month_grid (GcalMonthView *month_view,
+ cairo_t *cr,
+ gint x,
+ gint y)
{
GcalMonthViewPrivate *priv;
GtkWidget *widget;
@@ -720,8 +720,8 @@ _gcal_month_view_draw_month_grid (GcalMonthView *month_view,
}
static gboolean
-_gcal_month_view_is_in_range (GcalView *view,
- icaltimetype *date)
+gcal_month_view_is_in_range (GcalView *view,
+ icaltimetype *date)
{
g_debug ("Implementation of is_in_range called");
return TRUE;
diff --git a/src/gcal-main-toolbar.c b/src/gcal-toolbar.c
similarity index 67%
rename from src/gcal-main-toolbar.c
rename to src/gcal-toolbar.c
index e6ea27d..c84def5 100644
--- a/src/gcal-main-toolbar.c
+++ b/src/gcal-toolbar.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/*
- * gcal-main-toolbar.c
+ * gcal-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
@@ -17,14 +17,18 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "gcal-main-toolbar.h"
+#include "gcal-toolbar.h"
#include "gcal-utils.h"
#include <glib/gi18n.h>
-struct _GcalMainToolbarPrivate
+struct _GcalToolbarPrivate
{
GtkWidget *widget;
+
+ GtkWidget *left_item;
+ GtkWidget *central_item;
+ GtkWidget *right_item;
};
enum
@@ -39,31 +43,35 @@ enum
static guint signals[NUM_SIGNALS] = { 0, };
-static void gcal_main_toolbar_constructed (GObject *object);
+static void gcal_toolbar_constructed (GObject *object);
+
+static void gcal_toolbar_finalize (GObject *object);
-static void gcal_main_toolbar_finalize (GObject *object);
+static void gcal_toolbar_set_overview_mode (GcalToolbar *toolbar);
-static void _gcal_main_toolbar_view_changed (GtkWidget *button,
- gpointer user_data);
+static void gcal_toolbar_set_event_mode (GcalToolbar *toolbar);
-static void _gcal_main_toolbar_sources_shown (GtkWidget *button,
- gpointer user_data);
+static void gcal_toolbar_view_changed (GtkWidget *button,
+ gpointer user_data);
-static void _gcal_main_toolbar_add_event (GtkWidget *button,
- gpointer user_data);
+static void gcal_toolbar_sources_shown (GtkWidget *button,
+ gpointer user_data);
-G_DEFINE_TYPE (GcalMainToolbar, gcal_main_toolbar, GTK_CLUTTER_TYPE_ACTOR);
+static void gcal_toolbar_add_event (GtkWidget *button,
+ gpointer user_data);
+
+G_DEFINE_TYPE (GcalToolbar, gcal_toolbar, GTK_CLUTTER_TYPE_ACTOR);
static void
-gcal_main_toolbar_class_init (GcalMainToolbarClass *klass)
+gcal_toolbar_class_init (GcalToolbarClass *klass)
{
- G_OBJECT_CLASS (klass)->constructed = gcal_main_toolbar_constructed;
- G_OBJECT_CLASS (klass)->finalize = gcal_main_toolbar_finalize;
+ G_OBJECT_CLASS (klass)->constructed = gcal_toolbar_constructed;
+ G_OBJECT_CLASS (klass)->finalize = gcal_toolbar_finalize;
signals[VIEW_CHANGED] = g_signal_new ("view-changed",
- GCAL_TYPE_MAIN_TOOLBAR,
+ GCAL_TYPE_TOOLBAR,
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GcalMainToolbarClass,
+ G_STRUCT_OFFSET (GcalToolbarClass,
view_changed),
NULL, NULL,
g_cclosure_marshal_VOID__UINT,
@@ -72,9 +80,9 @@ gcal_main_toolbar_class_init (GcalMainToolbarClass *klass)
G_TYPE_UINT);
signals[SOURCES_SHOWN] = g_signal_new ("sources-shown",
- GCAL_TYPE_MAIN_TOOLBAR,
+ GCAL_TYPE_TOOLBAR,
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GcalMainToolbarClass,
+ G_STRUCT_OFFSET (GcalToolbarClass,
sources_shown),
NULL, NULL,
g_cclosure_marshal_VOID__BOOLEAN,
@@ -83,30 +91,30 @@ gcal_main_toolbar_class_init (GcalMainToolbarClass *klass)
G_TYPE_BOOLEAN);
signals[ADD_EVENT] = g_signal_new ("add-event",
- GCAL_TYPE_MAIN_TOOLBAR,
+ GCAL_TYPE_TOOLBAR,
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GcalMainToolbarClass,
+ G_STRUCT_OFFSET (GcalToolbarClass,
add_event),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
- g_type_class_add_private ((gpointer) klass, sizeof(GcalMainToolbarPrivate));
+ g_type_class_add_private ((gpointer) klass, sizeof(GcalToolbarPrivate));
}
static void
-gcal_main_toolbar_init (GcalMainToolbar *self)
+gcal_toolbar_init (GcalToolbar *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- GCAL_TYPE_MAIN_TOOLBAR,
- GcalMainToolbarPrivate);
+ GCAL_TYPE_TOOLBAR,
+ GcalToolbarPrivate);
}
static void
-gcal_main_toolbar_constructed (GObject *object)
+gcal_toolbar_constructed (GObject *object)
{
- GcalMainToolbarPrivate *priv;
+ GcalToolbarPrivate *priv;
GtkWidget *button;
GtkStyleContext *context;
@@ -115,9 +123,9 @@ gcal_main_toolbar_constructed (GObject *object)
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 = GCAL_TOOLBAR (object)->priv;
+ if (G_OBJECT_CLASS (gcal_toolbar_parent_class)->constructed != NULL)
+ G_OBJECT_CLASS (gcal_toolbar_parent_class)->constructed (object);
priv->widget = gtk_toolbar_new ();
gtk_widget_set_hexpand (priv->widget, TRUE);
@@ -140,8 +148,8 @@ gcal_main_toolbar_constructed (GObject *object)
g_signal_connect (button,
"clicked",
- G_CALLBACK (_gcal_main_toolbar_sources_shown),
- GCAL_MAIN_TOOLBAR (object));
+ G_CALLBACK (gcal_toolbar_sources_shown),
+ GCAL_TOOLBAR (object));
item = gtk_tool_item_new ();
gtk_container_add (GTK_CONTAINER (item), button);
@@ -177,8 +185,8 @@ gcal_main_toolbar_constructed (GObject *object)
GUINT_TO_POINTER (GCAL_VIEW_TYPE_DAILY));
g_signal_connect (button,
"clicked",
- G_CALLBACK (_gcal_main_toolbar_view_changed),
- GCAL_MAIN_TOOLBAR (object));
+ G_CALLBACK (gcal_toolbar_view_changed),
+ GCAL_TOOLBAR (object));
/* week */
button = gtk_button_new_with_label (_("Week"));
@@ -194,8 +202,8 @@ gcal_main_toolbar_constructed (GObject *object)
GUINT_TO_POINTER (GCAL_VIEW_TYPE_WEEKLY));
g_signal_connect (button,
"clicked",
- G_CALLBACK (_gcal_main_toolbar_view_changed),
- GCAL_MAIN_TOOLBAR (object));
+ G_CALLBACK (gcal_toolbar_view_changed),
+ GCAL_TOOLBAR (object));
/* month */
button = gtk_button_new_with_label (_("Month"));
@@ -211,8 +219,8 @@ gcal_main_toolbar_constructed (GObject *object)
GUINT_TO_POINTER (GCAL_VIEW_TYPE_MONTHLY));
g_signal_connect (button,
"clicked",
- G_CALLBACK (_gcal_main_toolbar_view_changed),
- GCAL_MAIN_TOOLBAR (object));
+ G_CALLBACK (gcal_toolbar_view_changed),
+ GCAL_TOOLBAR (object));
/* year */
button = gtk_button_new_with_label (_("Year"));
@@ -228,8 +236,8 @@ gcal_main_toolbar_constructed (GObject *object)
GUINT_TO_POINTER (GCAL_VIEW_TYPE_YEARLY));
g_signal_connect (button,
"clicked",
- G_CALLBACK (_gcal_main_toolbar_view_changed),
- GCAL_MAIN_TOOLBAR (object));
+ G_CALLBACK (gcal_toolbar_view_changed),
+ GCAL_TOOLBAR (object));
/* list */
button = gtk_button_new_with_label (_("List"));
@@ -245,8 +253,8 @@ gcal_main_toolbar_constructed (GObject *object)
GUINT_TO_POINTER (GCAL_VIEW_TYPE_LIST));
g_signal_connect (button,
"clicked",
- G_CALLBACK (_gcal_main_toolbar_view_changed),
- GCAL_MAIN_TOOLBAR (object));
+ G_CALLBACK (gcal_toolbar_view_changed),
+ GCAL_TOOLBAR (object));
/* spacer */
spacer = gtk_tool_item_new ();
@@ -265,8 +273,8 @@ gcal_main_toolbar_constructed (GObject *object)
g_signal_connect (button,
"clicked",
- G_CALLBACK (_gcal_main_toolbar_add_event),
- GCAL_MAIN_TOOLBAR (object));
+ G_CALLBACK (gcal_toolbar_add_event),
+ GCAL_TOOLBAR (object));
item = gtk_tool_item_new ();
gtk_container_add (GTK_CONTAINER (item), button);
@@ -281,19 +289,31 @@ gcal_main_toolbar_constructed (GObject *object)
}
static void
-gcal_main_toolbar_finalize (GObject *object)
+gcal_toolbar_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (gcal_toolbar_parent_class)->finalize (object);
+}
+
+static void
+gcal_toolbar_set_overview_mode (GcalToolbar *toolbar)
+{
+ ;
+}
+
+static void
+gcal_toolbar_set_event_mode (GcalToolbar *toolbar)
{
- G_OBJECT_CLASS (gcal_main_toolbar_parent_class)->finalize (object);
+ ;
}
static void
-_gcal_main_toolbar_view_changed (GtkWidget *button,
- gpointer user_data)
+gcal_toolbar_view_changed (GtkWidget *button,
+ gpointer user_data)
{
- GcalMainToolbar *toolbar;
+ GcalToolbar *toolbar;
guint view_type;
- toolbar = GCAL_MAIN_TOOLBAR (user_data);
+ toolbar = GCAL_TOOLBAR (user_data);
view_type = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (button),
"view-type"));
@@ -301,12 +321,12 @@ _gcal_main_toolbar_view_changed (GtkWidget *button,
}
static void
-_gcal_main_toolbar_sources_shown (GtkWidget *button,
- gpointer user_data)
+gcal_toolbar_sources_shown (GtkWidget *button,
+ gpointer user_data)
{
- GcalMainToolbar *toolbar;
+ GcalToolbar *toolbar;
- toolbar = GCAL_MAIN_TOOLBAR (user_data);
+ toolbar = GCAL_TOOLBAR (user_data);
g_signal_emit (toolbar,
signals[SOURCES_SHOWN],
0,
@@ -314,17 +334,32 @@ _gcal_main_toolbar_sources_shown (GtkWidget *button,
}
static void
-_gcal_main_toolbar_add_event (GtkWidget *button,
- gpointer user_data)
+gcal_toolbar_add_event (GtkWidget *button,
+ gpointer user_data)
{
- GcalMainToolbar *toolbar;
+ GcalToolbar *toolbar;
- toolbar = GCAL_MAIN_TOOLBAR (user_data);
+ toolbar = GCAL_TOOLBAR (user_data);
g_signal_emit (toolbar, signals[ADD_EVENT], 0);
}
ClutterActor*
-gcal_main_toolbar_new (void)
+gcal_toolbar_new (void)
+{
+ return g_object_new (gcal_toolbar_get_type (), NULL);
+}
+
+void
+gcal_toolbar_set_mode (GcalToolbar *toolbar,
+ GcalToolbarMode mode)
{
- return g_object_new (gcal_main_toolbar_get_type (), NULL);
+ g_return_if_fail (GCAL_IS_TOOLBAR (toolbar));
+ switch (mode)
+ {
+ case GCAL_TOOLBAR_OVERVIEW:
+ gcal_toolbar_set_overview_mode (toolbar);
+ return;
+ case GCAL_TOOLBAR_EVENT:
+ gcal_toolbar_set_event_mode (toolbar);
+ }
}
diff --git a/src/gcal-toolbar.h b/src/gcal-toolbar.h
new file mode 100644
index 0000000..9de55ca
--- /dev/null
+++ b/src/gcal-toolbar.h
@@ -0,0 +1,66 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
+/*
+ * gcal-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_TOOLBAR_H_
+#define _GCAL_TOOLBAR_H_
+
+#include "gcal-utils.h"
+
+#include <clutter-gtk/clutter-gtk.h>
+
+G_BEGIN_DECLS
+
+#define GCAL_TYPE_TOOLBAR (gcal_toolbar_get_type ())
+#define GCAL_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GCAL_TYPE_TOOLBAR, GcalToolbar))
+#define GCAL_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GCAL_TYPE_TOOLBAR, GcalToolbarClass))
+#define GCAL_IS_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GCAL_TYPE_TOOLBAR))
+#define GCAL_IS_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GCAL_TYPE_TOOLBAR))
+#define GCAL_TOOLBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GCAL_TYPE_TOOLBAR, GcalToolbarClass))
+
+typedef struct _GcalToolbarClass GcalToolbarClass;
+typedef struct _GcalToolbar GcalToolbar;
+typedef struct _GcalToolbarPrivate GcalToolbarPrivate;
+
+struct _GcalToolbarClass
+{
+ GtkClutterActorClass parent_class;
+
+ /* Signals */
+ void (*view_changed) (GcalToolbar *toolbar, guint view_type);
+ void (*sources_shown) (GcalToolbar *toolbar, gboolean visible);
+ void (*add_event) (GcalToolbar *toolbar);
+};
+
+struct _GcalToolbar
+{
+ GtkClutterActor parent_instance;
+
+ GcalToolbarPrivate *priv;
+};
+
+GType gcal_toolbar_get_type (void) G_GNUC_CONST;
+
+ClutterActor* gcal_toolbar_new (void);
+
+void gcal_toolbar_set_mode (GcalToolbar *toolbar,
+ GcalToolbarMode mode);
+
+G_END_DECLS
+
+#endif /* _GCAL_TOOLBAR_H_ */
diff --git a/src/gcal-utils.h b/src/gcal-utils.h
index a20243e..107bb68 100644
--- a/src/gcal-utils.h
+++ b/src/gcal-utils.h
@@ -32,6 +32,12 @@ typedef enum
GCAL_VIEW_TYPE_LIST,
} GcalViewTypeEnum;
+typedef enum
+{
+ GCAL_TOOLBAR_OVERVIEW = 0,
+ GCAL_TOOLBAR_EVENT
+} GcalToolbarMode;
+
#define ICAL_TIME_TYPE (icaltime_get_type ())
GType icaltime_get_type (void) G_GNUC_CONST;
diff --git a/src/gcal-window.c b/src/gcal-window.c
index e0d1249..c1723bc 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -20,7 +20,7 @@
#include "gcal-window.h"
#include "gcal-manager.h"
#include "gcal-floating-container.h"
-#include "gcal-main-toolbar.h"
+#include "gcal-toolbar.h"
#include "gcal-month-view.h"
#include "gcal-view.h"
#include "gcal-event-widget.h"
@@ -51,27 +51,27 @@ struct _GcalWindowPrivate
static void gcal_window_constructed (GObject *object);
-GcalManager* _gcal_window_get_manager (GcalWindow *window);
+GcalManager* gcal_window_get_manager (GcalWindow *window);
-static void _gcal_window_set_sources_view (GcalWindow *window);
+static void gcal_window_set_sources_view (GcalWindow *window);
-static void _gcal_window_view_changed (GcalMainToolbar *main_toolbar,
+static void gcal_window_view_changed (GcalToolbar *main_toolbar,
GcalViewTypeEnum view_type,
gpointer user_data);
-static void _gcal_window_sources_shown (GcalMainToolbar *main_toolbar,
+static void gcal_window_sources_shown (GcalToolbar *main_toolbar,
gboolean visible,
gpointer user_data);
-static void _gcal_window_add_event (GcalMainToolbar *main_toolbar,
+static void gcal_window_add_event (GcalToolbar *main_toolbar,
gpointer user_data);
-static void _gcal_window_sources_row_activated (GtkTreeView *tree_view,
+static void gcal_window_sources_row_activated (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *column,
gpointer user_data);
-static void _gcal_window_events_added (GcalManager *manager,
+static void gcal_window_events_added (GcalManager *manager,
gpointer events_list,
gpointer user_data);
@@ -144,7 +144,7 @@ gcal_window_constructed (GObject *object)
CLUTTER_BOX_ALIGNMENT_CENTER);
/* main_toolbar */
- priv->main_toolbar = gcal_main_toolbar_new ();
+ priv->main_toolbar = gcal_toolbar_new ();
clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (body_layout_manager),
priv->main_toolbar,
FALSE,
@@ -215,22 +215,22 @@ gcal_window_constructed (GObject *object)
/* signals connection/handling */
g_signal_connect (priv->main_toolbar,
"view-changed",
- G_CALLBACK (_gcal_window_view_changed),
+ G_CALLBACK (gcal_window_view_changed),
object);
g_signal_connect (priv->main_toolbar,
"sources-shown",
- G_CALLBACK (_gcal_window_sources_shown),
+ G_CALLBACK (gcal_window_sources_shown),
object);
g_signal_connect (priv->main_toolbar,
"add-event",
- G_CALLBACK (_gcal_window_add_event),
+ G_CALLBACK (gcal_window_add_event),
object);
gtk_widget_show (embed);
}
GcalManager*
-_gcal_window_get_manager (GcalWindow *window)
+gcal_window_get_manager (GcalWindow *window)
{
GcalApplication *app;
app = GCAL_APPLICATION (gtk_window_get_application (GTK_WINDOW (window)));
@@ -239,7 +239,7 @@ _gcal_window_get_manager (GcalWindow *window)
}
static void
-_gcal_window_set_sources_view (GcalWindow *window)
+gcal_window_set_sources_view (GcalWindow *window)
{
GcalWindowPrivate *priv;
GcalManager *manager;
@@ -249,7 +249,7 @@ _gcal_window_set_sources_view (GcalWindow *window)
priv = window->priv;
- manager = _gcal_window_get_manager (window);
+ manager = gcal_window_get_manager (window);
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),
@@ -302,12 +302,12 @@ _gcal_window_set_sources_view (GcalWindow *window)
/* signals */
g_signal_connect (priv->sources_view,
"row-activated",
- G_CALLBACK (_gcal_window_sources_row_activated),
+ G_CALLBACK (gcal_window_sources_row_activated),
window);
}
static void
-_gcal_window_view_changed (GcalMainToolbar *main_toolbar,
+gcal_window_view_changed (GcalToolbar *main_toolbar,
GcalViewTypeEnum view_type,
gpointer user_data)
{
@@ -332,9 +332,9 @@ _gcal_window_view_changed (GcalMainToolbar *main_toolbar,
}
static void
-_gcal_window_sources_shown (GcalMainToolbar *main_toolbar,
- gboolean visible,
- gpointer user_data)
+gcal_window_sources_shown (GcalToolbar *main_toolbar,
+ gboolean visible,
+ gpointer user_data)
{
GcalWindowPrivate *priv;
priv = ((GcalWindow*) user_data)->priv;
@@ -358,8 +358,8 @@ _gcal_window_sources_shown (GcalMainToolbar *main_toolbar,
}
static void
-_gcal_window_add_event (GcalMainToolbar *main_toolbar,
- gpointer user_data)
+gcal_window_add_event (GcalToolbar *main_toolbar,
+ gpointer user_data)
{
GcalWindowPrivate *priv;
@@ -367,7 +367,7 @@ _gcal_window_add_event (GcalMainToolbar *main_toolbar,
if (priv->add_view == NULL)
{
priv->add_view = gcal_event_view_new_with_manager (
- _gcal_window_get_manager (GCAL_WINDOW (user_data)));
+ 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);
@@ -390,7 +390,7 @@ _gcal_window_add_event (GcalMainToolbar *main_toolbar,
}
static void
-_gcal_window_sources_row_activated (GtkTreeView *tree_view,
+gcal_window_sources_row_activated (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *column,
gpointer user_data)
@@ -420,7 +420,7 @@ _gcal_window_sources_row_activated (GtkTreeView *tree_view,
}
static void
-_gcal_window_events_added (GcalManager *manager,
+gcal_window_events_added (GcalManager *manager,
gpointer events_list,
gpointer user_data)
{
@@ -494,13 +494,13 @@ gcal_window_new (GcalApplication *app)
"application",
GTK_APPLICATION (app),
NULL);
- _gcal_window_set_sources_view (win);
+ gcal_window_set_sources_view (win);
/* hooking signals */
- manager = _gcal_window_get_manager (win);
+ manager = gcal_window_get_manager (win);
g_signal_connect (manager,
"events-added",
- G_CALLBACK (_gcal_window_events_added),
+ G_CALLBACK (gcal_window_events_added),
win);
/* FIXME: demo code */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]