Debian Codegraph @

demos/gtk-demo/example_iconbrowser.cc

raw
1 /* Icon Browser
2 *
3 * Demonstrates many named icons.
4 *
5 * This demo shows Gtk::HeaderBar, Gtk::ListBox, Gtk::IconView and
6 * Gtk::SearchBar in action, but its primary aim is to show an assortment
7 * of named icons.
8 *
9 * Click on an icon to see it in different sizes.
10 *
11 * Press the search button and enter a search string, to show icons
12 * whose names match the search string.
13 *
14 * You can drag icons to other programs. Either drag an icon's name from
15 * the icon view, or drag an image from the dialog box that opens when you
16 * click on an icon.
17 */
18
19 #include <gtkmm.h>
20 #include <string>
21 #include <sstream>
22 #include <iostream>
23
24 // Labels in the ListBox with icon context names.
25 // The icon context ids in this program are not the same as in the Icon Naming Specification
26 // at http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html.
27 class IconContextLabel : public Gtk::Label
28 {
29 public:
30 IconContextLabel(const Glib::ustring& id, const Glib::ustring& name)
31 : Gtk::Label(name), m_id(id)
32 { }
33
34 Glib::ustring get_id() const { return m_id; }
35
36 private:
37 Glib::ustring m_id;
38
39 }; // end IconContextLabel
40
41 // A ListStore that stores names, descriptions and context ids of icons.
42 class IconInfoStore : public Gtk::ListStore
43 {
44 public:
45 static Glib::RefPtr<IconInfoStore> create();
46 ~IconInfoStore() override;
47
48 void set_text_column(bool symbolic)
49 { m_text_column = symbolic ? m_columns.symbolic_name : m_columns.name; }
50
51 Gtk::TreeModelColumn<Glib::ustring> get_text_column() const
52 { return m_text_column; }
53
54 struct ModelColumns : public Gtk::TreeModelColumnRecord
55 {
56 Gtk::TreeModelColumn<Glib::ustring> name;
57 Gtk::TreeModelColumn<Glib::ustring> symbolic_name;
58 Gtk::TreeModelColumn<Glib::ustring> description;
59 Gtk::TreeModelColumn<Glib::ustring> context_id;
60
61 ModelColumns()
62 {
63 add(name);
64 add(symbolic_name);
65 add(description);
66 add(context_id);
67 }
68 };
69
70 const ModelColumns m_columns;
71
72 protected:
73 IconInfoStore();
74
75 // Overridden virtual function:
76 bool drag_data_get_vfunc(const Gtk::TreeModel::Path& path,
77 Gtk::SelectionData& selection_data) const override;
78
79 private:
80 Gtk::TreeModelColumn<Glib::ustring> m_text_column;
81
82 }; // end IconInfoStore
83
84 // Dialog box, showing icon details.
85 class DetailDialog : public Gtk::Dialog
86 {
87 public:
88 DetailDialog(Gtk::Window& parent);
89 ~DetailDialog() override;
90
91 void set_image(const Glib::ustring& icon_name, const Glib::ustring& description);
92
93 protected:
94 // Signal handler:
95 void on_image_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& context,
96 Gtk::SelectionData& selection_data, guint info, guint time, int size_index);
97
98 Glib::RefPtr<Gdk::Pixbuf> get_icon(int size_index);
99
100 static const int n_icon_sizes = 5;
101 static const int m_icon_size[n_icon_sizes];
102
103 Glib::ustring m_icon_name;
104
105 // Child widgets:
106 Gtk::Grid m_grid;
107 Gtk::EventBox m_event_box[n_icon_sizes];
108 Gtk::Image m_image[n_icon_sizes];
109 Gtk::Label m_label[n_icon_sizes];
110 Gtk::Label m_description;
111
112 }; // end DetailDialog
113
114 // Main window.
115 class Example_IconBrowser : public Gtk::Window
116 {
117 public:
118 Example_IconBrowser();
119 ~Example_IconBrowser() override;
120
121 protected:
122 // Signal handlers:
123 bool on_window_key_press_event(GdkEventKey* event);
124 void on_symbolic_radio_toggled();
125 void on_context_list_selected_rows_changed();
126 void on_icon_view_item_activated(const Gtk::TreeModel::Path& path);
127 bool on_icon_view_query_tooltip(int x, int y,
128 bool keyboard_tooltip, const Glib::RefPtr<Gtk::Tooltip>& tooltip);
129 void on_search_bar_search_mode_enabled_changed();
130 void on_search_entry_search_changed();
131
132 void populate();
133 void add_context(const Glib::ustring& id,
134 const Glib::ustring& name, const Glib::ustring& description);
135 void add_icon(const Glib::ustring& name,
136 const Glib::ustring& description, const Glib::ustring& context_id);
137 bool is_icon_visible(const Gtk::TreeModel::const_iterator& iter) const;
138
139 // Child widgets, header bar:
140 Gtk::HeaderBar m_header;
141 Gtk::Box m_header_radio_button_box;
142 Gtk::RadioButton m_normal_radio;
143 Gtk::RadioButton m_symbolic_radio;
144 Gtk::ToggleButton m_search_button;
145
146 Glib::RefPtr<Gtk::SizeGroup> m_button_size_group;
147
148 // Child widgets, main part of window:
149 Gtk::Box m_hbox;
150 Gtk::ListBox m_context_list;
151 Gtk::Separator m_vseparator;
152 Gtk::Box m_vcontent_box;
153 Gtk::SearchBar m_search_bar;
154 Gtk::SearchEntry m_search_entry;
155 Gtk::ScrolledWindow m_scrolled_window;
156 Gtk::IconView m_icon_view;
157
158 Gtk::CellRendererPixbuf m_icon_cell;
159 Gtk::CellRendererText m_text_cell;
160
161 // Dialog box, showing icon details:
162 DetailDialog m_details;
163
164 Glib::RefPtr<Glib::Binding> m_binding_search_button_search_entry;
165 Glib::ustring m_current_context_id;
166 Glib::RefPtr<Gtk::TreeModelFilter> m_filter_model;
167 Glib::RefPtr<IconInfoStore> m_store;
168
169 }; // end Example_IconBrowser
170
171
172 Gtk::Window* do_iconbrowser()
173 {
174 return new Example_IconBrowser();
175 }
176
177 // Definition of main window methods.
178 Example_IconBrowser::Example_IconBrowser()
179 :
180 m_header_radio_button_box(Gtk::ORIENTATION_HORIZONTAL, 0),
181 m_normal_radio("Normal"),
182 m_symbolic_radio("Symbolic"),
183 m_hbox(Gtk::ORIENTATION_HORIZONTAL, 0),
184 m_vseparator(Gtk::ORIENTATION_VERTICAL),
185 m_vcontent_box(Gtk::ORIENTATION_VERTICAL, 0),
186 m_details(*this)
187 {
188 //set_title("Icon Browser"); // Not shown when header bar is shown
189 set_default_size(600, 800);
190
191 m_store = IconInfoStore::create();
192 m_filter_model = Gtk::TreeModelFilter::create(m_store);
193
194 // The header bar.
195 set_titlebar(m_header);
196 m_header.set_title("Icon Browser");
197 m_header.set_show_close_button(true);
198 m_header.pack_end(m_search_button);
199 m_search_button.set_image_from_icon_name("edit-find-symbolic", Gtk::ICON_SIZE_MENU);
200 m_header.pack_end(m_header_radio_button_box);
201 m_header_radio_button_box.pack_start(m_normal_radio);
202 m_header_radio_button_box.pack_start(m_symbolic_radio);
203 m_normal_radio.set_mode(false); // Make it look as a normal button
204 m_symbolic_radio.set_mode(false);
205 m_symbolic_radio.join_group(m_normal_radio);
206
207 m_button_size_group = Gtk::SizeGroup::create(Gtk::SIZE_GROUP_VERTICAL);
208 m_button_size_group->add_widget(m_normal_radio);
209 m_button_size_group->add_widget(m_symbolic_radio);
210 m_button_size_group->add_widget(m_search_button);
211
212 // Main part of the window.
213 add(m_hbox);
214 m_hbox.pack_start(m_context_list, Gtk::PACK_SHRINK);
215 m_context_list.set_selection_mode(Gtk::SELECTION_SINGLE);
216 m_hbox.pack_start(m_vseparator, Gtk::PACK_SHRINK);
217 m_hbox.pack_start(m_vcontent_box);
218 m_vcontent_box.pack_start(m_search_bar, Gtk::PACK_SHRINK);
219 m_search_bar.add(m_search_entry);
220 // The search bar is shown when the search toggle button is pressed.
221 m_binding_search_button_search_entry = Glib::Binding::bind_property(
222 m_search_button.property_active(),
223 m_search_bar.property_search_mode_enabled(),
224 Glib::BINDING_BIDIRECTIONAL);
225 m_vcontent_box.pack_start(m_scrolled_window);
226 m_scrolled_window.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
227 m_scrolled_window.add(m_icon_view);
228 m_icon_view.set_model(m_filter_model);
229 m_icon_view.set_selection_mode(Gtk::SELECTION_NONE);
230 m_icon_view.set_activate_on_single_click(true);
231 m_icon_view.pack_start(m_icon_cell);
232 m_icon_view.pack_start(m_text_cell);
233 m_icon_cell.set_padding(10, 10);
234 m_icon_cell.property_stock_size() = Gtk::ICON_SIZE_DND;
235 m_text_cell.set_padding(10, 10);
236 m_text_cell.set_alignment(0.5, 0.5);
237
238 // Enable dragging an icon name, and copying it to another program.
239 m_icon_view.enable_model_drag_source(
240 std::vector<Gtk::TargetEntry>(), Gdk::BUTTON1_MASK, Gdk::ACTION_COPY);
241 m_icon_view.drag_source_add_text_targets();
242
243 m_icon_view.set_has_tooltip(true);
244 m_filter_model->set_visible_func(
245 sigc::mem_fun(*this, &Example_IconBrowser::is_icon_visible));
246
247 // Connect signal handlers.
248 signal_key_press_event().connect(
249 sigc::mem_fun(*this, &Example_IconBrowser::on_window_key_press_event), false);
250 m_symbolic_radio.signal_toggled().connect(
251 sigc::mem_fun(*this, &Example_IconBrowser::on_symbolic_radio_toggled));
252 m_context_list.signal_selected_rows_changed().connect(
253 sigc::mem_fun(*this, &Example_IconBrowser::on_context_list_selected_rows_changed));
254 m_icon_view.signal_item_activated().connect(
255 sigc::mem_fun(*this, &Example_IconBrowser::on_icon_view_item_activated));
256 m_icon_view.signal_query_tooltip().connect(
257 sigc::mem_fun(*this, &Example_IconBrowser::on_icon_view_query_tooltip));
258 m_search_bar.property_search_mode_enabled().signal_changed().connect(
259 sigc::mem_fun(*this, &Example_IconBrowser::on_search_bar_search_mode_enabled_changed));
260 m_search_entry.signal_search_changed().connect(
261 sigc::mem_fun(*this, &Example_IconBrowser::on_search_entry_search_changed));
262
263 on_symbolic_radio_toggled();
264 populate();
265
266 show_all_children();
267 }
268
269 Example_IconBrowser::~Example_IconBrowser()
270 {
271 }
272
273 bool Example_IconBrowser::on_window_key_press_event(GdkEventKey* key_press_event)
274 {
275 return m_search_bar.handle_event(key_press_event);
276 }
277
278 void Example_IconBrowser::on_symbolic_radio_toggled()
279 {
280 const bool symbolic = m_symbolic_radio.get_active();
281 m_store->set_text_column(symbolic);
282 m_icon_view.clear_attributes(m_icon_cell);
283 m_icon_view.add_attribute(m_icon_cell, "icon-name", m_store->get_text_column());
284 m_icon_view.clear_attributes(m_text_cell);
285 m_icon_view.add_attribute(m_text_cell, "text", m_store->get_text_column());
286 m_filter_model->refilter();
287 m_icon_view.queue_draw();
288 }
289
290 void Example_IconBrowser::on_context_list_selected_rows_changed()
291 {
292 Gtk::ListBoxRow* row = m_context_list.get_selected_row();
293 if (!row)
294 return;
295
296 m_search_button.set_active(false);
297 Gtk::Widget* rowchild = row->get_child();
298 IconContextLabel* label = dynamic_cast<IconContextLabel*>(rowchild);
299 if (label)
300 {
301 m_current_context_id = label->get_id();
302 m_filter_model->refilter();
303 }
304 else
305 std::cout << "on_context_list_selected_rows_changed(): Unexpected child type." << std::endl;
306 }
307
308 void Example_IconBrowser::on_icon_view_item_activated(const Gtk::TreeModel::Path& path)
309 {
310 Gtk::TreeModel::iterator iter = m_filter_model->get_iter(path);
311 Gtk::TreeModel::Row row = *iter;
312 const Glib::ustring name = row[m_store->get_text_column()];
313 const Glib::ustring description = row[m_store->m_columns.description];
314 if (name.empty() || !Gtk::IconTheme::get_default()->has_icon(name))
315 return;
316
317 m_details.set_title(name);
318 m_details.set_image(name, description);
319 m_details.present();
320 }
321
322 bool Example_IconBrowser::on_icon_view_query_tooltip(int x, int y,
323 bool keyboard_tooltip, const Glib::RefPtr<Gtk::Tooltip>& tooltip)
324 {
325 // Very similar to what Gtk::IconView::set_tooltip_column() does.
326 // The important difference is that Gtk::Tooltip::set_text() is called
327 // instead of Gtk::Tooltip::set_markup().
328 Gtk::TreeModel::iterator iter;
329 if (!m_icon_view.get_tooltip_context_iter(x, y, keyboard_tooltip, iter))
330 return false;
331
332 Gtk::TreeModel::Row row = *iter;
333 const Glib::ustring description = row[m_store->m_columns.description];
334 if (description.empty())
335 return false;
336
337 tooltip->set_text(description);
338 m_icon_view.set_tooltip_item(tooltip, m_filter_model->get_path(iter));
339 return true;
340 }
341
342 void Example_IconBrowser::on_search_bar_search_mode_enabled_changed()
343 {
344 if (m_search_bar.get_search_mode())
345 m_context_list.unselect_all();
346 }
347
348 void Example_IconBrowser::on_search_entry_search_changed()
349 {
350 if (!m_search_entry.get_text().empty())
351 m_filter_model->refilter();
352 }
353
354 void Example_IconBrowser::populate()
355 {
356 // This icon list has been copied from gtk+/demos/icon-browser/iconbrowserwin.c
357 // and only slightly modified. (The first parameter in the calls to add_context()
358 // and add_icon() has been removed.) When gtk+'s populate() changes, it is
359 // easy to copy the modified populate().
360 add_context("volume", "Volume", "Icons related to audio input and output volume");
361 add_icon("audio-volume-high", "The icon used to indicate high audio volume", "volume");
362 add_icon("audio-volume-low", "The icon used to indicate low audio volume", "volume");
363 add_icon("audio-volume-medium", "The icon used to indicate medium audio volume", "volume");
364 add_icon("audio-volume-muted", "The icon used to indicate the muted state for audio playback", "volume");
365 add_icon("microphone-sensitivity-high", "The icon used to indicate high microphone sensitivity", "volume");
366 add_icon("microphone-sensitivity-low", "The icon used to indicate low microphone sensitivity", "volume");
367 add_icon("microphone-sensitivity-medium", "The icon used to indicate medium microphone sensitivity", "volume");
368 add_icon("microphone-sensitivity-muted", "The icon used to indicate that a microphone is muted", "volume");
369
370 add_context("multimedia", "Multimedia", "Icons related to playback of media");
371 add_icon("media-playlist-repeat", "The icon for the repeat mode of a media player", "multimedia");
372 add_icon("media-playlist-repeat-song", "The icon for repeating a song in a media player", "multimedia");
373 add_icon("media-playlist-shuffle", "The icon for the shuffle mode of a media player", "multimedia");
374 add_icon("media-playlist-consecutive", "The icon for consecutive mode of a media player", "multimedia");
375 add_icon("media-skip-backward", "The icon for the skip backward action of a media player", "multimedia");
376 add_icon("media-seek-backward", "The icon for the seek backward action of a media player", "multimedia");
377 add_icon("media-playback-start", "The icon for the start playback action of a media player", "multimedia");
378 add_icon("media-seek-forward", "The icon for the seek forward action of a media player", "multimedia");
379 add_icon("media-skip-forward", "The icon for the skip forward action of a media player", "multimedia");
380 add_icon("media-playback-stop", "The icon for the stop action of a media player", "multimedia");
381 add_icon("media-playback-pause", "The icon for the pause action of a media player", "multimedia");
382 add_icon("media-eject", "The icon for the eject action of a media player or file manager", "multimedia");
383 add_icon("media-record", "The icon for the record action of a media application", "multimedia");
384 add_icon("media-view-subtitles", "The icon used to show subtitles in a media player", "multimedia");
385
386 add_context("network", "Network", "Icons related to network status");
387 add_icon("network-transmit-receive", "The icon used data is being both transmitted and received simultaneously, while the computing device is connected to a network", "network");
388 add_icon("network-transmit", "The icon used when data is being transmitted, while the computing device is connected to a network", "network");
389 add_icon("network-receive", "The icon used when data is being received, while the computing device is connected to a network", "network");
390 add_icon("network-idle", "The icon used when no data is being transmitted or received, while the computing device is connected to a network", "network");
391 add_icon("network-error", "The icon used when an error occurs trying to intialize the network connection of the computing device", "network");
392 add_icon("network-offline", "The icon used when the computing device is disconnected from the network", "network");
393
394 add_context("weather", "Weather", "Icons about weather conditions");
395 add_icon("weather-clear", "The icon used while the weather for a region is “clear skies”", "weather");
396 add_icon("weather-clear-night", "The icon used while the weather for a region is “clear skies” during the night", "weather");
397 add_icon("weather-few-clouds", "The icon used while the weather for a region is “partly cloudy”", "weather");
398 add_icon("weather-few-clouds-night", "The icon used while the weather for a region is “partly cloudy” during the night", "weather");
399 add_icon("weather-fog", "The icon used while the weather for a region is “foggy”", "weather");
400 add_icon("weather-overcast", "The icon used while the weather for a region is “overcast”", "weather");
401 add_icon("weather-severe-alert", "The icon used while a sever weather alert is in effect for a region", "weather");
402 add_icon("weather-showers", "The icon used while rain showers are occurring in a region", "weather");
403 add_icon("weather-showers-scattered", "The icon used while scattered rain showers are occurring in a region", "weather");
404 add_icon("weather-snow", "The icon used while snow showers are occurring in a region", "weather");
405 add_icon("weather-storm", "The icon used while storms are occurring in a region", "weather");
406
407 add_context("navigation", "Navigation", "Icons for navigation in the user interface of a program");
408 add_icon("go-first", "The icon for the go to the first item in a list", "navigation");
409 add_icon("go-previous", "The icon for the go to the previous item in a list", "navigation");
410 add_icon("go-next", "The icon for the go to the next item in a list", "navigation");
411 add_icon("go-last", "The icon for the go to the last item in a list", "navigation");
412 add_icon("go-bottom", "The icon for the go to bottom of a list", "navigation");
413 add_icon("go-down", "The icon for the go down in a list", "navigation");
414 add_icon("go-up", "The icon for the go up in a list", "navigation");
415 add_icon("go-top", "The icon for the go to the top of a list", "navigation");
416 add_icon("go-home", "The icon for the go to home location", "navigation");
417 add_icon("go-jump", "The icon for the jump to action", "navigation");
418
419 add_context("editing", "Editing", "Icons related to editing a document");
420 add_icon("format-indent-less", "The icon for the decrease indent formatting action", "editing");
421 add_icon("format-indent-more", "The icon for the increase indent formatting action", "editing");
422 add_icon("format-justify-center", "The icon for the center justification formatting action", "editing");
423 add_icon("format-justify-fill", "The icon for the fill justification formatting action", "editing");
424 add_icon("format-justify-left", "The icon for the left justification formatting action", "editing");
425 add_icon("format-justify-right", "The icon for the right justification action", "editing");
426 add_icon("format-text-direction-ltr", "The icon for the left-to-right text formatting action", "editing");
427 add_icon("format-text-direction-rtl", "The icon for the right-to-left formatting action", "editing");
428 add_icon("format-text-bold", "The icon for the bold text formatting action", "editing");
429 add_icon("format-text-italic", "The icon for the italic text formatting action", "editing");
430 add_icon("format-text-underline", "The icon for the underlined text formatting action", "editing");
431 add_icon("format-text-strikethrough", "The icon for the strikethrough text formatting action", "editing");
432 add_icon("edit-clear", "The icon for the clear action", "editing");
433 add_icon("edit-clear-all", "", "editing");
434 add_icon("edit-copy", "The icon for the copy action", "editing");
435 add_icon("edit-cut", "The icon for the cut action", "editing");
436 add_icon("edit-delete", "The icon for the delete action", "editing");
437 add_icon("edit-find-replace", "The icon for the find and replace action", "editing");
438 add_icon("edit-paste", "The icon for the paste action", "editing");
439 add_icon("edit-redo", "The icon for the redo action", "editing");
440 add_icon("edit-select-all", "The icon for the select all action", "editing");
441 add_icon("edit-select", "", "editing");
442 add_icon("edit-undo", "The icon for the undo action", "editing");
443 add_icon("document-properties", "The icon for the action to view the properties of a document in an application", "editing");
444 add_icon("document-new", "The icon used for the action to create a new document", "editing");
445 add_icon("document-open", "The icon used for the action to open a document", "editing");
446 add_icon("document-open-recent", "The icon used for the action to open a document that was recently opened", "editing");
447 add_icon("document-save", "The icon for the save action. Should be an arrow pointing down and toward a hard disk", "editing");
448 add_icon("document-save-as", "The icon for the save as action", "editing");
449 add_icon("document-send", "The icon for the send action. Should be an arrow pointing up and away from a hard disk", "editing");
450 add_icon("document-page-setup", "The icon for the page setup action of a document editor", "editing");
451 add_icon("changes-allow", "", "other");
452 add_icon("changes-prevent", "", "other");
453 add_icon("object-flip-horizontal", "The icon for the action to flip an object horizontally", "editing");
454 add_icon("object-flip-vertical", "The icon for the action to flip an object vertically", "editing");
455 add_icon("object-rotate-left", "The icon for the rotate left action performed on an object", "editing");
456 add_icon("object-rotate-right", "The icon for the rotate rigt action performed on an object", "editing");
457 add_icon("insert-image", "The icon for the insert image action of an application", "editing");
458 add_icon("insert-link", "The icon for the insert link action of an application", "editing");
459 add_icon("insert-object", "The icon for the insert object action of an application", "editing");
460 add_icon("insert-text", "The icon for the insert text action of an application", "editing");
461 add_icon("accessories-text-editor", "The icon used for the desktop's text editing accessory program", "editing");
462
463 add_context("view", "View Controls", "Icons for view controls in a user interface");
464 add_icon("view-list", "The icon used for “List“ view mode", "view");
465 add_icon("view-grid", "The icon used for “Grid“ view mode (as opposed to “List“)", "view");
466 add_icon("view-fullscreen", "The icon used for the “Fullscreen” item in the application's “View” menu", "view");
467 add_icon("view-restore", "The icon used by an application for leaving the fullscreen view, and returning to a normal windowed view", "view");
468 add_icon("zoom-fit-best", "The icon used for the “Best Fit” item in the application's “View” menu", "view");
469 add_icon("zoom-in", "The icon used for the “Zoom in” item in the application's “View” menu", "view");
470 add_icon("zoom-out", "The icon used for the “Zoom Out” item in the application's “View” menu ", "view");
471 add_icon("zoom-original", "The icon used for the “Original Size” item in the application's “View” menu", "view");
472 add_icon("view-continuous", "The icon used for a continuous view mode", "view");
473 add_icon("view-paged", "The icon used for a paged view mode (as opposed to continuous)", "view");
474 add_icon("view-dual", "The icon used for a side-by-side view of paginated content", "view");
475 add_icon("view-wrapped", "The icon used to indicate a wrap-around to the beginning", "view");
476
477 add_context("calendar", "Calendar, Tasks and Alarms", "Icons related to calendars, tasks and alarms");
478 add_icon("task-due", "The icon used when a task is due soon", "calendar");
479 add_icon("task-past-due", "The icon used when a task that was due, has been left incomplete", "calendar");
480 add_icon("appointment-soon", "The icon used when an appointment will occur soon", "calendar");
481 add_icon("appointment-missed", "The icon used when an appointment was missed", "calendar");
482 add_icon("alarm", "The icon used for alarms when a task or appointment is due", "calendar");
483
484 add_context("communication", "Communication", "Icons related email, phone calls, IM and other forms of communication");
485 add_icon("mail-unread", "The icon used for an electronic mail that is unread", "communication");
486 add_icon("mail-read", "The icon used for an electronic mail that is read", "communication");
487 add_icon("mail-replied", "The icon used for an electronic mail that has been replied to", "communication");
488 add_icon("mail-attachment", "The icon used for an electronic mail that contains attachments", "communication");
489 add_icon("mail-mark-important", "The icon for the mark as important action of an electronic mail application", "communication");
490 add_icon("mail-send", "The icon for the send action of an electronic mail application", "communication");
491 add_icon("mail-send-receive", "The icon for the send and receive action of an electronic mail application", "communication");
492 add_icon("call-start", "The icon used for initiating or accepting a call", "communication");
493 add_icon("call-stop", "The icon used for stopping a current call", "communication");
494 add_icon("call-missed", "The icon used to show a missed call", "communication");
495 add_icon("user-available", "The icon used when a user on a chat network is available to initiate a conversation with", "communication");
496 add_icon("user-offline", "The icon used when a user on a chat network is not available", "communication");
497 add_icon("user-idle", "The icon used when a user on a chat network has not been an active participant in any chats on the network, for an extended period of time", "communication");
498 add_icon("user-invisible", "The icon used when a user is on a chat network, but is invisible to others", "communication");
499 add_icon("user-busy", "The icon used when a user is on a chat network, and has marked himself as busy", "communication");
500 add_icon("user-away", "The icon used when a user on a chat network is away from their keyboard and the chat program", "communication");
501 add_icon("user-status-pending", "The icon used when the current user status on a chat network is not known", "communication");
502
503 add_context("devices", "Devices and Media", "Icons for devices and media");
504 add_icon("audio-input-microphone", "The icon used for the microphone audio input device", "devices");
505 add_icon("camera-web", "The fallback icon for web cameras", "devices");
506 add_icon("camera-photo", "The icon used for a digital still camera devices", "devices");
507 add_icon("input-keyboard", "The icon used for the keyboard input device", "devices");
508 add_icon("printer", "The icon used for a printer device", "devices");
509 add_icon("video-display", "The icon used for the monitor that video gets displayed to", "devices");
510 add_icon("computer", "The icon used for the computing device as a whole", "devices");
511 add_icon("media-optical", "The icon used for physical optical media such as CD and DVD", "devices");
512 add_icon("phone", "The icon used for phone devices which support connectivity to the PC, such as VoIP, cellular, or possibly landline phones", "devices");
513 add_icon("input-dialpad", "The icon used for dialpad input devices", "devices");
514 add_icon("input-touchpad", "The icon used for touchpad input devices", "devices");
515 add_icon("scanner", "The icon used for a scanner device", "devices");
516 add_icon("audio-card", "The icon used for the audio rendering device", "devices");
517 add_icon("input-gaming", "The icon used for the gaming input device", "devices");
518 add_icon("input-mouse", "The icon used for the mousing input device", "devices");
519 add_icon("multimedia-player", "The icon used for generic multimedia playing devices", "devices");
520 add_icon("audio-headphones", "The icon used for headphones", "devices");
521 add_icon("audio-headset", "The icon used for headsets", "devices");
522 add_icon("display-projector", "The icon used for projectors", "devices");
523 add_icon("media-removable", "The icon used for generic removable media", "devices");
524 add_icon("printer-network", "The icon used for printers which are connected via the network", "devices");
525 add_icon("audio-speakers", "The icon used for speakers", "devices");
526 add_icon("camera-video", "The fallback icon for video cameras", "devices");
527 add_icon("drive-optical", "The icon used for optical media drives such as CD and DVD", "devices");
528 add_icon("drive-removable-media", "The icon used for removable media drives", "devices");
529 add_icon("input-tablet", "The icon used for graphics tablet input devices", "devices");
530 add_icon("network-wireless", "The icon used for wireless network connections", "devices");
531 add_icon("network-wired", "The icon used for wired network connections", "devices");
532 add_icon("media-floppy", "The icon used for physical floppy disk media", "devices");
533 add_icon("media-flash", "The fallback icon used for flash media, such as memory stick and SD", "devices");
534
535 add_context("contenttypes", "Content Types", "Icons for different types of data, such as audio or image files");
536 add_icon("application-certificate", "", "contenttypes");
537 add_icon("application-rss+xml", "", "contenttypes");
538 add_icon("application-x-appliance", "", "contenttypes");
539 add_icon("audio-x-generic", "The icon used for generic audio file types", "contenttypes");
540 add_icon("folder", "The standard folder icon used to represent directories on local filesystems, mail folders, and other hierarchical groups", "contenttypes");
541 add_icon("text-x-generic", "The icon used for generic text file types", "contenttypes");
542 add_icon("video-x-generic", "The icon used for generic video file types", "contenttypes");
543 add_icon("x-office-calendar", "The icon used for generic calendar file types", "contenttypes");
544
545 add_context("emotes", "Emotes", "Icons for emotions that are expressed through text chat applications such as :-) or :-P in IRC or instant messengers");
546 add_icon("face-angel", "The icon used for the 0:-) emote", "emotes");
547 add_icon("face-angry", "The icon used for the X-( emote", "emotes");
548 add_icon("face-cool", "The icon used for the B-) emote", "emotes");
549 add_icon("face-crying", "The icon used for the :'( emote", "emotes");
550 add_icon("face-devilish", "The icon used for the >:-) emote", "emotes");
551 add_icon("face-embarrassed", "The icon used for the :-[ emote", "emotes");
552 add_icon("face-kiss", "The icon used for the :-* emote", "emotes");
553 add_icon("face-laugh", "The icon used for the :-)) emote", "emotes");
554 add_icon("face-monkey", "The icon used for the :-(|) emote", "emotes");
555 add_icon("face-plain", "The icon used for the :-| emote", "emotes");
556 add_icon("face-raspberry", "The icon used for the :-P emote", "emotes");
557 add_icon("face-sad", "The icon used for the :-( emote", "emotes");
558 add_icon("face-shutmouth", "The 'shut mouth' emote", "emotes");
559 add_icon("face-sick", "The icon used for the :-& emote", "emotes");
560 add_icon("face-smile", "The icon used for the :-) emote", "emotes");
561 add_icon("face-smile-big", "The icon used for the :-D emote", "emotes");
562 add_icon("face-smirk", "The icon used for the :-! emote", "emotes");
563 add_icon("face-surprise", "The icon used for the :-0 emote", "emotes");
564 add_icon("face-tired", "The icon used for the |-) emote", "emotes");
565 add_icon("face-uncertain", "The icon used for the :-/ emote", "emotes");
566 add_icon("face-wink", "The icon used for the ;-) emote", "emotes");
567 add_icon("face-worried", "The icon used for the :-S emote", "emotes");
568 add_icon("face-yawn", "", "emotes");
569
570 add_context("general", "General", "Generally useful icons that don't fit in a particular category");
571 add_icon("edit-find", "The icon for generic search actions", "general");
572 add_icon("content-loading", "The icon used to indicate that content is loading", "general");
573 add_icon("open-menu", "The icon used for a menu button in the header bar", "general");
574 add_icon("view-more", "The icon used for a “View More“ action", "general");
575 add_icon("tab-new", "The icon used for a “New Tab“ action", "general");
576 add_icon("bookmark-new", "The icon used for creating a new bookmark", "general");
577 add_icon("mark-location", "The icon used to mark a location on a map", "general");
578 add_icon("find-location", "The icon used for a “Search location“ action", "general");
579 add_icon("send-to", "The icon used for a “Send to“ action", "general");
580 add_icon("object-select", "The icon used for generic selection actions", "general");
581 add_icon("window-close", "The icon used for actions that close a view, such as window or tab close button", "general");
582 add_icon("view-refresh", "The icon used for the “Refresh” item in the application's “View” menu", "general");
583 add_icon("process-stop", "The icon used for the “Stop” action in applications with actions that may take a while to process, such as web page loading in a browser", "general");
584 add_icon("action-unavailable", "The icon used to indicate that an action is currently unavailable, such as “Pause“ when no media is playing", "general");
585 add_icon("document-print", "The icon for the print action of an application", "general");
586 add_icon("printer-printing", "The icon used while a print job is successfully being spooled to a printing device", "general");
587 add_icon("printer-warning", "The icon used when a recoverable problem occurs while attempting to printing", "general");
588 add_icon("printer-error", "The icon used when an error occurs while attempting to print", "general");
589 add_icon("dialog-information", "The icon used when a dialog is opened to give information to the user that may be pertinent to the requested action", "general");
590 add_icon("dialog-question", "The icon used when a dialog is opened to ask a simple question of the user", "general");
591 add_icon("dialog-warning", "The icon used when a dialog is opened to warn the user of impending issues with the requested action", "general");
592 add_icon("dialog-password", "The icon used when a dialog requesting the authentication credentials for a user is opened", "general");
593 add_icon("dialog-error", "The icon used when a dialog is opened to explain an error condition to the user", "general");
594 add_icon("list-add", "The icon for the add to list action", "general");
595 add_icon("list-remove", "The icon for the remove from list action", "general");
596 add_icon("non-starred", "The icon used to indicate that an object is not 'starred'", "general");
597 add_icon("semi-starred", "The icon used to indicate that an object has is 'half-starred'", "general");
598 add_icon("starred", "The icon used to indicate that an object is 'starred'", "general");
599 add_icon("star-new", "The used for the “New Star“ action", "general");
600 add_icon("security-low", "The icon used to indicate that the security level of a connection is presumed to be insecure, either by using weak encryption, or by using a certificate that the could not be automatically verified, and which the user has not chosent to trust", "general");
601 add_icon("security-medium", "The icon used to indicate that the security level of a connection is presumed to be secure, using strong encryption, and a certificate that could not be automatically verified, but which the user has chosen to trust", "general");
602 add_icon("security-high", "The icon used to indicate that the security level of a connection is known to be secure, using strong encryption and a valid certificate", "general");
603 add_icon("user-trash", "The icon for the user's “Trash” place in the file system", "other");
604 add_icon("user-trash-full", "The icon for the user's “Trash” in the file system, when there are items in the “Trash” waiting for disposal or recovery", "general");
605 add_icon("emblem-system", "The icon used as an emblem for directories that contain system libraries, settings, and data", "general");
606 add_icon("avatar-default", "The generic avatar icon, which is used to represent a user that doesn't have a personalized avatar", "general");
607 add_icon("emblem-synchronizing", "The icon used as an emblem to indicate that a a synchronizing operation is in process", "general");
608 add_icon("emblem-shared", "The icon used as an emblem for files and directories that are shared to other users", "general");
609 add_icon("folder-download", "The icon representing the location in the file system where downloaded files are stored", "general");
610 add_icon("help-browser", "The icon used for the desktop's help browsing application", "general");
611
612 add_context("other", "Other", "Icons which have may be too specialized and not of general interest");
613 add_icon("view-sort-ascending", "The icon used for the “Sort Ascending” item in the application's “View” menu, or in a button for changing the sort method for a list", "other");
614 add_icon("view-sort-descending", "The icon used for the “Sort Descending” item in the application's “View” menu, or in a button for changing the sort method for a list", "other");
615 add_icon("document-revert", "The icon for the action of reverting to a previous version of a document", "other");
616 add_icon("address-book-new", "The icon used for the action to create a new address book", "other");
617 add_icon("application-exit", "The icon used for exiting an application. Typically this is seen in the application's menus as File->Quit", "other");
618 add_icon("appointment-new", "The icon used for the action to create a new appointment in a calendaring application", "other");
619 add_icon("contact-new", "The icon used for the action to create a new contact in an address book application", "other");
620 add_icon("document-print-preview", "The icon for the print preview action of an application", "other");
621 add_icon("folder-new", "The icon for creating a new folder", "other");
622 add_icon("help-about", "The icon for the About item in the Help menu", "other");
623 add_icon("help-contents", "The icon for Contents item in the Help menu", "other");
624 add_icon("help-faq", "The icon for the FAQ item in the Help menu", "other");
625 add_icon("list-remove-all", "", "other");
626 add_icon("mail-forward", "The icon for the forward action of an electronic mail application", "other");
627 add_icon("mail-mark-junk", "The icon for the mark as junk action of an electronic mail application", "other");
628 add_icon("mail-mark-notjunk", "The icon for the mark as not junk action of an electronic mail application", "other");
629 add_icon("mail-mark-read", "The icon for the mark as read action of an electronic mail application", "other");
630 add_icon("mail-mark-unread", "The icon for the mark as unread action of an electronic mail application", "other");
631 add_icon("mail-message-new", "The icon for the compose new mail action of an electronic mail application", "other");
632 add_icon("mail-reply-all", "The icon for the reply to all action of an electronic mail application", "other");
633 add_icon("mail-reply-sender", "The icon for the reply to sender action of an electronic mail application", "other");
634 add_icon("pan-down", "", "other");
635 add_icon("pan-end", "", "other");
636 add_icon("pan-start", "", "other");
637 add_icon("pan-up", "", "other");
638 add_icon("system-lock-screen", "The icon used for the “Lock Screen” item in the desktop's panel application", "other");
639 add_icon("system-log-out", "The icon used for the “Log Out” item in the desktop's panel application", "other");
640 add_icon("system-run", "The icon used for the “Run Application...” item in the desktop's panel application", "other");
641 add_icon("system-search", "The icon used for the “Search” item in the desktop's panel application", "other");
642 add_icon("system-reboot", "The icon used for the “Reboot” item in the desktop's panel application", "other");
643 add_icon("system-shutdown", "The icon used for the “Shutdown” item in the desktop's panel application", "other");
644 add_icon("tools-check-spelling", "The icon used for the “Check Spelling” item in the application's “Tools” menu", "other");
645 add_icon("window-maximize", "", "other");
646 add_icon("window-minimize", "", "other");
647 add_icon("window-restore", "", "other");
648 add_icon("window-new", "The icon used for the “New Window” item in the application's “Windows” menu", "other");
649 add_icon("accessories-calculator", "The icon used for the desktop's calculator accessory program", "other");
650 add_icon("accessories-character-map", "The icon used for the desktop's international and extended text character accessory program", "other");
651 add_icon("accessories-dictionary", "The icon used for the desktop's dictionary accessory program", "other");
652 add_icon("multimedia-volume-control", "The icon used for the desktop's hardware volume control application", "other");
653 add_icon("preferences-desktop-accessibility", "The icon used for the desktop's accessibility preferences", "other");
654 add_icon("preferences-desktop-display", "", "other");
655 add_icon("preferences-desktop-font", "The icon used for the desktop's font preferences", "other");
656 add_icon("preferences-desktop-keyboard", "The icon used for the desktop's keyboard preferences", "other");
657 add_icon("preferences-desktop-keyboard-shortcuts", "", "other");
658 add_icon("preferences-desktop-locale", "The icon used for the desktop's locale preferences", "other");
659 add_icon("preferences-desktop-remote-desktop", "", "other");
660 add_icon("preferences-desktop-multimedia", "The icon used for the desktop's multimedia preferences", "other");
661 add_icon("preferences-desktop-screensaver", "The icon used for the desktop's screen saving preferences", "other");
662 add_icon("preferences-desktop-theme", "The icon used for the desktop's theme preferences", "other");
663 add_icon("preferences-desktop-wallpaper", "The icon used for the desktop's wallpaper preferences", "other");
664 add_icon("preferences-system-privacy", "", "other");
665 add_icon("preferences-system-windows", "", "other");
666 add_icon("system-file-manager", "The icon used for the desktop's file management application", "other");
667 add_icon("system-software-install", "The icon used for the desktop's software installer application", "other");
668 add_icon("system-software-update", "The icon used for the desktop's software updating application", "other");
669 add_icon("system-users", "", "other");
670 add_icon("user-info", "", "other");
671 add_icon("utilities-system-monitor", "The icon used for the desktop's system resource monitor application", "other");
672 add_icon("utilities-terminal", "The icon used for the desktop's terminal emulation application. ", "other");
673 add_icon("application-x-addon", "", "other");
674 add_icon("application-x-executable", "The icon used for executable file types", "other");
675 add_icon("font-x-generic", "The icon used for generic font file types", "other");
676 add_icon("image-x-generic", "The icon used for generic image file types", "other");
677 add_icon("package-x-generic", "The icon used for generic package file types", "other");
678 add_icon("text-html", "The icon used for HTML text file types", "other");
679 add_icon("text-x-generic-template", "The icon used for generic text templates", "other");
680 add_icon("text-x-preview", "", "other");
681 add_icon("text-x-script", "The icon used for script file types, such as shell scripts", "other");
682 add_icon("x-office-address-book", "The icon used for generic address book file types", "other");
683 add_icon("x-office-document", "The icon used for generic document and letter file types", "other");
684 add_icon("x-office-document-template", "", "other");
685 add_icon("x-office-presentation", "The icon used for generic presentation file types", "other");
686 add_icon("x-office-presentation-template", "", "other");
687 add_icon("x-office-spreadsheet", "The icon used for generic spreadsheet file types", "other");
688 add_icon("x-office-spreadsheet-template", "", "other");
689 add_icon("x-package-repository", "", "other");
690 add_icon("applications-accessories", "The icon for the “Accessories” sub-menu of the Programs menu", "other");
691 add_icon("applications-development", "The icon for the “Programming” sub-menu of the Programs menu", "other");
692 add_icon("applications-engineering", "The icon for the “Engineering” sub-menu of the Programs menu", "other");
693 add_icon("applications-games", "The icon for the “Games” sub-menu of the Programs menu", "other");
694 add_icon("applications-graphics", "The icon for the “Graphics” sub-menu of the Programs menu", "other");
695 add_icon("applications-internet", "The icon for the “Internet” sub-menu of the Programs menu", "other");
696 add_icon("applications-multimedia", "The icon for the “Multimedia” sub-menu of the Programs menu", "other");
697 add_icon("applications-office", "The icon for the “Office” sub-menu of the Programs menu", "other");
698 add_icon("applications-other", "The icon for the “Other” sub-menu of the Programs menu", "other");
699 add_icon("applications-science", "The icon for the “Science” sub-menu of the Programs menu", "other");
700 add_icon("applications-system", "The icon for the “System Tools” sub-menu of the Programs menu", "other");
701 add_icon("applications-utilities", "The icon for the “Utilities” sub-menu of the Programs menu", "other");
702 add_icon("preferences-desktop", "The icon for the “Desktop Preferences” category", "other");
703 add_icon("preferences-desktop-peripherals", "The icon for the “Peripherals” sub-category of the “Desktop Preferences” category", "other");
704 add_icon("preferences-desktop-personal", "The icon for the “Personal” sub-category of the “Desktop Preferences” category", "other");
705 add_icon("preferences-other", "The icon for the “Other” preferences category", "other");
706 add_icon("preferences-system", "The icon for the “System Preferences” category", "other");
707 add_icon("preferences-system-network", "The icon for the “Network” sub-category of the “System Preferences” category", "other");
708 add_icon("system-help", "The icon for the “Help” system category", "other");
709 add_icon("battery", "The icon used for the system battery device", "other");
710 add_icon("computer-apple-ipad", "", "other");
711 add_icon("colorimeter-colorhug", "", "other");
712 add_icon("drive-harddisk", "The icon used for hard disk drives", "other");
713 add_icon("drive-harddisk-ieee1394", "", "other");
714 add_icon("drive-harddisk-system", "", "other");
715 add_icon("drive-multidisk", "", "other");
716 add_icon("media-optical-bd", "", "other");
717 add_icon("media-optical-cd-audio", "", "other");
718 add_icon("media-optical-dvd", "", "other");
719 add_icon("media-tape", "The icon used for generic physical tape media", "other");
720 add_icon("media-zip", "", "other");
721 add_icon("modem", "The icon used for modem devices", "other");
722 add_icon("multimedia-player-apple-ipod-touch", "", "other");
723 add_icon("network-vpn", "", "other");
724 add_icon("pda", "This is the fallback icon for Personal Digial Assistant devices. Primary use of this icon is for PDA devices connected to the PC. Connection medium is not an important aspect of the icon. The metaphor for this fallback icon should be a generic PDA device icon", "other");
725 add_icon("phone-apple-iphone", "", "other");
726 add_icon("uninterruptible-power-supply", "", "other");
727 add_icon("emblem-default", "The icon used as an emblem to specify the default selection of a printer for example", "other");
728 add_icon("emblem-documents", "The icon used as an emblem for the directory where a user's documents are stored", "other");
729 add_icon("emblem-downloads", "The icon used as an emblem for the directory where a user's downloads from the internet are stored", "other");
730 add_icon("emblem-favorite", "The icon used as an emblem for files and directories that the user marks as favorites", "other");
731 add_icon("emblem-generic", "", "other");
732 add_icon("emblem-important", "The icon used as an emblem for files and directories that are marked as important by the user", "other");
733 add_icon("emblem-mail", "The icon used as an emblem to specify the directory where the user's electronic mail is stored", "other");
734 add_icon("emblem-new", "", "other");
735 add_icon("emblem-ok", "", "other");
736 add_icon("emblem-package", "", "other");
737 add_icon("emblem-photos", "The icon used as an emblem to specify the directory where the user stores photographs", "other");
738 add_icon("emblem-readonly", "The icon used as an emblem for files and directories which can not be written to by the user", "other");
739 add_icon("emblem-symbolic-link", "The icon used as an emblem for files and direcotires that are links to other files or directories on the filesystem", "other");
740 add_icon("emblem-synchronized", "The icon used as an emblem for files or directories that are configured to be synchronized to another device", "other");
741 add_icon("emblem-unreadable", "The icon used as an emblem for files and directories that are inaccessible. ", "other");
742 add_icon("emblem-urgent", "", "other");
743 add_icon("emblem-videos", "", "other");
744 add_icon("emblem-web", "", "other");
745 add_icon("folder-documents", "", "other");
746 add_icon("folder-download", "", "other");
747 add_icon("folder-music", "", "other");
748 add_icon("folder-pictures", "", "other");
749 add_icon("folder-documents", "", "other");
750 add_icon("folder-publicshare", "", "other");
751 add_icon("folder-remote", "The icon used for normal directories on a remote filesystem", "other");
752 add_icon("folder-saved-search", "", "other");
753 add_icon("folder-templates", "", "other");
754 add_icon("folder-videos", "", "other");
755 add_icon("network-server", "The icon used for individual host machines under the “Network Servers” place in the file manager", "other");
756 add_icon("network-workgroup", "The icon for the “Network Servers” place in the desktop's file manager, and workgroups within the network", "other");
757 add_icon("start-here", "The icon used by the desktop's main menu for accessing places, applications, and other features", "other");
758 add_icon("user-bookmarks", "The icon for the user's special “Bookmarks” place", "other");
759 add_icon("user-desktop", "The icon for the special “Desktop” directory of the user", "other");
760 add_icon("user-home", "The icon for the special “Home” directory of the user", "other");
761 add_icon("airplane-mode", "", "other");
762 add_icon("battery-caution-charging", "", "other");
763 add_icon("battery-caution", "The icon used when the battery is below 40%", "other");
764 add_icon("battery-empty-charging", "", "other");
765 add_icon("battery-empty", "", "other");
766 add_icon("battery-full-charged", "", "other");
767 add_icon("battery-full-charging", "", "other");
768 add_icon("battery-full", "", "other");
769 add_icon("battery-good-charging", "", "other");
770 add_icon("battery-good", "", "other");
771 add_icon("battery-low-charging", "", "other");
772 add_icon("battery-low", "The icon used when the battery is below 20%", "other");
773 add_icon("battery-missing", "", "other");
774 add_icon("bluetooth-active", "", "other");
775 add_icon("bluetooth-disabled", "", "other");
776 add_icon("channel-insecure", "", "other");
777 add_icon("channel-secure", "", "other");
778 add_icon("computer-fail", "", "other");
779 add_icon("display-brightness", "", "other");
780 add_icon("keyboard-brightness", "", "other");
781 add_icon("folder-drag-accept", "The icon used for a folder while an object is being dragged onto it, that is of a type that the directory can contain", "other");
782 add_icon("folder-open", "The icon used for folders, while their contents are being displayed within the same window. This icon would normally be shown in a tree or list view, next to the main view of a folder's contents", "other");
783 add_icon("folder-visiting", "The icon used for folders, while their contents are being displayed in another window. This icon would typically be used when using multiple windows to navigate the hierarchy, such as in Nautilus's spatial mode", "other");
784 add_icon("image-loading", "The icon used when another image is being loaded, such as thumnails for larger images in the file manager", "other");
785 add_icon("image-missing", "The icon used when another image could not be loaded", "other");
786 add_icon("mail-signed", "The icon used for an electronic mail that contains a signature", "other");
787 add_icon("mail-signed-verified", "The icon used for an electronic mail that contains a signature which has also been verified by the security system", "other");
788 add_icon("network-cellular-3g", "", "other");
789 add_icon("network-cellular-4g", "", "other");
790 add_icon("network-cellular-edge", "", "other");
791 add_icon("network-cellular-gprs", "", "other");
792 add_icon("network-cellular-umts", "", "other");
793 add_icon("network-cellular-acquiring", "", "other");
794 add_icon("network-cellular-connected", "", "other");
795 add_icon("network-cellular-no-route", "", "other");
796 add_icon("network-cellular-offline", "", "other");
797 add_icon("network-cellular-signal-excellent", "", "other");
798 add_icon("network-cellular-signal-good", "", "other");
799 add_icon("network-cellular-signal-ok", "", "other");
800 add_icon("network-cellular-signal-weak", "", "other");
801 add_icon("network-cellular-signal-none", "", "other");
802 add_icon("network-vpn-acquiring", "", "other");
803 add_icon("network-vpn", "", "other");
804 add_icon("network-wired-acquiring", "", "other");
805 add_icon("network-wired-disconnected", "", "other");
806 add_icon("network-wired-no-route", "", "other");
807 add_icon("network-wired-offline", "", "other");
808 add_icon("network-wireless-acquiring", "", "other");
809 add_icon("network-wireless-connected", "", "other");
810 add_icon("network-wireless-encrypted", "", "other");
811 add_icon("network-wireless-hotspot", "", "other");
812 add_icon("network-wireless-no-route", "", "other");
813 add_icon("network-wireless-offline", "", "other");
814 add_icon("network-wireless-signal-excellent", "", "other");
815 add_icon("network-wireless-signal-good", "", "other");
816 add_icon("network-wireless-signal-ok", "", "other");
817 add_icon("network-wireless-signal-weak", "", "other");
818 add_icon("network-wireless-signal-none", "", "other");
819 add_icon("rotation-allowed", "", "other");
820 add_icon("rotation-locked", "", "other");
821 add_icon("software-update-available", "The icon used when an update is available for software installed on the computing device, through the system software update program", "other");
822 add_icon("software-update-urgent", "The icon used when an urgent update is available through the system software update program", "other");
823 add_icon("sync-error", "The icon used when an error occurs while attempting to synchronize data from the computing device, to another device", "other");
824 add_icon("sync-synchronizing", "The icon used while data is successfully synchronizing to another device", "other");
825 add_icon("touchpad-disabled", "", "other");
826 add_icon("trophy-bronze", "", "other");
827 add_icon("trophy-silver", "", "other");
828 add_icon("trophy-gold", "", "other");
829 }
830
831 void Example_IconBrowser::add_context(const Glib::ustring& id,
832 const Glib::ustring& name, const Glib::ustring& description)
833 {
834 IconContextLabel* row = Gtk::make_managed<IconContextLabel>(id, name);
835 row->show();
836 row->property_margin() = 10;
837 m_context_list.append(*row);
838
839 // Set the tooltip on the list box row.
840 Gtk::Container* listboxrow = row->get_parent();
841 listboxrow->set_tooltip_text(description);
842
843 if (m_current_context_id.empty())
844 m_current_context_id = row->get_id();
845 }
846
847 void Example_IconBrowser::add_icon(const Glib::ustring& name,
848 const Glib::ustring& description, const Glib::ustring& context_id)
849 {
850 Glib::ustring regular_name = name;
851 if (!Gtk::IconTheme::get_default()->has_icon(regular_name))
852 regular_name.clear();
853
854 Glib::ustring symbolic_name = name + "-symbolic";
855 if (!Gtk::IconTheme::get_default()->has_icon(symbolic_name))
856 symbolic_name.clear();
857
858 // Add a new row to the IconInfoStore (which is a ListStore).
859 Gtk::TreeModel::Row row = *(m_store->append());
860 row[m_store->m_columns.name] = regular_name;
861 row[m_store->m_columns.symbolic_name] = symbolic_name;
862 row[m_store->m_columns.description] = description;
863 row[m_store->m_columns.context_id] = context_id;
864 }
865
866 bool Example_IconBrowser::is_icon_visible(const Gtk::TreeModel::const_iterator& iter) const
867 {
868 const Gtk::TreeModel::Row row = *iter;
869 const Glib::ustring name = row[m_store->get_text_column()];
870 if (name.empty())
871 return false;
872
873 const bool search = m_search_button.get_active();
874 bool visible = false;
875 if (search)
876 {
877 const Glib::ustring search_text = m_search_entry.get_text();
878 visible = name.find(search_text) != std::string::npos;
879 }
880 else
881 {
882 const Glib::ustring context_id = row[m_store->m_columns.context_id];
883 visible = context_id == m_current_context_id;
884 }
885 return visible;
886 }
887
888
889 // Initialization of static data.
890 const int DetailDialog::n_icon_sizes;
891 const int DetailDialog::m_icon_size[n_icon_sizes] = { 16, 24, 32, 48, 64 };
892
893
894 // Definition of detail dialog methods.
895 DetailDialog::DetailDialog(Gtk::Window& parent)
896 : Gtk::Dialog("", parent, Gtk::DIALOG_MODAL | Gtk::DIALOG_USE_HEADER_BAR)
897 {
898 set_resizable(false);
899 Gtk::Box* content_area = get_content_area();
900 content_area->pack_start(m_grid);
901 m_grid.property_margin() = 10;
902 m_grid.set_row_spacing(10);
903 m_grid.set_column_spacing(10);
904 for (int i = 0; i < n_icon_sizes; ++i)
905 {
906 m_grid.attach(m_event_box[i], i, 0, 1, 1);
907 m_event_box[i].add(m_image[i]);
908 m_image[i].property_margin() = 4;
909 m_image[i].set_halign(Gtk::ALIGN_CENTER);
910 m_image[i].set_valign(Gtk::ALIGN_END);
911
912 // Enable dragging an image, and copying it to another program.
913 m_event_box[i].drag_source_set(
914 std::vector<Gtk::TargetEntry>(), Gdk::BUTTON1_MASK, Gdk::ACTION_COPY);
915 m_event_box[i].drag_source_add_image_targets();
916 m_event_box[i].signal_drag_data_get().connect(
917 sigc::bind(sigc::mem_fun(*this, &DetailDialog::on_image_drag_data_get), i));
918
919 m_grid.attach(m_label[i], i, 1, 1, 1);
920 m_label[i].property_margin() = 4;
921 m_label[i].set_halign(Gtk::ALIGN_CENTER);
922 m_label[i].set_valign(Gtk::ALIGN_CENTER);
923 std::ostringstream ostr;
924 ostr << m_icon_size[i] << 'x' << m_icon_size[i];
925 m_label[i].set_text(ostr.str());
926 }
927 m_grid.attach(m_description, 0, 2, n_icon_sizes, 1);
928 m_description.set_line_wrap(true);
929 m_description.set_max_width_chars(60);
930 m_description.set_halign(Gtk::ALIGN_START);
931 m_description.set_valign(Gtk::ALIGN_START);
932
933 show_all_children();
934 }
935
936 DetailDialog::~DetailDialog()
937 {
938 }
939
940 void DetailDialog::set_image(
941 const Glib::ustring& icon_name, const Glib::ustring& description)
942 {
943 m_icon_name = icon_name;
944
945 for (int i = 0; i < n_icon_sizes; ++i)
946 {
947 m_image[i].set_from_icon_name(icon_name, Gtk::ICON_SIZE_MENU);
948 m_image[i].set_pixel_size(m_icon_size[i]);
949 m_event_box[i].drag_source_set_icon(get_icon(i));
950 }
951 if (description.empty())
952 m_description.hide();
953 else
954 {
955 m_description.set_text(description);
956 m_description.show();
957 }
958 }
959
960 void DetailDialog::on_image_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& /* context */,
961 Gtk::SelectionData& selection_data, guint /* info */, guint /* time */, int size_index)
962 {
963 selection_data.set_pixbuf(get_icon(size_index));
964 }
965
966 Glib::RefPtr<Gdk::Pixbuf> DetailDialog::get_icon(int size_index)
967 {
968 Glib::RefPtr<Gtk::StyleContext> context = m_image[size_index].get_style_context();
969 Gtk::IconInfo info = Gtk::IconTheme::get_default()->lookup_icon(
970 m_icon_name, m_icon_size[size_index]);
971 Glib::RefPtr<Gdk::Pixbuf> pixbuf;
972 try
973 {
974 bool is_symbolic = false;
975 pixbuf = info.load_symbolic(context, is_symbolic);
976 }
977 catch (const Glib::Error& err)
978 {
979 std::cout << "Error in DetailDialog::get_icon(): " << err.what() << std::endl;
980 }
981 return pixbuf;
982 }
983
984 IconInfoStore::IconInfoStore()
985 {
986 // We can't call Gtk::ListStore(m_columns) in the initializer list
987 // because m_columns does not exist when the base class constructor runs.
988 // And we can't have a static m_columns instance, because that would be
989 // instantiated before the gtkmm type system.
990 // So, we use this method, which should only be used just after creation:
991 set_column_types(m_columns);
992
993 set_text_column(false);
994 }
995
996 IconInfoStore::~IconInfoStore()
997 {
998 }
999
1000 Glib::RefPtr<IconInfoStore> IconInfoStore::create()
1001 {
1002 return Glib::RefPtr<IconInfoStore>(new IconInfoStore());
1003 }
1004
1005 bool IconInfoStore::drag_data_get_vfunc(const Gtk::TreeModel::Path& path,
1006 Gtk::SelectionData& selection_data) const
1007 {
1008 // There is no const version of Gtk::TreeModel::get_iter().
1009 Gtk::TreeModel::const_iterator iter = const_cast<IconInfoStore*>(this)->get_iter(path);
1010 if (!iter)
1011 return false;
1012
1013 const Gtk::TreeModel::Row row = *iter;
1014 const Glib::ustring name = row[m_text_column];
1015 selection_data.set_text(name);
1016 return true;
1017 }