Back to index

easystroke  0.5.5.1
Public Member Functions | Private Attributes
ActionDBWatcher Class Reference

#include <actiondb.h>

Inheritance diagram for ActionDBWatcher:
Inheritance graph
[legend]
Collaboration diagram for ActionDBWatcher:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ActionDBWatcher ()
void init ()
virtual void timeout ()
virtual void notify ()
void execute_now ()
template<class T >
void watch (Out< T > &v)

Private Attributes

bool good_state

Detailed Description

Definition at line 407 of file actiondb.h.


Constructor & Destructor Documentation

Definition at line 410 of file actiondb.h.

: TimeoutWatcher(5000), good_state(true) {}

Member Function Documentation

void TimeoutWatcher::execute_now ( ) [inline, inherited]

Definition at line 152 of file var.h.

                          {
              if (remove_timeout())
                     timeout();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 196 of file actiondb.cc.

                           {
       std::string filename = config_dir+"actions";
       for (const char **v = actions_versions; *v; v++)
              if (is_file(filename + *v)) {
                     filename += *v;
                     try {
                            ifstream ifs(filename.c_str(), ios::binary);
                            if (!ifs.fail()) {
                                   boost::archive::text_iarchive ia(ifs);
                                   ia >> actions;
                                   if (verbosity >= 2)
                                          printf("Loaded actions.\n");
                            }
                     } catch (exception &e) {
                            printf(_("Error: Couldn't read action database: %s.\n"), e.what());
                     }
                     break;
              }
       watch(action_dummy);
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void TimeoutWatcher::notify ( ) [inline, virtual, inherited]

Implements Base.

Definition at line 151 of file var.h.

Here is the call graph for this function:

void ActionDBWatcher::timeout ( ) [virtual]

Implements Timeout.

Definition at line 217 of file actiondb.cc.

                              {
       std::string filename = config_dir+"actions"+actions_versions[0];
       std::string tmp = filename + ".tmp";
       try {
              ofstream ofs(tmp.c_str());
              boost::archive::text_oarchive oa(ofs);
              oa << (const ActionDB &)actions;
              ofs.close();
              if (rename(tmp.c_str(), filename.c_str()))
                     throw std::runtime_error(_("rename() failed"));
              if (verbosity >= 2)
                     printf("Saved actions.\n");
       } catch (exception &e) {
              printf(_("Error: Couldn't save action database: %s.\n"), e.what());
              if (!good_state)
                     return;
              good_state = false;
              error_dialog(Glib::ustring::compose(_( "Couldn't save %1.  Your changes will be lost.  "
                            "Make sure that \"%2\" is a directory and that you have write access to it.  "
                            "You can change the configuration directory "
                            "using the -c or --config-dir command line options."), _("actions"), config_dir));
       }
}

Here is the call graph for this function:

template<class T >
void Watcher::watch ( Out< T > &  v) [inline, inherited]

Definition at line 144 of file var.h.

{ v.connect(this); }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 408 of file actiondb.h.


The documentation for this class was generated from the following files: