diff options
author | Sankarasivasubramanian Pasupathilingam <psankar@src.gnome.org> | 2008-10-21 17:54:26 +0800 |
---|---|---|
committer | Sankarasivasubramanian Pasupathilingam <psankar@src.gnome.org> | 2008-10-21 17:54:26 +0800 |
commit | e3230aaa65efb5c08c743eea2b12f759103b2559 (patch) | |
tree | 28148b8705a5a54bbd2f8479bc7e2fa90ce2c44e /widgets | |
parent | 0031f7a894a5498d985e438af3527dc6905c4b70 (diff) | |
download | gsoc2013-evolution-e3230aaa65efb5c08c743eea2b12f759103b2559.tar.gz gsoc2013-evolution-e3230aaa65efb5c08c743eea2b12f759103b2559.tar.zst gsoc2013-evolution-e3230aaa65efb5c08c743eea2b12f759103b2559.zip |
Re-factor spinner usage
svn path=/trunk/; revision=36671
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/misc/ChangeLog | 8 | ||||
-rw-r--r-- | widgets/misc/e-spinner.c | 110 | ||||
-rw-r--r-- | widgets/misc/e-spinner.h | 35 | ||||
-rw-r--r-- | widgets/misc/e-task-widget.c | 5 |
4 files changed, 67 insertions, 91 deletions
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); |