3
* Copyright (C) 2001-2004 Murray Cumming
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License as
7
* published by the Free Software Foundation; either version 2 of the
8
* License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* General Public License for more details.
15
* You should have received a copy of the GNU General Public
16
* License along with this program; if not, write to the
17
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
* Boston, MA 02111-1307, USA.
21
#include "dialog_progress_creating.h"
22
#include <gtkmm/main.h>
23
#include <gtkmm/dialog.h>
24
#include <glibmm/i18n.h>
29
Dialog_ProgressCreating::Dialog_ProgressCreating(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade)
30
: Gtk::Window(cobject),
33
m_response_id(Gtk::RESPONSE_OK),
37
refGlade->get_widget("progressbar", m_progress);
38
refGlade->get_widget("label_message", m_label_message);
42
Dialog_ProgressCreating::~Dialog_ProgressCreating()
46
void Dialog_ProgressCreating::pulse()
51
//Allow GTK+ to perform all updates for us
52
//Without this, the progress bar will appear to do nothing.
54
// People are supposed to either use run(), or run their own mainloop.
55
// This method is a rather bad hack. I changed spawn.cc to use this
56
// properly, and it does not seem to be used elsewhere. armin.
58
//while(Gtk::Main::instance()->events_pending())
59
// Gtk::Main::instance()->iteration();
62
void Dialog_ProgressCreating::set_message(const Glib::ustring& title, const Glib::ustring& secondary_text)
65
m_label_message->set_text(secondary_text);
68
void Dialog_ProgressCreating::response(int response_id)
70
if(!m_running) return;
72
m_response_id = response_id;
77
int Dialog_ProgressCreating::run()
80
if(m_running) return Gtk::RESPONSE_CANCEL;
88
bool Dialog_ProgressCreating::on_delete_event(GdkEventAny* event)
90
if(m_running) response(Gtk::RESPONSE_DELETE_EVENT);