summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Valavanis <valavanisalex@gmail.com>2012-02-11 20:54:53 +0000
committerAlex Valavanis <valavanisalex@gmail.com>2012-02-11 20:54:53 +0000
commit88751013c436beeb04e6f3d51cc6a8c3efdf55f3 (patch)
tree57e714523079597e34d37bfacf83f27fcdd01447 /src
parentGet rid of deprecated gtk_marshal_* and some old GtkComboBox API (diff)
downloadinkscape-88751013c436beeb04e6f3d51cc6a8c3efdf55f3.tar.gz
inkscape-88751013c436beeb04e6f3d51cc6a8c3efdf55f3.zip
Replace old ComboText with Gtk::ComboBoxText
(bzr r10960)
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/document-properties.h1
-rw-r--r--src/ui/widget/Makefile_insert2
-rw-r--r--src/ui/widget/combo-text.cpp92
-rw-r--r--src/ui/widget/combo-text.h66
-rw-r--r--src/ui/widget/page-sizer.h1
-rw-r--r--src/ui/widget/unit-menu.cpp14
-rw-r--r--src/ui/widget/unit-menu.h4
7 files changed, 17 insertions, 163 deletions
diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h
index 77076c33a..103ace10b 100644
--- a/src/ui/dialog/document-properties.h
+++ b/src/ui/dialog/document-properties.h
@@ -18,6 +18,7 @@
#include <stddef.h>
#include <sigc++/sigc++.h>//
#include <gtkmm/comboboxtext.h>
+#include <gtkmm/liststore.h>
#include <gtkmm/notebook.h>
#include <gtkmm/textview.h>
#include <glibmm/i18n.h>
diff --git a/src/ui/widget/Makefile_insert b/src/ui/widget/Makefile_insert
index bd23b6782..4dc83a81d 100644
--- a/src/ui/widget/Makefile_insert
+++ b/src/ui/widget/Makefile_insert
@@ -9,8 +9,6 @@ ink_common_sources += \
ui/widget/color-preview.cpp \
ui/widget/color-preview.h \
ui/widget/combo-enums.h \
- ui/widget/combo-text.cpp \
- ui/widget/combo-text.h \
ui/widget/dock.h \
ui/widget/dock.cpp \
ui/widget/dock-item.h \
diff --git a/src/ui/widget/combo-text.cpp b/src/ui/widget/combo-text.cpp
deleted file mode 100644
index 43428adb8..000000000
--- a/src/ui/widget/combo-text.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Glom
- *
- * Copyright (C) 2001-2004 Murray Cumming
- *
- * 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 of the
- * License, 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "combo-text.h"
-#include <gtk/gtk.h>
-
-ComboText::ComboText()
- : Gtk::ComboBox()
-{
- m_model = Gtk::ListStore::create(m_text_columns);
- set_model(m_model);
- pack_start(m_text_columns.m_column);
-}
-
-
-ComboText::~ComboText()
-{
-
-}
-
-void ComboText::append_text(const Glib::ustring& text)
-{
- gtk_combo_box_append_text(gobj(), text.c_str());
-}
-
-void ComboText::insert_text(int position, const Glib::ustring& text)
-{
- gtk_combo_box_insert_text(gobj(), position, text.c_str());
-}
-
-void ComboText::prepend_text(const Glib::ustring& text)
-{
- gtk_combo_box_prepend_text(gobj(), text.c_str());
-}
-
-Glib::ustring ComboText::get_active_text() const
-{
- Glib::ustring result;
-
- //Get the active row:
- Gtk::TreeModel::iterator active_row = get_active();
- if(active_row)
- {
- Gtk::TreeModel::Row row = *active_row;
- result = row[m_text_columns.m_column];
- }
-
- return result;
-}
-
-void ComboText::clear_text()
-{
- m_model->clear();
-}
-
-void ComboText::set_active_text(const Glib::ustring& text)
-{
- for(Gtk::TreeModel::iterator iter = m_model->children().begin(); iter != m_model->children().end(); ++iter)
- {
- Glib::ustring this_text = (*iter)[m_text_columns.m_column];
-
- if(this_text == text)
- {
- set_active(iter);
- return; //success
- }
- }
-
- //Not found, so mark it as blank:
- unset_active();
-}
diff --git a/src/ui/widget/combo-text.h b/src/ui/widget/combo-text.h
deleted file mode 100644
index 382414fb0..000000000
--- a/src/ui/widget/combo-text.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Glom
- *
- * Copyright (C) 2001-2004 Murray Cumming
- *
- * 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 of the
- * License, 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef GLOM_MODE_DESIGN_COMBO_TEXTGLADE_HH
-#define GLOM_MODE_DESIGN_COMBO_TEXTGLADE_HH
-
-#include <gtkmm/combobox.h>
-
-#include <gtkmm/liststore.h>
-
-/** This class should just derive from Gtk::ComboBoxText and provide a
- * constuctor suitable for libglade's get_widget_derived() template.
- * However, I have reimplemented Gtk::ComboBoxText here temporarily,
- * until the fixes in gtkmm 2.4.3 are widely available.
- */
-class ComboText : public Gtk::ComboBox
-{
- public:
- ComboText();
- virtual ~ComboText();
-
- void append_text(const Glib::ustring& text);
- void insert_text(int position, const Glib::ustring& text);
- void prepend_text(const Glib::ustring& text);
- Glib::ustring get_active_text() const;
-
- //This is not part of ComboBoxText:
- void clear_text();
- void set_active_text(const Glib::ustring& text);
-
- protected:
-
- //Tree model columns:
- //These columns are used by the model that is created by the default constructor
- class TextModelColumns : public Gtk::TreeModel::ColumnRecord
- {
- public:
- TextModelColumns()
- { add(m_column); }
-
- Gtk::TreeModelColumn<Glib::ustring> m_column;
- };
-
- TextModelColumns m_text_columns;
- Glib::RefPtr<Gtk::ListStore> m_model;
-
-};
-
-#endif //GLOM_MODE_DESIGN_COMBO_TEXTGLADE_HH
diff --git a/src/ui/widget/page-sizer.h b/src/ui/widget/page-sizer.h
index 0c814590d..4040bb483 100644
--- a/src/ui/widget/page-sizer.h
+++ b/src/ui/widget/page-sizer.h
@@ -21,6 +21,7 @@
#include <gtkmm/alignment.h>
#include <gtkmm/expander.h>
#include <gtkmm/frame.h>
+#include <gtkmm/liststore.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/table.h>
diff --git a/src/ui/widget/unit-menu.cpp b/src/ui/widget/unit-menu.cpp
index 085783481..86e8c9e58 100644
--- a/src/ui/widget/unit-menu.cpp
+++ b/src/ui/widget/unit-menu.cpp
@@ -34,7 +34,11 @@ bool UnitMenu::setUnitType(UnitType unit_type)
UnitTable::UnitMap::iterator iter = m.begin();
while(iter != m.end()) {
Glib::ustring text = (*iter).first;
+#if WITH_GTKMM_2_24
+ append(text);
+#else
append_text(text);
+#endif
++iter;
}
_type = unit_type;
@@ -45,7 +49,11 @@ bool UnitMenu::setUnitType(UnitType unit_type)
bool UnitMenu::resetUnitType(UnitType unit_type)
{
- clear_text();
+#if WITH_GTKMM_2_24
+ remove_all();
+#else
+ clear_items();
+#endif
return setUnitType(unit_type);
}
@@ -53,7 +61,11 @@ bool UnitMenu::resetUnitType(UnitType unit_type)
void UnitMenu::addUnit(Unit const& u)
{
_unit_table.addUnit(u, false);
+#if WITH_GTKMM_2_24
+ append(u.abbr);
+#else
append_text(u.abbr);
+#endif
}
Unit UnitMenu::getUnit() const
diff --git a/src/ui/widget/unit-menu.h b/src/ui/widget/unit-menu.h
index 61e93bd65..142b11186 100644
--- a/src/ui/widget/unit-menu.h
+++ b/src/ui/widget/unit-menu.h
@@ -10,7 +10,7 @@
#ifndef INKSCAPE_UI_WIDGET_UNIT_H
#define INKSCAPE_UI_WIDGET_UNIT_H
-#include "combo-text.h"
+#include <gtkmm/comboboxtext.h>
#include "util/units.h"
using namespace Inkscape::Util;
@@ -22,7 +22,7 @@ namespace Widget {
/**
* A drop down menu for choosing unit types.
*/
-class UnitMenu : public ComboText
+class UnitMenu : public Gtk::ComboBoxText
{
public: