[evolution] ItipView: Cleanups.



commit c314a914595dc3741ee7dab401fbef7b63fb193b
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Apr 27 17:01:29 2012 -0400

    ItipView: Cleanups.

 plugins/itip-formatter/itip-view.c |  152 +++++------------
 plugins/itip-formatter/itip-view.h |  345 +++++++++++++++++-------------------
 2 files changed, 202 insertions(+), 295 deletions(-)
---
diff --git a/plugins/itip-formatter/itip-view.c b/plugins/itip-formatter/itip-view.c
index 09b34a0..32fbf52 100644
--- a/plugins/itip-formatter/itip-view.c
+++ b/plugins/itip-formatter/itip-view.c
@@ -740,110 +740,39 @@ itip_view_finalize (GObject *object)
 
 	d(printf("Itip view finalized!\n"));
 
-	if (priv->sender) {
-		g_free (priv->sender);
-		priv->sender = NULL;
-	}
-
-	if (priv->organizer) {
-		g_free (priv->organizer);
-		priv->organizer = NULL;
-	}
-
-	if (priv->organizer_sentby) {
-		g_free (priv->organizer_sentby);
-		priv->organizer_sentby = NULL;
-	}
-
-	if (priv->delegator) {
-		g_free (priv->delegator);
-		priv->delegator = NULL;
-	}
-
-	if (priv->attendee) {
-		g_free (priv->attendee);
-		priv->attendee = NULL;
-	}
-
-	if (priv->attendee_sentby) {
-		g_free (priv->attendee_sentby);
-		priv->attendee_sentby = NULL;
-	}
-
-	if (priv->proxy) {
-		g_free (priv->proxy);
-		priv->proxy = NULL;
-	}
-
-	if (priv->summary) {
-		g_free (priv->summary);
-		priv->summary = NULL;
-	}
-
-	if (priv->location) {
-		g_free (priv->location);
-		priv->location = NULL;
-	}
-
-	if (priv->status) {
-		g_free (priv->status);
-		priv->status = NULL;
-	}
-
-	if (priv->comment) {
-		g_free (priv->comment);
-		priv->comment = NULL;
-	}
-
-	if (priv->start_tm) {
-		g_free (priv->start_tm);
-		priv->start_tm = NULL;
-	}
-
-	if (priv->start_label) {
-		g_free (priv->start_label);
-		priv->start_label = NULL;
-	}
-
-	if (priv->end_tm) {
-		g_free (priv->end_tm);
-		priv->end_tm = NULL;
-	}
-
-	if (priv->end_label) {
-		g_free (priv->end_label);
-		priv->end_label = NULL;
-	}
-
-	if (priv->description) {
-		g_free (priv->description);
-		priv->description = NULL;
-	}
+	g_free (priv->sender);
+	g_free (priv->organizer);
+	g_free (priv->organizer_sentby);
+	g_free (priv->delegator);
+	g_free (priv->attendee);
+	g_free (priv->attendee_sentby);
+	g_free (priv->proxy);
+	g_free (priv->summary);
+	g_free (priv->location);
+	g_free (priv->status);
+	g_free (priv->comment);
+	g_free (priv->start_tm);
+	g_free (priv->start_label);
+	g_free (priv->end_tm);
+	g_free (priv->end_label);
+	g_free (priv->description);
+	g_free (priv->error);
 
 	for (iter = priv->lower_info_items; iter; iter = iter->next) {
 		ItipViewInfoItem *item = iter->data;
 		g_free (item->message);
 		g_free (item);
 	}
-	if (priv->lower_info_items) {
-		g_slist_free (priv->lower_info_items);
-		priv->lower_info_items = NULL;
-	}
+
+	g_slist_free (priv->lower_info_items);
 
 	for (iter = priv->upper_info_items; iter; iter = iter->next) {
 		ItipViewInfoItem *item = iter->data;
 		g_free (item->message);
 		g_free (item);
 	}
-	if (priv->upper_info_items) {
-		g_slist_free (priv->upper_info_items);
-		priv->upper_info_items = NULL;
-	}
 
-	if (priv->error) {
-		g_free (priv->error);
-		priv->error = NULL;
-	}
+	g_slist_free (priv->upper_info_items);
 
 	/* Chain up to parent's finalize() method. */
 	G_OBJECT_CLASS (itip_view_parent_class)->finalize (object);
@@ -859,23 +788,25 @@ itip_view_class_init (ItipViewClass *class)
 	object_class = G_OBJECT_CLASS (class);
 	object_class->finalize = itip_view_finalize;
 
