[glom/infobar] Replace progress dialog with infobar, bug 661051
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/infobar] Replace progress dialog with infobar, bug 661051
- Date: Wed, 12 Oct 2011 11:45:49 +0000 (UTC)
commit 2f8a6a822acee4123ce5490698b001f74d9092ae
Author: David King <davidk openismus com>
Date: Thu Oct 6 15:45:06 2011 +0200
Replace progress dialog with infobar, bug 661051
Makefile.am | 3 +-
Makefile_glom.am | 4 +-
glom/application.cc | 99 +++++---------------
glom/application.h | 8 +-
glom/dialog_progress_creating.cc | 101 --------------------
glom/frame_glom.cc | 74 ++++++--------
glom/frame_glom.h | 10 +-
glom/glade_utils.cc | 21 +---
glom/glade_utils.h | 5 +-
glom/infobar_progress_creating.cc | 61 ++++++++++++
...ress_creating.h => infobar_progress_creating.h} | 27 ++----
tests/test_glade_derived_instantiation.cc | 2 +-
ui/operator/window_main.glade | 39 ++++++++
ui/operator/window_progress.glade | 44 ---------
14 files changed, 187 insertions(+), 311 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index a8ecd8b..426fa15 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -93,8 +93,7 @@ dist_glade_operator_DATA = \
ui/operator/dialog_image_save_progress.glade \
ui/operator/dialog_import_csv.glade \
ui/operator/dialog_import_csv_progress.glade \
- ui/operator/window_main.glade \
- ui/operator/window_progress.glade
+ ui/operator/window_main.glade
glade_developerdir = $(pkgdatadir)/glade/developer
dist_glade_developer_DATA = ui/developer/dialog_add_related_table.glade \
diff --git a/Makefile_glom.am b/Makefile_glom.am
index 83dfba0..313a947 100644
--- a/Makefile_glom.am
+++ b/Makefile_glom.am
@@ -89,14 +89,14 @@ glom_source_files = \
glom/dialog_existing_or_new.h \
glom/dialog_invalid_data.cc \
glom/dialog_invalid_data.h \
- glom/dialog_progress_creating.cc \
- glom/dialog_progress_creating.h \
glom/filechooser_export.cc \
glom/filechooser_export.h \
glom/frame_glom.cc \
glom/frame_glom.h \
glom/glade_utils.cc \
glom/glade_utils.h \
+ glom/infobar_progress_creating.cc \
+ glom/infobar_progress_creating.h \
glom/notebook_glom.cc \
glom/notebook_glom.h \
glom/signal_reemitter.h \
diff --git a/glom/application.cc b/glom/application.cc
index 0b60d29..38f3291 100644
--- a/glom/application.cc
+++ b/glom/application.cc
@@ -23,8 +23,6 @@
#include <glom/application.h>
#include <glom/dialog_existing_or_new.h>
-#include <glom/dialog_progress_creating.h>
-
#ifndef GLOM_ENABLE_CLIENT_ONLY
#include <glom/mode_design/translation/dialog_change_language.h>
#include <glom/mode_design/translation/window_translations.h>
@@ -85,9 +83,6 @@ Application::Application(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builde
m_ui_save_extra_showextras(false),
m_ui_save_extra_newdb_hosting_mode(Document::HOSTING_MODE_DEFAULT),
m_avahi_progress_dialog(0),
- m_dialog_progress_creating(0),
- m_dialog_progess_save_backup(0),
- m_dialog_progess_convert_backup(0),
#endif // !GLOM_ENABLE_CLIENT_ONLY
m_show_sql_debug(false)
{
@@ -126,13 +121,6 @@ Application::~Application()
delete m_avahi_progress_dialog;
m_avahi_progress_dialog = 0;
- delete m_dialog_progress_creating;
- m_dialog_progress_creating = 0;
-
- delete m_dialog_progess_save_backup;
-
- delete m_dialog_progess_convert_backup;
- m_dialog_progess_convert_backup = 0;
#endif // !GLOM_ENABLE_CLIENT_ONLY
delete m_pAbout;
@@ -1300,18 +1288,12 @@ void Application::on_connection_close_progress()
void Application::on_connection_save_backup_progress()
{
- if(!m_dialog_progess_save_backup)
- m_dialog_progess_save_backup = Utils::get_and_show_pulse_dialog(_("Exporting Backup"), this);
-
- m_dialog_progess_save_backup->pulse();
+ m_pFrame->set_progress_message(_("Exporting Backup"));
}
void Application::on_connection_convert_backup_progress()
{
- if(!m_dialog_progess_convert_backup)
- m_dialog_progess_convert_backup = Utils::get_and_show_pulse_dialog(_("Restoring Backup"), this);
-
- m_dialog_progess_convert_backup->pulse();
+ m_pFrame->set_progress_message(_("Restoring Backup"));
}
void Application::on_document_close()
@@ -1632,23 +1614,11 @@ void Application::on_menu_help_contents()
void Application::on_recreate_database_progress()
{
//Show the user that something is happening, because the INSERTS might take time.
- //TOOD: This doesn't actually show up until near the end, even with Gtk::Main::instance()->iteration().
- if(!m_dialog_progress_creating)
- {
- Utils::get_glade_widget_derived_with_warning(m_dialog_progress_creating);
-
- m_dialog_progress_creating->set_message(_("Creating Glom Database"), _("Creating Glom database from example file."));
-
- m_dialog_progress_creating->set_transient_for(*this);
- m_dialog_progress_creating->show();
+ m_pFrame->set_progress_message(_("Creating Glom Database"), _("Creating Glom database from example file."));
- }
-
- //Ensure that the dialog is shown, instead of waiting for the application to be idle:
+ // Ensure that the infobar is shown, instead of waiting for the application to be idle.
while(Gtk::Main::instance()->events_pending())
Gtk::Main::instance()->iteration();
-
- m_dialog_progress_creating->pulse();
}
bool Application::recreate_database_from_example(bool& user_cancelled)
@@ -1714,21 +1684,12 @@ bool Application::recreate_database_from_example(bool& user_cancelled)
}
//Show the user that something is happening, because the INSERTS might take time.
- //TOOD: This doesn't actually show up until near the end, even with Gtk::Main::instance()->iteration().
- Dialog_ProgressCreating* dialog_progress_temp = 0;
- Utils::get_glade_widget_derived_with_warning(dialog_progress_temp);
- dialog_progress_temp->set_message(_("Creating Glom Database"), _("Creating Glom database from example file."));
- std::auto_ptr<Dialog_ProgressCreating> dialog_progress(dialog_progress_temp); //Put the dialog in an auto_ptr so that it will be deleted (and hidden) when the current function returns.
-
- dialog_progress->set_transient_for(*this);
- dialog_progress->show();
+ m_pFrame->set_progress_message(_("Creating Glom Database"), _("Creating Glom database from example file."));
- //Ensure that the dialog is shown, instead of waiting for the application to be idle:
+ // Ensure that the infobar is shown, instead of waiting for the application to be idle.
while(Gtk::Main::instance()->events_pending())
Gtk::Main::instance()->iteration();
- dialog_progress->pulse();
-
//Create the database: (This will show a connection dialog)
connection_pool->set_database( Glib::ustring() );
const bool db_created = m_pFrame->create_database(db_name, pDocument->get_database_title());
@@ -1740,7 +1701,7 @@ bool Application::recreate_database_from_example(bool& user_cancelled)
else
connection_pool->set_database(db_name); //Specify the new database when connecting from now on.
- dialog_progress->pulse();
+ m_pFrame->set_progress_message(_("Creating Glom Database"), _("Creating Glom database from example file."));
BusyCursor busy_cursor(this);
sharedptr<SharedConnection> sharedconnection;
@@ -1768,16 +1729,14 @@ bool Application::recreate_database_from_example(bool& user_cancelled)
return false;
}
- dialog_progress->pulse();
-
//Create the developer group, and make this user a member of it:
- dialog_progress->pulse();
+ m_pFrame->set_progress_message(_("Creating Glom Database"), _("Creating Glom database from example file."));
bool test = DbUtils::add_standard_groups(pDocument);
if(!test)
return false;
//Add any extra groups from the example file:
- dialog_progress->pulse();
+ m_pFrame->set_progress_message(_("Creating Glom Database"), _("Creating Glom database from example file."));
test = DbUtils::add_groups_from_document(pDocument);
if(!test)
return false;
@@ -1792,9 +1751,9 @@ bool Application::recreate_database_from_example(bool& user_cancelled)
Glib::ustring sql_fields;
Document::type_vec_fields fields = pDocument->get_table_fields(table_info->get_name());
- dialog_progress->pulse();
+ m_pFrame->set_progress_message(_("Creating Glom Database"), _("Creating Glom database from example file."));
const bool table_creation_succeeded = DbUtils::create_table(table_info, fields);
- dialog_progress->pulse();
+ m_pFrame->set_progress_message(_("Creating Glom Database"), _("Creating Glom database from example file."));
if(!table_creation_succeeded)
{
g_warning("Application::recreate_database_from_example(): CREATE TABLE failed with the newly-created database.");
@@ -1802,11 +1761,11 @@ bool Application::recreate_database_from_example(bool& user_cancelled)
}
}
- dialog_progress->pulse();
+ m_pFrame->set_progress_message(_("Creating Glom Database"), _("Creating Glom database from example file."));
DbUtils::add_standard_tables(pDocument); //Add internal, hidden, tables.
//Set table priviliges, using the groups we just added:
- dialog_progress->pulse();
+ m_pFrame->set_progress_message(_("Creating Glom Database"), _("Creating Glom database from example file."));
test = DbUtils::set_table_privileges_groups_from_document(pDocument);
if(!test)
return false;
@@ -1816,7 +1775,7 @@ bool Application::recreate_database_from_example(bool& user_cancelled)
sharedptr<const TableInfo> table_info = *iter;
//Add any example data to the table:
- dialog_progress->pulse();
+ m_pFrame->set_progress_message(_("Creating Glom Database"), _("Creating Glom database from example file."));
//try
//{
@@ -1902,20 +1861,13 @@ bool Application::recreate_database_from_backup(const Glib::ustring& backup_uri,
}
//Show the user that something is happening, because the INSERTS might take time.
- //TOOD: This doesn't actually show up until near the end, even with Gtk::Main::instance()->iteration().
- Dialog_ProgressCreating* dialog_progress_temp = 0;
- Utils::get_glade_widget_derived_with_warning(dialog_progress_temp);
- dialog_progress_temp->set_message(_("Creating Glom Database"), _("Creating Glom database from backup file."));
- std::auto_ptr<Dialog_ProgressCreating> dialog_progress(dialog_progress_temp); //Put the dialog in an auto_ptr so that it will be deleted (and hidden) when the current function returns.
-
- dialog_progress->set_transient_for(*this);
- dialog_progress->show();
+ m_pFrame->set_progress_message(_("Creating Glom Database"), _("Creating Glom database from backup file."));
- //Ensure that the dialog is shown, instead of waiting for the application to be idle:
+ // Ensure that the infobar is shown, instead of waiting for the application to be idle.
while(Gtk::Main::instance()->events_pending())
Gtk::Main::instance()->iteration();
- dialog_progress->pulse();
+ m_pFrame->set_progress_message(_("Creating Glom Database"), _("Creating Glom database from backup file."));
//Create the database: (This will show a connection dialog)
connection_pool->set_database( Glib::ustring() );
@@ -1940,18 +1892,17 @@ bool Application::recreate_database_from_backup(const Glib::ustring& backup_uri,
connection_pool->set_database(db_name); //Specify the new database when connecting from now on.
//Create the developer group, and make this user a member of it:
- dialog_progress->pulse();
+ m_pFrame->set_progress_message(_("Creating Glom Database"), _("Creating Glom database from backup file."));
bool test = DbUtils::add_standard_groups(pDocument);
if(!test)
return false;
//Add any extra groups from the example file:
- dialog_progress->pulse();
+ m_pFrame->set_progress_message(_("Creating Glom Database"), _("Creating Glom database from backup file."));
test = DbUtils::add_groups_from_document(pDocument);
if(!test)
return false;
- //dialog_progress->pulse();
//m_pFrame->add_standard_tables(); //Add internal, hidden, tables.
//Restore the backup into the database:
@@ -1985,8 +1936,7 @@ bool Application::recreate_database_from_backup(const Glib::ustring& backup_uri,
const bool restored = connection_pool->convert_backup(
sigc::mem_fun(*this, &Application::on_connection_convert_backup_progress), original_dir_path);
- delete m_dialog_progess_convert_backup;
- m_dialog_progess_convert_backup = 0;
+ m_pFrame->clear_progress_message();
if(!restored)
{
@@ -2687,8 +2637,7 @@ void Application::on_menu_developer_export_backup()
ConnectionPool* connection_pool = ConnectionPool::get_instance();
saved = connection_pool->save_backup(sigc::mem_fun(*this, &Application::on_connection_save_backup_progress), path_dir);
- delete m_dialog_progess_save_backup;
- m_dialog_progess_save_backup = 0;
+ m_pFrame->clear_progress_message();
}
//Compress the backup in a .tar.gz, so it is slightly more safe from changes:
@@ -2731,8 +2680,7 @@ void Application::on_menu_developer_export_backup()
std::cerr << G_STRFUNC << "tar failed with command:" << command_tar << std::endl;
}
- delete m_dialog_progess_save_backup;
- m_dialog_progess_save_backup = 0;
+ m_pFrame->clear_progress_message();
}
}
@@ -2825,8 +2773,7 @@ bool Application::do_restore_backup(const Glib::ustring& backup_uri)
std::cerr << G_STRFUNC << ": tar failed with command:" << command_tar << std::endl;
}
- delete m_dialog_progess_convert_backup;
- m_dialog_progess_convert_backup = 0;
+ m_pFrame->clear_progress_message();
if(!untarred)
ui_warning(_("Restore Backup failed."), _("There was an error while restoring the backup. The tar utility failed to extract the archive."));
diff --git a/glom/application.h b/glom/application.h
index 393025d..084b914 100644
--- a/glom/application.h
+++ b/glom/application.h
@@ -41,7 +41,7 @@ namespace Glom
{
class Window_Translations;
-class Dialog_ProgressCreating; //TODO: Rename this because it's not just about creating databases.
+class Infobar_ProgressCreating; //TODO: Rename this because it's not just about creating databases.
class Application : public GlomBakery::App_WithDoc_Gtk
{
@@ -254,9 +254,9 @@ private:
Gtk::MessageDialog* m_avahi_progress_dialog;
- Dialog_ProgressCreating* m_dialog_progress_creating;
- Dialog_ProgressCreating* m_dialog_progess_save_backup;
- Dialog_ProgressCreating* m_dialog_progess_convert_backup;
+ Infobar_ProgressCreating* m_infobar_progress_creating;
+ Infobar_ProgressCreating* m_infobar_progess_save_backup;
+ Infobar_ProgressCreating* m_infobar_progess_convert_backup;
#endif // !GLOM_ENABLE_CLIENT_ONLY
// This is set to the URI of an example file that is loaded to be able to
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index a57b45d..1569f72 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -94,10 +94,8 @@ Frame_Glom::Frame_Glom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>
m_pDialog_Relationships(0),
m_dialog_addrelatedtable(0),
m_dialog_relationships_overview(0),
- m_dialog_progess_connection_initialize(0),
#endif // !GLOM_ENABLE_CLIENT_ONLY
- m_dialog_progess_connection_startup(0),
- m_dialog_progess_connection_cleanup(0),
+ m_infobar_progress(0),
m_pDialogConnection(0)
{
m_pLabel_Table_DataMode = Gtk::manage(new Gtk::Label(_("No Table Selected")));
@@ -108,6 +106,10 @@ Frame_Glom::Frame_Glom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>
m_pLabel_Table_FindMode->show();
m_Notebook_Find.set_action_widget(m_pLabel_Table_FindMode, Gtk::PACK_START);
+ Infobar_ProgressCreating* infobar_progress = 0;
+ Utils::get_glade_widget_derived_with_warning(infobar_progress);
+ m_infobar_progress = infobar_progress;
+
//QuickFind widgets:
//We don't use Glade for these, so it easier to modify them for the Maemo port.
m_pBox_QuickFind = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, Utils::DEFAULT_SPACING_SMALL));
@@ -185,17 +187,10 @@ Frame_Glom::~Frame_Glom()
m_pDialogConnection = 0;
}
-
- delete m_dialog_progess_connection_startup;
- m_dialog_progess_connection_startup = 0;
-
- delete m_dialog_progess_connection_cleanup;
- m_dialog_progess_connection_cleanup = 0;
+ delete m_infobar_progress;
+ m_infobar_progress = 0;
#ifndef GLOM_ENABLE_CLIENT_ONLY
- delete m_dialog_progess_connection_initialize;
- m_dialog_progess_connection_initialize = 0;
-
if(m_pBox_Reports)
remove_view(m_pBox_Reports);
@@ -986,9 +981,6 @@ void Frame_Glom::on_menu_file_toggle_share(const Glib::RefPtr<Gtk::ToggleAction>
connectionpool->cleanup( sigc::mem_fun(*this, &Frame_Glom::on_connection_cleanup_progress) );
- delete m_dialog_progess_connection_cleanup;
- m_dialog_progess_connection_cleanup = 0;
-
connectionpool->set_network_shared(sigc::mem_fun(*this, &Frame_Glom::on_connection_startup_progress), shared);
ConnectionPool::StartupErrors started = connectionpool->startup( sigc::mem_fun(*this, &Frame_Glom::on_connection_startup_progress) );
if(started != ConnectionPool::Backend::STARTUPERROR_NONE)
@@ -998,9 +990,6 @@ void Frame_Glom::on_menu_file_toggle_share(const Glib::RefPtr<Gtk::ToggleAction>
}
connectionpool->set_ready_to_connect();
-
- delete m_dialog_progess_connection_startup;
- m_dialog_progess_connection_startup = 0;
}
//Update the UI:
@@ -1777,27 +1766,18 @@ void Frame_Glom::on_developer_dialog_hide()
#ifndef GLOM_ENABLE_CLIENT_ONLY
void Frame_Glom::on_connection_initialize_progress()
{
- if(!m_dialog_progess_connection_initialize)
- m_dialog_progess_connection_initialize = Utils::get_and_show_pulse_dialog(_("Initializing Database Data"), get_app_window());
-
- m_dialog_progess_connection_initialize->pulse();
+ set_progress_message(_("Initializing Database Data"));
}
#endif //GLOM_ENABLE_CLIENT_ONLY
void Frame_Glom::on_connection_startup_progress()
{
- if(!m_dialog_progess_connection_startup)
- m_dialog_progess_connection_startup = Utils::get_and_show_pulse_dialog(_("Starting Database Server"), get_app_window());
-
- m_dialog_progess_connection_startup->pulse();
+ set_progress_message(_("Starting Database Server"));
}
void Frame_Glom::on_connection_cleanup_progress()
{
- if(!m_dialog_progess_connection_cleanup)
- m_dialog_progess_connection_cleanup = Utils::get_and_show_pulse_dialog(_("Stopping Database Server"), get_app_window());
-
- m_dialog_progess_connection_cleanup->pulse();
+ set_progress_message(_("Stopping Database Server"));
}
bool Frame_Glom::handle_connection_initialize_errors(ConnectionPool::InitErrors error)
@@ -1928,9 +1908,6 @@ bool Frame_Glom::connection_request_password_and_choose_new_database_name()
const bool initialized = handle_connection_initialize_errors( connection_pool->initialize(
sigc::mem_fun(*this, &Frame_Glom::on_connection_initialize_progress) ) );
- delete m_dialog_progess_connection_initialize;
- m_dialog_progess_connection_initialize = 0;
-
if(!initialized)
return false;
@@ -2004,9 +1981,6 @@ bool Frame_Glom::connection_request_password_and_choose_new_database_name()
return false;
}
- delete m_dialog_progess_connection_startup;
- m_dialog_progess_connection_startup = 0;
-
const Glib::ustring database_name = document->get_connection_database();
//std::cout << "debug: database_name to create=" << database_name << std::endl;
@@ -2110,9 +2084,6 @@ void Frame_Glom::cleanup_connection()
{
ConnectionPool* connection_pool = ConnectionPool::get_instance();
connection_pool->cleanup( sigc::mem_fun(*this, &Frame_Glom::on_connection_cleanup_progress) );
-
- delete m_dialog_progess_connection_cleanup;
- m_dialog_progess_connection_cleanup = 0;
}
bool Frame_Glom::handle_request_password_connection_error(bool asked_for_password, const ExceptionConnection& ex, bool& database_not_found)
@@ -2145,6 +2116,28 @@ bool Frame_Glom::handle_request_password_connection_error(bool asked_for_passwor
}
}
+void Frame_Glom::set_progress_message(const Glib::ustring& message)
+{
+ const std::string collate_key = message.collate_key();
+
+ if(collate_key != m_progress_collate_key)
+ {
+ // New progress message.
+ m_progress_collate_key = collate_key;
+ m_infobar_progress->set_message(message);
+ m_infobar_progress->show();
+ m_infobar_progress->pulse();
+ }
+
+ // TODO: Block interaction with the rest of the UI.
+}
+
+void Frame_Glom::clear_progress_message()
+{
+ m_progress_collate_key.clear();
+ m_infobar_progress->hide();
+}
+
bool Frame_Glom::connection_request_password_and_attempt(bool& database_not_found, const Glib::ustring known_username, const Glib::ustring& known_password, bool confirm_known_user)
{
//Initialize output parameter:
@@ -2166,9 +2159,6 @@ bool Frame_Glom::connection_request_password_and_attempt(bool& database_not_foun
return false;
}
- delete m_dialog_progess_connection_startup;
- m_dialog_progess_connection_startup = 0;
-
//Only ask for the password if we are shared on the network, or we are using a centrally hosted server.
//Otherwise, no password question is necessary, due to how our self-hosted database server is configured.
if(document->get_network_shared()
diff --git a/glom/frame_glom.h b/glom/frame_glom.h
index f8bb8eb..33df441 100644
--- a/glom/frame_glom.h
+++ b/glom/frame_glom.h
@@ -57,7 +57,7 @@ class Dialog_AddRelatedTable;
class Dialog_RelationshipsOverview;
#endif // !GLOM_ENABLE_CLIENT_ONLY
-class Dialog_ProgressCreating; //TODO: Rename this because it's not just about creating databases.
+class Infobar_ProgressCreating; //TODO: Rename this because it's not just about creating databases.
class Frame_Glom :
public PlaceHolder,
@@ -70,6 +70,9 @@ public:
void set_databases_selected(const Glib::ustring& strName);
+ void set_progress_message(const Glib::ustring& message);
+ void clear_progress_message();
+
void do_print_layout(const Glib::ustring& print_layout_name, bool preview = false, Gtk::Window* transient_for = 0);
void on_box_tables_selected(const Glib::ustring& strName);
@@ -247,6 +250,7 @@ private:
//Member data:
Glib::ustring m_table_name;
+ std::string m_progress_collate_key;
//Child widgets:
Gtk::Label* m_pLabel_Table_DataMode;
@@ -285,11 +289,9 @@ private:
Dialog_AddRelatedTable* m_dialog_addrelatedtable;
Dialog_RelationshipsOverview* m_dialog_relationships_overview;
- Dialog_ProgressCreating* m_dialog_progess_connection_initialize;
#endif //GLOM_ENABLE_CLIENT_ONLY
- Dialog_ProgressCreating* m_dialog_progess_connection_startup;
- Dialog_ProgressCreating* m_dialog_progess_connection_cleanup;
+ Infobar_ProgressCreating* m_infobar_progress;
Dialog_Connection* m_pDialogConnection;
};
diff --git a/glom/glade_utils.cc b/glom/glade_utils.cc
index 0626e34..b3c5d0c 100644
--- a/glom/glade_utils.cc
+++ b/glom/glade_utils.cc
@@ -28,25 +28,16 @@ namespace Utils
{
-Dialog_ProgressCreating* get_and_show_pulse_dialog(const Glib::ustring& message, Gtk::Window* parent_window)
+Infobar_ProgressCreating* get_and_show_pulse_infobar(const Glib::ustring& message)
{
- if(!parent_window)
- std::cerr << G_STRFUNC << ": parent_window is NULL" << std::endl;
-
- Dialog_ProgressCreating* dialog_progress = 0;
- Utils::get_glade_widget_derived_with_warning(dialog_progress);
- if(!dialog_progress) //Unlikely and it already warns on stderr.
+ Infobar_ProgressCreating* infobar_progress = 0;
+ Utils::get_glade_widget_derived_with_warning(infobar_progress);
+ if(!infobar_progress) //Unlikely and it already warns on stderr.
return 0;
- dialog_progress->set_message(_("Processing"), message);
- dialog_progress->set_modal();
-
- if(parent_window)
- dialog_progress->set_transient_for(*parent_window);
-
- dialog_progress->show();
+ infobar_progress->set_message(message);
- return dialog_progress;
+ return infobar_progress;
}
} //namespace Utils
diff --git a/glom/glade_utils.h b/glom/glade_utils.h
index 24ef83e..3df16d0 100644
--- a/glom/glade_utils.h
+++ b/glom/glade_utils.h
@@ -23,7 +23,8 @@
#include <iostream> // For std::cerr
#include <gtkmm/builder.h>
-#include <glom/dialog_progress_creating.h>
+#include <gtkmm/window.h>
+#include <glom/infobar_progress_creating.h>
#include <giomm/file.h>
namespace Glom
@@ -167,7 +168,7 @@ void get_glade_widget_with_warning(const std::string& filename, const Glib::ustr
window->set_icon_name("glom");
}
-Dialog_ProgressCreating* get_and_show_pulse_dialog(const Glib::ustring& message, Gtk::Window* parent_window);
+Infobar_ProgressCreating* get_and_show_pulse_infobar(const Glib::ustring& message);
} //namespace Utils
diff --git a/glom/infobar_progress_creating.cc b/glom/infobar_progress_creating.cc
new file mode 100644
index 0000000..039482d
--- /dev/null
+++ b/glom/infobar_progress_creating.cc
@@ -0,0 +1,61 @@
+/* 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.
+ */
+
+#include <gtkmm/dialog.h>
+#include <glom/application.h>
+#include <glom/infobar_progress_creating.h>
+#include <gtkmm/main.h>
+#include <glibmm/i18n.h>
+
+namespace Glom
+{
+
+const char* Infobar_ProgressCreating::glade_id("infobar_progress");
+const bool Infobar_ProgressCreating::glade_developer(false);
+
+Infobar_ProgressCreating::Infobar_ProgressCreating(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder)
+: Gtk::InfoBar(cobject),
+ m_progress(0),
+ m_label_message(0)
+{
+ builder->get_widget("progressbar", m_progress);
+ builder->get_widget("label_message", m_label_message);
+}
+
+Infobar_ProgressCreating::~Infobar_ProgressCreating()
+{
+}
+
+void Infobar_ProgressCreating::pulse()
+{
+ m_progress->pulse();
+}
+
+void Infobar_ProgressCreating::set_message(const Glib::ustring& title, const Glib::ustring& secondary_text)
+{
+ m_label_message->set_text("<b>" + title + "</b>\n\n" + secondary_text);
+}
+
+void Infobar_ProgressCreating::set_message(const Glib::ustring& secondary_text)
+{
+ set_message(_("Processing"), secondary_text);
+}
+
+} //namespace Glom
diff --git a/glom/dialog_progress_creating.h b/glom/infobar_progress_creating.h
similarity index 70%
rename from glom/dialog_progress_creating.h
rename to glom/infobar_progress_creating.h
index a977f4e..2a65793 100644
--- a/glom/dialog_progress_creating.h
+++ b/glom/infobar_progress_creating.h
@@ -18,11 +18,11 @@
* Boston, MA 02111-1307, USA.
*/
-#ifndef GLOM_DIALOG_PROGRESS_CREATING_H
-#define GLOM_DIALOG_PROGRESS_CREATING_H
+#ifndef GLOM_INFOBAR_PROGRESS_CREATING_H
+#define GLOM_INFOBAR_PROGRESS_CREATING_H
#include <gtkmm/builder.h>
-#include <gtkmm/window.h>
+#include <gtkmm/infobar.h>
#include <gtkmm/label.h>
#include <gtkmm/progressbar.h>
@@ -32,35 +32,26 @@ namespace Glom
/** Use this to show the user that something is happening.
* Call pulse() repeatedly to show that we are still working.
*/
-class Dialog_ProgressCreating
- : public Gtk::Window
+class Infobar_ProgressCreating
+ : public Gtk::InfoBar
{
public:
static const char* glade_id;
static const bool glade_developer;
- Dialog_ProgressCreating(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
- virtual ~Dialog_ProgressCreating();
+ Infobar_ProgressCreating(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
+ virtual ~Infobar_ProgressCreating();
void set_message(const Glib::ustring& title, const Glib::ustring& secondary_text);
+ void set_message(const Glib::ustring& secondary_text);
void pulse();
- // TODO: This should probably derive from Gtk::Dialog... armin.
- void response(int response_id);
- int run();
-
- virtual bool on_delete_event(GdkEventAny* event);
-
private:
Gtk::ProgressBar* m_progress;
Gtk::Label* m_label_message;
-
- int m_response_id;
- bool m_running;
};
} //namespace Glom
-#endif //GLOM_DIALOG_PROGRESS_CREATING_H
-
+#endif //GLOM_INFOBAR_PROGRESS_CREATING_H
diff --git a/tests/test_glade_derived_instantiation.cc b/tests/test_glade_derived_instantiation.cc
index 928217c..f45590f 100644
--- a/tests/test_glade_derived_instantiation.cc
+++ b/tests/test_glade_derived_instantiation.cc
@@ -110,7 +110,7 @@ int main(int argc, char *argv[])
instantiate_widget<Dialog_InvalidData>();
instantiate_widget<DialogImageLoadProgress>();
instantiate_widget<DialogImageSaveProgress>();
- instantiate_widget<Dialog_ProgressCreating>();
+ instantiate_widget<Infobar_ProgressCreating>();
//Developer mode UI:
instantiate_widget<Box_Print_Layouts>();
diff --git a/ui/operator/window_main.glade b/ui/operator/window_main.glade
index 381f3f7..0ca66aa 100644
--- a/ui/operator/window_main.glade
+++ b/ui/operator/window_main.glade
@@ -18,6 +18,45 @@
<property name="border_width">12</property>
<property name="spacing">6</property>
<child>
+ <object class="GtkInfoBar" id="infobar_progress">
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkVBox" id="vbox84">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">6</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label_message">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Processing</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkProgressBar" id="progressbar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="pulse_step">0.10000000149</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
<object class="GtkVBox" id="vbox_quickfind">
<property name="visible">True</property>
<property name="can_focus">False</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]