[gnome-calendar] Fixes and enhancements.
- From: Erick PÃrez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] Fixes and enhancements.
- Date: Tue, 3 Jul 2012 19:53:54 +0000 (UTC)
commit e113e60e0fa8cde82143ff4dfd7d96f7a705f52f
Author: Erick PÃrez Castellanos <erick red gmail com>
Date: Sun Jul 1 01:59:24 2012 -0400
Fixes and enhancements.
Fixed a bunch of warnings.
Added scode for methods in GcalEventView.
Fixed typo in GcalManager
src/gcal-editable-date.c | 6 +++---
src/gcal-editable-entry.c | 4 ++--
src/gcal-editable-reminder.c | 4 ----
src/gcal-editable-text.c | 2 +-
src/gcal-editable.c | 36 ++++--------------------------------
src/gcal-event-view.c | 22 ++++++++++++++++++++++
src/gcal-manager.c | 2 +-
7 files changed, 33 insertions(+), 43 deletions(-)
---
diff --git a/src/gcal-editable-date.c b/src/gcal-editable-date.c
index eb50b2d..2c06f49 100644
--- a/src/gcal-editable-date.c
+++ b/src/gcal-editable-date.c
@@ -174,9 +174,9 @@ gcal_editable_date_clear (GcalEditable *editable)
g_return_if_fail (GCAL_IS_EDITABLE_DATE (editable));
priv = GCAL_EDITABLE_DATE (editable)->priv;
- gtk_label_set_text (GTK_LABEL (priv->view_widget), NULL);
- gtk_entry_set_text (GTK_ENTRY (priv->since_entry), NULL);
- gtk_entry_set_text (GTK_ENTRY (priv->until_entry), NULL);
+ gtk_label_set_text (GTK_LABEL (priv->view_widget), "");
+ gtk_entry_set_text (GTK_ENTRY (priv->since_entry), "");
+ gtk_entry_set_text (GTK_ENTRY (priv->until_entry), "");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->all_day_check), FALSE);
}
diff --git a/src/gcal-editable-entry.c b/src/gcal-editable-entry.c
index 1e83b82..aeaa435 100644
--- a/src/gcal-editable-entry.c
+++ b/src/gcal-editable-entry.c
@@ -147,8 +147,8 @@ gcal_editable_entry_clear (GcalEditable *editable)
g_return_if_fail (GCAL_IS_EDITABLE_ENTRY (editable));
priv = GCAL_EDITABLE_ENTRY (editable)->priv;
- gtk_label_set_text (GTK_LABEL (priv->view_widget), NULL);
- gtk_entry_set_text (GTK_ENTRY (priv->edit_widget), NULL);
+ gtk_label_set_text (GTK_LABEL (priv->view_widget), "");
+ gtk_entry_set_text (GTK_ENTRY (priv->edit_widget), "");
}
/**
diff --git a/src/gcal-editable-reminder.c b/src/gcal-editable-reminder.c
index 442e275..a541a80 100644
--- a/src/gcal-editable-reminder.c
+++ b/src/gcal-editable-reminder.c
@@ -272,10 +272,6 @@ gcal_editable_reminder_clear (GcalEditable *editable)
g_list_free_full (priv->reminders, (GDestroyNotify) gtk_widget_destroy);
priv->reminders = NULL;
- gcal_editable_reminder_insert_reminder (GCAL_EDITABLE_REMINDER (editable),
- NULL,
- 1,
- NULL);
g_list_free_full (priv->labels, (GDestroyNotify) gtk_widget_destroy);
priv->labels = NULL;
diff --git a/src/gcal-editable-text.c b/src/gcal-editable-text.c
index 748996e..b8d8104 100644
--- a/src/gcal-editable-text.c
+++ b/src/gcal-editable-text.c
@@ -139,7 +139,7 @@ gcal_editable_text_clear (GcalEditable *editable)
g_return_if_fail (GCAL_IS_EDITABLE_TEXT (editable));
priv = GCAL_EDITABLE_TEXT (editable)->priv;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->edit_widget));
- gtk_text_buffer_set_text (buffer, NULL, -1);
+ gtk_text_buffer_set_text (buffer, "", -1);
}
/* Public API */
diff --git a/src/gcal-editable.c b/src/gcal-editable.c
index 91eeaae..99e23be 100644
--- a/src/gcal-editable.c
+++ b/src/gcal-editable.c
@@ -22,18 +22,12 @@
struct _GcalEditablePrivate
{
- GtkWidget *event_box;
-
gboolean locked;
GcalEditableMode mode : 1;
};
static void gcal_editable_constructed (GObject *object);
-static gboolean gcal_editable_button_pressed (GtkWidget *widget,
- GdkEventButton *event,
- gpointer user_data);
-
G_DEFINE_TYPE (GcalEditable, gcal_editable, GTK_TYPE_NOTEBOOK);
static void gcal_editable_class_init (GcalEditableClass *klass)
@@ -68,29 +62,7 @@ gcal_editable_constructed (GObject *object)
priv->locked = FALSE;
priv->mode = GCAL_VIEW_MODE;
- priv->event_box = gtk_event_box_new ();
- gtk_widget_show_all (priv->event_box);
- gtk_notebook_insert_page (GTK_NOTEBOOK (object),
- priv->event_box,
- NULL,
- 0);
-
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (object), FALSE);
-
- g_signal_connect (priv->event_box,
- "button-press-event",
- G_CALLBACK (gcal_editable_button_pressed), object);
-}
-
-static gboolean
-gcal_editable_button_pressed (GtkWidget *widget,
- GdkEventButton *event,
- gpointer user_data)
-{
- if (event->type == GDK_2BUTTON_PRESS)
- gcal_editable_enter_edit_mode (user_data);
-
- return TRUE;
}
/* Public API */
@@ -98,12 +70,12 @@ void
gcal_editable_set_view_widget (GcalEditable *editable,
GtkWidget *widget)
{
- GcalEditablePrivate *priv;
-
g_return_if_fail (GCAL_IS_EDITABLE (editable));
- priv = editable->priv;
- gtk_container_add (GTK_CONTAINER (priv->event_box), widget);
+ if (gtk_notebook_get_nth_page (GTK_NOTEBOOK (editable), 0) != NULL)
+ gtk_notebook_remove_page (GTK_NOTEBOOK (editable), 0);
+
+ gtk_notebook_insert_page (GTK_NOTEBOOK (editable), widget, NULL, 0);
}
void
diff --git a/src/gcal-event-view.c b/src/gcal-event-view.c
index 15da314..017bbf3 100644
--- a/src/gcal-event-view.c
+++ b/src/gcal-event-view.c
@@ -389,6 +389,10 @@ gcal_event_view_load_event (GcalEventView *view,
priv->source_uid = tokens[0];
priv->event_uid = tokens[1];
+
+ /* Setting the widget to blank state to load a new event */
+ g_slist_foreach (priv->e_widgets, (GFunc) gcal_editable_clear, NULL);
+
gcal_event_view_update (view);
}
}
@@ -404,6 +408,15 @@ gcal_event_view_load_event (GcalEventView *view,
void
gcal_event_view_enter_edit_mode (GcalEventView *view)
{
+ GcalEventViewPrivate *priv;
+
+ g_return_if_fail (GCAL_IS_EVENT_VIEW (view));
+ priv = view->priv;
+
+ /* Setting the widget to blank state to load a new event */
+ g_slist_foreach (priv->e_widgets,
+ (GFunc) gcal_editable_enter_edit_mode,
+ NULL);
}
/**
@@ -416,4 +429,13 @@ gcal_event_view_enter_edit_mode (GcalEventView *view)
void
gcal_event_view_leave_edit_mode (GcalEventView *view)
{
+ GcalEventViewPrivate *priv;
+
+ g_return_if_fail (GCAL_IS_EVENT_VIEW (view));
+ priv = view->priv;
+
+ /* Setting the widget to blank state to load a new event */
+ g_slist_foreach (priv->e_widgets,
+ (GFunc) gcal_editable_leave_edit_mode,
+ NULL);
}
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index b35b288..d0ef9a1 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -976,7 +976,7 @@ gcal_manager_get_event_date (GcalManager *manager,
tm_date = icaltimetype_to_tm (dtstart);
e_utf8_strftime_fix_am_pm (since, 128, "%b, %d, %l:%M %p", &tm_date);
- tm_date = icaltimetype_to_tm (dtstart);
+ tm_date = icaltimetype_to_tm (dtend);
e_utf8_strftime_fix_am_pm (until, 128, "%b, %d, %l:%M %p", &tm_date);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]