-	signals[SOURCE_SELECTED] =
-		g_signal_new ("source_selected",
-			      G_TYPE_FROM_CLASS (class),
-			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (ItipViewClass, source_selected),
-			      NULL, NULL,
-			      g_cclosure_marshal_VOID__POINTER,
-			      G_TYPE_NONE, 1, G_TYPE_POINTER);
-
-	signals[RESPONSE] =
-		g_signal_new ("response",
-			      G_TYPE_FROM_CLASS (class),
-			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (ItipViewClass, response),
-			      NULL, NULL,
-			      g_cclosure_marshal_VOID__INT,
-			      G_TYPE_NONE, 1, G_TYPE_INT);
+	signals[SOURCE_SELECTED] = g_signal_new (
+		"source_selected",
+		G_TYPE_FROM_CLASS (class),
+		G_SIGNAL_RUN_LAST,
+		G_STRUCT_OFFSET (ItipViewClass, source_selected),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__OBJECT,
+		G_TYPE_NONE, 1,
+		E_TYPE_SOURCE);
+
+	signals[RESPONSE] = g_signal_new (
+		"response",
+		G_TYPE_FROM_CLASS (class),
+		G_SIGNAL_RUN_LAST,
+		G_STRUCT_OFFSET (ItipViewClass, response),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__INT,
+		G_TYPE_NONE, 1,
+		G_TYPE_INT);
 }
 
 static void
@@ -948,9 +879,9 @@ source_changed_cb (WebKitDOMElement *select,
 	g_signal_emit (view, signals[SOURCE_SELECTED], 0, source);
 }
 
