diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-07-18 03:58:11 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-07-18 03:58:11 +0800 |
commit | f8b8692499922f1aefe6c673549d6cd9f13c7856 (patch) | |
tree | 47e775bf3c9280464bc30779824efe0f2a5b4044 /widgets | |
parent | ec790f576119e171ba9b77dd6f7bfcf7a42ebeb1 (diff) | |
download | gsoc2013-evolution-f8b8692499922f1aefe6c673549d6cd9f13c7856.tar.gz gsoc2013-evolution-f8b8692499922f1aefe6c673549d6cd9f13c7856.tar.zst gsoc2013-evolution-f8b8692499922f1aefe6c673549d6cd9f13c7856.zip |
Remove unused EActivity properties and subclasses.
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/misc/Makefile.am | 2 | ||||
-rw-r--r-- | widgets/misc/e-activity.c | 159 | ||||
-rw-r--r-- | widgets/misc/e-activity.h | 9 | ||||
-rw-r--r-- | widgets/misc/e-file-activity.c | 365 | ||||
-rw-r--r-- | widgets/misc/e-file-activity.h | 83 |
5 files changed, 0 insertions, 618 deletions
diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am index 284a914953..c210393737 100644 --- a/widgets/misc/Makefile.am +++ b/widgets/misc/Makefile.am @@ -60,7 +60,6 @@ widgetsinclude_HEADERS = \ e-combo-cell-editable.h \ e-cursors.h \ e-dateedit.h \ - e-file-activity.h \ e-gui-utils.h \ e-hinted-entry.h \ e-hsv-utils.h \ @@ -123,7 +122,6 @@ libemiscwidgets_la_SOURCES = \ e-combo-cell-editable.c \ e-cursors.c \ e-dateedit.c \ - e-file-activity.c \ e-gui-utils.c \ e-hinted-entry.c \ e-hsv-utils.c \ diff --git a/widgets/misc/e-activity.c b/widgets/misc/e-activity.c index ac9a3d7e8a..9f8faf75cb 100644 --- a/widgets/misc/e-activity.c +++ b/widgets/misc/e-activity.c @@ -35,11 +35,8 @@ struct _EActivityPrivate { gchar *primary_text; gchar *secondary_text; gdouble percent; - guint idle_id; - GError *error; guint allow_cancel : 1; - guint blocking : 1; guint cancelled : 1; guint clickable : 1; guint completed : 1; @@ -48,7 +45,6 @@ struct _EActivityPrivate { enum { PROP_0, PROP_ALLOW_CANCEL, - PROP_BLOCKING, PROP_CLICKABLE, PROP_ICON_NAME, PROP_PERCENT, @@ -68,26 +64,6 @@ static gpointer parent_class; static gulong signals[LAST_SIGNAL]; static gboolean -activity_idle_cancel_cb (EActivity *activity) -{ - activity->priv->idle_id = 0; - e_activity_cancel (activity); - g_object_unref (activity); - - return FALSE; -} - -static gboolean -activity_idle_complete_cb (EActivity *activity) -{ - activity->priv->idle_id = 0; - e_activity_complete (activity); - g_object_unref (activity); - - return FALSE; -} - -static gboolean activity_describe_accumulator (GSignalInvocationHint *ihint, GValue *return_accu, const GValue *handler_return, @@ -114,12 +90,6 @@ activity_set_property (GObject *object, g_value_get_boolean (value)); return; - case PROP_BLOCKING: - e_activity_set_blocking ( - E_ACTIVITY (object), - g_value_get_boolean (value)); - return; - case PROP_CLICKABLE: e_activity_set_clickable ( E_ACTIVITY (object), @@ -167,12 +137,6 @@ activity_get_property (GObject *object, E_ACTIVITY (object))); return; - case PROP_BLOCKING: - g_value_set_boolean ( - value, e_activity_get_blocking ( - E_ACTIVITY (object))); - return; - case PROP_CLICKABLE: g_value_set_boolean ( value, e_activity_get_clickable ( @@ -218,12 +182,6 @@ activity_finalize (GObject *object) g_free (priv->primary_text); g_free (priv->secondary_text); - if (priv->idle_id > 0) - g_source_remove (priv->idle_id); - - if (priv->error != NULL) - g_error_free (priv->error); - /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -232,22 +190,12 @@ static void activity_cancelled (EActivity *activity) { activity->priv->cancelled = TRUE; - - if (activity->priv->idle_id > 0) { - g_source_remove (activity->priv->idle_id); - activity->priv->idle_id = 0; - } } static void activity_completed (EActivity *activity) { activity->priv->completed = TRUE; - - if (activity->priv->idle_id > 0) { - g_source_remove (activity->priv->idle_id); - activity->priv->idle_id = 0; - } } static void @@ -323,17 +271,6 @@ activity_class_init (EActivityClass *class) g_object_class_install_property ( object_class, - PROP_BLOCKING, - g_param_spec_boolean ( - "blocking", - NULL, - NULL, - TRUE, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT)); - - g_object_class_install_property ( - object_class, PROP_CLICKABLE, g_param_spec_boolean ( "clickable", @@ -500,29 +437,6 @@ e_activity_cancel (EActivity *activity) } void -e_activity_cancel_in_idle (EActivity *activity) -{ - guint old_idle_id; - - g_return_if_fail (E_IS_ACTIVITY (activity)); - - /* Be careful not to finalize the activity. Decrement the - * reference count only after incrementing it, in case this - * is the last reference. */ - - old_idle_id = activity->priv->idle_id; - - activity->priv->idle_id = g_idle_add ( - (GSourceFunc) activity_idle_cancel_cb, - g_object_ref (activity)); - - if (old_idle_id > 0) { - g_source_remove (old_idle_id); - g_object_unref (activity); - } -} - -void e_activity_complete (EActivity *activity) { g_return_if_fail (E_IS_ACTIVITY (activity)); @@ -537,29 +451,6 @@ e_activity_complete (EActivity *activity) } void -e_activity_complete_in_idle (EActivity *activity) -{ - guint old_idle_id; - - g_return_if_fail (E_IS_ACTIVITY (activity)); - - /* Be careful not to finalize the activity. Decrement the - * reference count only after incrementing it, in case this - * is the last reference. */ - - old_idle_id = activity->priv->idle_id; - - activity->priv->idle_id = g_idle_add ( - (GSourceFunc) activity_idle_complete_cb, - g_object_ref (activity)); - - if (old_idle_id > 0) { - g_source_remove (old_idle_id); - g_object_unref (activity); - } -} - -void e_activity_clicked (EActivity *activity) { g_return_if_fail (E_IS_ACTIVITY (activity)); @@ -616,25 +507,6 @@ e_activity_set_allow_cancel (EActivity *activity, } gboolean -e_activity_get_blocking (EActivity *activity) -{ - g_return_val_if_fail (E_IS_ACTIVITY (activity), FALSE); - - return activity->priv->blocking; -} - -void -e_activity_set_blocking (EActivity *activity, - gboolean blocking) -{ - g_return_if_fail (E_IS_ACTIVITY (activity)); - - activity->priv->blocking = blocking; - - g_object_notify (G_OBJECT (activity), "blocking"); -} - -gboolean e_activity_get_clickable (EActivity *activity) { g_return_val_if_fail (E_IS_ACTIVITY (activity), FALSE); @@ -731,34 +603,3 @@ e_activity_set_secondary_text (EActivity *activity, g_object_notify (G_OBJECT (activity), "secondary-text"); } - -void -e_activity_set_error (EActivity *activity, - const GError *error) -{ - g_return_if_fail (E_IS_ACTIVITY (activity)); - - if (activity->priv->error != NULL) { - g_error_free (activity->priv->error); - activity->priv->error = NULL; - } - - if (error != NULL) - activity->priv->error = g_error_copy (error); -} - -gboolean -e_activity_propagate_error (EActivity *activity, - GError **destination) -{ - gboolean propagated; - - g_return_val_if_fail (E_IS_ACTIVITY (activity), FALSE); - - if ((propagated = (activity->priv->error != NULL))) { - g_propagate_error (destination, activity->priv->error); - activity->priv->error = NULL; - } - - return propagated; -} diff --git a/widgets/misc/e-activity.h b/widgets/misc/e-activity.h index aca262172c..b396e3a630 100644 --- a/widgets/misc/e-activity.h +++ b/widgets/misc/e-activity.h @@ -69,9 +69,7 @@ EActivity * e_activity_new (const gchar *primary_text); EActivity * e_activity_newv (const gchar *format, ...) G_GNUC_PRINTF (1, 2); void e_activity_cancel (EActivity *activity); -void e_activity_cancel_in_idle (EActivity *activity); void e_activity_complete (EActivity *activity); -void e_activity_complete_in_idle (EActivity *activity); void e_activity_clicked (EActivity *activity); gchar * e_activity_describe (EActivity *activity); gboolean e_activity_is_cancelled (EActivity *activity); @@ -79,9 +77,6 @@ gboolean e_activity_is_completed (EActivity *activity); gboolean e_activity_get_allow_cancel (EActivity *activity); void e_activity_set_allow_cancel (EActivity *activity, gboolean allow_cancel); -gboolean e_activity_get_blocking (EActivity *activity); -void e_activity_set_blocking (EActivity *activity, - gboolean blocking); gboolean e_activity_get_clickable (EActivity *activity); void e_activity_set_clickable (EActivity *activity, gboolean clickable); @@ -97,10 +92,6 @@ void e_activity_set_primary_text (EActivity *activity, const gchar * e_activity_get_secondary_text (EActivity *activity); void e_activity_set_secondary_text (EActivity *activity, const gchar *secondary_text); -void e_activity_set_error (EActivity *activity, - const GError *error); -gboolean e_activity_propagate_error (EActivity *activity, - GError **destination); G_END_DECLS diff --git a/widgets/misc/e-file-activity.c b/widgets/misc/e-file-activity.c deleted file mode 100644 index e35ab4955c..0000000000 --- a/widgets/misc/e-file-activity.c +++ /dev/null @@ -1,365 +0,0 @@ -/* - * e-file-activity.c - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program 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 - * 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 <http://www.gnu.org/licenses/> - * - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#include "e-file-activity.h" - -#include <stdarg.h> - -#define E_FILE_ACTIVITY_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE \ - ((obj), E_TYPE_FILE_ACTIVITY, EFileActivityPrivate)) - -struct _EFileActivityPrivate { - GCancellable *cancellable; - GAsyncResult *result; - GFile *file; - - gulong handler_id; -}; - -enum { - PROP_0, - PROP_CANCELLABLE, - PROP_FILE, - PROP_RESULT -}; - -static gpointer parent_class; - -static void -file_activity_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - switch (property_id) { - case PROP_CANCELLABLE: - e_file_activity_set_cancellable ( - E_FILE_ACTIVITY (object), - g_value_get_object (value)); - return; - - case PROP_FILE: - e_file_activity_set_file ( - E_FILE_ACTIVITY (object), - g_value_get_object (value)); - return; - - case PROP_RESULT: - e_file_activity_set_result ( - E_FILE_ACTIVITY (object), - g_value_get_object (value)); - return; - } - - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); -} - -static void -file_activity_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - switch (property_id) { - case PROP_CANCELLABLE: - g_value_set_object ( - value, e_file_activity_get_cancellable ( - E_FILE_ACTIVITY (object))); - return; - - case PROP_FILE: - g_value_set_object ( - value, e_file_activity_get_file ( - E_FILE_ACTIVITY (object))); - return; - - case PROP_RESULT: - g_value_set_object ( - value, e_file_activity_get_result ( - E_FILE_ACTIVITY (object))); - return; - } - - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); -} - -static void -file_activity_dispose (GObject *object) -{ - EFileActivityPrivate *priv; - - priv = E_FILE_ACTIVITY_GET_PRIVATE (object); - - if (priv->cancellable != NULL) { - g_signal_handler_disconnect ( - priv->cancellable, priv->handler_id); - g_object_unref (priv->cancellable); - priv->cancellable = NULL; - } - - if (priv->result != NULL) { - g_object_unref (priv->result); - priv->result = NULL; - } - - if (priv->file != NULL) { - g_object_unref (priv->file); - priv->file = NULL; - } - - /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -file_activity_cancelled (EActivity *activity) -{ - EFileActivity *file_activity; - GCancellable *cancellable; - - file_activity = E_FILE_ACTIVITY (activity); - cancellable = e_file_activity_get_cancellable (file_activity); - g_cancellable_cancel (cancellable); - - /* Chain up to parent's cancelled() method. */ - E_ACTIVITY_CLASS (parent_class)->cancelled (activity); -} - -static void -file_activity_class_init (EFileActivityClass *class) -{ - GObjectClass *object_class; - EActivityClass *activity_class; - - parent_class = g_type_class_peek_parent (class); - g_type_class_add_private (class, sizeof (EFileActivityPrivate)); - - object_class = G_OBJECT_CLASS (class); - object_class->set_property = file_activity_set_property; - object_class->get_property = file_activity_get_property; - object_class->dispose = file_activity_dispose; - - activity_class = E_ACTIVITY_CLASS (class); - activity_class->cancelled = file_activity_cancelled; - - g_object_class_install_property ( - object_class, - PROP_CANCELLABLE, - g_param_spec_object ( - "cancellable", - "Cancellable", - NULL, - G_TYPE_CANCELLABLE, - G_PARAM_READWRITE)); - - g_object_class_install_property ( - object_class, - PROP_FILE, - g_param_spec_object ( - "file", - "File", - NULL, - G_TYPE_FILE, - G_PARAM_READWRITE)); - - g_object_class_install_property ( - object_class, - PROP_RESULT, - g_param_spec_object ( - "result", - "Result", - NULL, - G_TYPE_ASYNC_RESULT, - G_PARAM_READWRITE)); -} - -static void -file_activity_init (EFileActivity *file_activity) -{ - GCancellable *cancellable; - - file_activity->priv = E_FILE_ACTIVITY_GET_PRIVATE (file_activity); - - e_activity_set_allow_cancel (E_ACTIVITY (file_activity), TRUE); - - cancellable = g_cancellable_new (); - e_file_activity_set_cancellable (file_activity, cancellable); - g_object_unref (cancellable); -} - -GType -e_file_activity_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EFileActivityClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) file_activity_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EFileActivity), - 0, /* n_preallocs */ - (GInstanceInitFunc) file_activity_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - E_TYPE_ACTIVITY, "EFileActivity", &type_info, 0); - } - - return type; -} - -EActivity * -e_file_activity_new (const gchar *primary_text) -{ - return g_object_new ( - E_TYPE_FILE_ACTIVITY, - "primary-text", primary_text, NULL); -} - -EActivity * -e_file_activity_newv (const gchar *format, ...) -{ - EActivity *activity; - gchar *primary_text; - va_list args; - - va_start (args, format); - primary_text = g_strdup_vprintf (format, args); - activity = e_file_activity_new (primary_text); - g_free (primary_text); - va_end (args); - - return activity; -} - -GCancellable * -e_file_activity_get_cancellable (EFileActivity *file_activity) -{ - g_return_val_if_fail (E_IS_FILE_ACTIVITY (file_activity), NULL); - - return file_activity->priv->cancellable; -} - -void -e_file_activity_set_cancellable (EFileActivity *file_activity, - GCancellable *cancellable) -{ - g_return_if_fail (E_IS_FILE_ACTIVITY (file_activity)); - - if (cancellable != NULL) { - g_return_if_fail (G_IS_CANCELLABLE (cancellable)); - g_object_ref (cancellable); - } - - if (file_activity->priv->cancellable != NULL) { - g_signal_handler_disconnect ( - file_activity->priv->cancellable, - file_activity->priv->handler_id); - g_object_unref (file_activity->priv->cancellable); - file_activity->priv->handler_id = 0; - } - - file_activity->priv->cancellable = cancellable; - - if (cancellable != NULL) - file_activity->priv->handler_id = - g_signal_connect_swapped ( - cancellable, "cancelled", - G_CALLBACK (e_activity_cancel), - file_activity); - - g_object_notify (G_OBJECT (file_activity), "cancellable"); -} - -GFile * -e_file_activity_get_file (EFileActivity *file_activity) -{ - g_return_val_if_fail (E_IS_FILE_ACTIVITY (file_activity), NULL); - - return file_activity->priv->file; -} - -void -e_file_activity_set_file (EFileActivity *file_activity, - GFile *file) -{ - g_return_if_fail (E_IS_FILE_ACTIVITY (file_activity)); - - if (file != NULL) { - g_return_if_fail (G_IS_FILE (file)); - g_object_ref (file); - } - - if (file_activity->priv->file != NULL) - g_object_unref (file_activity->priv->file); - - file_activity->priv->file = file; - - g_object_notify (G_OBJECT (file_activity), "file"); -} - -GAsyncResult * -e_file_activity_get_result (EFileActivity *file_activity) -{ - g_return_val_if_fail (E_IS_FILE_ACTIVITY (file_activity), NULL); - - return file_activity->priv->result; -} - -void -e_file_activity_set_result (EFileActivity *file_activity, - GAsyncResult *result) -{ - g_return_if_fail (E_IS_FILE_ACTIVITY (file_activity)); - - if (result != NULL) { - g_return_if_fail (G_IS_ASYNC_RESULT (result)); - g_object_ref (result); - } - - if (file_activity->priv->result != NULL) - g_object_unref (file_activity->priv->result); - - file_activity->priv->result = result; - - g_object_notify (G_OBJECT (file_activity), "result"); -} - -void -e_file_activity_progress (goffset current_num_bytes, - goffset total_num_bytes, - gpointer activity) -{ - gdouble percent = -1.0; - - g_return_if_fail (E_IS_ACTIVITY (activity)); - - if (current_num_bytes > 0 && total_num_bytes > 0) - percent = (gdouble) current_num_bytes / total_num_bytes; - - e_activity_set_percent (activity, percent); -} diff --git a/widgets/misc/e-file-activity.h b/widgets/misc/e-file-activity.h deleted file mode 100644 index b4a5433c21..0000000000 --- a/widgets/misc/e-file-activity.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * e-file-activity.h - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program 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 - * 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 <http://www.gnu.org/licenses/> - * - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef E_FILE_ACTIVITY_H -#define E_FILE_ACTIVITY_H - -#include <gio/gio.h> -#include <widgets/misc/e-activity.h> - -/* Standard GObject macros */ -#define E_TYPE_FILE_ACTIVITY \ - (e_file_activity_get_type ()) -#define E_FILE_ACTIVITY(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST \ - ((obj), E_TYPE_FILE_ACTIVITY, EFileActivity)) -#define E_FILE_ACTIVITY_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST \ - ((cls), E_TYPE_FILE_ACTIVITY, EFileActivityClass)) -#define E_IS_FILE_ACTIVITY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE \ - ((obj), E_TYPE_FILE_ACTIVITY)) -#define E_IS_FILE_ACTIVITY_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_TYPE \ - ((cls), E_TYPE_FILE_ACTIVITY)) -#define E_FILE_ACTIVITY_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS \ - ((obj), E_TYPE_FILE_ACTIVITY, EFileActivityClass)) - -G_BEGIN_DECLS - -typedef struct _EFileActivity EFileActivity; -typedef struct _EFileActivityClass EFileActivityClass; -typedef struct _EFileActivityPrivate EFileActivityPrivate; - -struct _EFileActivity { - EActivity parent; - EFileActivityPrivate *priv; -}; - -struct _EFileActivityClass { - EActivityClass parent_class; -}; - -GType e_file_activity_get_type (void); -EActivity * e_file_activity_new (const gchar *primary_text); -EActivity * e_file_activity_newv (const gchar *format, - ...) G_GNUC_PRINTF (1, 2); -GCancellable * e_file_activity_get_cancellable (EFileActivity *file_activity); -void e_file_activity_set_cancellable (EFileActivity *file_activity, - GCancellable *cancellable); -GFile * e_file_activity_get_file (EFileActivity *file_activity); -void e_file_activity_set_file (EFileActivity *file_activity, - GFile *file); -GAsyncResult * e_file_activity_get_result (EFileActivity *file_activity); -void e_file_activity_set_result (EFileActivity *file_activity, - GAsyncResult *result); - -/* This can be used as a GFileProgressCallback. */ -void e_file_activity_progress (goffset current_num_bytes, - goffset total_num_bytes, - gpointer activity); - -G_END_DECLS - -#endif /* E_FILE_ACTIVITY_H */ |