glom r1544 - in trunk: . glom glom/libglom glom/libglom/document
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r1544 - in trunk: . glom glom/libglom glom/libglom/document
- Date: Thu, 10 Apr 2008 09:28:30 +0100 (BST)
Author: murrayc
Date: Thu Apr 10 09:28:30 2008
New Revision: 1544
URL: http://svn.gnome.org/viewvc/glom?rev=1544&view=rev
Log:
2008-04-10 Murray Cumming <murrayc murrayc com>
* glom/libglom/spawn_with_feedback.h
* glom/libglom/spawn_with_feedback.cc (get_and_show_pulse_dialog,
execute_command_line_and_wait,
execute_command_line_and_wait_until_second_command_returns_success):
* glom/libglom/connectionpool.h
* glom/libglom/connectionpool.cc:
start_self_hosting(), stop_self_hosting(), create_self_hosting():
Added parent_window parameter, so that any dialogs can be transient for
it.
* glom/application.cc on_document_load(),
stop_self_hosting_of_document_database(): Call
start/stop_self_hosting() with the parent_window parameter.
* glom/frame_glom.cc:
connection_request_password_and_choose_new_database_name():
* glom/libglom/document/document_glom.cc:
Call start/stop_self_hosting() with the parent_window parameter.
This should prevent these windows from being system-modal when using
the xfwm4 window manager.
Bug #525285 (Jani Monoses)
Modified:
trunk/ChangeLog
trunk/glom/application.cc
trunk/glom/frame_glom.cc
trunk/glom/libglom/connectionpool.cc
trunk/glom/libglom/connectionpool.h
trunk/glom/libglom/document/document_glom.cc
trunk/glom/libglom/spawn_with_feedback.cc
trunk/glom/libglom/spawn_with_feedback.h
Modified: trunk/glom/application.cc
==============================================================================
--- trunk/glom/application.cc (original)
+++ trunk/glom/application.cc Thu Apr 10 09:28:30 2008
@@ -961,7 +961,7 @@
if(!is_example) /* It will be started later, after we have asked for the initial db name/title and created the files.*/
{
- const bool test = connection_pool->start_self_hosting(); //Stopped in on_menu_file_close().
+ const bool test = connection_pool->start_self_hosting(this); //Stopped in on_menu_file_close().
if(!test)
return false;
@@ -2248,7 +2248,7 @@
if(!connection_pool)
return;
- connection_pool->stop_self_hosting();
+ connection_pool->stop_self_hosting(this);
}
}
Modified: trunk/glom/frame_glom.cc
==============================================================================
--- trunk/glom/frame_glom.cc (original)
+++ trunk/glom/frame_glom.cc Thu Apr 10 09:28:30 2008
@@ -1569,7 +1569,7 @@
created = dialog->create_self_hosted();
if(created)
{
- const bool test = connection_pool->start_self_hosting();
+ const bool test = connection_pool->start_self_hosting(get_app_window());
if(!test)
return false;
Modified: trunk/glom/libglom/connectionpool.cc
==============================================================================
--- trunk/glom/libglom/connectionpool.cc (original)
+++ trunk/glom/libglom/connectionpool.cc Thu Apr 10 09:28:30 2008
@@ -803,14 +803,16 @@
if(signum == SIGSEGV)
{
- connection_pool->stop_self_hosting();
+ //TODO: Make this dialog transient for the parent window,
+ //though this is obviously an unusual case.
+ connection_pool->stop_self_hosting(0 /* parent_window */);
//TODO: How can we let GNOME's crash handler still handle this?
exit(1);
}
}
-bool ConnectionPool::start_self_hosting()
+bool ConnectionPool::start_self_hosting(Gtk::Window* parent_window)
{
if(m_self_hosting_active)
return true; //Just do it once.
@@ -873,7 +875,7 @@
const std::string second_command_success_text = "is running"; //TODO: This is not a stable API. Also, watch out for localisation.
//The first command does not return, but the second command can check whether it succeeded:
- const bool result = Glom::Spawn::execute_command_line_and_wait_until_second_command_returns_success(command_postgres_start, command_check_postgres_has_started, _("Starting Database Server"), 0 /* window*/, second_command_success_text);
+ const bool result = Glom::Spawn::execute_command_line_and_wait_until_second_command_returns_success(command_postgres_start, command_check_postgres_has_started, _("Starting Database Server"), parent_window, second_command_success_text);
if(!result)
{
std::cerr << "Error while attempting to self-host a database." << std::endl;
@@ -905,7 +907,7 @@
return true;
}
-void ConnectionPool::stop_self_hosting()
+void ConnectionPool::stop_self_hosting(Gtk::Window* parent_window)
{
if(!m_self_hosting_active)
return; //Don't try to stop it if we have not started it.
@@ -932,14 +934,14 @@
// We use "-m fast" instead of the default "-m smart" because that waits for clients to disconnect (and sometimes never succeeds).
// TODO: Warn about connected clients on other computers? Warn those other users?
const std::string command_postgres_stop = Glib::shell_quote(get_path_to_postgres_executable("pg_ctl")) + " -D \"" + dbdir_data + "\" stop -m fast";
- const bool result = Glom::Spawn::execute_command_line_and_wait(command_postgres_stop, _("Stopping Database Server"));
+ const bool result = Glom::Spawn::execute_command_line_and_wait(command_postgres_stop, _("Stopping Database Server"), parent_window);
if(!result)
{
std::cerr << "Error while attempting to stop self-hosting of the database. Trying again." << std::endl;
//I've seen it fail when running under valgrind, and there are reports of failures in bug #420962.
//Maybe it will help to try again:
- const bool result = Glom::Spawn::execute_command_line_and_wait(command_postgres_stop, _("Stopping Database Server (retrying)"));
+ const bool result = Glom::Spawn::execute_command_line_and_wait(command_postgres_stop, _("Stopping Database Server (retrying)"), parent_window);
if(!result)
{
std::cerr << "Error while attempting (for a second time) to stop self-hosting of the database." << std::endl;
@@ -1044,7 +1046,7 @@
" -U " + username + " --pwfile=\"" + temp_pwfile + "\"";
//Note that --pwfile takes the password from the first line of a file. It's an alternative to supplying it when prompted on stdin.
- const bool result = Glom::Spawn::execute_command_line_and_wait(command_initdb, _("Creating Database Data"));
+ const bool result = Glom::Spawn::execute_command_line_and_wait(command_initdb, _("Creating Database Data"), parent_window);
if(!result)
{
std::cerr << "Error while attempting to create self-hosting database." << std::endl;
Modified: trunk/glom/libglom/connectionpool.h
==============================================================================
--- trunk/glom/libglom/connectionpool.h (original)
+++ trunk/glom/libglom/connectionpool.h Thu Apr 10 09:28:30 2008
@@ -184,12 +184,15 @@
#ifndef GLOM_ENABLE_CLIENT_ONLY
/** Start a database server instance for the exisiting database files.
+ * @param parent_window The parent window (transient for) of any dialogs shown during this operation.
+ * @result Whether the operation was successful.
*/
- bool start_self_hosting();
+ bool start_self_hosting(Gtk::Window* parent_window);
/** Stop the database server instance for the database files.
+ * @param parent_window The parent window (transient for) of any dialogs shown during this operation.
*/
- void stop_self_hosting();
+ void stop_self_hosting(Gtk::Window* parent_window);
/** Create new database files, for later use by their own database server instance.
* @param parent_window A parent window to use as the transient window when displaying errors.
Modified: trunk/glom/libglom/document/document_glom.cc
==============================================================================
--- trunk/glom/libglom/document/document_glom.cc (original)
+++ trunk/glom/libglom/document/document_glom.cc Thu Apr 10 09:28:30 2008
@@ -248,7 +248,7 @@
if(!connection_pool)
return;
- connection_pool->stop_self_hosting();
+ connection_pool->stop_self_hosting(m_parent_window);
}
#endif // !GLOM_ENABLE_CLIENT_ONLY
}
Modified: trunk/glom/libglom/spawn_with_feedback.cc
==============================================================================
--- trunk/glom/libglom/spawn_with_feedback.cc (original)
+++ trunk/glom/libglom/spawn_with_feedback.cc Thu Apr 10 09:28:30 2008
@@ -133,6 +133,9 @@
static Dialog_ProgressCreating* get_and_show_pulse_dialog(const Glib::ustring& message, Gtk::Window* parent_window)
{
+ if(!parent_window)
+ std::cerr << "debug: Glom: get_and_show_pulse_dialog(): parent_window is NULL" << std::endl;
+
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<Gnome::Glade::Xml> refXml = Gnome::Glade::Xml::create(Utils::get_glade_file_path("glom.glade"), "window_progress");
#else
@@ -170,6 +173,9 @@
bool execute_command_line_and_wait(const std::string& command, const Glib::ustring& message, Gtk::Window* parent_window)
{
+ if(!parent_window)
+ std::cerr << "debug: Glom: execute_command_line_and_wait(): parent_window is NULL" << std::endl;
+
//Show a dialog with a pulsing progress bar and a human-readable message, while we wait for the command to finish:
//
//Put the dialog in an auto_ptr so that it will be deleted (and hidden) when the current function returns.
@@ -177,9 +183,6 @@
std::auto_ptr<Dialog_ProgressCreating> dialog_progress;
dialog_progress.reset(dialog_temp);
-
- std::cout << std::endl << "debug: command_line: " << command << std::endl << std::endl;
-
return pulse_until_thread_finished(*dialog_progress, command, sigc::ptr_fun(&execute_command_line_on_thread_create) );
}
@@ -323,6 +326,9 @@
bool execute_command_line_and_wait_until_second_command_returns_success(const std::string& command, const std::string& second_command, const Glib::ustring& message, Gtk::Window* parent_window, const std::string& success_text)
{
+ if(!parent_window)
+ std::cerr << "debug: Glom: execute_command_line_and_wait_until_second_command_returns_success(): parent_window is NULL" << std::endl;
+
Dialog_ProgressCreating* dialog_temp = get_and_show_pulse_dialog(message, parent_window);
std::auto_ptr<Dialog_ProgressCreating> dialog_progress;
dialog_progress.reset(dialog_temp);
@@ -347,7 +353,7 @@
Glib::Pid child_pid;
int child_stderr;
- std::cout << std::endl << "debug: command_line: " << command << std::endl << std::endl;
+ std::cout << std::endl << " debug: command_line: " << command << std::endl << std::endl;
#ifdef GLIBMM_EXCEPTIONS_ENABLED
// Execute the first thread asynchronously (so we don't wait for it):
Modified: trunk/glom/libglom/spawn_with_feedback.h
==============================================================================
--- trunk/glom/libglom/spawn_with_feedback.h (original)
+++ trunk/glom/libglom/spawn_with_feedback.h Thu Apr 10 09:28:30 2008
@@ -35,7 +35,7 @@
* @param message A human-readable message to be shown, for instance in a dialog, while waiting.
* @parent_window Make the dialog transient to this window.
*/
-bool execute_command_line_and_wait(const std::string& command, const Glib::ustring& message, Gtk::Window* parent_window = 0);
+bool execute_command_line_and_wait(const std::string& command, const Glib::ustring& message, Gtk::Window* parent_window);
/** Execute a command-line command, and repeatedly call a second command that tests whether the first command has finished.
* @param command The command-line command.
@@ -43,9 +43,9 @@
* @parent_window Make the dialog transient to this window.
* @success_text If this is not empty, then the second command will only be considered to have succeeded when this text is found in its stdout output.
*/
-bool execute_command_line_and_wait_until_second_command_returns_success(const std::string& command, const std::string& second_command, const Glib::ustring& message, Gtk::Window* parent_window = 0, const std::string& success_text = std::string());
+bool execute_command_line_and_wait_until_second_command_returns_success(const std::string& command, const std::string& second_command, const Glib::ustring& message, Gtk::Window* parent_window, const std::string& success_text = std::string());
-//bool execute_command_line_and_wait_fixed_seconds(const std::string& command, unsigned int seconds, const Glib::ustring& message, Gtk::Window* parent_window = 0);
+//bool execute_command_line_and_wait_fixed_seconds(const std::string& command, unsigned int seconds, const Glib::ustring& message, Gtk::Window* parent_window);
} //Spawn
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]