aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@gnome.org>2009-11-02 18:10:40 +0800
committerXan Lopez <xan@gnome.org>2010-10-24 18:21:25 +0800
commitc255df464cf44e9687f80c5845e5f31a500f7084 (patch)
treeb2c5c6cb9d2ada8250894df681962961599e9a62
parent90f545eba59c0ecf1ea6924d909630e9a9b564c6 (diff)
downloadgsoc2013-epiphany-c255df464cf44e9687f80c5845e5f31a500f7084.tar.gz
gsoc2013-epiphany-c255df464cf44e9687f80c5845e5f31a500f7084.tar.zst
gsoc2013-epiphany-c255df464cf44e9687f80c5845e5f31a500f7084.zip
Spinner changes
We get rid of the spinner in the toolbar, since load information is already given by the floating status indicator inside the WebView. The only remaining spinner is the one in the tabs, which has been ported to use GtkSpinner. Get rid of EphySpinner. Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=524809 (again) https://bugzilla.gnome.org/show_bug.cgi?id=598442
-rw-r--r--doc/reference/epiphany-docs.sgml1
-rw-r--r--doc/reference/epiphany-sections.txt10
-rw-r--r--doc/reference/epiphany.types2
-rw-r--r--doc/reference/tmpl/ephy-spinner.sgml60
-rw-r--r--lib/widgets/Makefile.am4
-rw-r--r--lib/widgets/ephy-spinner-tool-item.c115
-rw-r--r--lib/widgets/ephy-spinner-tool-item.h62
-rw-r--r--lib/widgets/ephy-spinner.c967
-rw-r--r--lib/widgets/ephy-spinner.h72
-rw-r--r--lib/widgets/testspinner.c264
-rw-r--r--src/Makefile.am2
-rw-r--r--src/ephy-fullscreen-popup.c56
-rw-r--r--src/ephy-fullscreen-popup.h3
-rw-r--r--src/ephy-notebook.c8
-rw-r--r--src/ephy-toolbar.c56
-rw-r--r--src/ephy-toolbar.h3
-rw-r--r--src/ephy-window.c9
17 files changed, 3 insertions, 1691 deletions
diff --git a/doc/reference/epiphany-docs.sgml b/doc/reference/epiphany-docs.sgml
index 402a9466d..5585b616f 100644
--- a/doc/reference/epiphany-docs.sgml
+++ b/doc/reference/epiphany-docs.sgml
@@ -24,7 +24,6 @@
<xi:include href="xml/ephy-location-entry.xml"/>
<xi:include href="xml/ephy-node-view.xml"/>
<xi:include href="xml/ephy-search-entry.xml"/>
- <xi:include href="xml/ephy-spinner.xml"/>
<xi:include href="xml/ephy-tree-model-node.xml"/>
<xi:include href="xml/ephy-tree-model-sort.xml"/>
<xi:include href="xml/ephy-zoom-action.xml"/>
diff --git a/doc/reference/epiphany-sections.txt b/doc/reference/epiphany-sections.txt
index 75f78263b..345ab86f2 100644
--- a/doc/reference/epiphany-sections.txt
+++ b/doc/reference/epiphany-sections.txt
@@ -103,16 +103,6 @@ ephy_search_entry_clear
</SECTION>
<SECTION>
-<FILE>ephy-spinner</FILE>
-<TITLE>EphySpinner</TITLE>
-EphySpinner
-ephy_spinner_new
-ephy_spinner_start
-ephy_spinner_stop
-ephy_spinner_set_size
-</SECTION>
-
-<SECTION>
<FILE>ephy-tree-model-node</FILE>
<TITLE>EphyTreeModelNode</TITLE>
EphyTreeModelNode
diff --git a/doc/reference/epiphany.types b/doc/reference/epiphany.types
index c9637f5cd..561165e84 100644
--- a/doc/reference/epiphany.types
+++ b/doc/reference/epiphany.types
@@ -5,7 +5,6 @@ ephy_web_view_get_type
#include <ephy-node-view.h>
#include <ephy-location-entry.h>
#include <ephy-search-entry.h>
-#include <ephy-spinner.h>
#include <ephy-tree-model-sort.h>
#include <ephy-zoom-action.h>
#include <ephy-zoom-control.h>
@@ -13,7 +12,6 @@ ephy_web_view_get_type
ephy_node_view_get_type
ephy_location_entry_get_type
ephy_search_entry_get_type
-ephy_spinner_get_type
ephy_tree_model_node_get_type
ephy_tree_model_sort_get_type
ephy_zoom_action_get_type
diff --git a/doc/reference/tmpl/ephy-spinner.sgml b/doc/reference/tmpl/ephy-spinner.sgml
deleted file mode 100644
index 9c4d12cc6..000000000
--- a/doc/reference/tmpl/ephy-spinner.sgml
+++ /dev/null
@@ -1,60 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-EphySpinner
-
-<!-- ##### SECTION Short_Description ##### -->
-
-
-<!-- ##### SECTION Long_Description ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### SECTION See_Also ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### STRUCT EphySpinner ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### FUNCTION ephy_spinner_new ##### -->
-<para>
-
-</para>
-
-@Returns:
-
-
-<!-- ##### FUNCTION ephy_spinner_start ##### -->
-<para>
-
-</para>
-
-@spinner:
-
-
-<!-- ##### FUNCTION ephy_spinner_stop ##### -->
-<para>
-
-</para>
-
-@spinner:
-
-
-<!-- ##### FUNCTION ephy_spinner_set_size ##### -->
-<para>
-
-</para>
-
-@spinner:
-@size:
-
-
diff --git a/lib/widgets/Makefile.am b/lib/widgets/Makefile.am
index c0134b6ff..48c60e28c 100644
--- a/lib/widgets/Makefile.am
+++ b/lib/widgets/Makefile.am
@@ -7,10 +7,6 @@ libephywidgets_la_SOURCES = \
ephy-node-view.h \
ephy-search-entry.c \
ephy-search-entry.h \
- ephy-spinner.c \
- ephy-spinner.h \
- ephy-spinner-tool-item.c \
- ephy-spinner-tool-item.h \
ephy-tree-model-node.c \
ephy-tree-model-node.h \
ephy-tree-model-sort.c \
diff --git a/lib/widgets/ephy-spinner-tool-item.c b/lib/widgets/ephy-spinner-tool-item.c
deleted file mode 100644
index 96af434c6..000000000
--- a/lib/widgets/ephy-spinner-tool-item.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright © 2006 Christian Persch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * $Id$
- */
-
-#ifndef COMPILING_TESTSPINNER
-#include "config.h"
-#endif
-
-#include "ephy-spinner-tool-item.h"
-#include "ephy-spinner.h"
-
-G_DEFINE_TYPE (EphySpinnerToolItem, ephy_spinner_tool_item, GTK_TYPE_TOOL_ITEM)
-
-static void
-ephy_spinner_tool_item_init (EphySpinnerToolItem *item)
-{
- GtkWidget *spinner;
-
- spinner = ephy_spinner_new ();
- gtk_container_add (GTK_CONTAINER (item), spinner);
- gtk_widget_show (spinner);
-}
-
-static void
-ephy_spinner_tool_item_toolbar_reconfigured (GtkToolItem *tool_item)
-{
- EphySpinner *spinner;
- GtkToolbarStyle style;
- GtkIconSize spinner_size;
-
- spinner = EPHY_SPINNER (gtk_bin_get_child (GTK_BIN (tool_item)));
- g_return_if_fail (spinner);
-
- style = gtk_tool_item_get_toolbar_style (tool_item);
-
- /* FIXME: be smarter by taking the toolbar icon size (gtk_toolbar_get_icon_size) into account! */
-
- if (style == GTK_TOOLBAR_BOTH)
- {
- spinner_size = GTK_ICON_SIZE_DIALOG;
- }
- else
- {
- spinner_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
- }
-
- ephy_spinner_set_size (spinner, spinner_size);
-
- if (GTK_TOOL_ITEM_CLASS (ephy_spinner_tool_item_parent_class)->toolbar_reconfigured)
- GTK_TOOL_ITEM_CLASS (ephy_spinner_tool_item_parent_class)->toolbar_reconfigured (tool_item);
-}
-
-static void
-ephy_spinner_tool_item_class_init (EphySpinnerToolItemClass *klass)
-{
- GtkToolItemClass *tool_item_class = GTK_TOOL_ITEM_CLASS (klass);
-
- tool_item_class->toolbar_reconfigured = ephy_spinner_tool_item_toolbar_reconfigured;
-}
-
-/*
- * ephy_spinner_tool_item_new:
- *
- * Create a new #EphySpinnerToolItem. The spinner is a widget
- * that gives the user feedback about network status with
- * an animated image.
- *
- * Return Value: the spinner tool item
- **/
-GtkToolItem *
-ephy_spinner_tool_item_new (void)
-{
- return GTK_TOOL_ITEM (g_object_new (EPHY_TYPE_SPINNER_TOOL_ITEM, NULL));
-}
-
-/*
- * ephy_spinner_tool_item_set_spinning:
- *
- * Start or stop the spinner.
- **/
-void
-ephy_spinner_tool_item_set_spinning (EphySpinnerToolItem *item,
- gboolean spinning)
-{
- EphySpinner *spinner;
-
- spinner = EPHY_SPINNER (gtk_bin_get_child (GTK_BIN (item)));
- g_return_if_fail (spinner);
-
- if (spinning)
- {
- ephy_spinner_start (spinner);
- }
- else
- {
- ephy_spinner_stop (spinner);
- }
-}
diff --git a/lib/widgets/ephy-spinner-tool-item.h b/lib/widgets/ephy-spinner-tool-item.h
deleted file mode 100644
index fa07dcabf..000000000
--- a/lib/widgets/ephy-spinner-tool-item.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright © 2006 Christian Persch
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * $Id$
- */
-
-#ifndef EPHY_SPINNER_TOOL_ITEM_H
-#define EPHY_SPINNER_TOOL_ITEM_H
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define EPHY_TYPE_SPINNER_TOOL_ITEM (ephy_spinner_tool_item_get_type ())
-#define EPHY_SPINNER_TOOL_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_SPINNER_TOOL_ITEM, EphySpinnerToolItem))
-#define EPHY_SPINNER_TOOL_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_SPINNER_TOOL_ITEM, EphySpinnerToolItemClass))
-#define EPHY_IS_SPINNER_TOOL_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_SPINNER_TOOL_ITEM))
-#define EPHY_IS_SPINNER_TOOL_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_SPINNER_TOOL_ITEM))
-#define EPHY_SPINNER_TOOL_ITEM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_SPINNER_TOOL_ITEM, EphySpinnerToolItemClass))
-
-typedef struct _EphySpinnerToolItem EphySpinnerToolItem;
-typedef struct _EphySpinnerToolItemClass EphySpinnerToolItemClass;
-typedef struct _EphySpinnerToolItemDetails EphySpinnerToolItemDetails;
-
-struct _EphySpinnerToolItem
-{
- GtkToolItem parent;
-
- /*< private >*/
- EphySpinnerToolItemDetails *details;
-};
-
-struct _EphySpinnerToolItemClass
-{
- GtkToolItemClass parent_class;
-};
-
-GType ephy_spinner_tool_item_get_type (void);
-
-GtkToolItem *ephy_spinner_tool_item_new (void);
-
-void ephy_spinner_tool_item_set_spinning (EphySpinnerToolItem *item,
- gboolean spinning);
-
-G_END_DECLS
-
-#endif /* !EPHY_SPINNER_TOOL_ITEM_H */
diff --git a/lib/widgets/ephy-spinner.c b/lib/widgets/ephy-spinner.c
deleted file mode 100644
index c12dccd8a..000000000
--- a/lib/widgets/ephy-spinner.c
+++ /dev/null
@@ -1,967 +0,0 @@
-/*
- * Copyright © 2000 Eazel, Inc.
- * Copyright © 2002-2004 Marco Pesenti Gritti
- * Copyright © 2004, 2006 Christian Persch
- *
- * Nautilus is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Nautilus 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author: Andy Hertzfeld <andy@eazel.com>
- *
- * Ephy port by Marco Pesenti Gritti <marco@it.gnome.org>
- *
- */
-
-#ifndef COMPILING_TESTSPINNER
-#include "config.h"
-#include "ephy-debug.h"
-#endif
-
-#include "ephy-spinner.h"
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gtk/gtk.h>
-
-/**
- * SECTION:ephy-spinner
- * @short_description: A spinning 'loading' widget
- *
- * #EphySpinner implements an animated 'loading' indicator.
- *
- * Note that this is to be deprecated in favour of #GtkSpinner widget.
- */
-
-/* Spinner cache implementation */
-
-#define EPHY_TYPE_SPINNER_CACHE (ephy_spinner_cache_get_type())
-#define EPHY_SPINNER_CACHE(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EPHY_TYPE_SPINNER_CACHE, EphySpinnerCache))
-#define EPHY_SPINNER_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EPHY_TYPE_SPINNER_CACHE, EphySpinnerCacheClass))
-#define EPHY_IS_SPINNER_CACHE(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EPHY_TYPE_SPINNER_CACHE))
-#define EPHY_IS_SPINNER_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EPHY_TYPE_SPINNER_CACHE))
-#define EPHY_SPINNER_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_SPINNER_CACHE, EphySpinnerCacheClass))
-
-typedef struct _EphySpinnerCache EphySpinnerCache;
-typedef struct _EphySpinnerCacheClass EphySpinnerCacheClass;
-typedef struct _EphySpinnerCachePrivate EphySpinnerCachePrivate;
-
-struct _EphySpinnerCacheClass
-{
- GObjectClass parent_class;
-};
-
-struct _EphySpinnerCache
-{
- GObject parent_object;
-
- /*< private >*/
- EphySpinnerCachePrivate *priv;
-};
-
-#define EPHY_SPINNER_CACHE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SPINNER_CACHE, EphySpinnerCachePrivate))
-
-struct _EphySpinnerCachePrivate
-{
- /* Hash table of GdkScreen -> EphySpinnerCacheData */
- GHashTable *hash;
-};
-
-typedef struct
-{
- guint ref_count;
- GtkIconSize size;
- int width;
- int height;
- GdkPixbuf **animation_pixbufs;
- guint n_animation_pixbufs;
-} EphySpinnerImages;
-
-#define LAST_ICON_SIZE GTK_ICON_SIZE_DIALOG + 1
-#define SPINNER_ICON_NAME "process-working"
-#define SPINNER_FALLBACK_ICON_NAME "gnome-spinner"
-#define EPHY_SPINNER_IMAGES_INVALID ((EphySpinnerImages *) 0x1)
-
-typedef struct
-{
- GdkScreen *screen;
- GtkIconTheme *icon_theme;
- EphySpinnerImages *images[LAST_ICON_SIZE];
-} EphySpinnerCacheData;
-
-static void ephy_spinner_cache_class_init (EphySpinnerCacheClass *klass);
-static void ephy_spinner_cache_init (EphySpinnerCache *cache);
-
-static GObjectClass *ephy_spinner_cache_parent_class;
-
-static GType
-ephy_spinner_cache_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphySpinnerCacheClass),
- NULL,
- NULL,
- (GClassInitFunc) ephy_spinner_cache_class_init,
- NULL,
- NULL,
- sizeof (EphySpinnerCache),
- 0,
- (GInstanceInitFunc) ephy_spinner_cache_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "EphySpinnerCache",
- &our_info, 0);
- }
-
- return type;
-}
-
-static EphySpinnerImages *
-ephy_spinner_images_ref (EphySpinnerImages *images)
-{
- g_return_val_if_fail (images != NULL, NULL);
-
- images->ref_count++;
-
- return images;
-}
-
-static void
-ephy_spinner_images_unref (EphySpinnerImages *images)
-{
- g_return_if_fail (images != NULL);
-
- images->ref_count--;
- if (images->ref_count == 0)
- {
- guint i;
-
- LOG ("Freeing spinner images %p for size %d", images, images->size);
-
- for (i = 0; i < images->n_animation_pixbufs; ++i)
- {
- g_object_unref (images->animation_pixbufs[i]);
- }
- g_free (images->animation_pixbufs);
-
- g_free (images);
- }
-}
-
-static void
-ephy_spinner_cache_data_unload (EphySpinnerCacheData *data)
-{
- GtkIconSize size;
- EphySpinnerImages *images;
-
- g_return_if_fail (data != NULL);
-
- LOG ("EphySpinnerDataCache unload for screen %p", data->screen);
-
- for (size = GTK_ICON_SIZE_INVALID; size < LAST_ICON_SIZE; ++size)
- {
- images = data->images[size];
- data->images[size] = NULL;
-
- if (images != NULL && images != EPHY_SPINNER_IMAGES_INVALID)
- {
- ephy_spinner_images_unref (images);
- }
- }
-}
-
-static GdkPixbuf *
-extract_frame (GdkPixbuf *grid_pixbuf,
- int x,
- int y,
- int size)
-{
- GdkPixbuf *pixbuf;
-
- if (x + size > gdk_pixbuf_get_width (grid_pixbuf) ||
- y + size > gdk_pixbuf_get_height (grid_pixbuf))
- {
- return NULL;
- }
-
- pixbuf = gdk_pixbuf_new_subpixbuf (grid_pixbuf,
- x, y,
- size, size);
- g_return_val_if_fail (pixbuf != NULL, NULL);
-
- return pixbuf;
-}
-
-static GdkPixbuf *
-scale_to_size (GdkPixbuf *pixbuf,
- int dw,
- int dh)
-{
- GdkPixbuf *result;
- int pw, ph;
-
- g_return_val_if_fail (pixbuf != NULL, NULL);
-
- pw = gdk_pixbuf_get_width (pixbuf);
- ph = gdk_pixbuf_get_height (pixbuf);
-
- if (pw != dw || ph != dh)
- {
- result = gdk_pixbuf_scale_simple (pixbuf, dw, dh,
- GDK_INTERP_BILINEAR);
- g_object_unref (pixbuf);
- return result;
- }
-
- return pixbuf;
-}
-
-static EphySpinnerImages *
-ephy_spinner_images_load (GdkScreen *screen,
- GtkIconTheme *icon_theme,
- GtkIconSize icon_size)
-{
- EphySpinnerImages *images;
- GdkPixbuf *icon_pixbuf, *pixbuf;
- GtkIconInfo *icon_info = NULL;
- int grid_width, grid_height, x, y, requested_size, size, isw, ish, n;
- const char *icon;
- GSList *list = NULL, *l;
-
- LOG ("EphySpinnerCacheData loading for screen %p at size %d", screen, icon_size);
-
- START_PROFILER ("loading spinner animation")
-
- if (!gtk_icon_size_lookup_for_settings (gtk_settings_get_for_screen (screen),
- icon_size, &isw, &ish)) goto loser;
-
- requested_size = MAX (ish, isw);
-
- /* Load the animation. The 'rest icon' is the 0th frame */
- icon_info = gtk_icon_theme_lookup_icon (icon_theme,
- SPINNER_ICON_NAME,
- requested_size, 0);
- if (icon_info == NULL)
- {
- g_warning ("Throbber animation not found");
-
- /* If the icon naming spec compliant name wasn't found, try the old name */
- icon_info = gtk_icon_theme_lookup_icon (icon_theme,
- SPINNER_FALLBACK_ICON_NAME,
- requested_size, 0);
- if (icon_info == NULL)
- {
- g_warning ("Throbber fallback animation not found either");
- goto loser;
- }
- }
- g_assert (icon_info != NULL);
-
- size = gtk_icon_info_get_base_size (icon_info);
- icon = gtk_icon_info_get_filename (icon_info);
- if (icon == NULL) goto loser;
-
- icon_pixbuf = gdk_pixbuf_new_from_file (icon, NULL);
- gtk_icon_info_free (icon_info);
- icon_info = NULL;
-
- if (icon_pixbuf == NULL)
- {
- g_warning ("Could not load the spinner file");
- goto loser;
- }
-
- grid_width = gdk_pixbuf_get_width (icon_pixbuf);
- grid_height = gdk_pixbuf_get_height (icon_pixbuf);
-
- n = 0;
- for (y = 0; y < grid_height; y += size)
- {
- for (x = 0; x < grid_width ; x += size)
- {
- pixbuf = extract_frame (icon_pixbuf, x, y, size);
-
- if (pixbuf)
- {
- list = g_slist_prepend (list, pixbuf);
- ++n;
- }
- else
- {
- g_warning ("Cannot extract frame (%d, %d) from the grid\n", x, y);
- }
- }
- }
-
- g_object_unref (icon_pixbuf);
-
- if (list == NULL) goto loser;
- g_assert (n > 0);
-
- if (size > requested_size)
- {
- for (l = list; l != NULL; l = l->next)
- {
- l->data = scale_to_size (l->data, isw, ish);
- }
- }
-
- /* Now we've successfully got all the data */
- images = g_new (EphySpinnerImages, 1);
- images->ref_count = 1;
-
- images->size = icon_size;
- images->width = images->height = requested_size;
-
- images->n_animation_pixbufs = n;
- images->animation_pixbufs = g_new (GdkPixbuf *, n);
-
- for (l = list; l != NULL; l = l->next)
- {
- g_assert (l->data != NULL);
- images->animation_pixbufs[--n] = l->data;
- }
- g_assert (n == 0);
-
- g_slist_free (list);
-
- STOP_PROFILER ("loading spinner animation")
-
- return images;
-
-loser:
- if (icon_info)
- {
- gtk_icon_info_free (icon_info);
- }
- g_slist_foreach (list, (GFunc) g_object_unref, NULL);
-
- STOP_PROFILER ("loading spinner animation")
-
- return NULL;
-}
-
-static EphySpinnerCacheData *
-ephy_spinner_cache_data_new (GdkScreen *screen)
-{
- EphySpinnerCacheData *data;
-
- data = g_new0 (EphySpinnerCacheData, 1);
-
- data->screen = screen;
- data->icon_theme = gtk_icon_theme_get_for_screen (screen);
- g_signal_connect_swapped (data->icon_theme, "changed",
- G_CALLBACK (ephy_spinner_cache_data_unload),
- data);
-
- return data;
-}
-
-static void
-ephy_spinner_cache_data_free (EphySpinnerCacheData *data)
-{
- g_return_if_fail (data != NULL);
- g_return_if_fail (data->icon_theme != NULL);
-
- g_signal_handlers_disconnect_by_func
- (data->icon_theme,
- G_CALLBACK (ephy_spinner_cache_data_unload), data);
-
- ephy_spinner_cache_data_unload (data);
-
- g_free (data);
-}
-
-static EphySpinnerImages *
-ephy_spinner_cache_get_images (EphySpinnerCache *cache,
- GdkScreen *screen,
- GtkIconSize icon_size)
-{
- EphySpinnerCachePrivate *priv = cache->priv;
- EphySpinnerCacheData *data;
- EphySpinnerImages *images;
-
- LOG ("Getting animation images for screen %p at size %d", screen, icon_size);
-
- g_return_val_if_fail (icon_size >= 0 && icon_size < LAST_ICON_SIZE, NULL);
-
- /* Backward compat: "invalid" meant "native" size which doesn't exist anymore */
- if (icon_size == GTK_ICON_SIZE_INVALID)
- {
- icon_size = GTK_ICON_SIZE_DIALOG;
- }
-
- data = g_hash_table_lookup (priv->hash, screen);
- if (data == NULL)
- {
- data = ephy_spinner_cache_data_new (screen);
- /* FIXME: think about what happens when the screen's display is closed later on */
- g_hash_table_insert (priv->hash, screen, data);
- }
-
- images = data->images[icon_size];
- if (images == EPHY_SPINNER_IMAGES_INVALID)
- {
- /* Load failed, but don't try endlessly again! */
- return NULL;
- }
-
- if (images != NULL)
- {
- /* Return cached data */
- return ephy_spinner_images_ref (images);
- }
-
- images = ephy_spinner_images_load (screen, data->icon_theme, icon_size);
-
- if (images == NULL)
- {
- /* Mark as failed-to-load */
- data->images[icon_size] = EPHY_SPINNER_IMAGES_INVALID;
-
- return NULL;
- }
-
- data->images[icon_size] = images;
-
- return ephy_spinner_images_ref (images);
-}
-
-static void
-ephy_spinner_cache_init (EphySpinnerCache *cache)
-{
- EphySpinnerCachePrivate *priv;
-
- priv = cache->priv = EPHY_SPINNER_CACHE_GET_PRIVATE (cache);
-
- LOG ("EphySpinnerCache initialising");
-
- priv->hash = g_hash_table_new_full (g_direct_hash, g_direct_equal,
- NULL,
- (GDestroyNotify) ephy_spinner_cache_data_free);
-}
-
-static void
-ephy_spinner_cache_finalize (GObject *object)
-{
- EphySpinnerCache *cache = EPHY_SPINNER_CACHE (object);
- EphySpinnerCachePrivate *priv = cache->priv;
-
- g_hash_table_destroy (priv->hash);
-
- LOG ("EphySpinnerCache finalised");
-
- G_OBJECT_CLASS (ephy_spinner_cache_parent_class)->finalize (object);
-}
-
-static void
-ephy_spinner_cache_class_init (EphySpinnerCacheClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- ephy_spinner_cache_parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = ephy_spinner_cache_finalize;
-
- g_type_class_add_private (object_class, sizeof (EphySpinnerCachePrivate));
-}
-
-static EphySpinnerCache *spinner_cache = NULL;
-
-static EphySpinnerCache *
-ephy_spinner_cache_ref (void)
-{
- if (spinner_cache == NULL)
- {
- EphySpinnerCache **cache_ptr;
-
- spinner_cache = g_object_new (EPHY_TYPE_SPINNER_CACHE, NULL);
- cache_ptr = &spinner_cache;
- g_object_add_weak_pointer (G_OBJECT (spinner_cache),
- (gpointer *) cache_ptr);
-
- return spinner_cache;
- }
-
- return g_object_ref (spinner_cache);
-}
-
-/* Spinner implementation */
-
-#define SPINNER_TIMEOUT 125 /* ms */
-
-#define EPHY_SPINNER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SPINNER, EphySpinnerDetails))
-
-struct _EphySpinnerDetails
-{
- GtkIconTheme *icon_theme;
- EphySpinnerCache *cache;
- GtkIconSize size;
- EphySpinnerImages *images;
- guint current_image;
- guint timeout;
- guint timer_task;
- guint spinning : 1;
- guint need_load : 1;
-};
-
-static void ephy_spinner_class_init (EphySpinnerClass *class);
-static void ephy_spinner_init (EphySpinner *spinner);
-
-static GObjectClass *parent_class;
-
-GType
-ephy_spinner_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- const GTypeInfo our_info =
- {
- sizeof (EphySpinnerClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_spinner_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphySpinner),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_spinner_init
- };
-
- type = g_type_register_static (GTK_TYPE_WIDGET,
- "EphySpinner",
- &our_info, 0);
- }
-
- return type;
-}
-
-static gboolean
-ephy_spinner_load_images (EphySpinner *spinner)
-{
- EphySpinnerDetails *details = spinner->details;
-
- if (details->need_load)
- {
- START_PROFILER ("ephy_spinner_load_images")
-
- details->images =
- ephy_spinner_cache_get_images
- (details->cache,
- gtk_widget_get_screen (GTK_WIDGET (spinner)),
- details->size);
-
- STOP_PROFILER ("ephy_spinner_load_images")
-
- details->current_image = 0; /* 'rest' icon */
- details->need_load = FALSE;
- }
-
- return details->images != NULL;
-}
-
-static void
-ephy_spinner_unload_images (EphySpinner *spinner)
-{
- EphySpinnerDetails *details = spinner->details;
-
- if (details->images != NULL)
- {
- ephy_spinner_images_unref (details->images);
- details->images = NULL;
- }
-
- details->current_image = 0;
- details->need_load = TRUE;
-}
-
-static void
-icon_theme_changed_cb (GtkIconTheme *icon_theme,
- EphySpinner *spinner)
-{
- ephy_spinner_unload_images (spinner);
- gtk_widget_queue_resize (GTK_WIDGET (spinner));
-}
-
-static void
-ephy_spinner_init (EphySpinner *spinner)
-{
- EphySpinnerDetails *details;
-
- details = spinner->details = EPHY_SPINNER_GET_PRIVATE (spinner);
-
- gtk_widget_set_has_window (GTK_WIDGET (spinner), FALSE);
-
- details->cache = ephy_spinner_cache_ref ();
- details->size = GTK_ICON_SIZE_DIALOG;
- details->spinning = FALSE;
- details->timeout = SPINNER_TIMEOUT;
- details->need_load = TRUE;
-}
-
-static gboolean
-ephy_spinner_draw (GtkWidget *widget,
- cairo_t *cr)
-{
- EphySpinner *spinner = EPHY_SPINNER (widget);
- EphySpinnerDetails *details = spinner->details;
- EphySpinnerImages *images;
- GtkAllocation allocation;
- GdkPixbuf *pixbuf;
- int x_offset, y_offset, width, height;
-
- if (!gtk_widget_is_drawable (GTK_WIDGET (spinner)))
- {
- return FALSE;
- }
-
- if (details->need_load &&
- !ephy_spinner_load_images (spinner))
- {
- return FALSE;
- }
-
- images = details->images;
- if (images == NULL)
- {
- return FALSE;
- }
-
- /* Otherwise |images| will be NULL anyway */
- g_assert (images->n_animation_pixbufs > 0);
-
- g_assert (details->current_image >= 0 &&
- details->current_image < images->n_animation_pixbufs);
-
- pixbuf = images->animation_pixbufs[details->current_image];
-
- g_assert (pixbuf != NULL);
-
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
-
- /* Compute the offsets for the image centered on our allocation */
- gtk_widget_get_allocation (widget, &allocation);
- x_offset = (allocation.width - width) / 2;
- y_offset = (allocation.height - height) / 2;
- gdk_cairo_set_source_pixbuf (cr, pixbuf, x_offset, y_offset);
- cairo_paint (cr);
-
- return FALSE;
-}
-
-static gboolean
-bump_spinner_frame_cb (EphySpinner *spinner)
-{
- EphySpinnerDetails *details = spinner->details;
-
- /* This can happen when we've unloaded the images on a theme
- * change, but haven't been in the queued size request yet.
- * Just skip this update.
- */
- if (details->images == NULL) return TRUE;
-
- details->current_image++;
- if (details->current_image >= details->images->n_animation_pixbufs)
- {
- /* the 0th frame is the 'rest' icon */
- details->current_image = MIN (1, details->images->n_animation_pixbufs);
- }
-
- gtk_widget_queue_draw (GTK_WIDGET (spinner));
-
- /* run again */
- return TRUE;
-}
-
-static void
-ephy_spinner_remove_update_callback (EphySpinner *spinner)
-{
- EphySpinnerDetails *details = spinner->details;
-
- if (details->timer_task != 0)
- {
- g_source_remove (details->timer_task);
- details->timer_task = 0;
- }
-}
-
-#if 0
-/*
- * ephy_spinner_set_timeout:
- * @spinner: a #EphySpinner
- * @timeout: time delay between updates to the spinner.
- *
- * Sets the timeout delay for spinner updates.
- **/
-void
-ephy_spinner_set_timeout (EphySpinner *spinner,
- guint timeout)
-{
- EphySpinnerDetails *details = spinner->details;
-
- if (timeout != details->timeout)
- {
- ephy_spinner_stop (spinner);
-
- details->timeout = timeout;
-
- if (details->spinning)
- {
- ephy_spinner_start (spinner);
- }
- }
-}
-#endif
-
-static void
-ephy_spinner_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- EphySpinner *spinner = EPHY_SPINNER (widget);
- EphySpinnerDetails *details = spinner->details;
-
- if ((details->need_load &&
- !ephy_spinner_load_images (spinner)) ||
- details->images == NULL)
- {
- requisition->width = requisition->height = 0;
- gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (widget),
- details->size,
- &requisition->width,
- &requisition->height);
- return;
- }
-
- requisition->width = details->images->width;
- requisition->height = details->images->height;
-
- /* FIXME fix this hack */
- /* allocate some extra margin so we don't butt up against toolbar edges */
- if (details->size != GTK_ICON_SIZE_MENU)
- {
- requisition->width += 2;
- requisition->height += 2;
- }
-}
-
-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_dispose (GObject *object)
-{
- EphySpinner *spinner = EPHY_SPINNER (object);
-
- g_signal_handlers_disconnect_by_func
- (spinner->details->icon_theme,
- G_CALLBACK (icon_theme_changed_cb), spinner);
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-ephy_spinner_finalize (GObject *object)
-{
- EphySpinner *spinner = EPHY_SPINNER (object);
-
- ephy_spinner_remove_update_callback (spinner);
- ephy_spinner_unload_images (spinner);
-
- g_object_unref (spinner->details->cache);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-ephy_spinner_screen_changed (GtkWidget *widget,
- GdkScreen *old_screen)
-{
- EphySpinner *spinner = EPHY_SPINNER (widget);
- EphySpinnerDetails *details = spinner->details;
- GdkScreen *screen;
-
- if (GTK_WIDGET_CLASS (parent_class)->screen_changed)
- {
- GTK_WIDGET_CLASS (parent_class)->screen_changed (widget, old_screen);
- }
-
- screen = gtk_widget_get_screen (widget);
-
- /* FIXME: this seems to be happening when then spinner is destroyed!? */
- if (old_screen == screen) return;
-
- /* We'll get mapped again on the new screen, but not unmapped from
- * the old screen, so remove timeout here.
- */
- ephy_spinner_remove_update_callback (spinner);
-
- ephy_spinner_unload_images (spinner);
-
- if (old_screen != NULL)
- {
- g_signal_handlers_disconnect_by_func
- (gtk_icon_theme_get_for_screen (old_screen),
- G_CALLBACK (icon_theme_changed_cb), spinner);
- }
-
- details->icon_theme = gtk_icon_theme_get_for_screen (screen);
- g_signal_connect (details->icon_theme, "changed",
- G_CALLBACK (icon_theme_changed_cb), spinner);
-}
-
-static void
-ephy_spinner_class_init (EphySpinnerClass *class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
-
- parent_class = g_type_class_peek_parent (class);
-
- object_class->dispose = ephy_spinner_dispose;
- object_class->finalize = ephy_spinner_finalize;
-
- widget_class->draw = ephy_spinner_draw;
- widget_class->size_request = ephy_spinner_size_request;
- widget_class->map = ephy_spinner_map;
- widget_class->unmap = ephy_spinner_unmap;
- widget_class->screen_changed = ephy_spinner_screen_changed;
-
- g_type_class_add_private (object_class, sizeof (EphySpinnerDetails));
-}
-
-/**
- * ephy_spinner_start:
- * @spinner: an #EphySpinner
- *
- * Starts the spinner animation.
- **/
-void
-ephy_spinner_start (EphySpinner *spinner)
-{
- EphySpinnerDetails *details = spinner->details;
-
- details->spinning = TRUE;
-
- if (gtk_widget_get_mapped (GTK_WIDGET (spinner)) &&
- details->timer_task == 0 &&
- ephy_spinner_load_images (spinner))
- {
- /* the 0th frame is the 'rest' icon */
- details->current_image = MIN (1, details->images->n_animation_pixbufs);
-
- details->timer_task =
- g_timeout_add_full (G_PRIORITY_LOW,
- details->timeout,
- (GSourceFunc) bump_spinner_frame_cb,
- spinner,
- NULL);
- }
-}
-
-/**
- * ephy_spinner_stop:
- * @spinner: an #EphySpinner
- *
- * Stops the spinner animation.
- *
- **/
-void
-ephy_spinner_stop (EphySpinner *spinner)
-{
- EphySpinnerDetails *details = spinner->details;
-
- details->spinning = FALSE;
- details->current_image = 0;
-
- if (details->timer_task != 0)
- {
- ephy_spinner_remove_update_callback (spinner);
-
- //if (gtk_widget_get_mapped (GTK_WIDGET (spinner)))
- {
- gtk_widget_queue_draw (GTK_WIDGET (spinner));
- }
- }
-}
-
-/**
- * ephy_spinner_set_size:
- * @spinner: an #EphySpinner
- * @size: a new size for the spinner, as a #GtkIconSize
- *
- * Set the size of the spinner to @size.
- *
- **/
-void
-ephy_spinner_set_size (EphySpinner *spinner,
- GtkIconSize size)
-{
- if (size == GTK_ICON_SIZE_INVALID)
- {
- size = GTK_ICON_SIZE_DIALOG;
- }
-
- if (size != spinner->details->size)
- {
- ephy_spinner_unload_images (spinner);
-
- spinner->details->size = size;
-
- gtk_widget_queue_resize (GTK_WIDGET (spinner));
- }
-}
-
-/**
- * ephy_spinner_new:
- *
- * Creates a new #EphySpinner. The spinner is a widget
- * that gives the user feedback about network status with
- * an animated image.
- *
- * Returns: the spinner #GtkWidget
- *
- **/
-GtkWidget *
-ephy_spinner_new (void)
-{
- return GTK_WIDGET (g_object_new (EPHY_TYPE_SPINNER, NULL));
-}
diff --git a/lib/widgets/ephy-spinner.h b/lib/widgets/ephy-spinner.h
deleted file mode 100644
index bf376db97..000000000
--- a/lib/widgets/ephy-spinner.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/*
- * Copyright © 2000 Eazel, Inc.
- * Copyright © 2004, 2006 Christian Persch
- *
- * Nautilus is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Nautilus 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author: Andy Hertzfeld <andy@eazel.com>
- *
- */
-
-#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION)
-#error "Only <epiphany/epiphany.h> can be included directly."
-#endif
-
-#ifndef EPHY_SPINNER_H
-#define EPHY_SPINNER_H
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define EPHY_TYPE_SPINNER (ephy_spinner_get_type ())
-#define EPHY_SPINNER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_SPINNER, EphySpinner))
-#define EPHY_SPINNER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_SPINNER, EphySpinnerClass))
-#define EPHY_IS_SPINNER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_SPINNER))
-#define EPHY_IS_SPINNER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_SPINNER))
-#define EPHY_SPINNER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_SPINNER, EphySpinnerClass))
-
-typedef struct _EphySpinner EphySpinner;
-typedef struct _EphySpinnerClass EphySpinnerClass;
-typedef struct _EphySpinnerDetails EphySpinnerDetails;
-
-struct _EphySpinner
-{
- GtkWidget parent;
-
- /*< private >*/
- EphySpinnerDetails *details;
-};
-
-struct _EphySpinnerClass
-{
- GtkWidgetClass parent_class;
-};
-
-GType ephy_spinner_get_type (void);
-
-GtkWidget *ephy_spinner_new (void);
-
-void ephy_spinner_start (EphySpinner *spinner);
-
-void ephy_spinner_stop (EphySpinner *spinner);
-
-void ephy_spinner_set_size (EphySpinner *spinner,
- GtkIconSize size);
-
-G_END_DECLS
-
-#endif /* EPHY_SPINNER_H */
diff --git a/lib/widgets/testspinner.c b/lib/widgets/testspinner.c
deleted file mode 100644
index be5d256f1..000000000
--- a/lib/widgets/testspinner.c
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Copyright © 2005, 2006 Christian Persch
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include <glib.h>
-#include <gtk/gtk.h>
-
-#define COMPILING_TESTSPINNER
-#define LOG(msg, args...) g_print(msg, ## args); g_print ("\n")
-#define START_PROFILER(name)
-#define STOP_PROFILER(name)
-
-#include "ephy-spinner.c"
-#include "ephy-spinner-tool-item.c"
-
-#define MOVE_TIMEOUT 211 /* ms */
-
-static void start_or_stop (GtkToggleButton *button, EphySpinner *spinner)
-{
- if (gtk_toggle_button_get_active (button))
- {
- ephy_spinner_start (spinner);
- }
- else
- {
- ephy_spinner_stop (spinner);
- }
-}
-
-static void add_spinner (GtkTable *table,
- int row,
- GtkIconSize size,
- const char *sizename,
- guint interval,
- gboolean start)
-{
- GtkWidget *label, *frame, *button, *spinner;
- char *text;
-
- text = g_strdup_printf ("%s size:", sizename);
- label = gtk_label_new (text);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
- gtk_table_attach_defaults (table, label, 0, 1, row, row + 1);
- g_free (text);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
- gtk_table_attach (table, frame, 1, 2, row, row + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
-
- spinner = ephy_spinner_new ();
- ephy_spinner_set_size (EPHY_SPINNER (spinner), size);
- gtk_container_add (GTK_CONTAINER (frame), spinner);
-
- button = gtk_check_button_new_with_label ("Spin");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), start);
- start_or_stop (GTK_TOGGLE_BUTTON (button), EPHY_SPINNER (spinner));
- g_signal_connect (button, "toggled", G_CALLBACK (start_or_stop), spinner);
- gtk_table_attach_defaults (table, button, 2, 3, row, row + 1);
-}
-
-static void move_window (GtkWindow *window)
-{
- GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (window));
- GdkDisplay *display = gdk_screen_get_display (screen);
- gint number_of_screens = gdk_display_get_n_screens (display);
- gint screen_num = gdk_screen_get_number (screen);
-
- if ((screen_num + 1) < number_of_screens)
- {
- gtk_window_set_screen (window, gdk_display_get_screen (display, screen_num + 1));
- }
- else
- {
- gtk_window_set_screen (window, gdk_display_get_screen (display, 0));
- }
-}
-
-static gboolean
-move_true (GtkWindow *window)
-{
- move_window (window);
- return TRUE;
-}
-
-static void
-start_or_stop_repeated_moves (GtkWindow *window)
-{
- static guint timeout = 0;
-
- if (timeout == 0)
- {
- timeout = g_timeout_add (MOVE_TIMEOUT, (GSourceFunc) move_true, window);
- }
- else
- {
- g_source_remove (timeout);
- timeout = 0;
- }
-}
-
-static void
-change_toolbar_style_cb (GtkComboBox *combo,
- GtkToolbar *toolbar)
-{
- int value = gtk_combo_box_get_active (combo);
-
- gtk_toolbar_set_style (toolbar, value);
-}
-
-static void
-change_toolbar_icon_size_cb (GtkComboBox *combo,
- GtkToolbar *toolbar)
-{
- int value = gtk_combo_box_get_active (combo);
-
- if (value == GTK_ICON_SIZE_INVALID)
- {
- gtk_toolbar_unset_icon_size (toolbar);
- }
- else
- {
- gtk_toolbar_set_icon_size (toolbar, value);
- }
-}
-
-static void
-spin_toolbar_spinner_cb (GtkToggleButton *button,
- EphySpinnerToolItem *item)
-{
- ephy_spinner_tool_item_set_spinning (item, gtk_toggle_button_get_active (button));
-}
-
-int main(int argc, char **argv)
-{
- GtkWidget *window, *vbox, *vbox2, *widget, *toolbar, *combo;
- GtkToolItem *item;
- GtkTable *table;
- int row = 0, i;
- const char *toolbar_styles[] = {
- "icons",
- "text",
- "both (vertical)",
- "both (horizontal)"
- };
- const char *icon_sizes[] = {
- "default",
- "menu",
- "small toolbar",
- "large toolbar",
- "button",
- "dnd",
- "dialog"
- };
-
- gtk_init (&argc, &argv);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_container_set_border_width (GTK_CONTAINER (window), 12);
-
- vbox = gtk_vbox_new (FALSE, 6);
- gtk_container_add (GTK_CONTAINER (window), vbox);
-
- widget = gtk_table_new (5, 3, FALSE);
- gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
-
- table = GTK_TABLE (widget);
- gtk_table_set_row_spacings (table, 6);
- gtk_table_set_col_spacings (table,12);
-
- add_spinner (table, row++, GTK_ICON_SIZE_INVALID, "Native", 0, FALSE);
- add_spinner (table, row++, GTK_ICON_SIZE_MENU, "Menu", 0, FALSE);
- add_spinner (table, row++, GTK_ICON_SIZE_SMALL_TOOLBAR, "Small toolbar", 0, FALSE);
- add_spinner (table, row++, GTK_ICON_SIZE_LARGE_TOOLBAR, "Large toolbar", 0, FALSE);
- add_spinner (table, row++, GTK_ICON_SIZE_BUTTON, "Button", 0, FALSE);
- add_spinner (table, row++, GTK_ICON_SIZE_DND, "Drag-and-drop", 0, FALSE);
- add_spinner (table, row++, GTK_ICON_SIZE_DIALOG, "Dialog", 0, FALSE);
-
- /* Test toolbar */
- vbox2 = gtk_vbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX (vbox), vbox2, FALSE, FALSE, 0);
-
- toolbar = gtk_toolbar_new ();
- gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH);
- gtk_box_pack_end (GTK_BOX (vbox2), toolbar, FALSE, FALSE, 0);
-
- item = gtk_tool_button_new_from_stock (GTK_STOCK_NEW);
- gtk_tool_item_set_homogeneous (item, FALSE);
- gtk_tool_item_set_is_important (item, TRUE);
- gtk_widget_show (GTK_WIDGET (item));
- gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 0);
-
- item = gtk_tool_button_new_from_stock (GTK_STOCK_OPEN);
- gtk_tool_item_set_homogeneous (item, FALSE);
- gtk_widget_show (GTK_WIDGET (item));
- gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 0);
-
- item = gtk_tool_item_new ();
- gtk_tool_item_set_homogeneous (item, FALSE);
- gtk_widget_show (GTK_WIDGET (item));
- gtk_tool_item_set_expand (item, TRUE);
- gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
-
- item = ephy_spinner_tool_item_new ();
- gtk_widget_show (GTK_WIDGET (item));
- gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
-
- widget = gtk_check_button_new_with_label ("Spin");
- g_signal_connect (widget, "toggled", G_CALLBACK (spin_toolbar_spinner_cb), item);
- gtk_box_pack_start (GTK_BOX (vbox2), widget, FALSE, FALSE, 0);
-
- combo = gtk_combo_box_text_new ();
- g_signal_connect (combo, "changed", G_CALLBACK (change_toolbar_style_cb), toolbar);
- for (i = 0; i < G_N_ELEMENTS (toolbar_styles); ++i)
- {
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), toolbar_styles[i]);
- }
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo), GTK_TOOLBAR_BOTH);
- gtk_box_pack_start (GTK_BOX (vbox2), combo, FALSE, FALSE, 0);
-
- combo = gtk_combo_box_text_new ();
- g_signal_connect (combo, "changed", G_CALLBACK (change_toolbar_icon_size_cb), toolbar);
- for (i = 0; i < G_N_ELEMENTS (icon_sizes); ++i)
- {
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), icon_sizes[i]);
- }
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo), GTK_ICON_SIZE_INVALID);
- gtk_box_pack_start (GTK_BOX (vbox2), combo, FALSE, FALSE, 0);
-
- /* Controls */
- widget = gtk_button_new_with_label ("Move to next screen");
- g_signal_connect_swapped (widget, "clicked", G_CALLBACK (move_window), window);
- gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
-
- widget = gtk_toggle_button_new_with_label ("Move repeatedly to next screen");
- g_signal_connect_swapped (widget, "toggled", G_CALLBACK (start_or_stop_repeated_moves), window);
- gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
-
- widget = gtk_button_new_with_label ("Quit");
- g_signal_connect_swapped (widget, "clicked", G_CALLBACK (gtk_widget_destroy), window);
- gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
-
- gtk_widget_show_all (window);
-
- g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/src/Makefile.am b/src/Makefile.am
index 50e0abfe1..479f5be7a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -285,7 +285,6 @@ EPHY_GIR_H_FILES = \
$(top_srcdir)/lib/egg/egg-editable-toolbar.h \
$(top_srcdir)/lib/egg/egg-toolbars-model.h \
$(top_srcdir)/lib/widgets/ephy-search-entry.h \
- $(top_srcdir)/lib/widgets/ephy-spinner.h \
$(top_srcdir)/src/bookmarks/ephy-bookmarks.h \
$(top_srcdir)/src/ephy-extension.h \
$(top_srcdir)/src/ephy-extensions-manager.h \
@@ -318,7 +317,6 @@ EPHY_GIR_C_FILES = \
$(top_srcdir)/lib/egg/egg-editable-toolbar.c \
$(top_srcdir)/lib/egg/egg-toolbars-model.c \
$(top_srcdir)/lib/widgets/ephy-search-entry.c \
- $(top_srcdir)/lib/widgets/ephy-spinner.c \
$(top_srcdir)/src/bookmarks/ephy-bookmarks.c \
$(top_srcdir)/src/ephy-extension.c \
$(top_srcdir)/src/ephy-extensions-manager.c \
diff --git a/src/ephy-fullscreen-popup.c b/src/ephy-fullscreen-popup.c
index af1024928..9b47d8823 100644
--- a/src/ephy-fullscreen-popup.c
+++ b/src/ephy-fullscreen-popup.c
@@ -21,7 +21,6 @@
#include "config.h"
#include "ephy-fullscreen-popup.h"
-#include "ephy-spinner.h"
#include "ephy-debug.h"
#include <glib/gi18n.h>
@@ -34,7 +33,6 @@ struct _EphyFullscreenPopupPrivate
{
EphyWindow *window;
GtkWidget *frame;
- EphySpinner *spinner;
GtkWidget *lock;
GtkWidget *lock_ebox;
GtkWidget *button;
@@ -93,26 +91,10 @@ ephy_fullscreen_popup_update_visibility (EphyFullscreenPopup *popup)
g_object_set (priv->button, "visible", priv->show_button,
"sensitive", priv->show_button, NULL);
g_object_set (priv->frame, "visible", show_frame, NULL);
- g_object_set (priv->spinner, "visible", priv->spinning, NULL);
g_object_set (priv->lock_ebox, "visible", priv->show_lock, NULL);
}
static void
-ephy_fullscreen_popup_update_spinner (EphyFullscreenPopup *popup)
-{
- EphyFullscreenPopupPrivate *priv = popup->priv;
-
- if (priv->spinning && gtk_widget_get_visible (GTK_WIDGET (popup)))
- {
- ephy_spinner_start (priv->spinner);
- }
- else
- {
- ephy_spinner_stop (priv->spinner);
- }
-}
-
-static void
ephy_fullscreen_popup_update_position (EphyFullscreenPopup *popup)
{
GtkWidget *widget = GTK_WIDGET (popup);
@@ -172,17 +154,6 @@ ephy_fullscreen_popup_set_show_leave (EphyFullscreenPopup *popup,
}
void
-ephy_fullscreen_popup_set_spinning (EphyFullscreenPopup *popup,
- gboolean spinning)
-{
- EphyFullscreenPopupPrivate *priv = popup->priv;
-
- priv->spinning = spinning;
- ephy_fullscreen_popup_update_visibility (popup);
- ephy_fullscreen_popup_update_spinner (popup);
-}
-
-void
ephy_fullscreen_popup_set_security_state (EphyFullscreenPopup *popup,
gboolean show_lock,
const char *stock,
@@ -244,11 +215,6 @@ ephy_fullscreen_popup_constructor (GType type,
gtk_container_add (GTK_CONTAINER (priv->frame), frame_hbox);
gtk_widget_show (frame_hbox);
- /* add spinner */
- priv->spinner = EPHY_SPINNER (ephy_spinner_new ());
- ephy_spinner_set_size (EPHY_SPINNER (priv->spinner), GTK_ICON_SIZE_BUTTON);
- gtk_box_pack_start (GTK_BOX (frame_hbox), GTK_WIDGET (priv->spinner), FALSE, FALSE, 0);
-
/* lock */
priv->lock = gtk_image_new ();
gtk_widget_show (priv->lock);
@@ -321,26 +287,6 @@ ephy_fullscreen_popup_set_property (GObject *object,
}
static void
-ephy_fullscreen_popup_show (GtkWidget *widget)
-{
- EphyFullscreenPopup *popup = EPHY_FULLSCREEN_POPUP (widget);
-
- GTK_WIDGET_CLASS (ephy_fullscreen_popup_parent_class)->show (widget);
-
- ephy_fullscreen_popup_update_spinner (popup);
-}
-
-static void
-ephy_fullscreen_popup_hide (GtkWidget *widget)
-{
- EphyFullscreenPopup *popup = EPHY_FULLSCREEN_POPUP (widget);
-
- GTK_WIDGET_CLASS (ephy_fullscreen_popup_parent_class)->hide (widget);
-
- ephy_fullscreen_popup_update_spinner (popup);
-}
-
-static void
ephy_fullscreen_popup_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
@@ -375,8 +321,6 @@ ephy_fullscreen_popup_class_init (EphyFullscreenPopupClass *klass)
object_class->get_property = ephy_fullscreen_popup_get_property;
object_class->set_property = ephy_fullscreen_popup_set_property;
- widget_class->show = ephy_fullscreen_popup_show;
- widget_class->hide = ephy_fullscreen_popup_hide;
widget_class->size_request = ephy_fullscreen_popup_size_request;
widget_class->realize = ephy_fullscreen_popup_realize;
diff --git a/src/ephy-fullscreen-popup.h b/src/ephy-fullscreen-popup.h
index 26441f976..65614bbd6 100644
--- a/src/ephy-fullscreen-popup.h
+++ b/src/ephy-fullscreen-popup.h
@@ -64,9 +64,6 @@ GtkWidget *ephy_fullscreen_popup_new (EphyWindow *window);
void ephy_fullscreen_popup_set_show_leave (EphyFullscreenPopup *popup,
gboolean show_button);
-void ephy_fullscreen_popup_set_spinning (EphyFullscreenPopup *popup,
- gboolean spinning);
-
void ephy_fullscreen_popup_set_security_state (EphyFullscreenPopup *popup,
gboolean show_lock,
const char *stock,
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index 23805d267..b9a2e240c 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -32,7 +32,6 @@
#include "ephy-embed-utils.h"
#include "ephy-window.h"
#include "ephy-shell.h"
-#include "ephy-spinner.h"
#include "ephy-link.h"
#include "ephy-debug.h"
@@ -515,11 +514,11 @@ sync_load_status (EphyWebView *view, GParamSpec *pspec, GtkWidget *proxy)
{
gtk_widget_hide (icon);
gtk_widget_show (spinner);
- ephy_spinner_start (EPHY_SPINNER (spinner));
+ gtk_spinner_start (GTK_SPINNER (spinner));
}
else
{
- ephy_spinner_stop (EPHY_SPINNER (spinner));
+ gtk_spinner_stop (GTK_SPINNER (spinner));
gtk_widget_hide (spinner);
gtk_widget_show (icon);
}
@@ -598,8 +597,7 @@ build_tab_label (EphyNotebook *nb, EphyEmbed *embed)
gtk_widget_show (hbox);
/* setup load feedback */
- spinner = ephy_spinner_new ();
- ephy_spinner_set_size (EPHY_SPINNER (spinner), GTK_ICON_SIZE_MENU);
+ spinner = gtk_spinner_new ();
gtk_box_pack_start (GTK_BOX (hbox), spinner, FALSE, FALSE, 0);
/* setup site icon, empty by default */
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c
index c3f0ed7f0..a6edc29c0 100644
--- a/src/ephy-toolbar.c
+++ b/src/ephy-toolbar.c
@@ -34,7 +34,6 @@
#include "ephy-navigation-up-action.h"
#include "ephy-topic-action.h"
#include "ephy-zoom-action.h"
-#include "ephy-spinner-tool-item.h"
#include "ephy-dnd.h"
#include "ephy-shell.h"
#include "ephy-stock-icons.h"
@@ -71,7 +70,6 @@ struct _EphyToolbarPrivate
GtkActionGroup *action_group;
GtkAction *actions[LAST_ACTION];
GtkWidget *fixed_toolbar;
- EphySpinnerToolItem *spinner;
GtkToolItem *sep_item;
GtkToolItem *exit_button;
gulong set_focus_handler;
@@ -136,14 +134,6 @@ ephy_toolbar_update_fixed_visibility (EphyToolbar *toolbar)
g_object_set (priv->fixed_toolbar, "visible", show, NULL);
}
-static void
-ephy_toolbar_update_spinner (EphyToolbar *toolbar)
-{
- EphyToolbarPrivate *priv = toolbar->priv;
-
- ephy_spinner_tool_item_set_spinning (priv->spinner, priv->spinning);
-}
-
static void
maybe_finish_activation_cb (EphyWindow *window,
GtkWidget *widget,
@@ -572,24 +562,6 @@ ephy_toolbar_set_security_state (EphyToolbar *toolbar,
}
/**
- * ephy_toolbar_set_spinning:
- * @toolbar: an #EphyToolbar widget
- * @spinning: %TRUE to set the internal #EphySpinner as active
- *
- * Controls the internal #EphySpinner activity.
- **/
-void
-ephy_toolbar_set_spinning (EphyToolbar *toolbar,
- gboolean spinning)
-{
- EphyToolbarPrivate *priv = toolbar->priv;
-
- priv->spinning = spinning != FALSE;
-
- ephy_toolbar_update_spinner (toolbar);
-}
-
-/**
* ephy_toolbar_set_zoom:
* @toolbar: an #EphyToolbar widget
* @can_zoom: %TRUE if the current #EphyWebView can zoom
@@ -611,26 +583,6 @@ ephy_toolbar_set_zoom (EphyToolbar *toolbar,
/* Class implementation */
static void
-ephy_toolbar_show (GtkWidget *widget)
-{
- EphyToolbar *toolbar = EPHY_TOOLBAR (widget);
-
- GTK_WIDGET_CLASS (ephy_toolbar_parent_class)->show (widget);
-
- ephy_toolbar_update_spinner (toolbar);
-}
-
-static void
-ephy_toolbar_hide (GtkWidget *widget)
-{
- EphyToolbar *toolbar = EPHY_TOOLBAR (widget);
-
- GTK_WIDGET_CLASS (ephy_toolbar_parent_class)->hide (widget);
-
- ephy_toolbar_update_spinner (toolbar);
-}
-
-static void
ephy_toolbar_init (EphyToolbar *toolbar)
{
EphyToolbarPrivate *priv;
@@ -659,10 +611,6 @@ ephy_toolbar_constructor (GType type,
gtoolbar = GTK_TOOLBAR (priv->fixed_toolbar);
gtk_toolbar_set_show_arrow (gtoolbar, FALSE);
- priv->spinner = EPHY_SPINNER_TOOL_ITEM (ephy_spinner_tool_item_new ());
- gtk_toolbar_insert (gtoolbar, GTK_TOOL_ITEM (priv->spinner), -1);
- gtk_widget_show (GTK_WIDGET (priv->spinner));
-
priv->sep_item = gtk_separator_tool_item_new ();
gtk_toolbar_insert (gtoolbar, priv->sep_item, -1);
@@ -725,16 +673,12 @@ static void
ephy_toolbar_class_init (EphyToolbarClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->constructor = ephy_toolbar_constructor;
object_class->finalize = ephy_toolbar_finalize;
object_class->set_property = ephy_toolbar_set_property;
object_class->get_property = ephy_toolbar_get_property;
- widget_class->show = ephy_toolbar_show;
- widget_class->hide = ephy_toolbar_hide;
-
/**
* EphyToolbar::activation-finished:
* @toolbar: the object which received the signal.
diff --git a/src/ephy-toolbar.h b/src/ephy-toolbar.h
index 060a3ad5a..322543633 100644
--- a/src/ephy-toolbar.h
+++ b/src/ephy-toolbar.h
@@ -98,9 +98,6 @@ void ephy_toolbar_set_security_state (EphyToolbar *toolbar,
const char *stock_id,
const char *tooltip);
-void ephy_toolbar_set_spinning (EphyToolbar *toolbar,
- gboolean spinning);
-
void ephy_toolbar_set_zoom (EphyToolbar *toolbar,
gboolean can_zoom,
float zoom);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 7cd5253e1..3f7efa02a 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1804,15 +1804,6 @@ sync_tab_load_status (EphyWebView *view,
ephy_action_change_sensitivity_flags (action, SENS_FLAG_LOADING, loading);
action = gtk_action_group_get_action (action_group, "FilePrint");
ephy_action_change_sensitivity_flags (action, SENS_FLAG_LOADING, loading);
-
- ephy_toolbar_set_spinning (priv->toolbar, loading);
-
- if (priv->fullscreen_popup)
- {
- ephy_fullscreen_popup_set_spinning
- (EPHY_FULLSCREEN_POPUP (priv->fullscreen_popup),
- loading);
- }
}
static void