aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-10-02 05:11:19 +0800
committerChristian Persch <chpe@src.gnome.org>2005-10-02 05:11:19 +0800
commitb93acfe9668b0e1e12ba785fbf264a95920e0264 (patch)
treee9667b72247df12f55151b1fed13204a9c3f750a
parent292b22cfc4fb1e6e3a9a7c2b07c88319e94ff1b4 (diff)
downloadgsoc2013-epiphany-b93acfe9668b0e1e12ba785fbf264a95920e0264.tar
gsoc2013-epiphany-b93acfe9668b0e1e12ba785fbf264a95920e0264.tar.gz
gsoc2013-epiphany-b93acfe9668b0e1e12ba785fbf264a95920e0264.tar.bz2
gsoc2013-epiphany-b93acfe9668b0e1e12ba785fbf264a95920e0264.tar.lz
gsoc2013-epiphany-b93acfe9668b0e1e12ba785fbf264a95920e0264.tar.xz
gsoc2013-epiphany-b93acfe9668b0e1e12ba785fbf264a95920e0264.tar.zst
gsoc2013-epiphany-b93acfe9668b0e1e12ba785fbf264a95920e0264.zip
Don't spin unmapped spinners. Slightly decrease the frequency. Might help
2005-10-01 Christian Persch <chpe@cvs.gnome.org> * lib/widgets/ephy-spinner.c: (ephy_spinner_init), (ephy_spinner_start), (ephy_spinner_stop), (ephy_spinner_map), (ephy_spinner_unmap), (ephy_spinner_class_init): Don't spin unmapped spinners. Slightly decrease the frequency. Might help with bug #315232.
-rw-r--r--ChangeLog9
-rw-r--r--lib/widgets/ephy-spinner.c49
2 files changed, 54 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index ad12ec2c9..c445cf933 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2005-10-01 Christian Persch <chpe@cvs.gnome.org>
+ * lib/widgets/ephy-spinner.c: (ephy_spinner_init),
+ (ephy_spinner_start), (ephy_spinner_stop), (ephy_spinner_map),
+ (ephy_spinner_unmap), (ephy_spinner_class_init):
+
+ Don't spin unmapped spinners. Slightly decrease the frequency.
+ Might help with bug #315232.
+
+2005-10-01 Christian Persch <chpe@cvs.gnome.org>
+
* lib/widgets/ephy-location-entry.c: (entry_key_press_cb):
Reset the IM context before activating the entry.
diff --git a/lib/widgets/ephy-spinner.c b/lib/widgets/ephy-spinner.c
index 1ad7f442b..34876cf95 100644
--- a/lib/widgets/ephy-spinner.c
+++ b/lib/widgets/ephy-spinner.c
@@ -449,7 +449,7 @@ ephy_spinner_cache_ref (void)
/* Spinner implementation */
-#define SPINNER_TIMEOUT 100 /* Milliseconds Per Frame */
+#define SPINNER_TIMEOUT 125 /* ms */
#define EPHY_SPINNER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SPINNER, EphySpinnerDetails))
@@ -461,6 +461,7 @@ struct _EphySpinnerDetails
EphySpinnerImages *images;
GList *current_image;
guint timer_task;
+ guint spinning : 1;
};
static void ephy_spinner_class_init (EphySpinnerClass *class);
@@ -549,8 +550,9 @@ ephy_spinner_init (EphySpinner *spinner)
spinner->details->cache = ephy_spinner_cache_ref ();
spinner->details->size = GTK_ICON_SIZE_INVALID;
+ spinner->details->spinning = FALSE;
- /* FIXME: icon theme is per-screen, not global */
+ /* FIXME: multihead */
spinner->details->icon_theme = gtk_icon_theme_get_default ();
g_signal_connect (spinner->details->icon_theme, "changed",
G_CALLBACK (icon_theme_changed_cb), spinner);
@@ -676,7 +678,12 @@ bump_spinner_frame_cb (EphySpinner *spinner)
void
ephy_spinner_start (EphySpinner *spinner)
{
- if (spinner->details->timer_task == 0)
+ EphySpinnerDetails *details = spinner->details;
+
+ details->spinning = TRUE;
+
+ if (GTK_WIDGET_MAPPED (GTK_WIDGET (spinner)) &&
+ details->timer_task == 0)
{
if (spinner->details->images != NULL)
@@ -712,10 +719,18 @@ ephy_spinner_remove_update_callback (EphySpinner *spinner)
void
ephy_spinner_stop (EphySpinner *spinner)
{
+ EphySpinnerDetails *details = spinner->details;
+
+ details->spinning = FALSE;
+
if (spinner->details->timer_task != 0)
{
ephy_spinner_remove_update_callback (spinner);
- gtk_widget_queue_draw (GTK_WIDGET (spinner));
+
+ if (GTK_WIDGET_MAPPED (GTK_WIDGET (spinner)))
+ {
+ gtk_widget_queue_draw (GTK_WIDGET (spinner));
+ }
}
}
@@ -769,6 +784,30 @@ ephy_spinner_size_request (GtkWidget *widget,
}
static void
+ephy_spinner_map (GtkWidget *widget)
+{
+ EphySpinner *spinner = EPHY_SPINNER (widget);
+ EphySpinnerDetails *details = spinner->details;
+
+ GTK_WIDGET_CLASS (parent_class)->map (widget);
+
+ if (details->spinning)
+ {
+ ephy_spinner_start (spinner);
+ }
+}
+
+static void
+ephy_spinner_unmap (GtkWidget *widget)
+{
+ EphySpinner *spinner = EPHY_SPINNER (widget);
+
+ ephy_spinner_remove_update_callback (spinner);
+
+ GTK_WIDGET_CLASS (parent_class)->unmap (widget);
+}
+
+static void
ephy_spinner_finalize (GObject *object)
{
EphySpinner *spinner = EPHY_SPINNER (object);
@@ -797,6 +836,8 @@ ephy_spinner_class_init (EphySpinnerClass *class)
widget_class->expose_event = ephy_spinner_expose;
widget_class->size_request = ephy_spinner_size_request;
+ widget_class->map = ephy_spinner_map;
+ widget_class->unmap = ephy_spinner_unmap;
g_type_class_add_private (object_class, sizeof (EphySpinnerDetails));
}