Skip to content

Commit e89ae8f

Browse files
committed
Merge pull request #11 from Abogical/master
Use icons of PS3 and X-Box controllers
2 parents 9773e2b + 83ba76a commit e89ae8f

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*~
22
/build/
3+
jstest-gtk

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ You can find the latest version at:
1212

1313
* http://github.com/Grumbel/jstest-gtk/tree/master
1414

15-
Questions, comments and bug reporst can be given to:
15+
Questions, comments and bug reports can be given to:
1616

1717
* Ingo Ruhnke <[email protected]>
1818

data/PS3.png

5.16 KB
Loading

src/joystick_list_widget.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,21 @@ JoystickListWidget::on_refresh()
123123
for(std::vector<JoystickDescription>::const_iterator i = joysticks.begin(); i != joysticks.end(); ++i)
124124
{
125125
Gtk::ListStore::iterator it = device_list->append();
126-
(*it)[DeviceListColumns::instance().icon] = Gdk::Pixbuf::create_from_file(Main::current()->get_data_directory() + "generic.png");
126+
127+
const Glib::ustring& name = i->name;
128+
Glib::ustring icon_filename;
129+
//Playstation icon for ps3 controller
130+
if(name == "Sony PLAYSTATION(R)3 Controller") icon_filename = "PS3.png";
131+
//Xbox icon for xbox controller
132+
else if(name.find("X-Box") != Glib::ustring::npos) icon_filename = "xbox360_small.png";
133+
//General icon for the rest
134+
else icon_filename = "generic.png";
135+
136+
(*it)[DeviceListColumns::instance().icon] = Gdk::Pixbuf::create_from_file(Main::current()->get_data_directory() + icon_filename);
127137
(*it)[DeviceListColumns::instance().path] = i->filename;
128138

129139
std::ostringstream out;
130-
out << i->name << "\n"
140+
out << name << "\n"
131141
<< "Device: " << i->filename << "\n"
132142
<< "Axes: " << i->axis_count << "\n"
133143
<< "Buttons: " << i->button_count;

0 commit comments

Comments
 (0)