[nemiver] 598444 Use Gtk::Spinner instead of custom spinner widget
- From: Dodji Seketeli <dodji src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver] 598444 Use Gtk::Spinner instead of custom spinner widget
- Date: Wed, 23 Mar 2011 20:39:36 +0000 (UTC)
commit b4bdfe9735f8b625324625c6da40b77e2c71c2c7
Author: Kalev Lember <kalev smartlink ee>
Date: Mon Mar 21 01:35:35 2011 +0200
598444 Use Gtk::Spinner instead of custom spinner widget
* src/uicommon/nmv-spinner-tool-item.[cc,h]: Rewrote to use
Gtk::Spinner instead of EphySpinner.
* src/persp/dbgperspective/nmv-dbg-perspective.cc: Adapt to
nmv-spinner-tool-item changes.
* src/uicommon/ephy-spinner-tool-item.[c,h]:
* src/uicommon/ephy-spinner.[c,h]:
* src/uicommon/nmv-spinner.[cc,h]: Removed EphySpinner and its C++
wrappers.
* src/uicommon/Makefile.am: Removed references to deleted files.
* configure.ac: Bumped gtkmm minimum version to 2.20.
configure.ac | 2 +-
src/persp/dbgperspective/nmv-dbg-perspective.cc | 6 +-
src/uicommon/Makefile.am | 6 -
src/uicommon/ephy-spinner-tool-item.c | 115 ---
src/uicommon/ephy-spinner-tool-item.h | 62 --
src/uicommon/ephy-spinner.c | 961 -----------------------
src/uicommon/ephy-spinner.h | 73 --
src/uicommon/nmv-spinner-tool-item.cc | 109 +---
src/uicommon/nmv-spinner-tool-item.h | 26 +-
src/uicommon/nmv-spinner.cc | 141 ----
src/uicommon/nmv-spinner.h | 64 --
11 files changed, 32 insertions(+), 1533 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 397b645..aa7f8df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,7 +46,7 @@ LIBGNOMEVFS_VERSION=2.14
AC_SUBST([LIBGNOMEVFS_VERSION])
LIBXML2_VERSION=2.6.22
AC_SUBST([LIBXML2_VERSION])
-LIBGTKMM_VERSION=2.12.0
+LIBGTKMM_VERSION=2.20
AC_SUBST([LIBGTKMM_VERSION])
LIBGTKSOURCEVIEWMM1_VERSION=0.3.0
AC_SUBST([LIBGTKSOURCEVIEWMM1_VERSION])
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index df2edf7..05ca088 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -912,7 +912,7 @@ struct DBGPerspective::Priv {
SafePtr<Gtk::Paned> body_main_paned;
IWorkbench *workbench;
SafePtr<Gtk::HBox> toolbar;
- SpinnerToolItemSafePtr throbber;
+ SafePtr<SpinnerToolItem> throbber;
sigc::signal<void, bool> activated_signal;
sigc::signal<void, bool> attached_to_target_signal;
sigc::signal<void, bool> debugger_ready_signal;
@@ -3873,7 +3873,7 @@ DBGPerspective::init_toolbar ()
{
add_perspective_toolbar_entries ();
- m_priv->throbber = SpinnerToolItem::create ();
+ m_priv->throbber.reset (new SpinnerToolItem);
m_priv->toolbar.reset ((new Gtk::HBox));
THROW_IF_FAIL (m_priv->toolbar);
Gtk::Toolbar *glade_toolbar = dynamic_cast<Gtk::Toolbar*>
@@ -3883,7 +3883,7 @@ DBGPerspective::init_toolbar ()
gtk_separator_tool_item_set_draw (sep->gobj (), false);
sep->set_expand (true);
glade_toolbar->insert (*sep, -1);
- glade_toolbar->insert (m_priv->throbber->get_widget (), -1);
+ glade_toolbar->insert (*m_priv->throbber, -1);
m_priv->toolbar->pack_start (*glade_toolbar);
m_priv->toolbar->show_all ();
}
diff --git a/src/uicommon/Makefile.am b/src/uicommon/Makefile.am
index 1da8da3..1cca586 100644
--- a/src/uicommon/Makefile.am
+++ b/src/uicommon/Makefile.am
@@ -10,12 +10,6 @@ $(h)/nmv-dialog.cc \
$(h)/nmv-dialog.h \
$(h)/nmv-locate-file-dialog.cc \
$(h)/nmv-locate-file-dialog.h \
-$(h)/ephy-spinner.c \
-$(h)/ephy-spinner.h \
-$(h)/ephy-spinner-tool-item.c \
-$(h)/ephy-spinner-tool-item.h \
-$(h)/nmv-spinner.cc \
-$(h)/nmv-spinner.h \
$(h)/nmv-spinner-tool-item.h \
$(h)/nmv-spinner-tool-item.cc \
$(h)/nmv-popup-tip.cc \
diff --git a/src/uicommon/nmv-spinner-tool-item.cc b/src/uicommon/nmv-spinner-tool-item.cc
index 1b6f24e..859499d 100644
--- a/src/uicommon/nmv-spinner-tool-item.cc
+++ b/src/uicommon/nmv-spinner-tool-item.cc
@@ -22,120 +22,49 @@
*
*See COPYRIGHT file copyright information.
*/
-#include <gtkmm/toolbutton.h>
-#include "common/nmv-exception.h"
#include "nmv-spinner-tool-item.h"
-#include "ephy-spinner-tool-item.h"
+#include <gtkmm/spinner.h>
NEMIVER_BEGIN_NAMESPACE (nemiver)
-struct ESpinnerRef {
- void operator () (EphySpinnerToolItem *o)
- {
- if (o && G_IS_OBJECT (o)) {
- g_object_ref (G_OBJECT (o));
- } else {
- LOG_ERROR ("bad ephy spinner");
- }
- }
-};
-
-struct ESpinnerUnref {
- void operator () (EphySpinnerToolItem *o)
- {
- if (o && G_IS_OBJECT (o)) {
- g_object_unref (G_OBJECT (o));
- } else {
- LOG_ERROR ("bad ephy spinner");
- }
- }
-
-};
-
-struct SpinnerToolItem::Priv {
- SafePtr<EphySpinnerToolItem, ESpinnerRef, ESpinnerUnref> spinner;
- bool is_started;
- Gtk::ToolItem *widget;
-
- Priv () :
- spinner (EPHY_SPINNER_TOOL_ITEM (ephy_spinner_tool_item_new ()), true),
- is_started (false),
- widget (0)
- {
- THROW_IF_FAIL (GTK_IS_WIDGET (spinner.get ()));
- widget = Glib::wrap (GTK_TOOL_ITEM (spinner.get ()));
- THROW_IF_FAIL (widget);
- }
-
- ~Priv ()
- {
- widget = 0;
- is_started = false;
- }
-};//end struct SpinnerToolItem::Priv
-
-SpinnerToolItem::~SpinnerToolItem ()
-{
-}
SpinnerToolItem::SpinnerToolItem ()
{
- m_priv.reset (new Priv);
+ m_spinner.reset (new Gtk::Spinner);
+
+ // Don't recursively show the spinner with show_all ()
+ m_spinner->set_no_show_all ();
+
+ add (*m_spinner);
}
-SpinnerToolItemSafePtr
-SpinnerToolItem::create ()
+SpinnerToolItem::~SpinnerToolItem ()
{
- SpinnerToolItemSafePtr result (new SpinnerToolItem);
- THROW_IF_FAIL (result);
- return result;
}
void
SpinnerToolItem::start ()
{
- THROW_IF_FAIL (m_priv);
- THROW_IF_FAIL (m_priv->spinner);
-
- ephy_spinner_tool_item_set_spinning (m_priv->spinner.get (), true);
- m_priv->is_started = true;
-}
-
-bool
-SpinnerToolItem::is_started () const
-{
- THROW_IF_FAIL (m_priv);
- THROW_IF_FAIL (m_priv->spinner);
-
- return m_priv->is_started ;
+ m_spinner->start ();
+ m_spinner->show ();
}
void
SpinnerToolItem::stop ()
{
- THROW_IF_FAIL (m_priv);
- THROW_IF_FAIL (m_priv->spinner);
-
- ephy_spinner_tool_item_set_spinning (m_priv->spinner.get (), false);
- m_priv->is_started = false;
+ m_spinner->stop ();
+ m_spinner->hide ();
}
void
-SpinnerToolItem::toggle_state ()
+SpinnerToolItem::on_toolbar_reconfigured ()
{
- if (is_started ()) {
- stop ();
- } else {
- start ();
- }
-}
+ int spinner_width;
+ int spinner_height;
+ Gtk::IconSize::lookup (get_icon_size (), spinner_width, spinner_height);
+ m_spinner->set_size_request (spinner_width, spinner_height);
-Gtk::ToolItem&
-SpinnerToolItem::get_widget () const
-{
- THROW_IF_FAIL (m_priv);
- THROW_IF_FAIL (m_priv->widget);
- return *m_priv->widget;
+ // Call base class
+ Gtk::ToolItem::on_toolbar_reconfigured ();
}
NEMIVER_END_NAMESPACE (nemiver)
-
diff --git a/src/uicommon/nmv-spinner-tool-item.h b/src/uicommon/nmv-spinner-tool-item.h
index 2e650e3..08c4a3f 100644
--- a/src/uicommon/nmv-spinner-tool-item.h
+++ b/src/uicommon/nmv-spinner-tool-item.h
@@ -25,36 +25,28 @@
#ifndef __NMV_SPINNER_TOOL_ITEM_H__
#define __NMV_SPINNER_TOOL_ITEM_H__
-#include "common/nmv-object.h"
+#include <gtkmm/toolitem.h>
#include "common/nmv-safe-ptr-utils.h"
namespace Gtk {
- class ToolItem;
+ class Spinner;
}
NEMIVER_BEGIN_NAMESPACE (nemiver)
using nemiver::common::SafePtr;
-using nemiver::common::ObjectRef;
-using nemiver::common::ObjectUnref;
-using nemiver::common::Object;
-class SpinnerToolItem;
-typedef SafePtr<SpinnerToolItem, ObjectRef, ObjectUnref> SpinnerToolItemSafePtr;
-
-class SpinnerToolItem : public Object {
- struct Priv;
- SafePtr<Priv> m_priv;
- SpinnerToolItem ();
+class SpinnerToolItem : public Gtk::ToolItem {
+ SafePtr<Gtk::Spinner> m_spinner;
public:
- virtual ~SpinnerToolItem () ;
- static SpinnerToolItemSafePtr create ();
+ SpinnerToolItem ();
+ virtual ~SpinnerToolItem ();
void start ();
- bool is_started () const;
void stop ();
- void toggle_state ();
- Gtk::ToolItem& get_widget () const;
+
+protected:
+ virtual void on_toolbar_reconfigured ();
};//end class SpinnerToolItem
NEMIVER_END_NAMESPACE (nemiver)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]