[glom/maemo5] client-only mode: Ifdef out unused code.
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glom/maemo5] client-only mode: Ifdef out unused code.
- Date: Mon, 28 Sep 2009 09:18:58 +0000 (UTC)
commit 53af47a0d767da4b0ec80ab8b0cfb2cfa97d7ef6
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Sep 28 11:08:24 2009 +0200
client-only mode: Ifdef out unused code.
* glom/dialog_existing_or_new.[h|cc]: Ifdef out unused code for the new
document notebook tab in client-only mode.
ChangeLog | 7 ++++
glom/dialog_existing_or_new.cc | 70 +++++++++++++++++++++++++++-------------
glom/dialog_existing_or_new.h | 58 +++++++++++++++++++--------------
glom/dialog_invalid_data.h | 4 +-
4 files changed, 89 insertions(+), 50 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index aa98005..3b74084 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2009-09-28 Murray Cumming <murrayc murrayc com>
+ client-only mode: Ifdef out unused code.
+
+ * glom/dialog_existing_or_new.[h|cc]: Ifdef out unused code for the new
+ document notebook tab in client-only mode.
+
+2009-09-28 Murray Cumming <murrayc murrayc com>
+
Maemo: Removed icons from dialogs.
* glom/glom.glade: Comment out icons in our maemo5 branch.
diff --git a/glom/dialog_existing_or_new.cc b/glom/dialog_existing_or_new.cc
index ee37cc6..f55fea6 100644
--- a/glom/dialog_existing_or_new.cc
+++ b/glom/dialog_existing_or_new.cc
@@ -109,7 +109,6 @@ Dialog_ExistingOrNew::Dialog_ExistingOrNew(BaseObjectType* cobject, const Glib::
#endif //GLOM_ENABLE_CLIENT_ONLY
builder->get_widget("existing_or_new_existing_treeview", m_existing_view);
- builder->get_widget("existing_or_new_new_treeview", m_new_view);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(!m_existing_view || !m_new_view)
@@ -127,8 +126,7 @@ Dialog_ExistingOrNew::Dialog_ExistingOrNew(BaseObjectType* cobject, const Glib::
m_existing_model->set_sort_column(m_existing_columns.m_col_time, Gtk::SORT_DESCENDING);
m_existing_view->set_model(m_existing_model);
- m_new_model = Gtk::TreeStore::create(m_new_columns);
- m_new_view->set_model(m_new_model);
+
m_iter_existing_other = m_existing_model->append();
(*m_iter_existing_other)[m_existing_columns.m_col_title] = _("Select File");
@@ -141,11 +139,7 @@ Dialog_ExistingOrNew::Dialog_ExistingOrNew(BaseObjectType* cobject, const Glib::
m_iter_existing_recent = m_existing_model->append();
(*m_iter_existing_recent)[m_existing_columns.m_col_title] = _("Recently Opened");
- m_iter_new_empty = m_new_model->append();
- (*m_iter_new_empty)[m_new_columns.m_col_title] = _("New Empty Document");
-
- m_iter_new_template = m_new_model->append();
- (*m_iter_new_template)[m_new_columns.m_col_title] = _("New From Template");
+
m_existing_column_title.set_expand(true);
m_existing_column_title.pack_start(m_existing_icon_renderer, false);
@@ -154,18 +148,9 @@ Dialog_ExistingOrNew::Dialog_ExistingOrNew(BaseObjectType* cobject, const Glib::
m_existing_column_title.set_cell_data_func(m_existing_title_renderer, sigc::mem_fun(*this, &Dialog_ExistingOrNew::existing_title_data_func));
m_existing_view->append_column(m_existing_column_title);
- m_new_column_title.set_expand(true);
- m_new_column_title.pack_start(m_new_icon_renderer, false);
- m_new_column_title.pack_start(m_new_title_renderer, true);
- m_new_column_title.set_cell_data_func(m_new_icon_renderer, sigc::mem_fun(*this, &Dialog_ExistingOrNew::new_icon_data_func));
- m_new_column_title.set_cell_data_func(m_new_title_renderer, sigc::mem_fun(*this, &Dialog_ExistingOrNew::new_title_data_func));
- m_new_view->append_column(m_new_column_title);
-
m_existing_view->set_headers_visible(false);
m_existing_view->signal_row_activated().connect(sigc::mem_fun(*this, &Dialog_ExistingOrNew::on_existing_row_activated));
- m_new_view->set_headers_visible(false);
- m_new_view->signal_row_activated().connect(sigc::mem_fun(*this, &Dialog_ExistingOrNew::on_new_row_activated));
-
+
// Load example files:
#ifndef GLOM_ENABLE_CLIENT_ONLY
@@ -219,8 +204,7 @@ Dialog_ExistingOrNew::Dialog_ExistingOrNew(BaseObjectType* cobject, const Glib::
m_iter_existing_network_dummy = create_dummy_item_existing(m_iter_existing_network, _(NETWORK_DUMMY_TEXT));
#endif
- m_iter_new_template_dummy = create_dummy_item_new(m_iter_new_template, _(TEMPLATE_DUMMY_TEXT));
-
+
// Expand recently used files
m_existing_view->expand_row(m_existing_model->get_path(m_iter_existing_recent), false);
@@ -236,6 +220,28 @@ Dialog_ExistingOrNew::Dialog_ExistingOrNew(BaseObjectType* cobject, const Glib::
existing_view_selection->set_select_function( sigc::mem_fun(*this, &Dialog_ExistingOrNew::on_existing_select_func) );
#ifndef GLOM_ENABLE_CLIENT_ONLY
+ builder->get_widget("existing_or_new_new_treeview", m_new_view);
+ m_new_model = Gtk::TreeStore::create(m_new_columns);
+ m_new_view->set_model(m_new_model);
+
+ m_iter_new_empty = m_new_model->append();
+ (*m_iter_new_empty)[m_new_columns.m_col_title] = _("New Empty Document");
+
+ m_iter_new_template = m_new_model->append();
+ (*m_iter_new_template)[m_new_columns.m_col_title] = _("New From Template");
+
+ m_new_column_title.set_expand(true);
+ m_new_column_title.pack_start(m_new_icon_renderer, false);
+ m_new_column_title.pack_start(m_new_title_renderer, true);
+ m_new_column_title.set_cell_data_func(m_new_icon_renderer, sigc::mem_fun(*this, &Dialog_ExistingOrNew::new_icon_data_func));
+ m_new_column_title.set_cell_data_func(m_new_title_renderer, sigc::mem_fun(*this, &Dialog_ExistingOrNew::new_title_data_func));
+ m_new_view->append_column(m_new_column_title);
+
+ m_new_view->set_headers_visible(false);
+ m_new_view->signal_row_activated().connect(sigc::mem_fun(*this, &Dialog_ExistingOrNew::on_new_row_activated));
+
+ m_iter_new_template_dummy = create_dummy_item_new(m_iter_new_template, _(TEMPLATE_DUMMY_TEXT));
+
Glib::RefPtr<Gtk::TreeView::Selection> new_view_selection = m_new_view->get_selection();
new_view_selection->signal_changed().connect(sigc::mem_fun(*this, &Dialog_ExistingOrNew::on_new_selection_changed));
new_view_selection->set_select_function( sigc::mem_fun(*this, &Dialog_ExistingOrNew::on_new_select_func) );
@@ -302,6 +308,7 @@ bool Dialog_ExistingOrNew::on_existing_select_func(const Glib::RefPtr<Gtk::TreeM
return true;
}
+#ifndef GLOM_ENABLE_CLIENT_ONLY
bool Dialog_ExistingOrNew::on_new_select_func(const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool /* path_currently_selected */)
{
Gtk::TreeModel::iterator iter = model->get_iter(path);
@@ -310,7 +317,7 @@ bool Dialog_ExistingOrNew::on_new_select_func(const Glib::RefPtr<Gtk::TreeModel>
else
return true;
}
-
+#endif //GLOM_ENABLE_CLIENT_ONLY
Dialog_ExistingOrNew::Action Dialog_ExistingOrNew::get_action_impl(Gtk::TreeModel::iterator& iter) const
{
@@ -333,6 +340,7 @@ Dialog_ExistingOrNew::Action Dialog_ExistingOrNew::get_action_impl(Gtk::TreeMode
}
else
{
+ #ifndef GLOM_ENABLE_CLIENT_ONLY
if(m_new_view->get_selection()->count_selected_rows() == 0)
return NONE;
@@ -343,7 +351,10 @@ Dialog_ExistingOrNew::Action Dialog_ExistingOrNew::get_action_impl(Gtk::TreeMode
return NEW_EMPTY;
else
return NONE;
+ #endif //GLOM_ENABLE_CLIENT_ONLY
}
+
+ return NONE;
}
Dialog_ExistingOrNew::Action Dialog_ExistingOrNew::get_action() const
@@ -355,13 +366,16 @@ Dialog_ExistingOrNew::Action Dialog_ExistingOrNew::get_action() const
Glib::ustring Dialog_ExistingOrNew::get_uri() const
{
Gtk::TreeModel::iterator iter;
- Action action = get_action_impl(iter);
+ const Action action = get_action_impl(iter);
+ #ifndef GLOM_ENABLE_CLIENT_ONLY
if(action == NEW_FROM_TEMPLATE)
{
return (*iter)[m_new_columns.m_col_template_uri];
}
- else if(action == OPEN_URI)
+ else
+ #endif //GLOM_ENABLE_CLIENT_ONLY
+ if(action == OPEN_URI)
{
if(iter == m_iter_existing_other)
{
@@ -422,12 +436,14 @@ std::auto_ptr<Gtk::TreeModel::iterator> Dialog_ExistingOrNew::create_dummy_item_
return std::auto_ptr<Gtk::TreeModel::iterator>(new Gtk::TreeModel::iterator(iter));
}
+#ifndef GLOM_ENABLE_CLIENT_ONLY
std::auto_ptr<Gtk::TreeModel::iterator> Dialog_ExistingOrNew::create_dummy_item_new(const Gtk::TreeModel::iterator& parent, const Glib::ustring& text)
{
Gtk::TreeModel::iterator iter = m_new_model->append(parent->children());
(*iter)[m_new_columns.m_col_title] = text;
return std::auto_ptr<Gtk::TreeModel::iterator>(new Gtk::TreeModel::iterator(iter));
}
+#endif //GLOM_ENABLE_CLIENT_ONLY
void Dialog_ExistingOrNew::existing_icon_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter)
{
@@ -548,6 +564,7 @@ void Dialog_ExistingOrNew::existing_title_data_func(Gtk::CellRenderer* renderer,
#endif // PROPERTIES_ENABLED
}
+#ifndef GLOM_ENABLE_CLIENT_ONLY
void Dialog_ExistingOrNew::new_icon_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter)
{
Gtk::CellRendererPixbuf* pixbuf_renderer = dynamic_cast<Gtk::CellRendererPixbuf*>(renderer);
@@ -642,6 +659,7 @@ void Dialog_ExistingOrNew::new_title_data_func(Gtk::CellRenderer* renderer, cons
}
#endif
}
+#endif //GLOM_ENABLE_CLIENT_ONLY
void Dialog_ExistingOrNew::on_switch_page(GtkNotebookPage* /* page */, guint /* page_num */)
{
@@ -653,10 +671,12 @@ void Dialog_ExistingOrNew::on_existing_selection_changed()
update_ui_sensitivity();
}
+#ifndef GLOM_ENABLE_CLIENT_ONLY
void Dialog_ExistingOrNew::on_new_selection_changed()
{
update_ui_sensitivity();
}
+#endif //GLOM_ENABLE_CLIENT_ONLY
void Dialog_ExistingOrNew::update_ui_sensitivity()
{
@@ -684,6 +704,7 @@ void Dialog_ExistingOrNew::update_ui_sensitivity()
#endif
}
}
+ #ifndef GLOM_ENABLE_CLIENT_ONLY
else
{
const int count = m_new_view->get_selection()->count_selected_rows();
@@ -699,6 +720,7 @@ void Dialog_ExistingOrNew::update_ui_sensitivity()
(!m_iter_new_template_dummy.get() || sel != *m_iter_new_template_dummy));
}
}
+ #endif //GLOM_ENABLE_CLIENT_ONLY
m_select_button->set_sensitive(sensitivity);
}
@@ -897,6 +919,7 @@ void Dialog_ExistingOrNew::on_existing_button_clicked(const Gtk::TreeModel::Path
on_select_clicked();
}
+#ifndef GLOM_ENABLE_CLIENT_ONLY
void Dialog_ExistingOrNew::on_new_row_activated(const Gtk::TreeModel::Path& /* path */, Gtk::TreeViewColumn* /* column */)
{
if(m_select_button->is_sensitive())
@@ -910,6 +933,7 @@ void Dialog_ExistingOrNew::on_new_button_clicked(const Gtk::TreeModel::Path& pat
if(m_select_button->is_sensitive())
on_select_clicked();
}
+#endif //GLOM_ENABLE_CLIENT_ONLY
void Dialog_ExistingOrNew::on_select_clicked()
{
diff --git a/glom/dialog_existing_or_new.h b/glom/dialog_existing_or_new.h
index f187016..82e83d5 100644
--- a/glom/dialog_existing_or_new.h
+++ b/glom/dialog_existing_or_new.h
@@ -68,24 +68,29 @@ private:
Action get_action_impl(Gtk::TreeModel::iterator& iter) const;
std::auto_ptr<Gtk::TreeModel::iterator> create_dummy_item_existing(const Gtk::TreeModel::iterator& parent, const Glib::ustring& text);
- std::auto_ptr<Gtk::TreeModel::iterator> create_dummy_item_new(const Gtk::TreeModel::iterator& parent, const Glib::ustring& text);
void existing_icon_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter);
void existing_title_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter);
- void new_icon_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter);
- void new_title_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter);
void on_switch_page(GtkNotebookPage* page, guint page_num);
void on_existing_selection_changed();
- void on_new_selection_changed();
+
bool on_existing_select_func(const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool path_currently_selected);
- bool on_new_select_func(const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool path_currently_selected);
void update_ui_sensitivity();
#ifndef GLOM_ENABLE_CLIENT_ONLY
+ std::auto_ptr<Gtk::TreeModel::iterator> create_dummy_item_new(const Gtk::TreeModel::iterator& parent, const Glib::ustring& text);
+ void on_new_selection_changed();
+ void new_icon_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter);
+ void new_title_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter);
+ bool on_new_select_func(const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool path_currently_selected);
+ void on_new_row_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
+ void on_new_button_clicked(const Gtk::TreeModel::Path& path);
+
+
bool list_examples_at_path(const std::string& path);
void on_enumerate_children(const Glib::RefPtr<Gio::AsyncResult>& res);
void on_next_files(const Glib::RefPtr<Gio::AsyncResult>& res);
@@ -103,10 +108,11 @@ private:
void on_existing_row_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
void on_existing_button_clicked(const Gtk::TreeModel::Path& path);
- void on_new_row_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column);
- void on_new_button_clicked(const Gtk::TreeModel::Path& path);
-
void on_select_clicked();
+
+
+ Gtk::Notebook* m_notebook;
+ Gtk::Button* m_select_button;
class ExistingModelColumns : public Gtk::TreeModel::ColumnRecord
{
@@ -138,6 +144,13 @@ private:
Gtk::TreeModelColumn< Glib::RefPtr<Gtk::RecentInfo> > m_col_recent_info;
};
+
+ ExistingModelColumns m_existing_columns;
+ Glib::RefPtr<Gtk::TreeStore> m_existing_model;
+ Gtk::TreeView* m_existing_view;
+
+#ifndef GLOM_ENABLE_CLIENT_ONLY
+
class NewModelColumns : public Gtk::TreeModel::ColumnRecord
{
public:
@@ -148,43 +161,38 @@ private:
Gtk::TreeModelColumn<Glib::ustring> m_col_title;
Gtk::TreeModelColumn<Glib::ustring> m_col_template_uri;
};
-
- Gtk::Notebook* m_notebook;
- Gtk::Button* m_select_button;
-
- ExistingModelColumns m_existing_columns;
- Glib::RefPtr<Gtk::TreeStore> m_existing_model;
- Gtk::TreeView* m_existing_view;
-
+
NewModelColumns m_new_columns;
Gtk::TreeView* m_new_view;
Glib::RefPtr<Gtk::TreeStore> m_new_model;
+
+ Gtk::TreeViewColumn m_new_column_title;
+ Gtk::TreeViewColumn m_new_column_button;
+ Gtk::CellRendererPixbuf m_new_icon_renderer;
+ Gtk::CellRendererText m_new_title_renderer;
+ Gtk::TreeModel::iterator m_iter_new_empty;
+ Gtk::TreeModel::iterator m_iter_new_template;
+ std::auto_ptr<Gtk::TreeModel::iterator> m_iter_new_template_dummy;
+#endif //GLOM_ENABLE_CLIENT_ONLY
Gtk::TreeViewColumn m_existing_column_title;
Gtk::TreeViewColumn m_existing_column_button;
Gtk::CellRendererPixbuf m_existing_icon_renderer;
Gtk::CellRendererText m_existing_title_renderer;
- Gtk::TreeViewColumn m_new_column_title;
- Gtk::TreeViewColumn m_new_column_button;
- Gtk::CellRendererPixbuf m_new_icon_renderer;
- Gtk::CellRendererText m_new_title_renderer;
Gtk::TreeModel::iterator m_iter_existing_recent;
#ifndef G_OS_WIN32
Gtk::TreeModel::iterator m_iter_existing_network;
#endif
Gtk::TreeModel::iterator m_iter_existing_other;
-
- Gtk::TreeModel::iterator m_iter_new_empty;
- Gtk::TreeModel::iterator m_iter_new_template;
-
+
// Dummy children to indicate that a parent item has no (real) children
#ifndef G_OS_WIN32
std::auto_ptr<Gtk::TreeModel::iterator> m_iter_existing_network_dummy;
#endif
std::auto_ptr<Gtk::TreeModel::iterator> m_iter_existing_recent_dummy;
- std::auto_ptr<Gtk::TreeModel::iterator> m_iter_new_template_dummy;
+
#ifndef GLOM_ENABLE_CLIENT_ONLY
Glib::RefPtr<Gio::File> m_examples_dir;
diff --git a/glom/dialog_invalid_data.h b/glom/dialog_invalid_data.h
index 87402d0..ffe9f80 100644
--- a/glom/dialog_invalid_data.h
+++ b/glom/dialog_invalid_data.h
@@ -40,9 +40,9 @@ public:
Dialog_InvalidData(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
virtual ~Dialog_InvalidData();
- /** Show appropriate example data for this field type
+ /** Show appropriate example data for this field type.
*/
- virtual void set_example_data(Field::glom_field_type glom_type);
+ void set_example_data(Field::glom_field_type glom_type);
private:
Gtk::Label* m_label;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]