From e4afd3f9fb962ea1295a0657ec9f83a427829171 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 26 May 2009 23:21:02 -0400 Subject: Remove trailing whitespace, again. --- calendar/gui/dialogs/comp-editor-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs/comp-editor-util.c') diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index f09024eba0..4666058b51 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -12,7 +12,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see + * License along with the program; if not, see * * * Authors: -- cgit v1.2.3 From 948235c3d1076dbe6ed2e57a24c16a083bbd9f01 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 27 May 2009 10:29:19 -0400 Subject: Prefer GLib basic types over C types. --- calendar/gui/dialogs/comp-editor-util.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor-util.c') diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index 4666058b51..e9661db372 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -121,7 +121,7 @@ write_label_piece (struct icaltimetype *tt, { struct tm tmp_tm = { 0 }; struct icaltimetype tt_copy = *tt; - int len; + gint len; /* FIXME: May want to convert the time to an appropriate zone. */ @@ -166,7 +166,7 @@ write_label_piece (struct icaltimetype *tt, void comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label) { - char buffer[1024]; + gchar buffer[1024]; gboolean start_set = FALSE, end_set = FALSE; gboolean complete_set = FALSE, due_set = FALSE; @@ -290,13 +290,13 @@ comp_editor_get_current_time (GtkObject *object, gpointer data) * Return value: The category names stripped of surrounding whitespace * and separated with commas. **/ -char * -comp_editor_strip_categories (const char *categories) +gchar * +comp_editor_strip_categories (const gchar *categories) { - char *new_categories; - const char *start, *end; - const char *p; - char *new_p; + gchar *new_categories; + const gchar *start, *end; + const gchar *p; + gchar *new_p; if (!categories) return NULL; @@ -314,7 +314,7 @@ comp_editor_strip_categories (const char *categories) if (g_unichar_isspace (c)) continue; else if (c == ',') { - int len; + gint len; if (!start) continue; @@ -337,7 +337,7 @@ comp_editor_strip_categories (const char *categories) } if (start) { - int len; + gint len; g_return_val_if_fail (start <= end, NULL); -- cgit v1.2.3 From 374bd42f69aca2e132fd854c9619f3d7491f1f96 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 12 Jul 2009 23:33:07 -0400 Subject: Fix excessive whitespace. --- calendar/gui/dialogs/comp-editor-util.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor-util.c') diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index e9661db372..e330a7f9d4 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -81,7 +81,6 @@ comp_editor_dates (CompEditorPageDates *dates, ECalComponent *comp) e_cal_component_get_completed (comp, &dates->complete); } - /* This frees the dates in the CompEditorPageDates struct. But it doesn't free * the struct (as that is usually static). */ @@ -109,7 +108,6 @@ comp_editor_free_dates (CompEditorPageDates *dates) e_cal_component_free_icaltimetype (dates->complete); } - /* dtstart is only passed in if tt is the dtend. */ static void write_label_piece (struct icaltimetype *tt, @@ -249,7 +247,6 @@ comp_editor_new_date_edit (gboolean show_date, gboolean show_time, return GTK_WIDGET (dedit); } - /* Returns the current time, for EDateEdit widgets and ECalendar items in the dialogs. FIXME: Should probably use the timezone from somewhere in the component @@ -278,8 +275,6 @@ comp_editor_get_current_time (GtkObject *object, gpointer data) return tmp_tm; } - - /** * comp_editor_strip_categories: * @categories: A string of category names entered by the user. -- cgit v1.2.3 From de85e3c7862100da10fe860aef2b651245a1fdbf Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 1 Aug 2009 07:29:41 -0400 Subject: Replace more "config" classes with property bindings. --- calendar/gui/dialogs/comp-editor-util.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor-util.c') diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index e330a7f9d4..cfe4139708 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -32,8 +32,9 @@ #include #include #include +#include "e-util/e-binding.h" +#include "widgets/misc/e-dateedit.h" #include "../calendar-config.h" -#include "../e-date-edit-config.h" #include "comp-editor-util.h" @@ -204,16 +205,9 @@ comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label) gtk_label_set_text (GTK_LABEL (label), buffer); } -static void -date_edit_destroy_cb (EDateEdit *date_edit, gpointer data) -{ - EDateEditConfig *config = data; - - g_object_unref (config); -} - /** * comp_editor_new_date_edit: + * @shell_settings: an #EShellSettings * @show_date: Whether to show a date picker in the widget. * @show_time: Whether to show a time picker in the widget. * @make_time_insensitive: Whether the time field is made insensitive rather @@ -225,11 +219,14 @@ date_edit_destroy_cb (EDateEdit *date_edit, gpointer data) * Return value: A newly-created #EDateEdit widget. **/ GtkWidget * -comp_editor_new_date_edit (gboolean show_date, gboolean show_time, - gboolean make_time_insensitive) +comp_editor_new_date_edit (EShellSettings *shell_settings, + gboolean show_date, + gboolean show_time, + gboolean make_time_insensitive) { EDateEdit *dedit; - EDateEditConfig *config; + + g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL); dedit = E_DATE_EDIT (e_date_edit_new ()); @@ -241,8 +238,13 @@ comp_editor_new_date_edit (gboolean show_date, gboolean show_time, e_date_edit_set_make_time_insensitive (dedit, FALSE); #endif - config = e_date_edit_config_new (dedit); - g_signal_connect (G_OBJECT (dedit), "destroy", G_CALLBACK (date_edit_destroy_cb), config); + e_binding_new ( + G_OBJECT (shell_settings), "cal-date-navigator-show-week-numbers", + G_OBJECT (dedit), "show-week-numbers"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-week-start-day", + G_OBJECT (dedit), "week-start-day"); return GTK_WIDGET (dedit); } -- cgit v1.2.3 From 3b0699fc304d0f4aecb261d19869de221f5d6abf Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 7 Aug 2009 21:43:09 -0400 Subject: More refactoring of settings management. --- calendar/gui/dialogs/comp-editor-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/dialogs/comp-editor-util.c') diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index cfe4139708..697e8bda7f 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -239,7 +239,7 @@ comp_editor_new_date_edit (EShellSettings *shell_settings, #endif e_binding_new ( - G_OBJECT (shell_settings), "cal-date-navigator-show-week-numbers", + G_OBJECT (shell_settings), "cal-show-week-numbers", G_OBJECT (dedit), "show-week-numbers"); e_binding_new ( -- cgit v1.2.3 From 5e5e1de764de6b705c12275dc652b1a36ba98fdd Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 27 Jul 2009 17:34:13 +0200 Subject: Bug #420513 - Be able to notify about meeting only new attendees --- calendar/gui/dialogs/comp-editor-util.c | 132 ++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) (limited to 'calendar/gui/dialogs/comp-editor-util.c') diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index 697e8bda7f..d8e05ca0df 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -35,6 +35,8 @@ #include "e-util/e-binding.h" #include "widgets/misc/e-dateedit.h" #include "../calendar-config.h" +#include "../e-date-edit-config.h" +#include "../itip-utils.h" #include "comp-editor-util.h" @@ -347,3 +349,133 @@ comp_editor_strip_categories (const gchar *categories) return new_categories; } + +static GSList * +manage_new_attendees (const GSList *lst, const gchar *eml, gboolean add) +{ + GSList *copy = NULL; + const GSList *l; + gboolean found = FALSE; + + g_return_val_if_fail (eml != NULL, NULL); + + for (l = lst; l; l = l->next) { + const gchar *eml2 = l->data; + + if (!eml2) + continue; + + if (g_ascii_strcasecmp (eml, eml2) == 0) { + found = TRUE; + if (add) + copy = g_slist_append (copy, g_strdup (eml2)); + } else { + copy = g_slist_append (copy, g_strdup (eml2)); + } + } + + if (!found && add) { + copy = g_slist_append (copy, g_strdup (eml)); + } + + return copy; +} + +static void +free_slist_strs (gpointer data) +{ + GSList *lst = data; + + if (lst) { + g_slist_foreach (lst, (GFunc) g_free, NULL); + g_slist_free (lst); + } +} + +/** + * comp_editor_manage_new_attendees: + * Manages the 'new-attendees' string of new attendees of the component. + * @param comp: The component. + * @param ma: An attendee. + * @param add: TRUE to add attendee's email to new-attendees, FALSE to remove from it. + * + * @note The list is just string of emails separated by ';' + **/ +void +comp_editor_manage_new_attendees (ECalComponent *comp, EMeetingAttendee *ma, gboolean add) +{ + const gchar *eml; + + g_return_if_fail (comp != NULL); + g_return_if_fail (ma != NULL); + + eml = e_meeting_attendee_get_address (ma); + if (eml) + eml = itip_strip_mailto (eml); + g_return_if_fail (eml != NULL); + + g_object_set_data_full (G_OBJECT (comp), "new-attendees", manage_new_attendees (g_object_get_data (G_OBJECT (comp), "new-attendees"), eml, add), free_slist_strs); +} + +/** + * comp_editor_copy_new_attendees: + * Copies "new-attendees" information from src to des component. + * @param des: Component, to copy to. + * @param src: Component, to copy from. + **/ +void +comp_editor_copy_new_attendees (ECalComponent *des, ECalComponent *src) +{ + GSList *copy = NULL, *l; + + g_return_if_fail (src != NULL); + g_return_if_fail (des != NULL); + + for (l = g_object_get_data (G_OBJECT (src), "new-attendees"); l; l = l->next) { + copy = g_slist_append (copy, g_strdup (l->data)); + } + + g_object_set_data_full (G_OBJECT (des), "new-attendees", copy, free_slist_strs); +} + +/** + * comp_editor_have_in_new_attendees: + * @param comp: Component with the "new-attendees" possibly set. + * @param ma: Meeting attendee to check. + * @return Whether ma is present in the list of new attendees of the comp. + **/ +gboolean +comp_editor_have_in_new_attendees (ECalComponent *comp, EMeetingAttendee *ma) +{ + const gchar *eml; + + g_return_val_if_fail (comp != NULL, FALSE); + g_return_val_if_fail (ma != NULL, FALSE); + + eml = e_meeting_attendee_get_address (ma); + if (eml) + eml = itip_strip_mailto (eml); + g_return_val_if_fail (eml != NULL, FALSE); + + return comp_editor_have_in_new_attendees_lst (g_object_get_data (G_OBJECT (comp), "new-attendees"), eml); +} + +/** + * comp_editor_have_in_new_attendees_lst: + * Same as @ref comp_editor_have_in_new_attendees only parameters are direct GSList and string. + **/ +gboolean +comp_editor_have_in_new_attendees_lst (const GSList *new_attendees, const gchar *eml) +{ + const GSList *l; + + if (!eml) + return FALSE; + + for (l = new_attendees; l; l = l->next) { + if (l->data && g_ascii_strcasecmp (eml, l->data) == 0) + return TRUE; + } + + return FALSE; +} -- cgit v1.2.3 From 741d49c900ecc01002513060826b43dc26d4e55d Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 27 Jul 2009 17:43:02 +0200 Subject: Bug #203853 - Cut/Copy key bindings don't work in day and week views --- calendar/gui/dialogs/comp-editor-util.c | 1 - 1 file changed, 1 deletion(-) (limited to 'calendar/gui/dialogs/comp-editor-util.c') diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index d8e05ca0df..6fc05d4a92 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -35,7 +35,6 @@ #include "e-util/e-binding.h" #include "widgets/misc/e-dateedit.h" #include "../calendar-config.h" -#include "../e-date-edit-config.h" #include "../itip-utils.h" #include "comp-editor-util.h" -- cgit v1.2.3