[glom] update_table_sensitive_ui
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] update_table_sensitive_ui
- Date: Wed, 22 Jun 2011 20:53:28 +0000 (UTC)
commit 66891cb5206a30e1b8f4242b3abfa7b3b9894487
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Jun 22 22:53:21 2011 +0200
update_table_sensitive_ui
ChangeLog | 12 ++++++++++
glom/application.cc | 57 ++++++++++++++++++++++++++-------------------------
glom/application.h | 6 ++--
glom/frame_glom.cc | 18 +++------------
glom/frame_glom.h | 5 +--
glom/glom.glade | 24 +--------------------
6 files changed, 51 insertions(+), 71 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 20b754c..abe6c1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2011-06-22 Murray Cumming <murrayc murrayc com>
+ Remove the User Level menu and the User Level label.
+
+ * glom/glom.glade: Main window: Remove the User Level label.
+ * glom/application.[h|cc]:
+ * glom/frame_glom.[h|cc]: Remove the User Level menu, moving
+ its two radio menu items to the top of the Developer menu.
+ init_menus(), update_table_sensitive_ui(): Make sure that all
+ developer items are deactivated in operator mode, now that
+ we don't just deactivate the whole developer menu.
+
+2011-06-22 Murray Cumming <murrayc murrayc com>
+
Main window: Simplify widgets at top.
* glom/glom.glade:
diff --git a/glom/application.cc b/glom/application.cc
index c377a81..6f0d3df 100644
--- a/glom/application.cc
+++ b/glom/application.cc
@@ -460,20 +460,6 @@ void Application::init_menus()
m_listTableSensitiveActions.push_back(action);
#endif
-#ifndef GLOM_ENABLE_CLIENT_ONLY
- //"UserLevel" menu:
- m_refActionGroup_Others->add(Gtk::Action::create("Glom_Menu_userlevel", _("_User Level")));
- Gtk::RadioAction::Group group_userlevel;
-
- m_action_menu_userlevel_developer = Gtk::RadioAction::create(group_userlevel, "GlomAction_Menu_userlevel_Developer", C_("User-level menu item", "_Developer"));
- m_refActionGroup_Others->add(m_action_menu_userlevel_developer,
- sigc::mem_fun(*this, &Application::on_menu_userlevel_developer) );
-
- m_action_menu_userlevel_operator = Gtk::RadioAction::create(group_userlevel, "GlomAction_Menu_userlevel_Operator", C_("User-level menu item", "_Operator"));
- m_refActionGroup_Others->add(m_action_menu_userlevel_operator,
- sigc::mem_fun(*this, &Application::on_menu_userlevel_operator) );
-#endif // !GLOM_ENABLE_CLIENT_ONLY
-
//"Mode" menu:
action = Gtk::Action::create("Glom_Menu_Mode", _("_Mode"));
m_refActionGroup_Others->add(action);
@@ -486,9 +472,20 @@ void Application::init_menus()
#ifndef GLOM_ENABLE_CLIENT_ONLY
action = Gtk::Action::create("Glom_Menu_Developer", C_("Developer menu title", "_Developer"));
- m_listDeveloperActions.push_back(action);
m_refActionGroup_Others->add(action);
+
+ Gtk::RadioAction::Group group_userlevel;
+
+ m_action_menu_developer_developer = Gtk::RadioAction::create(group_userlevel, "GlomAction_Menu_Developer_Developer", _("_Developer Mode"));
+ m_refActionGroup_Others->add(m_action_menu_developer_developer,
+ sigc::mem_fun(*this, &Application::on_menu_developer_developer) );
+
+ m_action_menu_developer_operator = Gtk::RadioAction::create(group_userlevel, "GlomAction_Menu_Developer_Operator", _("_Operator Mode"));
+ m_refActionGroup_Others->add(m_action_menu_developer_operator,
+ sigc::mem_fun(*this, &Application::on_menu_developer_operator) );
+
+
action = Gtk::Action::create("GlomAction_Menu_Developer_Database_Preferences", _("_Database Preferences"));
m_listDeveloperActions.push_back(action);
m_refActionGroup_Others->add(action, sigc::mem_fun(*m_pFrame, &Frame_Glom::on_menu_developer_database_preferences) );
@@ -544,6 +541,7 @@ void Application::init_menus()
//"Active Platform" menu:
action = Gtk::Action::create("Glom_Menu_Developer_ActivePlatform", _("_Active Platform"));
+ m_listDeveloperActions.push_back(action);
m_refActionGroup_Others->add(action);
Gtk::RadioAction::Group group_active_platform;
@@ -605,11 +603,10 @@ void Application::init_menus()
#endif // !GLOM_ENABLE_CLIENT_ONLY
" </menu>"
#ifndef GLOM_ENABLE_CLIENT_ONLY
- " <menu action='Glom_Menu_userlevel'>"
- " <menuitem action='GlomAction_Menu_userlevel_Developer' />"
- " <menuitem action='GlomAction_Menu_userlevel_Operator' />"
- " </menu>"
" <menu action='Glom_Menu_Developer'>"
+ " <menuitem action='GlomAction_Menu_Developer_Developer' />"
+ " <menuitem action='GlomAction_Menu_Developer_Operator' />"
+ " <separator />"
" <menuitem action='GlomAction_Menu_Developer_Fields' />"
" <menuitem action='GlomAction_Menu_Developer_Relationships' />"
" <menuitem action='GlomAction_Menu_Developer_RelationshipsOverview' />"
@@ -660,20 +657,20 @@ void Application::on_menu_file_toggle_share()
m_pFrame->on_menu_file_toggle_share(m_toggleaction_network_shared);
}
-void Application::on_menu_userlevel_developer()
+void Application::on_menu_developer_developer()
{
if(!m_pFrame)
return;
- m_pFrame->on_menu_userlevel_Developer(m_action_menu_userlevel_developer, m_action_menu_userlevel_operator);
+ m_pFrame->on_menu_developer_developer(m_action_menu_developer_developer, m_action_menu_developer_operator);
m_pFrame->show_layout_toolbar(m_action_show_layout_toolbar->get_active());
}
-void Application::on_menu_userlevel_operator()
+void Application::on_menu_developer_operator()
{
if(m_pFrame)
{
- m_pFrame->on_menu_userlevel_Operator(m_action_menu_userlevel_operator);
+ m_pFrame->on_menu_developer_operator(m_action_menu_developer_operator);
m_pFrame->show_layout_toolbar(false);
}
}
@@ -1378,6 +1375,8 @@ void Application::on_userlevel_changed(AppState::userlevels /* userlevel */)
void Application::update_table_sensitive_ui()
{
+ AppState::userlevels userlevel = get_userlevel();
+
bool has_table = false;
if(m_pFrame)
@@ -1386,7 +1385,9 @@ void Application::update_table_sensitive_ui()
for(type_listActions::iterator iter = m_listTableSensitiveActions.begin(); iter != m_listTableSensitiveActions.end(); ++iter)
{
Glib::RefPtr<Gtk::Action> action = *iter;
- action->set_sensitive(has_table);
+
+ const bool sensitive = (userlevel == AppState::USERLEVEL_DEVELOPER) && has_table;
+ action->set_sensitive(sensitive);
}
}
@@ -1417,13 +1418,13 @@ void Application::update_userlevel_ui()
//We only need to set/unset one, because the others are in the same radio group.
if(userlevel == AppState::USERLEVEL_DEVELOPER)
{
- if(!m_action_menu_userlevel_developer->get_active())
- m_action_menu_userlevel_developer->set_active();
+ if(!m_action_menu_developer_developer->get_active())
+ m_action_menu_developer_developer->set_active();
}
else if(userlevel == AppState::USERLEVEL_OPERATOR)
{
- if(!m_action_menu_userlevel_operator->get_active())
- m_action_menu_userlevel_operator->set_active();
+ if(!m_action_menu_developer_operator->get_active())
+ m_action_menu_developer_operator->set_active();
// Remove the drag layout toolbar
}
}
diff --git a/glom/application.h b/glom/application.h
index 75f61d7..58ba0b1 100644
--- a/glom/application.h
+++ b/glom/application.h
@@ -173,8 +173,8 @@ private:
void existing_or_new_new();
void on_menu_file_toggle_share();
- void on_menu_userlevel_developer();
- void on_menu_userlevel_operator();
+ void on_menu_developer_developer();
+ void on_menu_developer_operator();
void on_menu_file_save_as_example();
void on_menu_developer_changelanguage();
void on_menu_developer_translations();
@@ -236,7 +236,7 @@ private:
Glib::RefPtr<Gtk::Action> m_action_mode_find;
#ifndef GLOM_ENABLE_CLIENT_ONLY
Glib::RefPtr<Gtk::Action> m_action_developer_users;
- Glib::RefPtr<Gtk::RadioAction> m_action_menu_userlevel_developer, m_action_menu_userlevel_operator;
+ Glib::RefPtr<Gtk::RadioAction> m_action_menu_developer_developer, m_action_menu_developer_operator;
Glib::RefPtr<Gtk::ToggleAction> m_action_show_layout_toolbar;
#endif // !GLOM_ENABLE_CLIENT_ONLY
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index d6818e7..8d26ff7 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -81,7 +81,6 @@ Frame_Glom::Frame_Glom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>
m_pLabel_Table(0),
m_box_header(0),
m_box_footer(0),
- m_pLabel_userlevel(0),
m_pBox_RecordsCount(0),
m_pLabel_RecordsCount(0),
m_pLabel_FoundCount(0),
@@ -116,7 +115,6 @@ Frame_Glom::Frame_Glom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>
builder->get_widget("hbox_header", m_box_header);
builder->get_widget("hbox_footer", m_box_footer);
- builder->get_widget("label_user_level", m_pLabel_userlevel);
//Hide unnecessary widgets on maemo that take too much space,
//and reduce the border width:
@@ -512,7 +510,7 @@ void Frame_Glom::show_no_table()
}
#ifndef GLOM_ENABLE_CLIENT_ONLY
-void Frame_Glom::on_menu_userlevel_Developer(const Glib::RefPtr<Gtk::RadioAction>& action, const Glib::RefPtr<Gtk::RadioAction>& operator_action)
+void Frame_Glom::on_menu_developer_developer(const Glib::RefPtr<Gtk::RadioAction>& action, const Glib::RefPtr<Gtk::RadioAction>& operator_action)
{
if(action && action->get_active())
{
@@ -587,7 +585,7 @@ void Frame_Glom::on_menu_userlevel_Developer(const Glib::RefPtr<Gtk::RadioAction
}
}
-void Frame_Glom::on_menu_userlevel_Operator(const Glib::RefPtr<Gtk::RadioAction>& action)
+void Frame_Glom::on_menu_developer_operator(const Glib::RefPtr<Gtk::RadioAction>& action)
{
if(action && action->get_active())
{
@@ -1438,17 +1436,9 @@ void Frame_Glom::on_notebook_find_criteria(const Gnome::Gda::SqlExpr& where_clau
}
}
-void Frame_Glom::on_userlevel_changed(AppState::userlevels userlevel)
+void Frame_Glom::on_userlevel_changed(AppState::userlevels /* userlevel */)
{
- //show user level:
- //The _C macro provides translator context.
- Glib::ustring user_level_name = C_("Mode", "Operator");
- if(userlevel == AppState::USERLEVEL_DEVELOPER)
- user_level_name = C_("Mode", "Developer");
-
- if(m_pLabel_userlevel)
- m_pLabel_userlevel->set_text(user_level_name);
-
+ //show user level in the window title:
show_table_title();
}
diff --git a/glom/frame_glom.h b/glom/frame_glom.h
index ac933fc..e38a7eb 100644
--- a/glom/frame_glom.h
+++ b/glom/frame_glom.h
@@ -78,8 +78,8 @@ public:
void on_box_reports_selected(const Glib::ustring& strName);
void on_box_print_layouts_selected(const Glib::ustring& strName);
- void on_menu_userlevel_Developer(const Glib::RefPtr<Gtk::RadioAction>& action, const Glib::RefPtr<Gtk::RadioAction>& operator_action);
- void on_menu_userlevel_Operator(const Glib::RefPtr<Gtk::RadioAction>& action);
+ void on_menu_developer_developer(const Glib::RefPtr<Gtk::RadioAction>& action, const Glib::RefPtr<Gtk::RadioAction>& operator_action);
+ void on_menu_developer_operator(const Glib::RefPtr<Gtk::RadioAction>& action);
void on_menu_file_export();
void on_menu_file_import();
@@ -256,7 +256,6 @@ private:
Gtk::Label* m_pLabel_Table;
Gtk::HBox* m_box_header;
Gtk::HBox* m_box_footer;
- Gtk::Label* m_pLabel_userlevel;
Gtk::HBox* m_pBox_RecordsCount; //Only show this when in Data mode.
Gtk::Label* m_pLabel_RecordsCount;
diff --git a/glom/glom.glade b/glom/glom.glade
index 47ea89a..58fca56 100644
--- a/glom/glom.glade
+++ b/glom/glom.glade
@@ -1683,29 +1683,7 @@ The data in the field was not recognized. Please try to correct the data or reve
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
- <object class="GtkLabel" id="label38">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes"><b>User Level:</b></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_user_level">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">None selected</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
+ <placeholder/>
</child>
<child>
<object class="GtkHBox" id="hbox_records_count">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]