aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog5
-rw-r--r--mail/em-folder-view.c5
-rw-r--r--widgets/misc/ChangeLog8
-rw-r--r--widgets/misc/e-spinner.c110
-rw-r--r--widgets/misc/e-spinner.h35
-rw-r--r--widgets/misc/e-task-widget.c5
6 files changed, 73 insertions, 95 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index ad9fceff78..7a7536b9a7 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-21 Sankar P <psankar@novell.com>
+
+ * em-folder-view.c (emfv_spin):
+ Re-factor spinner usage
+
2008-10-20 Patrick Ohly <Patrick.Ohly@gmx.de>
* mail-component.h: Fixed a build break.
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 414e72715b..56f6ba6bc2 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -2539,10 +2539,7 @@ emfv_spin(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject)
box = gtk_hbox_new (FALSE, 0);
g_free (msg);
- ep = e_spinner_new ();
- e_spinner_set_size ((ESpinner *)ep, GTK_ICON_SIZE_SMALL_TOOLBAR);
- e_spinner_start ((ESpinner *)ep);
-
+ ep = e_spinner_new_spinning_small_shown ();
gtk_box_pack_start ((GtkBox *)box, ep, FALSE, FALSE, 0);
gtk_box_pack_start ((GtkBox *)box, label, FALSE, FALSE, 0);
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index e3ab25123c..85ec90411f 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,11 @@
+2008-10-21 Sankar P <psankar@novell.com>
+
+ * e-spinner.c (e_spinner_stop),
+ (e_spinner_new_spinning_small_shown):
+ * e-spinner.h:
+ * e-task-widget.c (e_task_widget_construct):
+ Re-factor spinner usage.
+
2008-10-17 Sankar P <psankar@novell.com>
License Changes
diff --git a/widgets/misc/e-spinner.c b/widgets/misc/e-spinner.c
index 26a77e6126..56990d71a1 100644
--- a/widgets/misc/e-spinner.c
+++ b/widgets/misc/e-spinner.c
@@ -32,6 +32,30 @@
#include "e-spinner.h"
+#define E_TYPE_SPINNER (e_spinner_get_type ())
+#define E_SPINNER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_SPINNER, ESpinner))
+#define E_SPINNER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_SPINNER, ESpinnerClass))
+#define E_IS_SPINNER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_SPINNER))
+#define E_IS_SPINNER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_SPINNER))
+#define E_SPINNER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_TYPE_SPINNER, ESpinnerClass))
+
+typedef struct _ESpinner ESpinner;
+typedef struct _ESpinnerClass ESpinnerClass;
+typedef struct _ESpinnerDetails ESpinnerDetails;
+
+struct _ESpinner
+{
+ GtkWidget parent;
+
+ /*< private >*/
+ ESpinnerDetails *details;
+};
+
+struct _ESpinnerClass
+{
+ GtkWidgetClass parent_class;
+};
+
#define LOG(msg, args...)
#define START_PROFILER(name)
#define STOP_PROFILER(name)
@@ -518,7 +542,7 @@ static void e_spinner_init (ESpinner *spinner);
static GObjectClass *parent_class;
-GType
+static GType
e_spinner_get_type (void)
{
static GType type = 0;
@@ -701,13 +725,7 @@ bump_spinner_frame_cb (ESpinner *spinner)
return TRUE;
}
-/**
- * e_spinner_start:
- * @spinner: a #ESpinner
- *
- * Start the spinner animation.
- **/
-void
+static void
e_spinner_start (ESpinner *spinner)
{
ESpinnerDetails *details = spinner->details;
@@ -742,39 +760,7 @@ e_spinner_remove_update_callback (ESpinner *spinner)
}
}
-/**
- * e_spinner_stop:
- * @spinner: a #ESpinner
- *
- * Stop the spinner animation.
- **/
-void
-e_spinner_stop (ESpinner *spinner)
-{
- ESpinnerDetails *details = spinner->details;
-
- details->spinning = FALSE;
- details->current_image = 0;
-
- if (details->timer_task != 0)
- {
- e_spinner_remove_update_callback (spinner);
-
- if (GTK_WIDGET_MAPPED (GTK_WIDGET (spinner)))
- {
- gtk_widget_queue_draw (GTK_WIDGET (spinner));
- }
- }
-}
-
-/*
- * e_spinner_set_size:
- * @spinner: a #ESpinner
- * @size: the size of type %GtkIconSize
- *
- * Set the size of the spinner.
- **/
-void
+static void
e_spinner_set_size (ESpinner *spinner,
GtkIconSize size)
{
@@ -794,6 +780,27 @@ e_spinner_set_size (ESpinner *spinner,
}
#if 0
+
+static void
+e_spinner_stop (ESpinner *spinner)
+{
+ ESpinnerDetails *details = spinner->details;
+
+ details->spinning = FALSE;
+ details->current_image = 0;
+
+ if (details->timer_task != 0)
+ {
+ e_spinner_remove_update_callback (spinner);
+
+ if (GTK_WIDGET_MAPPED (GTK_WIDGET (spinner)))
+ {
+ gtk_widget_queue_draw (GTK_WIDGET (spinner));
+ }
+ }
+}
+
+
/*
* e_spinner_set_timeout:
* @spinner: a #ESpinner
@@ -958,17 +965,14 @@ e_spinner_class_init (ESpinnerClass *class)
g_type_class_add_private (object_class, sizeof (ESpinnerDetails));
}
-/*
- * e_spinner_new:
- *
- * Create a new #ESpinner. The spinner is a widget
- * that gives the user feedback about network status with
- * an animated image.
- *
- * Return Value: the spinner #GtkWidget
- **/
-GtkWidget *
-e_spinner_new (void)
+GtkWidget *e_spinner_new_spinning_small_shown (void)
{
- return GTK_WIDGET (g_object_new (E_TYPE_SPINNER, NULL));
+ ESpinner *image;
+ image = E_SPINNER (g_object_new (E_TYPE_SPINNER, NULL));
+
+ e_spinner_set_size (image, GTK_ICON_SIZE_SMALL_TOOLBAR);
+ e_spinner_start (image);
+ gtk_widget_show (GTK_WIDGET(image));
+
+ return GTK_WIDGET (image);
}
diff --git a/widgets/misc/e-spinner.h b/widgets/misc/e-spinner.h
index 5a1cd42c5e..0fb97d945e 100644
--- a/widgets/misc/e-spinner.h
+++ b/widgets/misc/e-spinner.h
@@ -32,40 +32,7 @@
G_BEGIN_DECLS
-#define E_TYPE_SPINNER (e_spinner_get_type ())
-#define E_SPINNER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_SPINNER, ESpinner))
-#define E_SPINNER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_SPINNER, ESpinnerClass))
-#define E_IS_SPINNER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_SPINNER))
-#define E_IS_SPINNER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_SPINNER))
-#define E_SPINNER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_TYPE_SPINNER, ESpinnerClass))
-
-typedef struct _ESpinner ESpinner;
-typedef struct _ESpinnerClass ESpinnerClass;
-typedef struct _ESpinnerDetails ESpinnerDetails;
-
-struct _ESpinner
-{
- GtkWidget parent;
-
- /*< private >*/
- ESpinnerDetails *details;
-};
-
-struct _ESpinnerClass
-{
- GtkWidgetClass parent_class;
-};
-
-GType e_spinner_get_type (void);
-
-GtkWidget *e_spinner_new (void);
-
-void e_spinner_start (ESpinner *throbber);
-
-void e_spinner_stop (ESpinner *throbber);
-
-void e_spinner_set_size (ESpinner *spinner,
- GtkIconSize size);
+GtkWidget *e_spinner_new_spinning_small_shown (void);
G_END_DECLS
diff --git a/widgets/misc/e-task-widget.c b/widgets/misc/e-task-widget.c
index 138e9ad5b4..d545613998 100644
--- a/widgets/misc/e-task-widget.c
+++ b/widgets/misc/e-task-widget.c
@@ -145,10 +145,7 @@ e_task_widget_construct (ETaskWidget *task_widget,
gtk_widget_set_size_request (box, 1, -1);
priv->box = gtk_hbox_new (FALSE, 0);
- priv->image = e_spinner_new ();
- e_spinner_set_size (E_SPINNER (priv->image), GTK_ICON_SIZE_SMALL_TOOLBAR);
- e_spinner_start (E_SPINNER (priv->image));
- gtk_widget_show (priv->image);
+ priv->image = e_spinner_new_spinning_small_shown ();
gtk_widget_show (priv->box);
gtk_box_pack_start (GTK_BOX (priv->box), priv->image, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (box), priv->box, FALSE, TRUE, 0);