paperbox r171 - in trunk: . src
- From: markoa svn gnome org
- To: svn-commits-list gnome org
- Subject: paperbox r171 - in trunk: . src
- Date: Thu, 19 Jun 2008 09:56:56 +0000 (UTC)
Author: markoa
Date: Thu Jun 19 09:56:56 2008
New Revision: 171
URL: http://svn.gnome.org/viewvc/paperbox?rev=171&view=rev
Log:
Correctly check for config dirs on startup
Modified:
trunk/ (props changed)
trunk/ChangeLog
trunk/configure.ac
trunk/src/category.cc
trunk/src/config.cc
trunk/src/config.hh
trunk/src/main.cc
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Thu Jun 19 09:56:56 2008
@@ -1,6 +1,6 @@
### Copyright (C) 2007, 2008 Marko Anastasov
-AC_INIT([PaperBox], [0.3.0], [http://bugzilla.gnome.org/enter_bug.cgi?product=paperbox], [paperbox])
+AC_INIT([PaperBox], [0.3.1], [http://bugzilla.gnome.org/enter_bug.cgi?product=paperbox], [paperbox])
AC_PREREQ(2.59)
AC_CONFIG_SRCDIR([src/main.cc])
Modified: trunk/src/category.cc
==============================================================================
--- trunk/src/category.cc (original)
+++ trunk/src/category.cc Thu Jun 19 09:56:56 2008
@@ -31,18 +31,6 @@
namespace {
- // Creates ~/.config/paperbox/categories/ if it does not exist.
- void check_category_path()
- {
- std::string path = paperbox::Category::get_default_path();
-
- if (! Glib::file_test(path, Glib::FILE_TEST_EXISTS))
- if (g_mkdir_with_parents(path.c_str(), S_IRWXU) == -1)
- g_warning("Could not make directory %s with parents: %s",
- path.c_str(),
- g_strerror(errno));
- }
-
// Loads open text stream's contents into a string list.
void read_lines(std::ifstream& fs,
std::vector<std::string>& lines)
@@ -83,7 +71,6 @@
name_(name.raw())
{
file_ = Gio::File::create_for_path(get_default_path() + name_);
- check_category_path();
if (! file_->query_exists()) {
// touch
Modified: trunk/src/config.cc
==============================================================================
--- trunk/src/config.cc (original)
+++ trunk/src/config.cc Thu Jun 19 09:56:56 2008
@@ -20,10 +20,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <errno.h>
#include <glibmm/fileutils.h>
#include <glibmm-utils/log-stream-utils.h>
#include <giomm/error.h>
#include <giomm/file.h>
+#include "category.hh"
#include "config.hh"
#include "main-window.hh"
@@ -34,6 +36,20 @@
const ustring UI_GROUP = "UI";
+ // Will create ~/.config/paperbox and ~/.config/paperbox/categories.
+ // Call it from main().
+ void
+ init_config_dirs()
+ {
+ std::string path = paperbox::Category::get_default_path();
+
+ if (! Glib::file_test(path, Glib::FILE_TEST_EXISTS))
+ if (g_mkdir_with_parents(path.c_str(), S_IRWXU) == -1)
+ g_warning("Could not make directory %s with parents: %s",
+ path.c_str(),
+ g_strerror(errno));
+ }
+
// Returns the default implementation of the Config interface to
// the rest of the application.
shared_ptr<Config>
Modified: trunk/src/config.hh
==============================================================================
--- trunk/src/config.hh (original)
+++ trunk/src/config.hh Thu Jun 19 09:56:56 2008
@@ -51,6 +51,8 @@
boost::shared_ptr<Config> get_default_config();
+ void init_config_dirs();
+
const std::string KEY_FILE_CONFIG_PATH = Glib::get_home_dir() +
G_DIR_SEPARATOR_S + ".config" + G_DIR_SEPARATOR + "paperbox" +
G_DIR_SEPARATOR + "config.ini";
Modified: trunk/src/main.cc
==============================================================================
--- trunk/src/main.cc (original)
+++ trunk/src/main.cc Thu Jun 19 09:56:56 2008
@@ -24,6 +24,7 @@
#include <giomm/init.h>
#include <gtkmm/main.h>
#include <glibmm-utils/log-stream-utils.h>
+#include "config.hh"
#include "main-window.hh"
int
@@ -33,6 +34,8 @@
Gio::init();
Gtk::Main kit(argc, argv);
+ paperbox::init_config_dirs();
+
paperbox::MainWindow* main_window = 0;
try {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]