-static gchar*
+static gchar *
 parse_html_mnemonics (const gchar *label,
-		      gchar **access_key)
+                      gchar **access_key)
 {
 	const gchar *pos = NULL;
 	gchar ak = 0;
@@ -988,7 +919,6 @@ parse_html_mnemonics (const gchar *label,
 	return g_string_free (html_label, FALSE);
 }
 
-
 static void
 append_checkbox_table_row (GString *buffer,
                            const gchar *name,
diff --git a/plugins/itip-formatter/itip-view.h b/plugins/itip-formatter/itip-view.h
index 5ae8d9c..33f6f6f 100644
--- a/plugins/itip-formatter/itip-view.h
+++ b/plugins/itip-formatter/itip-view.h
@@ -21,8 +21,8 @@
  *
  */
 
-#ifndef _ITIP_VIEW_H_
-#define _ITIP_VIEW_H_
+#ifndef ITIP_VIEW_H
+#define ITIP_VIEW_H
 
 #include <stdarg.h>
 #include <unistd.h>
@@ -31,19 +31,31 @@
 #include <libecal/e-cal-client.h>
 #include <webkit/webkitdom.h>
 
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define ITIP_TYPE_VIEW \
+	(itip_view_get_type ())
+#define ITIP_VIEW(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), ITIP_TYPE_VIEW, ItipView))
+#define ITIP_VIEW_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), ITIP_TYPE_VIEW, ItipViewClass))
+#define ITIP_IS_VIEW(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), ITIP_TYPE_VIEW))
+#define ITIP_IS_VIEW_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), ITIP_TYPE_VIEW))
+#define ITIP_VIEW_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), ITIP_TYPE_VIEW, ItipViewClass))
 
-#define ITIP_TYPE_VIEW            (itip_view_get_type ())
-#define ITIP_VIEW(object)         (G_TYPE_CHECK_INSTANCE_CAST ((object), ITIP_TYPE_VIEW, ItipView))
-#define ITIP_VIEW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), ITIP_TYPE_VIEW, ItipViewClass))
-#define ITIP_IS_VIEW(object)      (G_TYPE_CHECK_INSTANCE_TYPE ((object), ITIP_TYPE_VIEW))
-#define ITIP_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ITIP_TYPE_VIEW))
-#define ITIP_VIEW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), ITIP_TYPE_VIEW, ItipViewClass))
+G_BEGIN_DECLS
 
-typedef struct _ItipView        ItipView;
+typedef struct _ItipView ItipView;
+typedef struct _ItipViewClass ItipViewClass;
 typedef struct _ItipViewPrivate ItipViewPrivate;
-typedef struct _ItipViewClass   ItipViewClass;
-typedef struct _ItipPURI        ItipPURI;
+typedef struct _ItipPURI ItipPURI;
 
 typedef enum {
 	ITIP_VIEW_MODE_NONE,
@@ -79,189 +91,154 @@ typedef enum {
 } ItipViewInfoItemType;
 
 struct _ItipView {
-	GObject parent_instance;
-
+	GObject parent;
 	ItipViewPrivate *priv;
 };
 
 struct _ItipViewClass {
 	GObjectClass parent_class;
 
-	void    (* source_selected)             (ItipView *view,
-                                                 ESource *selected_source);
-
-	void    (* response)                    (ItipView *view,
-                                                 gint response);
+	void		(*source_selected)	(ItipView *view,
+						 ESource *selected_source);
+	void		(*response)		(ItipView *view,
+						 gint response);
 };
 
-GType           itip_view_get_type              (void);
-
-ItipView *       itip_view_new                   (ItipPURI *puri);
-
-void            itip_view_write                 (GString *buffer);
-
-void            itip_view_write_for_printing    (ItipView *view,
-                                                 GString *buffer);
-
-void            itip_view_create_dom_bindings   (ItipView *view,
-                                                 WebKitDOMElement *element);
-
-ItipPURI *       itip_view_get_puri              (ItipView *view);
-
-void            itip_view_set_mode              (ItipView *view,
-                                                 ItipViewMode mode);
-ItipViewMode    itip_view_get_mode              (ItipView *view);
-
-void            itip_view_set_item_type         (ItipView *view,
-                                                 ECalClientSourceType type);
+GType		itip_view_get_type		(void);
+ItipView *	itip_view_new			(ItipPURI *puri);
+void		itip_view_write			(GString *buffer);
+void		itip_view_write_for_printing	(ItipView *view,
+						 GString *buffer);
+void		itip_view_create_dom_bindings	(ItipView *view,
+						 WebKitDOMElement *element);
+ItipPURI *	itip_view_get_puri		(ItipView *view);
+ItipViewMode	itip_view_get_mode		(ItipView *view);
+void		itip_view_set_mode		(ItipView *view,
+						 ItipViewMode mode);
 ECalClientSourceType
-                itip_view_get_item_type         (ItipView *view);
-
-void            itip_view_set_organizer         (ItipView *view,
-                                                 const gchar *organizer);
-const gchar *    itip_view_get_organizer         (ItipView *view);
-
-void            itip_view_set_organizer_sentby  (ItipView *view,
-                                                 const gchar *sentby);
-const gchar *    itip_view_get_organizer_sentby  (ItipView *view);
-
-void            itip_view_set_attendee          (ItipView *view,
-                                                 const gchar *attendee);
-const gchar *    itip_view_get_attendee          (ItipView *view);
-
-void            itip_view_set_attendee_sentby   (ItipView *view,
-                                                 const gchar *sentby);
-const gchar *    itip_view_get_attendee_sentby   (ItipView *view);
-
-void            itip_view_set_delegator         (ItipView *view,
-                                                 const gchar *delegator);
-const gchar *    itip_view_get_delegator         (ItipView *view);
-
-void            itip_view_set_proxy             (ItipView *view,
-                                                 const gchar *proxy);
-const gchar *    itip_view_get_proxy             (ItipView *view);
-
-void            itip_view_set_summary           (ItipView *view,
-                                                 const gchar *summary);
-const gchar *    itip_view_get_summary           (ItipView *view);
-
-void            itip_view_set_location          (ItipView *view,
-                                                 const gchar *location);
-const gchar *    itip_view_get_location          (ItipView *view);
-
-void            itip_view_set_status            (ItipView *view,
-                                                 const gchar *status);
-const gchar *    itip_view_get_status            (ItipView *view);
-
-void            itip_view_set_comment           (ItipView *view,
-                                                 const gchar *comment);
-const gchar *    itip_view_get_comment           (ItipView *view);
-
-void            itip_view_set_description       (ItipView *view,
-                                                 const gchar *description);
-const gchar *    itip_view_get_description       (ItipView *view);
-
-void            itip_view_set_start             (ItipView *view,
-                                                 struct tm *start,
-                                                 gboolean is_date);
+		itip_view_get_item_type		(ItipView *view);
+void		itip_view_set_item_type		(ItipView *view,
+						 ECalClientSourceType type);
+const gchar *	itip_view_get_organizer		(ItipView *view);
+void		itip_view_set_organizer		(ItipView *view,
+						 const gchar *organizer);
+const gchar *	itip_view_get_organizer_sentby	(ItipView *view);
+void		itip_view_set_organizer_sentby	(ItipView *view,
+						 const gchar *sentby);
+const gchar *	itip_view_get_attendee		(ItipView *view);
+void		itip_view_set_attendee		(ItipView *view,
+						 const gchar *attendee);
+const gchar *	itip_view_get_attendee_sentby	(ItipView *view);
+void		itip_view_set_attendee_sentby	(ItipView *view,
+						 const gchar *sentby);
+const gchar *	itip_view_get_delegator		(ItipView *view);
+void		itip_view_set_delegator		(ItipView *view,
+						 const gchar *delegator);
+const gchar *	itip_view_get_proxy		(ItipView *view);
+void		itip_view_set_proxy		(ItipView *view,
+						 const gchar *proxy);
+const gchar *	itip_view_get_summary		(ItipView *view);
+void		itip_view_set_summary		(ItipView *view,
+						 const gchar *summary);
+const gchar *	itip_view_get_location		(ItipView *view);
+void		itip_view_set_location		(ItipView *view,
+						 const gchar *location);
+const gchar *	itip_view_get_status		(ItipView *view);
+void		itip_view_set_status		(ItipView *view,
+						 const gchar *status);
+const gchar *	itip_view_get_comment		(ItipView *view);
+void		itip_view_set_comment		(ItipView *view,
+						 const gchar *comment);
+const gchar *	itip_view_get_description	(ItipView *view);
+void		itip_view_set_description	(ItipView *view,
+						 const gchar *description);
 const struct tm *
-                itip_view_get_start             (ItipView *view,
-                                                 gboolean *is_date);
-
-void            itip_view_set_end               (ItipView *view,
-                                                 struct tm *end,
-                                                 gboolean is_date);
+		itip_view_get_start		(ItipView *view,
+						 gboolean *is_date);
+void		itip_view_set_start		(ItipView *view,
+						 struct tm *start,
+						 gboolean is_date);
 const struct tm *
-                itip_view_get_end               (ItipView *view,
-                                                 gboolean *is_date);
-
-guint           itip_view_add_upper_info_item   (ItipView *view,
-                                                 ItipViewInfoItemType type,
-                                                 const gchar *message);
-guint           itip_view_add_upper_info_item_printf
-                                                (ItipView *view,
-                                                 ItipViewInfoItemType,
-                                                 const gchar *format, ...) G_GNUC_PRINTF (3, 4);
-void            itip_view_remove_upper_info_item
-                                                (ItipView *view,
-                                                 guint id);
-void            itip_view_clear_upper_info_items
-                                                (ItipView *view);
-
-guint           itip_view_add_lower_info_item   (ItipView *view,
-                                                 ItipViewInfoItemType type,
-                                                 const gchar *message);
-guint           itip_view_add_lower_info_item_printf
-                                                (ItipView *view,
-                                                 ItipViewInfoItemType type,
-                                                 const gchar *format, ...) G_GNUC_PRINTF (3, 4);
-void            itip_view_remove_lower_info_item
-                                                (ItipView *view,
-                                                 guint id);
-void            itip_view_clear_lower_info_items
-                                                (ItipView *view);
-
-void            itip_view_set_source_list       (ItipView *view,
-                                                 ESourceList *source_list);
-ESourceList *    itip_view_get_source_list       (ItipView *view);
-
-void            itip_view_set_source            (ItipView *view,
-                                                 ESource *source);
-ESource *        itip_view_get_source            (ItipView *view);
-
-void            itip_view_set_rsvp              (ItipView *view,
-                                                 gboolean rsvp);
-gboolean        itip_view_get_rsvp              (ItipView *view);
-
-void            itip_view_set_show_rsvp_check   (ItipView *view,
-                                                 gboolean show);
-gboolean        itip_view_get_show_rsvp_check   (ItipView *view);
-
-void            itip_view_set_update            (ItipView *view,
-                                                 gboolean update);
-gboolean        itip_view_get_update            (ItipView *view);
-
-void            itip_view_set_show_update_check (ItipView *view,
-                                                 gboolean show);
-gboolean        itip_view_get_show_update_check (ItipView *view);
-
-void            itip_view_set_rsvp_comment      (ItipView *view,
-                                                 const gchar *comment);
-gchar *          itip_view_get_rsvp_comment      (ItipView *view);
-
-void            itip_view_set_buttons_sensitive (ItipView *view,
-                                                 gboolean sensitive);
-gboolean        itip_view_get_buttons_sensitive (ItipView *view);
-
-void            itip_view_set_show_recur_check  (ItipView *view,
-                                                 gboolean show);
-gboolean        itip_view_get_recur_check_state (ItipView *view);
-
-void            itip_view_set_needs_decline     (ItipView *view,
-                                                 gboolean needs_decline);
-
-void            itip_view_set_show_free_time_check
-                                                (ItipView *view,
-                                                 gboolean show);
-gboolean        itip_view_get_free_time_check_state
-                                                (ItipView *view);
-
-void            itip_view_set_show_keep_alarm_check
-                                                (ItipView *view,
-                                                 gboolean show);
-gboolean        itip_view_get_keep_alarm_check_state
-                                                (ItipView *view);
-
-void            itip_view_set_show_inherit_alarm_check
-                                                (ItipView *view,
-                                                 gboolean show);
-gboolean        itip_view_get_inherit_alarm_check_state
-                                                (ItipView *view);
-
-void            itip_view_set_error             (ItipView *view,
-                                                 const gchar *error_html,
-                                                 gboolean show_save_btn);
+		itip_view_get_end		(ItipView *view,
+						 gboolean *is_date);
+void		itip_view_set_end		(ItipView *view,
+						 struct tm *end,
+						 gboolean is_date);
+guint		itip_view_add_upper_info_item	(ItipView *view,
+						 ItipViewInfoItemType type,
+						 const gchar *message);
+guint		itip_view_add_upper_info_item_printf
+						(ItipView *view,
+						 ItipViewInfoItemType,
+						 const gchar *format,
+						 ...) G_GNUC_PRINTF (3, 4);
+void		itip_view_remove_upper_info_item
+						(ItipView *view,
+						 guint id);
+void		itip_view_clear_upper_info_items
+						(ItipView *view);
+guint		itip_view_add_lower_info_item	(ItipView *view,
+						 ItipViewInfoItemType type,
+						 const gchar *message);
+guint		itip_view_add_lower_info_item_printf
+						(ItipView *view,
+						 ItipViewInfoItemType type,
+						 const gchar *format,
+						 ...) G_GNUC_PRINTF (3, 4);
+void		itip_view_remove_lower_info_item
+						(ItipView *view,
+						 guint id);
+void		itip_view_clear_lower_info_items
+						(ItipView *view);
+ESourceList *	itip_view_get_source_list	(ItipView *view);
+void		itip_view_set_source_list	(ItipView *view,
+						 ESourceList *source_list);
+ESource *	itip_view_get_source		(ItipView *view);
+void		itip_view_set_source		(ItipView *view,
+						 ESource *source);
+gboolean	itip_view_get_rsvp		(ItipView *view);
+void		itip_view_set_rsvp		(ItipView *view,
+						 gboolean rsvp);
+gboolean	itip_view_get_show_rsvp_check	(ItipView *view);
+void		itip_view_set_show_rsvp_check	(ItipView *view,
+						 gboolean show);
+gboolean	itip_view_get_update		(ItipView *view);
+void		itip_view_set_update		(ItipView *view,
+						 gboolean update);
+gboolean	itip_view_get_show_update_check	(ItipView *view);
+void		itip_view_set_show_update_check	(ItipView *view,
+						 gboolean show);
+gchar *		itip_view_get_rsvp_comment	(ItipView *view);
+void		itip_view_set_rsvp_comment	(ItipView *view,
+						 const gchar *comment);
+gboolean	itip_view_get_buttons_sensitive	(ItipView *view);
+void		itip_view_set_buttons_sensitive	(ItipView *view,
+						 gboolean sensitive);
+gboolean	itip_view_get_recur_check_state	(ItipView *view);
+void		itip_view_set_show_recur_check	(ItipView *view,
+						 gboolean show);
+void		itip_view_set_needs_decline	(ItipView *view,
+						 gboolean needs_decline);
+gboolean	itip_view_get_free_time_check_state
+						(ItipView *view);
+void		itip_view_set_show_free_time_check
+						(ItipView *view,
+						 gboolean show);
+gboolean	itip_view_get_keep_alarm_check_state
+						(ItipView *view);
+void		itip_view_set_show_keep_alarm_check
+						(ItipView *view,
+						 gboolean show);
+gboolean	itip_view_get_inherit_alarm_check_state
+						(ItipView *view);
+void		itip_view_set_show_inherit_alarm_check
+						(ItipView *view,
+						 gboolean show);
+void		itip_view_set_error		(ItipView *view,
+						 const gchar *error_html,
+						 gboolean show_save_btn);
 
 G_END_DECLS
 
-#endif
+#endif /* ITIP_VIEW_H */
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]