edit-dialog: show events description, minor tweaks

This commit is contained in:
Erick Pérez Castellanos
2014-12-04 17:10:48 -05:00
parent eb436f57db
commit 74c9f009d8
4 changed files with 63 additions and 7 deletions
+2 -2
View File
@@ -118,6 +118,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="valign">start</property>
<property name="label" translatable="yes">Notes</property>
<style>
<class name="dim-label" />
@@ -215,11 +216,10 @@
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window">
<property name="height_request">80</property>
<property name="height_request">120</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTextView" id="notes_text">
+12 -5
View File
@@ -703,12 +703,19 @@ gcal_edit_dialog_set_event_data (GcalEditDialog *dialog,
priv->ev_store->location = const_text != NULL ? g_strdup (const_text) : "";
/* notes */
priv->ev_store->description = "";
if (priv->ev_store->description != NULL)
g_free (priv->ev_store->description);
gtk_text_buffer_set_text (
gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->notes_text)),
priv->ev_store->description,
-1);
priv->ev_store->description =
get_desc_from_component (priv->component,
"\n");
if (priv->ev_store->description != NULL)
{
gtk_text_buffer_set_text (
gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->notes_text)),
priv->ev_store->description,
-1);
}
gcal_edit_dialog_set_writable (
dialog,
+45
View File
@@ -304,6 +304,51 @@ void print_date (const gchar* prefix,
g_free (temp);
}
/**
* get_desc_from_component:
* @component:
*
* Utility method to handle the extraction of the description from an
* #ECalComponent. This cycle through the list of #ECalComponentText
* and concatenate each string into one.
*
* Returns: (Transfer full) a new allocated string with the description
**/
gchar*
get_desc_from_component (ECalComponent *component,
const gchar *joint_char)
{
GSList *text_list;
GSList *l;
gchar *desc = NULL;
e_cal_component_get_description_list (component, &text_list);
for (l = text_list; l != NULL; l = l->next)
{
if (l->data != NULL)
{
ECalComponentText *text;
gchar *carrier;
text = l->data;
if (desc != NULL)
{
carrier = g_strconcat (desc, joint_char, text->value, NULL);
g_free (desc);
desc = carrier;
}
else
{
desc = g_strdup (text->value);
}
}
}
e_cal_component_free_text_list (text_list);
return desc;
}
/* Function to do a last minute fixup of the AM/PM stuff if the locale
* and gettext haven't done it right. Most English speaking countries
* except the USA use the 24 hour clock (UK, Australia etc). However
+4
View File
@@ -21,6 +21,7 @@
#define __GCAL_UTILS_H__
#include <gtk/gtk.h>
#include <libecal/libecal.h>
#include <libical/icaltime.h>
#define ICAL_TIME_TYPE (icaltime_get_type ())
@@ -77,6 +78,9 @@ gint gcal_compare_event_widget_by_date (gconstpointer
void print_date (const gchar* prefix,
const icaltimetype* icaltime);
gchar* get_desc_from_component (ECalComponent *component,
const gchar *joint_char);
/* code brought from evolution */
gsize e_strftime_fix_am_pm (gchar *str,
gsize max,