Permalink
Browse files

Indention level fixed (shift width = 4)

  • Loading branch information...
1 parent d66f9af commit 1fb31d1423c734b2508796154ed8af067cf079f2 @jaypikay jaypikay committed Apr 20, 2012
Showing with 147 additions and 148 deletions.
  1. +25 −26 src/NWindow.h
  2. +22 −22 src/Util.cc
  3. +100 −100 src/main.cc
View
@@ -28,53 +28,52 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "SetBG.h"
class NWindow : public Gtk::Window {
- public:
- NWindow ();
- void show (void);
- virtual ~NWindow ();
+ public:
+ NWindow ();
+ void show (void);
+ virtual ~NWindow ();
- Thumbview view;
- void sighandle_dblclick_item(const Gtk::TreeModel::Path& path);
- void sighandle_click_apply(void);
- void sighandle_mode_change(void);
+ Thumbview view;
+ void sighandle_dblclick_item(const Gtk::TreeModel::Path& path);
+ void sighandle_click_apply(void);
+ void sighandle_mode_change(void);
- void set_default_selections();
+ void set_default_selections();
std::map<Glib::ustring, Glib::ustring> map_displays; // a map of current displays on the running instance to their display names
-
- bool is_multihead;
- bool is_xinerama;
+
+ bool is_multihead;
+ bool is_xinerama;
void set_bg(Glib::ustring file);
- protected:
-
- Glib::RefPtr<Gtk::ActionGroup> m_action_group;
- Glib::RefPtr<Gtk::UIManager> m_ui_manager;
- Gtk::VBox main_vbox;
- Gtk::HBox bot_hbox;
+ protected:
+ Glib::RefPtr<Gtk::ActionGroup> m_action_group;
+ Glib::RefPtr<Gtk::UIManager> m_ui_manager;
+ Gtk::VBox main_vbox;
+ Gtk::HBox bot_hbox;
- ImageCombo select_mode, select_display;
+ ImageCombo select_mode, select_display;
- Gtk::Button apply;
+ Gtk::Button apply;
Gtk::Button btn_prefs;
- Gtk::ColorButton button_bgcolor;
+ Gtk::ColorButton button_bgcolor;
bool m_dirty; // set if the user double clicks to preview but forgets to press apply
- void setup_select_boxes();
+ void setup_select_boxes();
- void sighandle_accel_quit();
+ void sighandle_accel_quit();
void sighandle_togb_list_toggled();
void sighandle_togb_icon_toggled();
void sighandle_btn_prefs();
virtual bool on_delete_event(GdkEventAny *event);
#ifdef USE_XINERAMA
- // xinerama stuff
- XineramaScreenInfo* xinerama_info;
- gint xinerama_num_screens;
+ // xinerama stuff
+ XineramaScreenInfo* xinerama_info;
+ gint xinerama_num_screens;
#endif
};
View
@@ -184,34 +184,34 @@ void restore_saved_bgs() {
*/
ArgParser* create_arg_parser() {
- ArgParser* parser = new ArgParser();
- parser->register_option("restore", _("Restore saved backgrounds"));
- parser->register_option("no-recurse", _("Do not recurse into subdirectories"));
- parser->register_option("sort", _("How to sort the backgrounds. Valid options are:\n\t\t\t* alpha, for alphanumeric sort\n\t\t\t* ralpha, for reverse alphanumeric sort\n\t\t\t* time, for last modified time sort (oldest first)\n\t\t\t* rtime, for reverse last modified time sort (newest first)"), true);
- parser->register_option("set-color", _("background color in hex, #000000 by default"), true);
-
- // command line set modes
- Glib::ustring openp(" (");
- Glib::ustring closep(")");
- parser->register_option("set-scaled", _("Sets the background to the given file") + openp + _("scaled") + closep);
- parser->register_option("set-tiled", _("Sets the background to the given file") + openp + _("tiled") + closep);
- parser->register_option("set-auto", _("Sets the background to the given file") + openp + _("auto") + closep);
- parser->register_option("set-centered", _("Sets the background to the given file") + openp + _("centered") + closep);
- parser->register_option("set-zoom", _("Sets the background to the given file") + openp + _("zoom") + closep);
+ ArgParser* parser = new ArgParser();
+ parser->register_option("restore", _("Restore saved backgrounds"));
+ parser->register_option("no-recurse", _("Do not recurse into subdirectories"));
+ parser->register_option("sort", _("How to sort the backgrounds. Valid options are:\n\t\t\t* alpha, for alphanumeric sort\n\t\t\t* ralpha, for reverse alphanumeric sort\n\t\t\t* time, for last modified time sort (oldest first)\n\t\t\t* rtime, for reverse last modified time sort (newest first)"), true);
+ parser->register_option("set-color", _("background color in hex, #000000 by default"), true);
+
+ // command line set modes
+ Glib::ustring openp(" (");
+ Glib::ustring closep(")");
+ parser->register_option("set-scaled", _("Sets the background to the given file") + openp + _("scaled") + closep);
+ parser->register_option("set-tiled", _("Sets the background to the given file") + openp + _("tiled") + closep);
+ parser->register_option("set-auto", _("Sets the background to the given file") + openp + _("auto") + closep);
+ parser->register_option("set-centered", _("Sets the background to the given file") + openp + _("centered") + closep);
+ parser->register_option("set-zoom", _("Sets the background to the given file") + openp + _("zoom") + closep);
parser->register_option("set-zoom-fill", _("Sets the background to the given file") + openp + _("zoom-fill") + closep);
parser->register_option("save", _("Saves the background permanently"));
- std::vector<std::string> vecsetopts;
- vecsetopts.push_back("set-scaled");
- vecsetopts.push_back("set-tiled");
- vecsetopts.push_back("set-auto");
- vecsetopts.push_back("set-centered");
- vecsetopts.push_back("set-zoom");
+ std::vector<std::string> vecsetopts;
+ vecsetopts.push_back("set-scaled");
+ vecsetopts.push_back("set-tiled");
+ vecsetopts.push_back("set-auto");
+ vecsetopts.push_back("set-centered");
+ vecsetopts.push_back("set-zoom");
vecsetopts.push_back("set-zoom-fill");
- parser->make_exclusive(vecsetopts);
+ parser->make_exclusive(vecsetopts);
- return parser;
+ return parser;
}
/**
View
@@ -76,89 +76,89 @@ bool poll_inotify(void) {
int main (int argc, char ** argv) {
- // set up i18n
- bindtextdomain(PACKAGE, LOCALEDIR);
- bind_textdomain_codeset(PACKAGE, "UTF-8");
- textdomain(PACKAGE);
-
- /* i18n::set_text_domain_dir(PACKAGE, LOCALEDIR);
- i18n::set_text_domain(PACKAGE);*/
-
-
- Gtk::Main kit(argc, argv);
- Gtk::IconTheme::get_default()->append_search_path(NITROGEN_DATA_DIR
- G_DIR_SEPARATOR_S "icons");
- if (!Glib::thread_supported()) Glib::thread_init();
- Config *cfg = Config::get_instance();
- ArgParser *parser = Util::create_arg_parser();
-
- // parse command line
- if ( ! parser->parse(argc, argv) ) {
- std::cerr << _("Error parsing command line") << ": " << parser->get_error() << "\n";
- return -1;
- }
-
- // if we got restore, set it and exit
- if ( parser->has_argument("restore") ) {
- restore_bgs();
- return 0;
- }
-
- // if we got a help, display it and exit
- if ( parser->has_argument("help") ) {
- std::cout << parser->help_text() << "\n";
- return 0;
- }
-
- // get the starting dir
- std::string startdir = parser->get_extra_args();
+ // set up i18n
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset(PACKAGE, "UTF-8");
+ textdomain(PACKAGE);
+
+ /* i18n::set_text_domain_dir(PACKAGE, LOCALEDIR);
+ i18n::set_text_domain(PACKAGE);*/
+
+
+ Gtk::Main kit(argc, argv);
+ Gtk::IconTheme::get_default()->append_search_path(NITROGEN_DATA_DIR
+ G_DIR_SEPARATOR_S "icons");
+ if (!Glib::thread_supported()) Glib::thread_init();
+ Config *cfg = Config::get_instance();
+ ArgParser *parser = Util::create_arg_parser();
+
+ // parse command line
+ if ( ! parser->parse(argc, argv) ) {
+ std::cerr << _("Error parsing command line") << ": " << parser->get_error() << "\n";
+ return -1;
+ }
+
+ // if we got restore, set it and exit
+ if ( parser->has_argument("restore") ) {
+ restore_bgs();
+ return 0;
+ }
+
+ // if we got a help, display it and exit
+ if ( parser->has_argument("help") ) {
+ std::cout << parser->help_text() << "\n";
+ return 0;
+ }
+
+ // get the starting dir
+ std::string startdir = parser->get_extra_args();
bool bcmdlinedir = startdir.length() > 0;
-// if (!bcmd <= 0) {
-// startdir = ".";
-// cfg->set_recurse(false);
-// }
+ // if (!bcmd <= 0) {
+ // startdir = ".";
+ // cfg->set_recurse(false);
+ // }
if (bcmdlinedir)
- startdir = Util::fix_start_dir(std::string(startdir));
-
- // should we set on the command line?
+ startdir = Util::fix_start_dir(std::string(startdir));
+
+ // should we set on the command line?
Gdk::Color color("#000000");
if ( parser->has_argument("set-color") ) {
Glib::ustring bgcolor_str = parser->get_value ("set-color");
color.parse(bgcolor_str);
}
- if ( parser->has_argument("set-tiled") ) {
- set_bg_once(startdir, SetBG::SET_TILE, parser->has_argument("save"), color);
- return 0;
- }
+ if ( parser->has_argument("set-tiled") ) {
+ set_bg_once(startdir, SetBG::SET_TILE, parser->has_argument("save"), color);
+ return 0;
+ }
- if ( parser->has_argument("set-scaled") ) {
- set_bg_once(startdir, SetBG::SET_SCALE, parser->has_argument("save"), color);
- return 0;
- }
+ if ( parser->has_argument("set-scaled") ) {
+ set_bg_once(startdir, SetBG::SET_SCALE, parser->has_argument("save"), color);
+ return 0;
+ }
if ( parser->has_argument("set-auto") ) {
- set_bg_once(startdir, SetBG::SET_AUTO, parser->has_argument("save"), color);
- return 0;
- }
+ set_bg_once(startdir, SetBG::SET_AUTO, parser->has_argument("save"), color);
+ return 0;
+ }
- if ( parser->has_argument("set-zoom") ) {
- set_bg_once(startdir, SetBG::SET_ZOOM, parser->has_argument("save"), color);
- return 0;
- }
+ if ( parser->has_argument("set-zoom") ) {
+ set_bg_once(startdir, SetBG::SET_ZOOM, parser->has_argument("save"), color);
+ return 0;
+ }
- if ( parser->has_argument("set-zoom-fill") ) {
- set_bg_once(startdir, SetBG::SET_ZOOM_FILL, parser->has_argument("save"), color);
- return 0;
- }
+ if ( parser->has_argument("set-zoom-fill") ) {
+ set_bg_once(startdir, SetBG::SET_ZOOM_FILL, parser->has_argument("save"), color);
+ return 0;
+ }
- if ( parser->has_argument("set-centered") ) {
- set_bg_once(startdir, SetBG::SET_CENTER, parser->has_argument("save"), color);
- return 0;
- }
+ if ( parser->has_argument("set-centered") ) {
+ set_bg_once(startdir, SetBG::SET_CENTER, parser->has_argument("save"), color);
+ return 0;
+ }
- if ( parser->has_argument("no-recurse") )
- cfg->set_recurse(false);
+ if ( parser->has_argument("no-recurse") )
+ cfg->set_recurse(false);
// load configuration if there is one
cfg->load_cfg();
@@ -170,53 +170,53 @@ int main (int argc, char ** argv) {
cfg->get_pos(x, y);
// create main window
- NWindow* main_window = new NWindow();
+ NWindow* main_window = new NWindow();
main_window->set_default_size(w, h);
main_window->move(x, y); // most likely will be ignored by the wm
-// main_window->view.set_dir(startdir);
+ // main_window->view.set_dir(startdir);
if (bcmdlinedir)
- main_window->view.load_dir(startdir);
+ main_window->view.load_dir(startdir);
else
main_window->view.load_dir(cfg->get_dirs());
main_window->view.set_current_display_mode(cfg->get_display_mode());
- main_window->set_default_selections();
+ main_window->set_default_selections();
main_window->view.set_icon_captions(cfg->get_icon_captions());
main_window->signal_delete_event().connect(sigc::bind(sigc::ptr_fun(&on_window_close_save_pos), main_window));
- main_window->show();
-
- if ( parser->has_argument("sort") ) {
- Glib::ustring sort_mode = parser->get_value ("sort");
- Thumbview::SortMode mode;
-
- if (sort_mode == "alpha") {
- mode = Thumbview::SORT_ALPHA;
- } else if (sort_mode == "ralpha") {
- mode = Thumbview::SORT_RALPHA;
- } else if (sort_mode == "time") {
- mode = Thumbview::SORT_TIME;
- } else {
- mode = Thumbview::SORT_RTIME;
- }
-
- main_window->view.set_sort_mode (mode);
- }
-
- // remove parser
- delete parser;
-
- // rig up idle/thread routines
- Glib::Thread::create(sigc::mem_fun(main_window->view, &Thumbview::load_cache_images), true);
- Glib::Thread::create(sigc::mem_fun(main_window->view, &Thumbview::create_cache_images), true);
+ main_window->show();
+
+ if ( parser->has_argument("sort") ) {
+ Glib::ustring sort_mode = parser->get_value ("sort");
+ Thumbview::SortMode mode;
+
+ if (sort_mode == "alpha") {
+ mode = Thumbview::SORT_ALPHA;
+ } else if (sort_mode == "ralpha") {
+ mode = Thumbview::SORT_RALPHA;
+ } else if (sort_mode == "time") {
+ mode = Thumbview::SORT_TIME;
+ } else {
+ mode = Thumbview::SORT_RTIME;
+ }
+
+ main_window->view.set_sort_mode (mode);
+ }
+
+ // remove parser
+ delete parser;
+
+ // rig up idle/thread routines
+ Glib::Thread::create(sigc::mem_fun(main_window->view, &Thumbview::load_cache_images), true);
+ Glib::Thread::create(sigc::mem_fun(main_window->view, &Thumbview::create_cache_images), true);
#ifdef USE_INOTIFY
- Glib::signal_timeout().connect(sigc::ptr_fun(&poll_inotify), (unsigned)1e3);
+ Glib::signal_timeout().connect(sigc::ptr_fun(&poll_inotify), (unsigned)1e3);
#endif
- Gtk::Main::run (*main_window);
+ Gtk::Main::run (*main_window);
cfg->save_cfg();
- return 0;
+ return 0;
}

0 comments on commit 1fb31d1

Please sign in to comment.