[epiphany] Port to GtkSpinner



commit 98811918bc8c5065eb4b21feb35c9f4def67341f
Author: Xan Lopez <xan gnome org>
Date:   Mon Nov 2 12:10:40 2009 +0200

    Port to GtkSpinner
    
    https://bugzilla.gnome.org/show_bug.cgi?id=598442

 lib/widgets/ephy-spinner-tool-item.c |   52 +-
 lib/widgets/ephy-spinner.c           |  967 ----------------------------------
 lib/widgets/ephy-spinner.h           |   72 ---
 src/Makefile.am                      |    2 -
 src/ephy-fullscreen-popup.c          |   11 +-
 src/ephy-notebook.c                  |    8 +-
 6 files changed, 34 insertions(+), 1078 deletions(-)
---
diff --git a/lib/widgets/ephy-spinner-tool-item.c b/lib/widgets/ephy-spinner-tool-item.c
index 96af434..21583e8 100644
--- a/lib/widgets/ephy-spinner-tool-item.c
+++ b/lib/widgets/ephy-spinner-tool-item.c
@@ -24,7 +24,6 @@
 #endif
 
 #include "ephy-spinner-tool-item.h"
-#include "ephy-spinner.h"
 
 G_DEFINE_TYPE (EphySpinnerToolItem, ephy_spinner_tool_item, GTK_TYPE_TOOL_ITEM)
 
@@ -33,7 +32,7 @@ ephy_spinner_tool_item_init (EphySpinnerToolItem *item)
 {
 	GtkWidget *spinner;
 
-	spinner = ephy_spinner_new ();
+	spinner = gtk_spinner_new ();
 	gtk_container_add (GTK_CONTAINER (item), spinner);
 	gtk_widget_show (spinner);
 }
@@ -41,38 +40,38 @@ ephy_spinner_tool_item_init (EphySpinnerToolItem *item)
 static void
 ephy_spinner_tool_item_toolbar_reconfigured (GtkToolItem *tool_item)
 {
-	EphySpinner *spinner;
-	GtkToolbarStyle style;
-	GtkIconSize spinner_size;
+       GtkWidget *spinner;
+       GtkToolbarStyle style;
+       gint size;
 
-	spinner = EPHY_SPINNER (gtk_bin_get_child (GTK_BIN (tool_item)));
-	g_return_if_fail (spinner);
+       spinner = gtk_bin_get_child (GTK_BIN (tool_item));
+       g_return_if_fail (spinner);
 
-	style = gtk_tool_item_get_toolbar_style (tool_item);
+       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! */
+       /* 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;
-	}
+       if (style == GTK_TOOLBAR_BOTH)
+       {
+	       size = 44;
+       }
+       else
+       {
+	       size = 20;
+       }
 
-	ephy_spinner_set_size (spinner, spinner_size);
+       gtk_widget_set_size_request (spinner, size, 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);
+       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);
+       GtkToolItemClass *tool_item_class = GTK_TOOL_ITEM_CLASS (klass);
 
-	tool_item_class->toolbar_reconfigured = ephy_spinner_tool_item_toolbar_reconfigured;
+       tool_item_class->toolbar_reconfigured = ephy_spinner_tool_item_toolbar_reconfigured;
 }
 
 /*
@@ -99,17 +98,18 @@ void
 ephy_spinner_tool_item_set_spinning (EphySpinnerToolItem *item,
 				     gboolean spinning)
 {
-	EphySpinner *spinner;
+	GtkWidget *spinner;
 
-	spinner = EPHY_SPINNER (gtk_bin_get_child (GTK_BIN (item)));
+	spinner = gtk_bin_get_child (GTK_BIN (item));
 	g_return_if_fail (spinner);
 
 	if (spinning)
 	{
-		ephy_spinner_start (spinner);
+		gtk_spinner_start (GTK_SPINNER (spinner));
 	}
 	else
 	{
-		ephy_spinner_stop (spinner);
+		gtk_spinner_stop (GTK_SPINNER (spinner));
+		gtk_spinner_reset (GTK_SPINNER (spinner));
 	}
 }
diff --git a/src/Makefile.am b/src/Makefile.am
index 50e0abf..479f5be 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 af10249..4ed7a82 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,7 @@ struct _EphyFullscreenPopupPrivate
 {
 	EphyWindow *window;
 	GtkWidget *frame;
-	EphySpinner *spinner;
+	GtkWidget *spinner;
 	GtkWidget *lock;
 	GtkWidget *lock_ebox;
 	GtkWidget *button;
@@ -104,11 +103,12 @@ ephy_fullscreen_popup_update_spinner (EphyFullscreenPopup *popup)
 
 	if (priv->spinning && gtk_widget_get_visible (GTK_WIDGET (popup)))
 	{
-		ephy_spinner_start (priv->spinner);
+		gtk_spinner_start (GTK_SPINNER (priv->spinner));
 	}
 	else
 	{
-		ephy_spinner_stop (priv->spinner);
+		gtk_spinner_stop (GTK_SPINNER (priv->spinner));
+		gtk_spinner_reset (GTK_SPINNER (priv->spinner));
 	}
 }
 
@@ -245,8 +245,7 @@ ephy_fullscreen_popup_constructor (GType type,
 	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);
+	priv->spinner = gtk_spinner_new ();
 	gtk_box_pack_start (GTK_BOX (frame_hbox), GTK_WIDGET (priv->spinner), FALSE, FALSE, 0);
 
 	/* lock */
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index 23805d2..b9a2e24 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 */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]