← easystroke

Report WM frames as such in application list

9dee8ad574ab478f29989f735dcd489a6d838cbe · Thomas Jaeger · Jan 14, 2010 15:06

http://sourceforge.net/apps/trac/easystroke/ticket/35

+9 −5 · 4 files changed

  • actions.cc +2 −2
  • prefs.cc +2 −3
  • win.cc +4 −0
  • win.h +1 −0
diff --git a/actions.cc b/actions.cc
index 2fb5712..db1ed5c 100644
--- a/actions.cc
+++ b/actions.cc
@@ -300,7 +300,7 @@ Actions::Actions() :
 
 void Actions::load_app_list(const Gtk::TreeNodeChildren &ch, ActionListDiff *actions) {
 	Gtk::TreeRow row = *(apps_model->append(ch));
-	row[ca.app] = actions->name;
+	row[ca.app] = app_name_hr(actions->name);
 	row[ca.actions] = actions;
 	for (ActionListDiff::iterator i = actions->begin(); i != actions->end(); i++)
 		load_app_list(row.children(), &(*i));
@@ -606,7 +606,7 @@ void Actions::on_add_app() {
 		apps_model->children().begin()->children() :
 		apps_view->get_selection()->get_selected()->children();
 	Gtk::TreeRow row = *(apps_model->append(ch));
-	row[ca.app] = name;
+	row[ca.app] = app_name_hr(name);
 	row[ca.actions] = child;
 	actions.apps[name] = child;
 	Gtk::TreePath path = apps_model->get_path(row);
diff --git a/prefs.cc b/prefs.cc
index 6266a69..f575adf 100644
--- a/prefs.cc
+++ b/prefs.cc
@@ -336,7 +336,7 @@ Prefs::Prefs() {
 	for (std::map<std::string, RButtonInfo>::const_iterator i = exceptions.begin(); i!=exceptions.end(); i++) {
 		Gtk::TreeModel::Row row = *(tm->append());
 		row[cols.app] = i->first;
-		row[cols.user_app] = i->first == "" ? _("(window manager frame)") : i->first;
+		row[cols.user_app] = app_name_hr(i->first);
 		row[cols.button] = i->second ? i->second->get_button_text() : _("<App disabled>");
 	}
 }
@@ -586,11 +586,10 @@ void Prefs::on_add() {
 		is_new = prefs.exceptions.write_ref(a).insert(
 				std::pair<std::string, RButtonInfo>(str, RButtonInfo())).second;
 	}
-	Glib::ustring user_str = str == "" ? _("(window manager frame)") : str;
 	if (is_new) {
 		Gtk::TreeModel::Row row = *(tm->append());
 		row[cols.app] = str;
-		row[cols.user_app] = user_str;
+		row[cols.user_app] = app_name_hr(str);
 		row[cols.button] = _("<App disabled>");
 		Gtk::TreePath path = tm->get_path(row);
 		tv->set_cursor(path);
diff --git a/win.cc b/win.cc
index 521ec42..591f732 100644
--- a/win.cc
+++ b/win.cc
@@ -267,3 +267,7 @@ void error_dialog(const Glib::ustring &text) {
 	dialog.show();
 	dialog.run();
 }
+
+Glib::ustring app_name_hr(Glib::ustring src) {
+	return src == "" ? _("(window manager frame)") : src;
+}
diff --git a/win.h b/win.h
index 70bec86..be215de 100644
--- a/win.h
+++ b/win.h
@@ -122,4 +122,5 @@ private:
 };
 
 void error_dialog(const Glib::ustring &);
+Glib::ustring app_name_hr(Glib::ustring);
 #endif