├── .gitignore ├── LICENSE.md ├── README.md ├── data ├── de.haeckerfelix.gradio.appdata.xml.in ├── de.haeckerfelix.gradio.desktop.in ├── de.haeckerfelix.gradio.gresource.xml ├── de.haeckerfelix.gradio.gschema.xml ├── de.haeckerfelix.gradio.search-provider.ini ├── de.haeckerfelix.gradio.service.in ├── de.haeckerfelix.gradio.style.css ├── icons │ ├── de.haeckerfelix.gradio.svg │ ├── export_logo.sh │ └── hicolor │ │ ├── 16x16 │ │ └── apps │ │ │ ├── de.haeckerfelix.gradio.png │ │ │ └── gradio.png │ │ ├── 22x22 │ │ └── apps │ │ │ ├── de.haeckerfelix.gradio.png │ │ │ └── gradio.png │ │ ├── 24x24 │ │ └── apps │ │ │ ├── de.haeckerfelix.gradio.png │ │ │ └── gradio.png │ │ ├── 256x256 │ │ └── apps │ │ │ ├── de.haeckerfelix.gradio.png │ │ │ └── gradio.png │ │ ├── 32x32 │ │ └── apps │ │ │ ├── de.haeckerfelix.gradio.png │ │ │ └── gradio.png │ │ ├── 48x48 │ │ └── apps │ │ │ ├── de.haeckerfelix.gradio.png │ │ │ └── gradio.png │ │ ├── 512x512 │ │ └── apps │ │ │ ├── de.haeckerfelix.gradio.png │ │ │ └── gradio.png │ │ └── scalable │ │ └── apps │ │ ├── de.haeckerfelix.gradio-symbolic.svg │ │ └── de.haeckerfelix.gradio.svg ├── meson.build └── ui │ ├── collection-row.ui │ ├── details-box.ui │ ├── groupbox.ui │ ├── headerbar.ui │ ├── item │ ├── button-item.ui │ └── switch-item.ui │ ├── main-window.ui │ ├── menubutton.ui │ ├── organize-collection-popover.ui │ ├── page │ ├── collection-items-page.ui │ ├── collections-page.ui │ ├── library-page.ui │ ├── search-page.ui │ └── settings-page.ui │ ├── player-toolbar.ui │ ├── searchbar.ui │ ├── selection-menu.ui │ ├── selection-toolbar.ui │ ├── station-editor.ui │ └── status-icon.ui ├── de.haeckerfelix.gradio.json ├── docs └── CODE_OF_CONDUCT.md ├── external ├── gd │ ├── libgd │ │ ├── gd-entry-focus-hack.c │ │ ├── gd-entry-focus-hack.h │ │ ├── gd-icon-utils.c │ │ ├── gd-icon-utils.h │ │ ├── gd-main-box-child.c │ │ ├── gd-main-box-child.h │ │ ├── gd-main-box-generic.c │ │ ├── gd-main-box-generic.h │ │ ├── gd-main-box-item.c │ │ ├── gd-main-box-item.h │ │ ├── gd-main-box.c │ │ ├── gd-main-box.h │ │ ├── gd-main-icon-box-child.c │ │ ├── gd-main-icon-box-child.h │ │ ├── gd-main-icon-box-icon.c │ │ ├── gd-main-icon-box-icon.h │ │ ├── gd-main-icon-box.c │ │ ├── gd-main-icon-box.h │ │ ├── gd-main-icon-view.c │ │ ├── gd-main-icon-view.h │ │ ├── gd-main-list-view.c │ │ ├── gd-main-list-view.h │ │ ├── gd-main-view-generic.c │ │ ├── gd-main-view-generic.h │ │ ├── gd-main-view.c │ │ ├── gd-main-view.h │ │ ├── gd-margin-container.c │ │ ├── gd-margin-container.h │ │ ├── gd-notification.c │ │ ├── gd-notification.h │ │ ├── gd-styled-text-renderer.c │ │ ├── gd-styled-text-renderer.h │ │ ├── gd-tagged-entry-default.css │ │ ├── gd-tagged-entry.c │ │ ├── gd-tagged-entry.gresource.xml │ │ ├── gd-tagged-entry.h │ │ ├── gd-toggle-pixbuf-renderer.c │ │ ├── gd-toggle-pixbuf-renderer.h │ │ ├── gd-two-lines-renderer.c │ │ ├── gd-two-lines-renderer.h │ │ ├── gd-types-catalog.c │ │ ├── gd-types-catalog.h │ │ ├── gd.h │ │ └── meson.build │ └── meson.build └── meson.build ├── gradio.doap ├── meson.build ├── meson_post_install.sh ├── po ├── .gitignore ├── LINGUAS ├── POTFILES.in ├── README.md ├── be.po ├── ca.po ├── cmn.po ├── cs.po ├── de.po ├── es.po ├── fi.po ├── fr.po ├── ga.po ├── gradio.pot ├── hi.po ├── hr.po ├── hu.po ├── id.po ├── it.po ├── ja.po ├── ka.po ├── ko.po ├── meson.build ├── nb.po ├── nl.po ├── pl.po ├── pt_BR.po ├── pt_PT.po ├── ru.po ├── sk.po ├── sr.po ├── sr@latin.po ├── sv.po ├── tr.po ├── uk.po └── update-po.sh └── src ├── gradio-app.vala ├── gradio-audio-player.vala ├── gradio-category-items.vala ├── gradio-codec-installer.vala ├── gradio-collection.vala ├── gradio-details-box.vala ├── gradio-headerbar.vala ├── gradio-image-cache.vala ├── gradio-library.vala ├── gradio-main-window.vala ├── gradio-mainbox.vala ├── gradio-menubutton.vala ├── gradio-mpris.vala ├── gradio-organize-collection-popover.vala ├── gradio-player-toolbar.vala ├── gradio-radio-browser.vala ├── gradio-radio-station.vala ├── gradio-search-provider.vala ├── gradio-searchbar.vala ├── gradio-selection-toolbar.vala ├── gradio-settings.vala ├── gradio-station-compare.vala ├── gradio-station-editor-dialog.vala ├── gradio-station-provider.vala ├── gradio-status-icon.vala ├── gradio-thumbnail.vala ├── gradio-utils.vala ├── groupbox ├── gradio-groupbox-button.vala ├── gradio-groupbox-item.vala ├── gradio-groupbox-switch-item.vala ├── gradio-groupbox-widget-item.vala └── gradio-groupbox.vala ├── meson.build ├── model ├── gradio-generic-model.vala └── gradio-station-model.vala ├── page ├── gradio-collection-items-page.vala ├── gradio-library-page.vala ├── gradio-page.vala ├── gradio-search-page.vala └── gradio-settings-page.vala └── vapis ├── cairo.vapi ├── config.vapi └── gd-1.0.vapi /.gitignore: -------------------------------------------------------------------------------- 1 | .flatpak-builder 2 | *_source.tar* 3 | *.snap 4 | .buildconfig 5 | de.haeckerfelix.gradio.json~ 6 | _build 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ___ 2 | ### The successor of Gradio is Shortwave. 3 | 4 | Get more information here: 5 | 6 | https://gitlab.gnome.org/World/Shortwave 7 | ___ 8 | 9 | # Gradio 10 | A GTK3 app for finding and listening to internet radio stations. 11 | 12 | ![alt text](https://raw.githubusercontent.com/haecker-felix/gradio/master/data/icons/hicolor/256x256/apps/de.haeckerfelix.gradio.png "Logo") 13 | 14 | [![GitHub release](https://img.shields.io/github/release/haecker-felix/gradio.svg)](https://github.com/haecker-felix/gradio/releases/) 15 | [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) 16 | [![Packaging status](https://repology.org/badge/tiny-repos/gradio.svg)](https://repology.org/metapackage/gradio) 17 | 18 | ## General Informations 19 | 20 | * **License** 21 | GNU General Public License, Version 3 22 | -------------------------------------------------------------------------------- /data/de.haeckerfelix.gradio.appdata.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | de.haeckerfelix.gradio.desktop 4 | Gradio 5 | Find and listen to internet radio stations 6 | gradio 7 | Felix Häcker 8 | haeckerfelix@gnome.org 9 | CC0 10 | GPL-3.0+ 11 | 12 | mild 13 | 14 | 15 | 16 |

17 | With Gradio you can browse, search and of course play radio stations. All 18 | this is simple and uncomplicated. 19 |

20 |
21 | 22 | 23 | 24 | https://raw.githubusercontent.com/haecker-felix/gradio-appdata/master/screenshot_1.png 25 | 26 | 27 | https://raw.githubusercontent.com/haecker-felix/gradio-appdata/master/screenshot_2.png 28 | 29 | 30 | https://raw.githubusercontent.com/haecker-felix/gradio-appdata/master/screenshot_3.png 31 | 32 | 33 | https://raw.githubusercontent.com/haecker-felix/gradio-appdata/master/screenshot_4.png 34 | 35 | 36 | 37 | https://github.com/haecker-felix/Gradio 38 | https://github.com/haecker-felix/Gradio/issues 39 | https://de.liberapay.com/haecker-felix 40 | 41 | 42 | AppMenu 43 | HiDpiIcon 44 | ModernToolkit 45 | Notifications 46 | SearchProvider 47 | 48 | 49 | 50 | 51 | 52 |

This will probably be the last version of Gradio. It includes updated translations and small improvements.

53 |
54 |
55 | 56 | 57 |

Updated translations, minor user interface improvements.

58 |
59 |
60 | 61 | 62 |

Some discover design tweaks, improved tags support, improved filter popover, updated translations, improved m3u export.

63 |
64 |
65 | 66 | 67 |

The "Discover" section is back! Merged "Add" and "Search" page. New unified library view. Library can now be exported as M3U playlist. And much more..!

68 |
69 |
70 | 71 | 72 |

Group your stations into collections, Everything is now sortable, Extended search page, Stations can be created and edited, New details sidebar, New selection system.

73 |
74 |
75 | 76 | 77 |

New grid/list view, new right click menu, background playback, redesigned discover page.

78 |
79 |
80 | 81 | 82 | 83 | 84 |

New volume control, show connection information, new sort options.

85 |
86 |
87 | 88 | 89 | 90 | 91 |

MPRIS Support, vote for stations, search for stations.

92 |
93 |
94 |
95 | 96 |
97 | -------------------------------------------------------------------------------- /data/de.haeckerfelix.gradio.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Gradio 3 | Comment=Find and listen to internet radio stations 4 | Exec=gradio 5 | Icon=de.haeckerfelix.gradio 6 | Terminal=false 7 | Type=Application 8 | Categories=AudioVideo;Audio;Player;GNOME; 9 | Keywords=gradio;internet;radio;music; 10 | StartupNotify=true 11 | -------------------------------------------------------------------------------- /data/de.haeckerfelix.gradio.gresource.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | de.haeckerfelix.gradio.style.css 4 | ui/item/switch-item.ui 5 | ui/item/button-item.ui 6 | ui/page/library-page.ui 7 | ui/page/search-page.ui 8 | ui/page/collection-items-page.ui 9 | ui/page/collections-page.ui 10 | ui/page/settings-page.ui 11 | ui/details-box.ui 12 | ui/station-editor.ui 13 | ui/groupbox.ui 14 | ui/main-window.ui 15 | ui/player-toolbar.ui 16 | ui/status-icon.ui 17 | ui/headerbar.ui 18 | ui/selection-menu.ui 19 | ui/selection-toolbar.ui 20 | ui/organize-collection-popover.ui 21 | ui/searchbar.ui 22 | ui/menubutton.ui 23 | ui/collection-row.ui 24 | icons/hicolor/48x48/apps/de.haeckerfelix.gradio.png 25 | 26 | 27 | -------------------------------------------------------------------------------- /data/de.haeckerfelix.gradio.gschema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | Only show working radio stations 6 | 7 | 8 | 9 | false 10 | Prefer dark theme of the user interface 11 | 12 | 13 | 14 | true 15 | MPRIS support 16 | 17 | 18 | 19 | true 20 | Continue the playback if window is closed. 21 | 22 | 23 | 24 | true 25 | Cache station icons 26 | 27 | 28 | 29 | true 30 | Show notifications 31 | 32 | 33 | 34 | false 35 | Show technical information in the UI 36 | 37 | 38 | 39 | 0.99 40 | Volume position 41 | 42 | 43 | 44 | 500 45 | Height of the window 46 | 47 | 48 | 49 | 870 50 | Width of the window 51 | 52 | 53 | 54 | false 55 | Resume Playback On Startup 56 | 57 | 58 | 59 | 0 60 | The last played station 61 | 62 | 63 | 64 | 200 65 | The size of the station icons 66 | 67 | 68 | 69 | 1 70 | 71 | 72 | 73 | 74 | false 75 | 76 | 77 | 78 | 79 | false 80 | Show a tray icon to restore gradio 81 | 82 | 83 | 84 | 100 85 | Maximum of stations to show in search 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /data/de.haeckerfelix.gradio.search-provider.ini: -------------------------------------------------------------------------------- 1 | [Shell Search Provider] 2 | DesktopId=de.haeckerfelix.gradio.desktop 3 | BusName=de.haeckerfelix.gradio 4 | ObjectPath=/de/haeckerfelix/gradio/SearchProvider 5 | Version=2 6 | 7 | -------------------------------------------------------------------------------- /data/de.haeckerfelix.gradio.service.in: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=de.haeckerfelix.gradio 3 | Exec=@bindir@/gradio --gapplication-service 4 | -------------------------------------------------------------------------------- /data/de.haeckerfelix.gradio.style.css: -------------------------------------------------------------------------------- 1 | .thumbnail { 2 | background-color: #ffffff; 3 | border: 2px solid; 4 | border-color: mix(@theme_base_color,@theme_fg_color,0.5); 5 | border-radius: 3px; 6 | } 7 | 8 | .small-button { 9 | font-size: smaller; 10 | padding: 2px 2px; 11 | } 12 | -------------------------------------------------------------------------------- /data/icons/export_logo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for i in 16 22 24 32 48 256 512 4 | do 5 | inkscape -z -e hicolor/$i\x$i/apps/de.haeckerfelix.gradio.png -w $i -h $i de.haeckerfelix.gradio.svg 6 | inkscape -z -e hicolor/$i\x$i/apps/gradio.png -w $i -h $i de.haeckerfelix.gradio.svg 7 | done 8 | 9 | -------------------------------------------------------------------------------- /data/icons/hicolor/16x16/apps/de.haeckerfelix.gradio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haecker-felix/Gradio/fff2e2804f12209e9b910a3444da28526cec1400/data/icons/hicolor/16x16/apps/de.haeckerfelix.gradio.png -------------------------------------------------------------------------------- /data/icons/hicolor/16x16/apps/gradio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haecker-felix/Gradio/fff2e2804f12209e9b910a3444da28526cec1400/data/icons/hicolor/16x16/apps/gradio.png -------------------------------------------------------------------------------- /data/icons/hicolor/22x22/apps/de.haeckerfelix.gradio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haecker-felix/Gradio/fff2e2804f12209e9b910a3444da28526cec1400/data/icons/hicolor/22x22/apps/de.haeckerfelix.gradio.png -------------------------------------------------------------------------------- /data/icons/hicolor/22x22/apps/gradio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haecker-felix/Gradio/fff2e2804f12209e9b910a3444da28526cec1400/data/icons/hicolor/22x22/apps/gradio.png -------------------------------------------------------------------------------- /data/icons/hicolor/24x24/apps/de.haeckerfelix.gradio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haecker-felix/Gradio/fff2e2804f12209e9b910a3444da28526cec1400/data/icons/hicolor/24x24/apps/de.haeckerfelix.gradio.png -------------------------------------------------------------------------------- /data/icons/hicolor/24x24/apps/gradio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haecker-felix/Gradio/fff2e2804f12209e9b910a3444da28526cec1400/data/icons/hicolor/24x24/apps/gradio.png -------------------------------------------------------------------------------- /data/icons/hicolor/256x256/apps/de.haeckerfelix.gradio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haecker-felix/Gradio/fff2e2804f12209e9b910a3444da28526cec1400/data/icons/hicolor/256x256/apps/de.haeckerfelix.gradio.png -------------------------------------------------------------------------------- /data/icons/hicolor/256x256/apps/gradio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haecker-felix/Gradio/fff2e2804f12209e9b910a3444da28526cec1400/data/icons/hicolor/256x256/apps/gradio.png -------------------------------------------------------------------------------- /data/icons/hicolor/32x32/apps/de.haeckerfelix.gradio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haecker-felix/Gradio/fff2e2804f12209e9b910a3444da28526cec1400/data/icons/hicolor/32x32/apps/de.haeckerfelix.gradio.png -------------------------------------------------------------------------------- /data/icons/hicolor/32x32/apps/gradio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haecker-felix/Gradio/fff2e2804f12209e9b910a3444da28526cec1400/data/icons/hicolor/32x32/apps/gradio.png -------------------------------------------------------------------------------- /data/icons/hicolor/48x48/apps/de.haeckerfelix.gradio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haecker-felix/Gradio/fff2e2804f12209e9b910a3444da28526cec1400/data/icons/hicolor/48x48/apps/de.haeckerfelix.gradio.png -------------------------------------------------------------------------------- /data/icons/hicolor/48x48/apps/gradio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haecker-felix/Gradio/fff2e2804f12209e9b910a3444da28526cec1400/data/icons/hicolor/48x48/apps/gradio.png -------------------------------------------------------------------------------- /data/icons/hicolor/512x512/apps/de.haeckerfelix.gradio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haecker-felix/Gradio/fff2e2804f12209e9b910a3444da28526cec1400/data/icons/hicolor/512x512/apps/de.haeckerfelix.gradio.png -------------------------------------------------------------------------------- /data/icons/hicolor/512x512/apps/gradio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haecker-felix/Gradio/fff2e2804f12209e9b910a3444da28526cec1400/data/icons/hicolor/512x512/apps/gradio.png -------------------------------------------------------------------------------- /data/icons/hicolor/scalable/apps/de.haeckerfelix.gradio-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | image/svg+xml 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 23 | 26 | 29 | 32 | 39 | 45 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /data/meson.build: -------------------------------------------------------------------------------- 1 | i18n = import('i18n') 2 | gnome_module = import('gnome') 3 | 4 | # Compile Resources # 5 | resources = gnome_module.compile_resources('gradio-resources', 'de.haeckerfelix.gradio.gresource.xml', source_dir : '.') 6 | 7 | 8 | # Translate and install appdata and desktop file # 9 | i18n.merge_file( 10 | input: 'de.haeckerfelix.gradio.desktop.in', 11 | output: 'de.haeckerfelix.gradio.desktop', 12 | po_dir: '../po/', 13 | type: 'desktop', 14 | install: true, 15 | install_dir: join_paths(get_option('datadir'), 'applications') 16 | ) 17 | 18 | i18n.merge_file( 19 | input: 'de.haeckerfelix.gradio.appdata.xml.in', 20 | output: 'de.haeckerfelix.gradio.appdata.xml', 21 | po_dir: '../po/', 22 | type: 'xml', 23 | install: true, 24 | install_dir: join_paths(get_option('datadir'), 'metainfo') 25 | ) 26 | 27 | # dbus service / search provider 28 | dbusconf = configuration_data() 29 | dbusconf.set('bindir', join_paths(get_option('prefix'), get_option('bindir'))) 30 | configure_file( 31 | input: 'de.haeckerfelix.gradio.service.in', 32 | output: 'de.haeckerfelix.gradio.service', 33 | configuration: dbusconf, 34 | install: true, 35 | install_dir: join_paths(get_option('datadir'), 'dbus-1', 'services'), 36 | ) 37 | 38 | install_data('de.haeckerfelix.gradio.search-provider.ini', 39 | install_dir: join_paths(get_option('datadir'), 'gnome-shell', 'search-providers'), 40 | ) 41 | 42 | # Icons # 43 | icondir = join_paths(get_option('datadir'), 'icons', 'hicolor') 44 | icon_sizes = ['16x16', '24x24', '32x32', '48x48', '256x256', '512x512'] 45 | 46 | foreach size : icon_sizes 47 | install_data('icons/hicolor/@0@/apps/de.haeckerfelix.gradio.png'.format(size), install_dir : join_paths(icondir, size, 'apps')) 48 | endforeach 49 | 50 | install_data('icons/hicolor/scalable/apps/de.haeckerfelix.gradio.svg', install_dir : 'share/icons/hicolor/scalable/apps') 51 | install_data('icons/hicolor/scalable/apps/de.haeckerfelix.gradio-symbolic.svg', install_dir : 'share/icons/hicolor/symbolic/apps') 52 | 53 | 54 | # Settings Schema # 55 | install_data('de.haeckerfelix.gradio.gschema.xml', install_dir : join_paths(get_option('datadir'), 'glib-2.0/schemas/')) 56 | -------------------------------------------------------------------------------- /data/ui/collection-row.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 78 | 79 | -------------------------------------------------------------------------------- /data/ui/groupbox.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 59 | 60 | -------------------------------------------------------------------------------- /data/ui/item/button-item.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 71 | 72 | -------------------------------------------------------------------------------- /data/ui/item/switch-item.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 72 | 73 | -------------------------------------------------------------------------------- /data/ui/organize-collection-popover.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 125 | 126 | -------------------------------------------------------------------------------- /data/ui/page/collection-items-page.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 31 | 32 | -------------------------------------------------------------------------------- /data/ui/page/collections-page.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 105 | 106 | -------------------------------------------------------------------------------- /data/ui/page/library-page.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 124 | 125 | -------------------------------------------------------------------------------- /data/ui/page/settings-page.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 42 | 43 | -------------------------------------------------------------------------------- /data/ui/selection-menu.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | app.select-all 7 | Select All 8 | 9 | 10 | app.select-none 11 | Select None 12 | 13 |
14 |
15 |
16 | -------------------------------------------------------------------------------- /data/ui/status-icon.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 62 | 63 | 300 64 | 200 65 | False 66 | 67 | 68 | True 69 | False 70 | center 71 | center 72 | vertical 73 | 6 74 | 75 | 76 | True 77 | False 78 | 300 79 | crossfade 80 | 81 | 82 | True 83 | False 84 | 64 85 | network-transmit-receive-symbolic 86 | 87 | 88 | connected 89 | 90 | 91 | 92 | 93 | True 94 | False 95 | 64 96 | network-offline-symbolic 97 | 98 | 99 | no-connection 100 | 1 101 | 102 | 103 | 104 | 105 | False 106 | True 107 | 0 108 | 109 | 110 | 111 | 112 | True 113 | False 114 | label 115 | center 116 | True 117 | 118 | 119 | False 120 | True 121 | 1 122 | 123 | 124 | 125 | 126 | True 127 | False 128 | 129 | 130 | 131 | 134 | 135 | 136 | False 137 | True 138 | 2 139 | 140 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /de.haeckerfelix.gradio.json: -------------------------------------------------------------------------------- 1 | { 2 | "app-id":"de.haeckerfelix.gradio", 3 | "runtime":"org.gnome.Platform", 4 | "runtime-version":"3.34", 5 | "sdk":"org.gnome.Sdk", 6 | "command":"gradio", 7 | "finish-args":[ 8 | "--share=ipc", 9 | "--share=network", 10 | "--socket=x11", 11 | "--socket=wayland", 12 | "--socket=pulseaudio", 13 | "--device=dri", 14 | "--env=DCONF_USER_CONFIG_DIR=.config/dconf", 15 | "--filesystem=xdg-run/dconf", 16 | "--filesystem=~/.config/dconf:ro", 17 | "--talk-name=ca.desrt.dconf", 18 | "--own-name=org.mpris.MediaPlayer2.gradio" 19 | ], 20 | "modules":[ 21 | { 22 | "name": "gst-libav", 23 | "buildsystem": "meson", 24 | "sources": [ 25 | { 26 | "type": "archive", 27 | "url": "https://gstreamer.freedesktop.org/src/gst-libav/gst-libav-1.16.0.tar.xz", 28 | "sha256": "dfac119043a9cfdcacd7acde77f674ab172cf2537b5812be52f49e9cddc53d9a" 29 | } 30 | ] 31 | }, 32 | { 33 | "name": "gst-plugins-ugly", 34 | "config-opts": [ "--disable-gtk-doc"], 35 | "cleanup": [ "*.la", "/share/gtk-doc" ], 36 | "sources": [ 37 | { 38 | "type": "archive", 39 | "url": "https://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-1.16.0.tar.xz", 40 | "sha256": "e30964c5f031c32289e0b25e176c3c95a5737f2052dfc81d0f7427ef0233a4c2" 41 | } 42 | ] 43 | }, 44 | { 45 | "name": "gradio", 46 | "buildsystem": "meson", 47 | "sources":[ 48 | { 49 | "type": "archive", 50 | "url": "https://github.com/haecker-felix/Gradio/archive/v7.3.tar.gz", 51 | "sha256": "5c5afed83fceb9a9f8bc7414b8a200128b3317ccf1ed50a0e7321ca15cf19412" 52 | } 53 | ] 54 | } 55 | ] 56 | } 57 | -------------------------------------------------------------------------------- /docs/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Attribution 36 | 37 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 38 | 39 | [homepage]: http://contributor-covenant.org 40 | [version]: http://contributor-covenant.org/version/1/4/ 41 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-entry-focus-hack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, 2012 Red Hat, Inc. 3 | * 4 | * Gnome Documents is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by the 6 | * Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * Gnome Documents is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with Gnome Documents; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Cosimo Cecchi 19 | * 20 | */ 21 | 22 | #include "gd-entry-focus-hack.h" 23 | 24 | /* taken from gtk/gtktreeview.c */ 25 | static void 26 | send_focus_change (GtkWidget *widget, 27 | GdkDevice *device, 28 | gboolean in) 29 | { 30 | GdkDeviceManager *device_manager; 31 | GList *devices, *d; 32 | 33 | device_manager = gdk_display_get_device_manager (gtk_widget_get_display (widget)); 34 | devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER); 35 | devices = g_list_concat (devices, gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_SLAVE)); 36 | devices = g_list_concat (devices, gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_FLOATING)); 37 | 38 | for (d = devices; d; d = d->next) 39 | { 40 | GdkDevice *dev = d->data; 41 | GdkEvent *fevent; 42 | GdkWindow *window; 43 | 44 | if (gdk_device_get_source (dev) != GDK_SOURCE_KEYBOARD) 45 | continue; 46 | 47 | window = gtk_widget_get_window (widget); 48 | if (!window) 49 | continue; 50 | 51 | /* Skip non-master keyboards that haven't 52 | * selected for events from this window 53 | */ 54 | if (gdk_device_get_device_type (dev) != GDK_DEVICE_TYPE_MASTER && 55 | !gdk_window_get_device_events (window, dev)) 56 | continue; 57 | 58 | fevent = gdk_event_new (GDK_FOCUS_CHANGE); 59 | 60 | fevent->focus_change.type = GDK_FOCUS_CHANGE; 61 | fevent->focus_change.window = g_object_ref (window); 62 | fevent->focus_change.in = in; 63 | gdk_event_set_device (fevent, device); 64 | 65 | gtk_widget_send_focus_change (widget, fevent); 66 | 67 | gdk_event_free (fevent); 68 | } 69 | 70 | g_list_free (devices); 71 | } 72 | 73 | void 74 | gd_entry_focus_hack (GtkWidget *entry, 75 | GdkDevice *device) 76 | { 77 | GtkEntryClass *entry_class; 78 | GtkWidgetClass *entry_parent_class; 79 | 80 | /* Grab focus will select all the text. We don't want that to happen, so we 81 | * call the parent instance and bypass the selection change. This is probably 82 | * really non-kosher. */ 83 | entry_class = g_type_class_peek (GTK_TYPE_ENTRY); 84 | entry_parent_class = g_type_class_peek_parent (entry_class); 85 | (entry_parent_class->grab_focus) (entry); 86 | 87 | /* send focus-in event */ 88 | send_focus_change (entry, device, TRUE); 89 | } 90 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-entry-focus-hack.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, 2012 Red Hat, Inc. 3 | * 4 | * Gnome Documents is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by the 6 | * Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * Gnome Documents is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with Gnome Documents; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Cosimo Cecchi 19 | * 20 | */ 21 | 22 | #ifndef __GD_ENTRY_FOCUS_HACK_H__ 23 | #define __GD_ENTRY_FOCUS_HACK_H__ 24 | 25 | #include 26 | 27 | void gd_entry_focus_hack (GtkWidget *entry, 28 | GdkDevice *device); 29 | 30 | #endif/* __GD_ENTRY_FOCUS_HACK_H__ */ 31 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-icon-utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, 2012, 2015, 2016 Red Hat, Inc. 3 | * 4 | * Gnome Documents is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by the 6 | * Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * Gnome Documents is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 | * for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with Gnome Documents; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Cosimo Cecchi 19 | * 20 | */ 21 | 22 | #ifndef __GD_CREATE_SYMBOLIC_ICON_H__ 23 | #define __GD_CREATE_SYMBOLIC_ICON_H__ 24 | 25 | #include 26 | #include 27 | 28 | cairo_surface_t *gd_copy_image_surface (cairo_surface_t *surface); 29 | 30 | cairo_surface_t *gd_create_surface_with_counter (GtkWidget *widget, 31 | cairo_surface_t *base, 32 | gint number); 33 | 34 | GIcon *gd_create_symbolic_icon (const gchar *name, 35 | gint base_size); 36 | GIcon *gd_create_symbolic_icon_for_scale (const gchar *name, 37 | gint base_size, 38 | gint scale); 39 | 40 | GdkPixbuf *gd_embed_image_in_frame (GdkPixbuf *source_image, 41 | const gchar *frame_image_url, 42 | GtkBorder *slice_width, 43 | GtkBorder *border_width); 44 | cairo_surface_t *gd_embed_surface_in_frame (cairo_surface_t *source_image, 45 | const gchar *frame_image_url, 46 | GtkBorder *slice_width, 47 | GtkBorder *border_width); 48 | 49 | #endif /* __GD_CREATE_SYMBOLIC_ICON_H__ */ 50 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-main-box-child.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2017 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Debarshi Ray 19 | * 20 | */ 21 | 22 | #include "gd-main-box-child.h" 23 | 24 | G_DEFINE_INTERFACE (GdMainBoxChild, gd_main_box_child, GTK_TYPE_WIDGET) 25 | 26 | static void 27 | gd_main_box_child_default_init (GdMainBoxChildInterface *iface) 28 | { 29 | GParamSpec *pspec; 30 | 31 | /** 32 | * GdMainBoxChild:item: 33 | * 34 | * A #GdMainBoxItem that is rendered by the #GdMainBoxChild widget. 35 | */ 36 | pspec = g_param_spec_object ("item", 37 | "Item", 38 | "An item that is rendered by the widget", 39 | GD_TYPE_MAIN_BOX_ITEM, 40 | G_PARAM_CONSTRUCT_ONLY | 41 | G_PARAM_EXPLICIT_NOTIFY | 42 | G_PARAM_READWRITE | 43 | G_PARAM_STATIC_STRINGS); 44 | g_object_interface_install_property (iface, pspec); 45 | 46 | /** 47 | * GdMainBoxChild:selection-mode: 48 | * 49 | * Whether the #GdMainBoxChild widget is in selection mode. 50 | */ 51 | pspec = g_param_spec_boolean ("selection-mode", 52 | "Selection mode", 53 | "Whether the child is in selection mode", 54 | FALSE, 55 | G_PARAM_CONSTRUCT | 56 | G_PARAM_EXPLICIT_NOTIFY | 57 | G_PARAM_READWRITE | 58 | G_PARAM_STATIC_STRINGS); 59 | g_object_interface_install_property (iface, pspec); 60 | 61 | /** 62 | * GdMainBoxChild:show-primary-text: 63 | * 64 | * Whether the #GdMainBoxChild widget is going to show the 65 | * primary-text of its item. 66 | */ 67 | pspec = g_param_spec_boolean ("show-primary-text", 68 | "Show Primary Text", 69 | "Whether the item's primary-text is going to be shown", 70 | FALSE, 71 | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); 72 | g_object_interface_install_property (iface, pspec); 73 | 74 | /** 75 | * GdMainBoxChild:show-secondary-text: 76 | * 77 | * Whether the #GdMainBoxChild widget is going to show the 78 | * secondary-text of its item. 79 | */ 80 | pspec = g_param_spec_boolean ("show-secondary-text", 81 | "Show Secondary Text", 82 | "Whether the item's secondary-text is going to be shown", 83 | FALSE, 84 | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); 85 | g_object_interface_install_property (iface, pspec); 86 | } 87 | 88 | /** 89 | * gd_main_box_child_get_item: 90 | * @self: 91 | * 92 | * Returns: (transfer none): The #GdMainBoxItem 93 | */ 94 | GdMainBoxItem * 95 | gd_main_box_child_get_item (GdMainBoxChild *self) 96 | { 97 | GdMainBoxChildInterface *iface; 98 | 99 | g_return_val_if_fail (GD_IS_MAIN_BOX_CHILD (self), NULL); 100 | 101 | iface = GD_MAIN_BOX_CHILD_GET_IFACE (self); 102 | 103 | return (* iface->get_item) (self); 104 | } 105 | 106 | /** 107 | * gd_main_box_child_get_index: 108 | * @self: 109 | * 110 | * Returns: (transfer none): The index 111 | */ 112 | gint 113 | gd_main_box_child_get_index (GdMainBoxChild *self) 114 | { 115 | GdMainBoxChildInterface *iface; 116 | 117 | g_return_val_if_fail (GD_IS_MAIN_BOX_CHILD (self), -1); 118 | 119 | iface = GD_MAIN_BOX_CHILD_GET_IFACE (self); 120 | 121 | return (* iface->get_index) (self); 122 | } 123 | 124 | /** 125 | * gd_main_box_child_get_selected: 126 | * @self: 127 | * 128 | * Returns: (transfer none): Whether @self is selected 129 | */ 130 | gboolean 131 | gd_main_box_child_get_selected (GdMainBoxChild *self) 132 | { 133 | GdMainBoxChildInterface *iface; 134 | 135 | g_return_val_if_fail (GD_IS_MAIN_BOX_CHILD (self), FALSE); 136 | 137 | iface = GD_MAIN_BOX_CHILD_GET_IFACE (self); 138 | 139 | return (* iface->get_selected) (self); 140 | } 141 | 142 | /** 143 | * gd_main_box_child_get_selection_mode: 144 | * @self: 145 | * 146 | * Returns: (transfer none): Whether @self is in selection mode 147 | */ 148 | gboolean 149 | gd_main_box_child_get_selection_mode (GdMainBoxChild *self) 150 | { 151 | gboolean selection_mode; 152 | 153 | g_return_val_if_fail (GD_IS_MAIN_BOX_CHILD (self), FALSE); 154 | 155 | g_object_get (self, "selection-mode", &selection_mode, NULL); 156 | return selection_mode; 157 | } 158 | 159 | /** 160 | * gd_main_box_child_set_selected: 161 | * @self: 162 | * @selected: 163 | */ 164 | void 165 | gd_main_box_child_set_selected (GdMainBoxChild *self, gboolean selected) 166 | { 167 | GdMainBoxChildInterface *iface; 168 | 169 | g_return_if_fail (GD_IS_MAIN_BOX_CHILD (self)); 170 | 171 | iface = GD_MAIN_BOX_CHILD_GET_IFACE (self); 172 | 173 | return (* iface->set_selected) (self, selected); 174 | } 175 | 176 | /** 177 | * gd_main_box_child_set_selection_mode: 178 | * @self: 179 | * @selection_mode: 180 | */ 181 | void 182 | gd_main_box_child_set_selection_mode (GdMainBoxChild *self, gboolean selection_mode) 183 | { 184 | g_return_if_fail (GD_IS_MAIN_BOX_CHILD (self)); 185 | g_object_set (self, "selection-mode", selection_mode, NULL); 186 | } 187 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-main-box-child.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Debarshi Ray 19 | * 20 | */ 21 | 22 | #ifndef __GD_MAIN_BOX_CHILD_H__ 23 | #define __GD_MAIN_BOX_CHILD_H__ 24 | 25 | #include 26 | 27 | #include "gd-main-box-item.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GD_TYPE_MAIN_BOX_CHILD gd_main_box_child_get_type() 32 | G_DECLARE_INTERFACE (GdMainBoxChild, gd_main_box_child, GD, MAIN_BOX_CHILD, GtkWidget) 33 | 34 | struct _GdMainBoxChildInterface 35 | { 36 | GTypeInterface base_iface; 37 | 38 | /* vtable */ 39 | gint (* get_index) (GdMainBoxChild *self); 40 | GdMainBoxItem * (* get_item) (GdMainBoxChild *self); 41 | gboolean (* get_selected) (GdMainBoxChild *self); 42 | void (* set_selected) (GdMainBoxChild *self, gboolean selected); 43 | }; 44 | 45 | gint gd_main_box_child_get_index (GdMainBoxChild *self); 46 | GdMainBoxItem * gd_main_box_child_get_item (GdMainBoxChild *self); 47 | gboolean gd_main_box_child_get_selected (GdMainBoxChild *self); 48 | gboolean gd_main_box_child_get_selection_mode (GdMainBoxChild *self); 49 | void gd_main_box_child_set_selected (GdMainBoxChild *self, gboolean selected); 50 | void gd_main_box_child_set_selection_mode (GdMainBoxChild *self, gboolean selection_mode); 51 | 52 | G_END_DECLS 53 | 54 | #endif /* __GD_MAIN_BOX_CHILD_H__ */ 55 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-main-box-generic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2017 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Debarshi Ray 19 | * 20 | */ 21 | 22 | #ifndef __GD_MAIN_BOX_GENERIC_H__ 23 | #define __GD_MAIN_BOX_GENERIC_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "gd-main-box-child.h" 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GD_TYPE_MAIN_BOX_GENERIC gd_main_box_generic_get_type() 33 | G_DECLARE_INTERFACE (GdMainBoxGeneric, gd_main_box_generic, GD, MAIN_BOX_GENERIC, GtkWidget) 34 | 35 | struct _GdMainBoxGenericInterface 36 | { 37 | GTypeInterface base_iface; 38 | 39 | /* vtable */ 40 | GdMainBoxChild * (* get_child_at_index) (GdMainBoxGeneric *self, gint index); 41 | const gchar * (* get_last_selected_id) (GdMainBoxGeneric *self); 42 | GListModel * (* get_model) (GdMainBoxGeneric *self); 43 | GList * (* get_selected_children) (GdMainBoxGeneric *self); 44 | void (* select_all) (GdMainBoxGeneric *self); 45 | void (* select_child) (GdMainBoxGeneric *self, GdMainBoxChild *child); 46 | void (* unselect_all) (GdMainBoxGeneric *self); 47 | void (* unselect_child) (GdMainBoxGeneric *self, GdMainBoxChild *child); 48 | }; 49 | 50 | GdMainBoxChild * gd_main_box_generic_get_child_at_index (GdMainBoxGeneric *self, gint index); 51 | const gchar * gd_main_box_generic_get_last_selected_id (GdMainBoxGeneric *self); 52 | GListModel * gd_main_box_generic_get_model (GdMainBoxGeneric *self); 53 | GList * gd_main_box_generic_get_selected_children (GdMainBoxGeneric *self); 54 | gboolean gd_main_box_generic_get_selection_mode (GdMainBoxGeneric *self); 55 | gboolean gd_main_box_generic_get_show_primary_text (GdMainBoxGeneric *self); 56 | gboolean gd_main_box_generic_get_show_secondary_text (GdMainBoxGeneric *self); 57 | void gd_main_box_generic_select_all (GdMainBoxGeneric *self); 58 | void gd_main_box_generic_select_child (GdMainBoxGeneric *self, GdMainBoxChild *child); 59 | void gd_main_box_generic_set_model (GdMainBoxGeneric *self, GListModel *model); 60 | void gd_main_box_generic_set_selection_mode (GdMainBoxGeneric *self, gboolean selection_mode); 61 | void gd_main_box_generic_set_show_primary_text (GdMainBoxGeneric *self, gboolean show_primary_text); 62 | void gd_main_box_generic_set_show_secondary_text (GdMainBoxGeneric *self, 63 | gboolean show_secondary_text); 64 | void gd_main_box_generic_unselect_all (GdMainBoxGeneric *self); 65 | void gd_main_box_generic_unselect_child (GdMainBoxGeneric *self, GdMainBoxChild *child); 66 | 67 | void gd_main_box_generic_toggle_selection_for_child (GdMainBoxGeneric *self, 68 | GdMainBoxChild *child, 69 | gboolean select_range); 70 | 71 | G_END_DECLS 72 | 73 | #endif /* __GD_MAIN_BOX_GENERIC_H__ */ 74 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-main-box-item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Debarshi Ray 19 | * 20 | */ 21 | 22 | #ifndef __GD_MAIN_BOX_ITEM_H__ 23 | #define __GD_MAIN_BOX_ITEM_H__ 24 | 25 | #include 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define GD_TYPE_MAIN_BOX_ITEM gd_main_box_item_get_type() 31 | G_DECLARE_INTERFACE (GdMainBoxItem, gd_main_box_item, GD, MAIN_BOX_ITEM, GObject) 32 | 33 | struct _GdMainBoxItemInterface 34 | { 35 | GTypeInterface base_iface; 36 | 37 | /* vtable */ 38 | const gchar * (* get_id) (GdMainBoxItem *self); 39 | const gchar * (* get_uri) (GdMainBoxItem *self); 40 | const gchar * (* get_primary_text) (GdMainBoxItem *self); 41 | const gchar * (* get_secondary_text) (GdMainBoxItem *self); 42 | cairo_surface_t * (* get_icon) (GdMainBoxItem *self); 43 | }; 44 | 45 | const gchar * gd_main_box_item_get_id (GdMainBoxItem *self); 46 | const gchar * gd_main_box_item_get_uri (GdMainBoxItem *self); 47 | const gchar * gd_main_box_item_get_primary_text (GdMainBoxItem *self); 48 | const gchar * gd_main_box_item_get_secondary_text (GdMainBoxItem *self); 49 | cairo_surface_t * gd_main_box_item_get_icon (GdMainBoxItem *self); 50 | gint64 gd_main_box_item_get_mtime (GdMainBoxItem *self); 51 | gboolean gd_main_box_item_get_pulse (GdMainBoxItem *self); 52 | 53 | G_END_DECLS 54 | 55 | #endif /* __GD_MAIN_BOX_ITEM_H__ */ 56 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-main-box.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 2017 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Debarshi Ray 19 | * 20 | */ 21 | 22 | #ifndef __GD_MAIN_BOX_H__ 23 | #define __GD_MAIN_BOX_H__ 24 | 25 | #include 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define GD_TYPE_MAIN_BOX gd_main_box_get_type() 31 | G_DECLARE_DERIVABLE_TYPE (GdMainBox, gd_main_box, GD, MAIN_BOX, GtkBin) 32 | 33 | typedef enum 34 | { 35 | GD_MAIN_BOX_ICON, 36 | GD_MAIN_BOX_LIST 37 | } GdMainBoxType; 38 | 39 | struct _GdMainBoxClass 40 | { 41 | GtkBinClass parent_class; 42 | }; 43 | 44 | GtkWidget * gd_main_box_new (GdMainBoxType type); 45 | GdMainBoxType gd_main_box_get_box_type (GdMainBox *self); 46 | GListModel * gd_main_box_get_model (GdMainBox *self); 47 | GList * gd_main_box_get_selection (GdMainBox *self); 48 | gboolean gd_main_box_get_selection_mode (GdMainBox *self); 49 | gboolean gd_main_box_get_show_primary_text (GdMainBox *self); 50 | gboolean gd_main_box_get_show_secondary_text (GdMainBox *self); 51 | void gd_main_box_select_all (GdMainBox *self); 52 | void gd_main_box_set_box_type (GdMainBox *self, GdMainBoxType type); 53 | void gd_main_box_set_model (GdMainBox *self, GListModel *model); 54 | void gd_main_box_set_selection_mode (GdMainBox *self, gboolean selection_mode); 55 | void gd_main_box_set_show_primary_text (GdMainBox *self, gboolean show_primary_text); 56 | void gd_main_box_set_show_secondary_text (GdMainBox *self, gboolean show_secondary_text); 57 | void gd_main_box_unselect_all (GdMainBox *self); 58 | 59 | G_END_DECLS 60 | 61 | #endif /* __GD_MAIN_BOX_H__ */ 62 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-main-icon-box-child.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Debarshi Ray 19 | * 20 | */ 21 | 22 | #ifndef __GD_MAIN_ICON_BOX_CHILD_H__ 23 | #define __GD_MAIN_ICON_BOX_CHILD_H__ 24 | 25 | #include 26 | 27 | #include "gd-main-box-item.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GD_TYPE_MAIN_ICON_BOX_CHILD gd_main_icon_box_child_get_type() 32 | G_DECLARE_DERIVABLE_TYPE (GdMainIconBoxChild, gd_main_icon_box_child, GD, MAIN_ICON_BOX_CHILD, GtkFlowBoxChild) 33 | 34 | struct _GdMainIconBoxChildClass 35 | { 36 | GtkFlowBoxChildClass parent_class; 37 | }; 38 | 39 | GtkWidget * gd_main_icon_box_child_new (GdMainBoxItem *item, gboolean selection_mode); 40 | 41 | G_END_DECLS 42 | 43 | #endif /* __GD_MAIN_ICON_BOX_CHILD_H__ */ 44 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-main-icon-box-icon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Debarshi Ray 19 | * 20 | */ 21 | 22 | #ifndef __GD_MAIN_ICON_BOX_ICON_H__ 23 | #define __GD_MAIN_ICON_BOX_ICON_H__ 24 | 25 | #include 26 | 27 | #include "gd-main-box-item.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GD_TYPE_MAIN_ICON_BOX_ICON gd_main_icon_box_icon_get_type() 32 | G_DECLARE_FINAL_TYPE (GdMainIconBoxIcon, gd_main_icon_box_icon, GD, MAIN_ICON_BOX_ICON, GtkDrawingArea) 33 | 34 | GtkWidget * gd_main_icon_box_icon_new (GdMainBoxItem *item); 35 | GdMainBoxItem * gd_main_icon_box_icon_get_item (GdMainIconBoxIcon *self); 36 | void gd_main_icon_box_icon_set_item (GdMainIconBoxIcon *self, GdMainBoxItem *item); 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __GD_MAIN_ICON_BOX_ICON_H__ */ 41 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-main-icon-box.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Debarshi Ray 19 | * 20 | */ 21 | 22 | #ifndef __GD_MAIN_ICON_BOX_H__ 23 | #define __GD_MAIN_ICON_BOX_H__ 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | #define GD_TYPE_MAIN_ICON_BOX gd_main_icon_box_get_type() 30 | G_DECLARE_DERIVABLE_TYPE (GdMainIconBox, gd_main_icon_box, GD, MAIN_ICON_BOX, GtkFlowBox) 31 | 32 | struct _GdMainIconBoxClass 33 | { 34 | GtkFlowBoxClass parent_class; 35 | 36 | /* signals */ 37 | gboolean (* move_cursor) (GdMainIconBox *self, GtkMovementStep step, gint count); 38 | }; 39 | 40 | GtkWidget * gd_main_icon_box_new (void); 41 | 42 | G_END_DECLS 43 | 44 | #endif /* __GD_MAIN_ICON_BOX_H__ */ 45 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-main-icon-view.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Cosimo Cecchi 19 | * 20 | */ 21 | 22 | #ifndef __GD_MAIN_ICON_VIEW_H__ 23 | #define __GD_MAIN_ICON_VIEW_H__ 24 | 25 | #include 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define GD_TYPE_MAIN_ICON_VIEW gd_main_icon_view_get_type() 31 | 32 | #define GD_MAIN_ICON_VIEW(obj) \ 33 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ 34 | GD_TYPE_MAIN_ICON_VIEW, GdMainIconView)) 35 | 36 | #define GD_MAIN_ICON_VIEW_CLASS(klass) \ 37 | (G_TYPE_CHECK_CLASS_CAST ((klass), \ 38 | GD_TYPE_MAIN_ICON_VIEW, GdMainIconViewClass)) 39 | 40 | #define GD_IS_MAIN_ICON_VIEW(obj) \ 41 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ 42 | GD_TYPE_MAIN_ICON_VIEW)) 43 | 44 | #define GD_IS_MAIN_ICON_VIEW_CLASS(klass) \ 45 | (G_TYPE_CHECK_CLASS_TYPE ((klass), \ 46 | GD_TYPE_MAIN_ICON_VIEW)) 47 | 48 | #define GD_MAIN_ICON_VIEW_GET_CLASS(obj) \ 49 | (G_TYPE_INSTANCE_GET_CLASS ((obj), \ 50 | GD_TYPE_MAIN_ICON_VIEW, GdMainIconViewClass)) 51 | 52 | typedef struct _GdMainIconView GdMainIconView; 53 | typedef struct _GdMainIconViewClass GdMainIconViewClass; 54 | typedef struct _GdMainIconViewPrivate GdMainIconViewPrivate; 55 | 56 | struct _GdMainIconView 57 | { 58 | GtkIconView parent; 59 | }; 60 | 61 | struct _GdMainIconViewClass 62 | { 63 | GtkIconViewClass parent_class; 64 | }; 65 | 66 | GType gd_main_icon_view_get_type (void) G_GNUC_CONST; 67 | 68 | GtkWidget * gd_main_icon_view_new (void); 69 | 70 | G_END_DECLS 71 | 72 | #endif /* __GD_MAIN_ICON_VIEW_H__ */ 73 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-main-list-view.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Cosimo Cecchi 19 | * 20 | */ 21 | 22 | #ifndef __GD_MAIN_LIST_VIEW_H__ 23 | #define __GD_MAIN_LIST_VIEW_H__ 24 | 25 | #include 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define GD_TYPE_MAIN_LIST_VIEW gd_main_list_view_get_type() 31 | 32 | #define GD_MAIN_LIST_VIEW(obj) \ 33 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ 34 | GD_TYPE_MAIN_LIST_VIEW, GdMainListView)) 35 | 36 | #define GD_MAIN_LIST_VIEW_CLASS(klass) \ 37 | (G_TYPE_CHECK_CLASS_CAST ((klass), \ 38 | GD_TYPE_MAIN_LIST_VIEW, GdMainListViewClass)) 39 | 40 | #define GD_IS_MAIN_LIST_VIEW(obj) \ 41 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ 42 | GD_TYPE_MAIN_LIST_VIEW)) 43 | 44 | #define GD_IS_MAIN_LIST_VIEW_CLASS(klass) \ 45 | (G_TYPE_CHECK_CLASS_TYPE ((klass), \ 46 | GD_TYPE_MAIN_LIST_VIEW)) 47 | 48 | #define GD_MAIN_LIST_VIEW_GET_CLASS(obj) \ 49 | (G_TYPE_INSTANCE_GET_CLASS ((obj), \ 50 | GD_TYPE_MAIN_LIST_VIEW, GdMainListViewClass)) 51 | 52 | typedef struct _GdMainListView GdMainListView; 53 | typedef struct _GdMainListViewClass GdMainListViewClass; 54 | typedef struct _GdMainListViewPrivate GdMainListViewPrivate; 55 | 56 | struct _GdMainListView 57 | { 58 | GtkTreeView parent; 59 | 60 | GdMainListViewPrivate *priv; 61 | }; 62 | 63 | struct _GdMainListViewClass 64 | { 65 | GtkTreeViewClass parent_class; 66 | }; 67 | 68 | GType gd_main_list_view_get_type (void) G_GNUC_CONST; 69 | 70 | GtkWidget * gd_main_list_view_new (void); 71 | 72 | void gd_main_list_view_add_renderer (GdMainListView *self, 73 | GtkCellRenderer *renderer, 74 | GtkTreeCellDataFunc func, 75 | gpointer user_data, 76 | GDestroyNotify destroy); 77 | 78 | G_END_DECLS 79 | 80 | #endif /* __GD_MAIN_LIST_VIEW_H__ */ 81 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-main-view-generic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Cosimo Cecchi 19 | * 20 | */ 21 | 22 | #ifndef __GD_MAIN_VIEW_GENERIC_H__ 23 | #define __GD_MAIN_VIEW_GENERIC_H__ 24 | 25 | #include 26 | 27 | #include 28 | 29 | G_BEGIN_DECLS 30 | 31 | typedef enum { 32 | GD_MAIN_COLUMN_ID, 33 | GD_MAIN_COLUMN_URI, 34 | GD_MAIN_COLUMN_PRIMARY_TEXT, 35 | GD_MAIN_COLUMN_SECONDARY_TEXT, 36 | GD_MAIN_COLUMN_ICON, 37 | GD_MAIN_COLUMN_MTIME, 38 | GD_MAIN_COLUMN_SELECTED, 39 | GD_MAIN_COLUMN_PULSE, 40 | 41 | GD_MAIN_COLUMN_LAST 42 | } GdMainColumns; 43 | 44 | #define GD_TYPE_MAIN_VIEW_GENERIC gd_main_view_generic_get_type() 45 | 46 | #define GD_MAIN_VIEW_GENERIC(obj) \ 47 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ 48 | GD_TYPE_MAIN_VIEW_GENERIC, GdMainViewGeneric)) 49 | 50 | #define GD_MAIN_VIEW_GENERIC_CLASS(klass) \ 51 | (G_TYPE_CHECK_CLASS_CAST ((klass), \ 52 | GD_TYPE_MAIN_VIEW_GENERIC, GdMainViewGenericIface)) 53 | 54 | #define GD_IS_MAIN_VIEW_GENERIC(obj) \ 55 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ 56 | GD_TYPE_MAIN_VIEW_GENERIC)) 57 | 58 | #define GD_IS_MAIN_VIEW_GENERIC_CLASS(klass) \ 59 | (G_TYPE_CHECK_CLASS_TYPE ((klass), \ 60 | GD_TYPE_MAIN_VIEW_GENERIC)) 61 | 62 | #define GD_MAIN_VIEW_GENERIC_GET_IFACE(obj) \ 63 | (G_TYPE_INSTANCE_GET_INTERFACE ((obj), \ 64 | GD_TYPE_MAIN_VIEW_GENERIC, GdMainViewGenericIface)) 65 | 66 | typedef struct _GdMainViewGeneric GdMainViewGeneric; 67 | typedef struct _GdMainViewGenericIface GdMainViewGenericIface; 68 | 69 | struct _GdMainViewGenericIface 70 | { 71 | GTypeInterface base_iface; 72 | 73 | /* vtable */ 74 | void (* set_model) (GdMainViewGeneric *self, 75 | GtkTreeModel *model); 76 | GtkTreeModel * (* get_model) (GdMainViewGeneric *self); 77 | 78 | GtkTreePath * (* get_path_at_pos) (GdMainViewGeneric *self, 79 | gint x, 80 | gint y); 81 | void (* scroll_to_path) (GdMainViewGeneric *self, 82 | GtkTreePath *path); 83 | void (* set_selection_mode) (GdMainViewGeneric *self, 84 | gboolean selection_mode); 85 | }; 86 | 87 | GType gd_main_view_generic_get_type (void) G_GNUC_CONST; 88 | 89 | void gd_main_view_generic_set_model (GdMainViewGeneric *self, 90 | GtkTreeModel *model); 91 | GtkTreeModel * gd_main_view_generic_get_model (GdMainViewGeneric *self); 92 | 93 | void gd_main_view_generic_scroll_to_path (GdMainViewGeneric *self, 94 | GtkTreePath *path); 95 | void gd_main_view_generic_set_selection_mode (GdMainViewGeneric *self, 96 | gboolean selection_mode); 97 | GtkTreePath * gd_main_view_generic_get_path_at_pos (GdMainViewGeneric *self, 98 | gint x, 99 | gint y); 100 | void gd_main_view_generic_select_all (GdMainViewGeneric *self); 101 | void gd_main_view_generic_unselect_all (GdMainViewGeneric *self); 102 | void gd_main_view_generic_set_rubberband_range (GdMainViewGeneric *self, 103 | GtkTreePath *start, 104 | GtkTreePath *end); 105 | 106 | /* private */ 107 | void _gd_main_view_generic_dnd_common (GtkTreeModel *model, 108 | gboolean selection_mode, 109 | GtkTreePath *path, 110 | GtkSelectionData *data); 111 | void _gd_main_view_generic_get_rubberband_range (GdMainViewGeneric *self, 112 | GtkTreePath **start, 113 | GtkTreePath **end); 114 | 115 | G_END_DECLS 116 | 117 | #endif /* __GD_MAIN_VIEW_GENERIC_H__ */ 118 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-main-view.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Cosimo Cecchi 19 | * 20 | */ 21 | 22 | #ifndef __GD_MAIN_VIEW_H__ 23 | #define __GD_MAIN_VIEW_H__ 24 | 25 | #include 26 | 27 | #include 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GD_TYPE_MAIN_VIEW gd_main_view_get_type() 32 | G_DECLARE_DERIVABLE_TYPE (GdMainView, gd_main_view, GD, MAIN_VIEW, GtkScrolledWindow) 33 | 34 | typedef enum { 35 | GD_MAIN_VIEW_ICON, 36 | GD_MAIN_VIEW_LIST 37 | } GdMainViewType; 38 | 39 | struct _GdMainViewClass { 40 | GtkScrolledWindowClass parent_class; 41 | }; 42 | 43 | GdMainView * gd_main_view_new (GdMainViewType type); 44 | void gd_main_view_set_view_type (GdMainView *self, 45 | GdMainViewType type); 46 | GdMainViewType gd_main_view_get_view_type (GdMainView *self); 47 | 48 | void gd_main_view_set_selection_mode (GdMainView *self, 49 | gboolean selection_mode); 50 | gboolean gd_main_view_get_selection_mode (GdMainView *self); 51 | 52 | GList * gd_main_view_get_selection (GdMainView *self); 53 | 54 | void gd_main_view_select_all (GdMainView *self); 55 | void gd_main_view_unselect_all (GdMainView *self); 56 | 57 | GtkTreeModel * gd_main_view_get_model (GdMainView *self); 58 | void gd_main_view_set_model (GdMainView *self, 59 | GtkTreeModel *model); 60 | 61 | GtkWidget * gd_main_view_get_generic_view (GdMainView *self); 62 | 63 | G_END_DECLS 64 | 65 | #endif /* __GD_MAIN_VIEW_H__ */ 66 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-margin-container.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Cosimo Cecchi 19 | * 20 | */ 21 | 22 | #ifndef _GD_MARGIN_CONTAINER_H 23 | #define _GD_MARGIN_CONTAINER_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GD_TYPE_MARGIN_CONTAINER gd_margin_container_get_type() 32 | 33 | #define GD_MARGIN_CONTAINER(obj) \ 34 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ 35 | GD_TYPE_MARGIN_CONTAINER, GdMarginContainer)) 36 | 37 | #define GD_MARGIN_CONTAINER_CLASS(klass) \ 38 | (G_TYPE_CHECK_CLASS_CAST ((klass), \ 39 | GD_TYPE_MARGIN_CONTAINER, GdMarginContainerClass)) 40 | 41 | #define GD_IS_MARGIN_CONTAINER(obj) \ 42 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ 43 | GD_TYPE_MARGIN_CONTAINER)) 44 | 45 | #define GD_IS_MARGIN_CONTAINER_CLASS(klass) \ 46 | (G_TYPE_CHECK_CLASS_TYPE ((klass), \ 47 | GD_TYPE_MARGIN_CONTAINER)) 48 | 49 | #define GD_MARGIN_CONTAINER_GET_CLASS(obj) \ 50 | (G_TYPE_INSTANCE_GET_CLASS ((obj), \ 51 | GD_TYPE_MARGIN_CONTAINER, GdMarginContainerClass)) 52 | 53 | typedef struct _GdMarginContainer GdMarginContainer; 54 | typedef struct _GdMarginContainerClass GdMarginContainerClass; 55 | typedef struct _GdMarginContainerPrivate GdMarginContainerPrivate; 56 | 57 | struct _GdMarginContainer 58 | { 59 | GtkBin parent; 60 | 61 | GdMarginContainerPrivate *priv; 62 | }; 63 | 64 | struct _GdMarginContainerClass 65 | { 66 | GtkBinClass parent_class; 67 | }; 68 | 69 | GType gd_margin_container_get_type (void) G_GNUC_CONST; 70 | 71 | GdMarginContainer *gd_margin_container_new (void); 72 | 73 | G_END_DECLS 74 | 75 | #endif /* _GD_MARGIN_CONTAINER_H */ 76 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-notification.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 | /* 3 | * gd-notification 4 | * Based on gtk-notification from gnome-contacts: 5 | * http://git.gnome.org/browse/gnome-contacts/tree/src/gtk-notification.c?id=3.3.91 6 | * 7 | * Copyright (C) Erick Pérez Castellanos 2011 8 | * Copyright (C) 2012 Red Hat, Inc. 9 | * 10 | * This program is free software: you can redistribute it and/or modify it 11 | * under the terms of the GNU Lesser General Public License as published 12 | * by the Free Software Foundation, either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, but 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | * See the GNU Lesser General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Lesser General Public License 21 | * along with this program. If not, see ."; 22 | */ 23 | 24 | #ifndef _GD_NOTIFICATION_H_ 25 | #define _GD_NOTIFICATION_H_ 26 | 27 | #include 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GD_TYPE_NOTIFICATION (gd_notification_get_type ()) 32 | #define GD_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GD_TYPE_NOTIFICATION, GdNotification)) 33 | #define GD_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GD_TYPE_NOTIFICATION, GdNotificationClass)) 34 | #define GTK_IS_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GD_TYPE_NOTIFICATION)) 35 | #define GTK_IS_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GD_TYPE_NOTIFICATION)) 36 | #define GD_NOTIFICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GD_TYPE_NOTIFICATION, GdNotificationClass)) 37 | 38 | typedef struct _GdNotificationPrivate GdNotificationPrivate; 39 | typedef struct _GdNotificationClass GdNotificationClass; 40 | typedef struct _GdNotification GdNotification; 41 | 42 | struct _GdNotificationClass { 43 | GtkBinClass parent_class; 44 | 45 | /* Signals */ 46 | void (*dismissed) (GdNotification *self); 47 | }; 48 | 49 | struct _GdNotification { 50 | GtkBin parent_instance; 51 | 52 | /*< private > */ 53 | GdNotificationPrivate *priv; 54 | }; 55 | 56 | GType gd_notification_get_type (void) G_GNUC_CONST; 57 | 58 | GtkWidget *gd_notification_new (void); 59 | void gd_notification_set_timeout (GdNotification *notification, 60 | gint timeout_sec); 61 | void gd_notification_dismiss (GdNotification *notification); 62 | void gd_notification_set_show_close_button (GdNotification *notification, 63 | gboolean show_close_button); 64 | 65 | G_END_DECLS 66 | 67 | #endif /* _GD_NOTIFICATION_H_ */ 68 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-styled-text-renderer.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Cosimo Cecchi 19 | * 20 | */ 21 | 22 | #include "gd-styled-text-renderer.h" 23 | 24 | G_DEFINE_TYPE (GdStyledTextRenderer, gd_styled_text_renderer, GTK_TYPE_CELL_RENDERER_TEXT); 25 | 26 | struct _GdStyledTextRendererPrivate { 27 | GList *style_classes; 28 | }; 29 | 30 | static void 31 | gd_styled_text_renderer_render (GtkCellRenderer *cell, 32 | cairo_t *cr, 33 | GtkWidget *widget, 34 | const GdkRectangle *background_area, 35 | const GdkRectangle *cell_area, 36 | GtkCellRendererState flags) 37 | { 38 | GdStyledTextRenderer *self = GD_STYLED_TEXT_RENDERER (cell); 39 | GtkStyleContext *context; 40 | const gchar *style_class; 41 | GList *l; 42 | 43 | context = gtk_widget_get_style_context (widget); 44 | gtk_style_context_save (context); 45 | 46 | for (l = self->priv->style_classes; l != NULL; l = l->next) 47 | { 48 | style_class = l->data; 49 | gtk_style_context_add_class (context, style_class); 50 | } 51 | 52 | GTK_CELL_RENDERER_CLASS (gd_styled_text_renderer_parent_class)->render 53 | (cell, cr, widget, 54 | background_area, cell_area, flags); 55 | 56 | gtk_style_context_restore (context); 57 | } 58 | 59 | static void 60 | gd_styled_text_renderer_finalize (GObject *obj) 61 | { 62 | GdStyledTextRenderer *self = GD_STYLED_TEXT_RENDERER (obj); 63 | 64 | if (self->priv->style_classes != NULL) 65 | { 66 | g_list_free_full (self->priv->style_classes, g_free); 67 | self->priv->style_classes = NULL; 68 | } 69 | 70 | G_OBJECT_CLASS (gd_styled_text_renderer_parent_class)->finalize (obj); 71 | } 72 | 73 | static void 74 | gd_styled_text_renderer_class_init (GdStyledTextRendererClass *klass) 75 | { 76 | GtkCellRendererClass *crclass = GTK_CELL_RENDERER_CLASS (klass); 77 | GObjectClass *oclass = G_OBJECT_CLASS (klass); 78 | 79 | oclass->finalize = gd_styled_text_renderer_finalize; 80 | crclass->render = gd_styled_text_renderer_render; 81 | 82 | g_type_class_add_private (klass, sizeof (GdStyledTextRendererPrivate)); 83 | } 84 | 85 | static void 86 | gd_styled_text_renderer_init (GdStyledTextRenderer *self) 87 | { 88 | self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GD_TYPE_STYLED_TEXT_RENDERER, 89 | GdStyledTextRendererPrivate); 90 | } 91 | 92 | GtkCellRenderer * 93 | gd_styled_text_renderer_new (void) 94 | { 95 | return g_object_new (GD_TYPE_STYLED_TEXT_RENDERER, 96 | NULL); 97 | } 98 | 99 | void 100 | gd_styled_text_renderer_add_class (GdStyledTextRenderer *self, 101 | const gchar *class) 102 | { 103 | if (g_list_find_custom (self->priv->style_classes, class, (GCompareFunc) g_strcmp0)) 104 | return; 105 | 106 | self->priv->style_classes = g_list_append (self->priv->style_classes, g_strdup (class)); 107 | } 108 | 109 | void 110 | gd_styled_text_renderer_remove_class (GdStyledTextRenderer *self, 111 | const gchar *class) 112 | { 113 | GList *class_element; 114 | 115 | class_element = g_list_find_custom (self->priv->style_classes, class, (GCompareFunc) g_strcmp0); 116 | 117 | if (class_element == NULL) 118 | return; 119 | 120 | self->priv->style_classes = g_list_remove_link (self->priv->style_classes, 121 | class_element); 122 | g_free (class_element->data); 123 | g_list_free_1 (class_element); 124 | } 125 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-styled-text-renderer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Cosimo Cecchi 19 | * 20 | */ 21 | 22 | #ifndef _GD_STYLED_TEXT_RENDERER_H 23 | #define _GD_STYLED_TEXT_RENDERER_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GD_TYPE_STYLED_TEXT_RENDERER gd_styled_text_renderer_get_type() 32 | 33 | #define GD_STYLED_TEXT_RENDERER(obj) \ 34 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ 35 | GD_TYPE_STYLED_TEXT_RENDERER, GdStyledTextRenderer)) 36 | 37 | #define GD_STYLED_TEXT_RENDERER_CLASS(klass) \ 38 | (G_TYPE_CHECK_CLASS_CAST ((klass), \ 39 | GD_TYPE_STYLED_TEXT_RENDERER, GdStyledTextRendererClass)) 40 | 41 | #define GD_IS_STYLED_TEXT_RENDERER(obj) \ 42 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ 43 | GD_TYPE_STYLED_TEXT_RENDERER)) 44 | 45 | #define GD_IS_STYLED_TEXT_RENDERER_CLASS(klass) \ 46 | (G_TYPE_CHECK_CLASS_TYPE ((klass), \ 47 | GD_TYPE_STYLED_TEXT_RENDERER)) 48 | 49 | #define GD_STYLED_TEXT_RENDERER_GET_CLASS(obj) \ 50 | (G_TYPE_INSTANCE_GET_CLASS ((obj), \ 51 | GD_TYPE_STYLED_TEXT_RENDERER, GdStyledTextRendererClass)) 52 | 53 | typedef struct _GdStyledTextRenderer GdStyledTextRenderer; 54 | typedef struct _GdStyledTextRendererClass GdStyledTextRendererClass; 55 | typedef struct _GdStyledTextRendererPrivate GdStyledTextRendererPrivate; 56 | 57 | struct _GdStyledTextRenderer 58 | { 59 | GtkCellRendererText parent; 60 | 61 | GdStyledTextRendererPrivate *priv; 62 | }; 63 | 64 | struct _GdStyledTextRendererClass 65 | { 66 | GtkCellRendererTextClass parent_class; 67 | }; 68 | 69 | GType gd_styled_text_renderer_get_type (void) G_GNUC_CONST; 70 | 71 | GtkCellRenderer *gd_styled_text_renderer_new (void); 72 | void gd_styled_text_renderer_add_class (GdStyledTextRenderer *self, 73 | const gchar *class); 74 | void gd_styled_text_renderer_remove_class (GdStyledTextRenderer *self, 75 | const gchar *class); 76 | 77 | G_END_DECLS 78 | 79 | #endif /* _GD_STYLED_TEXT_RENDERER_H */ 80 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-tagged-entry-default.css: -------------------------------------------------------------------------------- 1 | @define-color entry_tag_bg #3465a4; 2 | @define-color entry_tag_fg #ffffff; 3 | 4 | .documents-entry-tag { 5 | background-image: none; 6 | background-color: @entry_tag_bg; 7 | color: @entry_tag_fg; 8 | 9 | border-radius: 4px; 10 | border-width: 0; 11 | 12 | margin: 2px; 13 | padding: 4px; 14 | } 15 | 16 | .documents-entry-tag:hover { 17 | background-color: shade(@entry_tag_bg, 1.10); 18 | color: @entry_tag_fg; 19 | } 20 | 21 | .documents-entry-tag.button, 22 | .documents-entry-tag.button:hover, 23 | .documents-entry-tag.button:active, 24 | .documents-entry-tag.button:active:hover { 25 | background-color: transparent; 26 | background-image: none; 27 | box-shadow: none; 28 | border-image: none; 29 | border-width: 0; 30 | } 31 | 32 | .documents-entry-tag.button:hover { 33 | color: shade(@entry_tag_bg, 2.10); 34 | } 35 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-tagged-entry.gresource.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | gd-tagged-entry-default.css 5 | 6 | 7 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-tagged-entry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Red Hat, Inc. 3 | * Copyright (c) 2013 Ignacio Casal Quinteiro 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU Lesser General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or (at your 8 | * option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 13 | * License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program; if not, write to the Free Software Foundation, 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | * 19 | * Author: Cosimo Cecchi 20 | * 21 | */ 22 | 23 | #ifndef __GD_TAGGED_ENTRY_H__ 24 | #define __GD_TAGGED_ENTRY_H__ 25 | 26 | #include 27 | 28 | #include 29 | 30 | G_BEGIN_DECLS 31 | 32 | #define GD_TYPE_TAGGED_ENTRY gd_tagged_entry_get_type() 33 | #define GD_TAGGED_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GD_TYPE_TAGGED_ENTRY, GdTaggedEntry)) 34 | #define GD_TAGGED_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GD_TYPE_TAGGED_ENTRY, GdTaggedEntryClass)) 35 | #define GD_IS_TAGGED_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GD_TYPE_TAGGED_ENTRY)) 36 | #define GD_IS_TAGGED_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GD_TYPE_TAGGED_ENTRY)) 37 | #define GD_TAGGED_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GD_TYPE_TAGGED_ENTRY, GdTaggedEntryClass)) 38 | 39 | typedef struct _GdTaggedEntry GdTaggedEntry; 40 | typedef struct _GdTaggedEntryClass GdTaggedEntryClass; 41 | typedef struct _GdTaggedEntryPrivate GdTaggedEntryPrivate; 42 | 43 | typedef struct _GdTaggedEntryTag GdTaggedEntryTag; 44 | typedef struct _GdTaggedEntryTagClass GdTaggedEntryTagClass; 45 | typedef struct _GdTaggedEntryTagPrivate GdTaggedEntryTagPrivate; 46 | 47 | struct _GdTaggedEntry 48 | { 49 | GtkSearchEntry parent; 50 | 51 | GdTaggedEntryPrivate *priv; 52 | }; 53 | 54 | struct _GdTaggedEntryClass 55 | { 56 | GtkSearchEntryClass parent_class; 57 | }; 58 | 59 | #define GD_TYPE_TAGGED_ENTRY_TAG gd_tagged_entry_tag_get_type() 60 | #define GD_TAGGED_ENTRY_TAG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GD_TYPE_TAGGED_ENTRY_TAG, GdTaggedEntryTag)) 61 | #define GD_TAGGED_ENTRY_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GD_TYPE_TAGGED_ENTRY_TAG, GdTaggedEntryTagClass)) 62 | #define GD_IS_TAGGED_ENTRY_TAG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GD_TYPE_TAGGED_ENTRY_TAG)) 63 | #define GD_IS_TAGGED_ENTRY_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GD_TYPE_TAGGED_ENTRY_TAG)) 64 | #define GD_TAGGED_ENTRY_TAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GD_TYPE_TAGGED_ENTRY_TAG, GdTaggedEntryTagClass)) 65 | 66 | struct _GdTaggedEntryTag 67 | { 68 | GObject parent; 69 | 70 | GdTaggedEntryTagPrivate *priv; 71 | }; 72 | 73 | struct _GdTaggedEntryTagClass 74 | { 75 | GObjectClass parent_class; 76 | }; 77 | 78 | GType gd_tagged_entry_get_type (void) G_GNUC_CONST; 79 | 80 | GdTaggedEntry *gd_tagged_entry_new (void); 81 | 82 | void gd_tagged_entry_set_tag_button_visible (GdTaggedEntry *self, 83 | gboolean visible); 84 | gboolean gd_tagged_entry_get_tag_button_visible (GdTaggedEntry *self); 85 | 86 | gboolean gd_tagged_entry_insert_tag (GdTaggedEntry *self, 87 | GdTaggedEntryTag *tag, 88 | gint position); 89 | 90 | gboolean gd_tagged_entry_add_tag (GdTaggedEntry *self, 91 | GdTaggedEntryTag *tag); 92 | 93 | gboolean gd_tagged_entry_remove_tag (GdTaggedEntry *self, 94 | GdTaggedEntryTag *tag); 95 | 96 | GType gd_tagged_entry_tag_get_type (void) G_GNUC_CONST; 97 | 98 | GdTaggedEntryTag *gd_tagged_entry_tag_new (const gchar *label); 99 | 100 | void gd_tagged_entry_tag_set_label (GdTaggedEntryTag *tag, 101 | const gchar *label); 102 | const gchar *gd_tagged_entry_tag_get_label (GdTaggedEntryTag *tag); 103 | 104 | void gd_tagged_entry_tag_set_has_close_button (GdTaggedEntryTag *tag, 105 | gboolean has_close_button); 106 | gboolean gd_tagged_entry_tag_get_has_close_button (GdTaggedEntryTag *tag); 107 | 108 | void gd_tagged_entry_tag_set_style (GdTaggedEntryTag *tag, 109 | const gchar *style); 110 | const gchar *gd_tagged_entry_tag_get_style (GdTaggedEntryTag *tag); 111 | 112 | gboolean gd_tagged_entry_tag_get_area (GdTaggedEntryTag *tag, 113 | cairo_rectangle_int_t *rect); 114 | 115 | G_END_DECLS 116 | 117 | #endif /* __GD_TAGGED_ENTRY_H__ */ 118 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-toggle-pixbuf-renderer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Cosimo Cecchi 19 | * 20 | */ 21 | 22 | #ifndef _GD_TOGGLE_PIXBUF_RENDERER_H 23 | #define _GD_TOGGLE_PIXBUF_RENDERER_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GD_TYPE_TOGGLE_PIXBUF_RENDERER gd_toggle_pixbuf_renderer_get_type() 32 | 33 | #define GD_TOGGLE_PIXBUF_RENDERER(obj) \ 34 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ 35 | GD_TYPE_TOGGLE_PIXBUF_RENDERER, GdTogglePixbufRenderer)) 36 | 37 | #define GD_TOGGLE_PIXBUF_RENDERER_CLASS(klass) \ 38 | (G_TYPE_CHECK_CLASS_CAST ((klass), \ 39 | GD_TYPE_TOGGLE_PIXBUF_RENDERER, GdTogglePixbufRendererClass)) 40 | 41 | #define GD_IS_TOGGLE_PIXBUF_RENDERER(obj) \ 42 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ 43 | GD_TYPE_TOGGLE_PIXBUF_RENDERER)) 44 | 45 | #define GD_IS_TOGGLE_PIXBUF_RENDERER_CLASS(klass) \ 46 | (G_TYPE_CHECK_CLASS_TYPE ((klass), \ 47 | GD_TYPE_TOGGLE_PIXBUF_RENDERER)) 48 | 49 | #define GD_TOGGLE_PIXBUF_RENDERER_GET_CLASS(obj) \ 50 | (G_TYPE_INSTANCE_GET_CLASS ((obj), \ 51 | GD_TYPE_TOGGLE_PIXBUF_RENDERER, GdTogglePixbufRendererClass)) 52 | 53 | typedef struct _GdTogglePixbufRenderer GdTogglePixbufRenderer; 54 | typedef struct _GdTogglePixbufRendererClass GdTogglePixbufRendererClass; 55 | typedef struct _GdTogglePixbufRendererPrivate GdTogglePixbufRendererPrivate; 56 | 57 | struct _GdTogglePixbufRenderer 58 | { 59 | GtkCellRendererPixbuf parent; 60 | 61 | GdTogglePixbufRendererPrivate *priv; 62 | }; 63 | 64 | struct _GdTogglePixbufRendererClass 65 | { 66 | GtkCellRendererPixbufClass parent_class; 67 | }; 68 | 69 | GType gd_toggle_pixbuf_renderer_get_type (void) G_GNUC_CONST; 70 | 71 | GtkCellRenderer *gd_toggle_pixbuf_renderer_new (void); 72 | 73 | G_END_DECLS 74 | 75 | #endif /* _GD_TOGGLE_PIXBUF_RENDERER_H */ 76 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-two-lines-renderer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | * Author: Cosimo Cecchi 19 | * 20 | */ 21 | 22 | #ifndef _GD_TWO_LINES_RENDERER_H 23 | #define _GD_TWO_LINES_RENDERER_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define GD_TYPE_TWO_LINES_RENDERER gd_two_lines_renderer_get_type() 32 | 33 | #define GD_TWO_LINES_RENDERER(obj) \ 34 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ 35 | GD_TYPE_TWO_LINES_RENDERER, GdTwoLinesRenderer)) 36 | 37 | #define GD_TWO_LINES_RENDERER_CLASS(klass) \ 38 | (G_TYPE_CHECK_CLASS_CAST ((klass), \ 39 | GD_TYPE_TWO_LINES_RENDERER, GdTwoLinesRendererClass)) 40 | 41 | #define GD_IS_TWO_LINES_RENDERER(obj) \ 42 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ 43 | GD_TYPE_TWO_LINES_RENDERER)) 44 | 45 | #define GD_IS_TWO_LINES_RENDERER_CLASS(klass) \ 46 | (G_TYPE_CHECK_CLASS_TYPE ((klass), \ 47 | GD_TYPE_TWO_LINES_RENDERER)) 48 | 49 | #define GD_TWO_LINES_RENDERER_GET_CLASS(obj) \ 50 | (G_TYPE_INSTANCE_GET_CLASS ((obj), \ 51 | GD_TYPE_TWO_LINES_RENDERER, GdTwoLinesRendererClass)) 52 | 53 | typedef struct _GdTwoLinesRenderer GdTwoLinesRenderer; 54 | typedef struct _GdTwoLinesRendererClass GdTwoLinesRendererClass; 55 | typedef struct _GdTwoLinesRendererPrivate GdTwoLinesRendererPrivate; 56 | 57 | struct _GdTwoLinesRenderer 58 | { 59 | GtkCellRendererText parent; 60 | 61 | GdTwoLinesRendererPrivate *priv; 62 | }; 63 | 64 | struct _GdTwoLinesRendererClass 65 | { 66 | GtkCellRendererTextClass parent_class; 67 | }; 68 | 69 | GType gd_two_lines_renderer_get_type (void) G_GNUC_CONST; 70 | 71 | GtkCellRenderer *gd_two_lines_renderer_new (void); 72 | 73 | G_END_DECLS 74 | 75 | #endif /* _GD_TWO_LINES_RENDERER_H */ 76 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-types-catalog.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | */ 19 | 20 | #ifdef HAVE_CONFIG_H 21 | # include 22 | #endif 23 | 24 | #include "gd-types-catalog.h" 25 | 26 | #ifdef LIBGD__BOX_COMMON 27 | # include "gd-main-box-child.h" 28 | # include "gd-main-box-generic.h" 29 | # include "gd-main-box-item.h" 30 | #endif 31 | 32 | #ifdef LIBGD_MAIN_ICON_BOX 33 | # include "gd-main-icon-box.h" 34 | # include "gd-main-icon-box-child.h" 35 | #endif 36 | 37 | #ifdef LIBGD_MAIN_BOX 38 | # include "gd-main-box.h" 39 | #endif 40 | 41 | #ifdef LIBGD__VIEW_COMMON 42 | # include "gd-main-view-generic.h" 43 | # include "gd-styled-text-renderer.h" 44 | # include "gd-two-lines-renderer.h" 45 | #endif 46 | 47 | #ifdef LIBGD_MAIN_ICON_VIEW 48 | # include "gd-main-icon-view.h" 49 | # include "gd-toggle-pixbuf-renderer.h" 50 | #endif 51 | 52 | #ifdef LIBGD_MAIN_LIST_VIEW 53 | # include "gd-main-list-view.h" 54 | #endif 55 | 56 | #ifdef LIBGD_MAIN_VIEW 57 | # include "gd-main-view.h" 58 | #endif 59 | 60 | #ifdef LIBGD_MARGIN_CONTAINER 61 | # include "gd-margin-container.h" 62 | #endif 63 | 64 | #ifdef LIBGD_TAGGED_ENTRY 65 | # include "gd-tagged-entry.h" 66 | #endif 67 | 68 | #ifdef LIBGD_NOTIFICATION 69 | # include "gd-notification.h" 70 | #endif 71 | 72 | /** 73 | * gd_ensure_types: 74 | * 75 | * This functions must be called during initialization 76 | * to make sure the widget types are available to GtkBuilder. 77 | */ 78 | void 79 | gd_ensure_types (void) 80 | { 81 | #ifdef LIBGD__BOX_COMMON 82 | g_type_ensure (GD_TYPE_MAIN_BOX_CHILD); 83 | g_type_ensure (GD_TYPE_MAIN_BOX_GENERIC); 84 | g_type_ensure (GD_TYPE_MAIN_BOX_ITEM); 85 | #endif 86 | 87 | #ifdef LIBGD_MAIN_ICON_BOX 88 | g_type_ensure (GD_TYPE_MAIN_ICON_BOX); 89 | g_type_ensure (GD_TYPE_MAIN_ICON_BOX_CHILD); 90 | #endif 91 | 92 | #ifdef LIBGD_MAIN_BOX 93 | g_type_ensure (GD_TYPE_MAIN_BOX); 94 | #endif 95 | 96 | #ifdef LIBGD__VIEW_COMMON 97 | g_type_ensure (GD_TYPE_MAIN_VIEW_GENERIC); 98 | g_type_ensure (GD_TYPE_STYLED_TEXT_RENDERER); 99 | g_type_ensure (GD_TYPE_TWO_LINES_RENDERER); 100 | #endif 101 | 102 | #ifdef LIBGD_MAIN_ICON_VIEW 103 | g_type_ensure (GD_TYPE_MAIN_ICON_VIEW); 104 | g_type_ensure (GD_TYPE_TOGGLE_PIXBUF_RENDERER); 105 | #endif 106 | 107 | #ifdef LIBGD_MAIN_LIST_VIEW 108 | g_type_ensure (GD_TYPE_MAIN_LIST_VIEW); 109 | #endif 110 | 111 | #ifdef LIBGD_MAIN_VIEW 112 | g_type_ensure (GD_TYPE_MAIN_VIEW); 113 | #endif 114 | 115 | #ifdef LIBGD_MARGIN_CONTAINER 116 | g_type_ensure (GD_TYPE_MARGIN_CONTAINER); 117 | #endif 118 | 119 | #ifdef LIBGD_TAGGED_ENTRY 120 | g_type_ensure (GD_TYPE_TAGGED_ENTRY); 121 | #endif 122 | 123 | #ifdef LIBGD_NOTIFICATION 124 | g_type_ensure (GD_TYPE_NOTIFICATION); 125 | #endif 126 | } 127 | 128 | -------------------------------------------------------------------------------- /external/gd/libgd/gd-types-catalog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Red Hat, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or (at your 7 | * option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 | * License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | * 18 | */ 19 | 20 | #ifndef __GD_TYPES_CATALOG_H__ 21 | #define __GD_TYPES_CATALOG_H__ 22 | 23 | #include 24 | 25 | G_BEGIN_DECLS 26 | 27 | void gd_ensure_types (void); 28 | 29 | G_END_DECLS 30 | 31 | #endif /* __GD_TYPES_CATALOG_H__ */ 32 | -------------------------------------------------------------------------------- /external/gd/libgd/gd.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | # include 4 | # include 5 | 6 | # include 7 | # include 8 | # include 9 | 10 | # include 11 | # include 12 | 13 | # include 14 | 15 | # include 16 | # include 17 | # include 18 | 19 | # include 20 | # include 21 | 22 | # include 23 | 24 | # include 25 | 26 | # include 27 | 28 | # include 29 | 30 | # include 31 | 32 | -------------------------------------------------------------------------------- /external/gd/libgd/meson.build: -------------------------------------------------------------------------------- 1 | gdres = gnome_module.compile_resources('gd-tagged-entry-resources', 'gd-tagged-entry.gresource.xml') 2 | -------------------------------------------------------------------------------- /external/gd/meson.build: -------------------------------------------------------------------------------- 1 | gnome_module = import('gnome') 2 | 3 | subdir('libgd') 4 | 5 | sources = [ 6 | 'libgd/gd.h', 7 | 'libgd/gd-types-catalog.h', 8 | 'libgd/gd-types-catalog.c', 9 | 'libgd/gd-entry-focus-hack.c', 10 | 'libgd/gd-entry-focus-hack.h', 11 | 'libgd/gd-icon-utils.c', 12 | 'libgd/gd-icon-utils.h', 13 | 'libgd/gd-main-box.c', 14 | 'libgd/gd-main-box-child.c', 15 | 'libgd/gd-main-box-child.h', 16 | 'libgd/gd-main-box-generic.c', 17 | 'libgd/gd-main-box-generic.h', 18 | 'libgd/gd-main-box.h', 19 | 'libgd/gd-main-box-item.c', 20 | 'libgd/gd-main-box-item.h', 21 | 'libgd/gd-main-icon-box.c', 22 | 'libgd/gd-main-icon-box-child.c', 23 | 'libgd/gd-main-icon-box-child.h', 24 | 'libgd/gd-main-icon-box.h', 25 | 'libgd/gd-main-icon-box-icon.c', 26 | 'libgd/gd-main-icon-box-icon.h', 27 | 'libgd/gd-notification.c', 28 | 'libgd/gd-notification.h', 29 | gdres, 30 | 'libgd/gd-tagged-entry.c', 31 | 'libgd/gd-tagged-entry.h' 32 | ] 33 | 34 | 35 | gd_lib = static_library( 'libgd', sources, dependencies : [glib, gobject, gio, gtk, libm], include_directories : include_directories('.'), install : false) 36 | 37 | gd = declare_dependency(link_with : gd_lib, include_directories : include_directories('.')) 38 | -------------------------------------------------------------------------------- /external/meson.build: -------------------------------------------------------------------------------- 1 | subdir('gd') 2 | -------------------------------------------------------------------------------- /gradio.doap: -------------------------------------------------------------------------------- 1 | 6 | 7 | Gradio 8 | Application for finding and listening to internet radio stations 9 | Application for finding and listening to internet radio stations 10 | 11 | 12 | 13 | 14 | Vala 15 | 16 | 17 | 18 | Felix Häcker 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | project('gradio', ['vala', 'C'], version : '7.3') 2 | 3 | i18n = import('i18n') 4 | 5 | cc = meson.get_compiler('c') 6 | libm = cc.find_library('m', required: false) 7 | glib = dependency('glib-2.0') 8 | gobject = dependency('gobject-2.0') 9 | gio = dependency('gio-2.0') 10 | gtk = dependency('gtk+-3.0', version : '>=3.20') 11 | libsoup = dependency('libsoup-2.4') 12 | json_glib = dependency('json-glib-1.0') 13 | gstreamer = dependency('gstreamer-1.0') 14 | gstreamer_pbutils = dependency('gstreamer-pbutils-1.0') 15 | sqlite3 = dependency('sqlite3') 16 | 17 | subdir('data') 18 | subdir('po') 19 | subdir('external') 20 | subdir('src') 21 | 22 | meson.add_install_script('meson_post_install.sh') 23 | -------------------------------------------------------------------------------- /meson_post_install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from os import environ, path 4 | from subprocess import call 5 | 6 | prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local') 7 | datadir = path.join(prefix, 'share') 8 | destdir = environ.get('DESTDIR', '') 9 | 10 | # Package managers set this so we don't need to run 11 | if not destdir: 12 | print('Updating icon cache...') 13 | call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')]) 14 | 15 | print('Updating desktop database...') 16 | call(['update-desktop-database', '-q', path.join(datadir, 'applications')]) 17 | 18 | print('Compiling GSettings schemas...') 19 | call(['glib-compile-schemas', path.join(datadir, 'glib-2.0', 'schemas')]) 20 | 21 | 22 | -------------------------------------------------------------------------------- /po/.gitignore: -------------------------------------------------------------------------------- 1 | _*.pot 2 | *.gmo 3 | *.po~ 4 | stamp-it 5 | Makefile.in.in 6 | .intltool-merge-cache 7 | POTFILES 8 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- 1 | cs 2 | de 3 | es 4 | fr 5 | hr 6 | it 7 | ka 8 | nb 9 | nl 10 | pl 11 | pt_BR 12 | sk 13 | sr 14 | sr@latin 15 | sv 16 | tr 17 | -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | # List of source files containing translatable strings. 2 | data/ui/page/library-page.ui 3 | data/ui/page/collections-page.ui 4 | data/ui/details-box.ui 5 | data/ui/organize-collection-popover.ui 6 | data/ui/selection-menu.ui 7 | data/ui/selection-toolbar.ui 8 | data/ui/station-editor.ui 9 | data/ui/page/search-page.ui 10 | data/ui/menubutton.ui 11 | src/page/gradio-collection-items-page.vala 12 | src/page/gradio-library-page.vala 13 | src/page/gradio-search-page.vala 14 | src/page/gradio-settings-page.vala 15 | src/page/gradio-settings-page.vala 16 | src/gradio-headerbar.vala 17 | src/gradio-searchbar.vala 18 | src/gradio-library.vala 19 | src/gradio-station-editor-dialog.vala 20 | src/gradio-selection-toolbar.vala 21 | -------------------------------------------------------------------------------- /po/README.md: -------------------------------------------------------------------------------- 1 | ## Update .po files 2 | *Example:* msgmerge de.po gradio.pot --update 3 | 4 | -------------------------------------------------------------------------------- /po/meson.build: -------------------------------------------------------------------------------- 1 | i18n.gettext('gradio', preset: 'glib') 2 | -------------------------------------------------------------------------------- /po/update-po.sh: -------------------------------------------------------------------------------- 1 | find . -type f -iname "*.po" -exec bash -c 'msgmerge --update "{}" gradio.pot' \; 2 | -------------------------------------------------------------------------------- /src/gradio-audio-player.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gst; 18 | 19 | namespace Gradio{ 20 | public class AudioPlayer : GLib.Object { 21 | 22 | public uint current_bitrate_tag { get; set;} 23 | public string current_title_tag { get; set;} 24 | public RadioStation station { get; set;} 25 | public string status_message { get; set;} 26 | 27 | private const int reconnect_delay = 10000; 28 | private uint delayed_changed_id; 29 | 30 | public double volume { 31 | get{return playbin.volume;} 32 | set{playbin.volume = value;} 33 | } 34 | 35 | public Gst.State state{ 36 | get{return playbin.current_state; } 37 | set{playbin.set_state(value);} 38 | } 39 | 40 | private dynamic Element playbin; 41 | private CodecInstaller codec; 42 | 43 | public AudioPlayer(){ 44 | Gst.PbUtils.init(); 45 | 46 | playbin = ElementFactory.make ("playbin", "playbin"); 47 | codec = new CodecInstaller(); 48 | volume = App.settings.volume_position; 49 | 50 | if(App.settings.previous_station != 0 && App.settings.resume_playback_on_startup){ 51 | Util.get_station_by_id.begin(App.settings.previous_station, (obj, res) => { 52 | station = Util.get_station_by_id.end(res); 53 | }); 54 | } 55 | 56 | notify["state"].connect(() => { 57 | switch(state){ 58 | case Gst.State.PLAYING: status_message = "Connected to radio station."; break; 59 | default: current_bitrate_tag = 0; current_title_tag = ""; status_message = "Not connected.";break; 60 | } 61 | }); 62 | 63 | notify["station"].connect(new_station); 64 | } 65 | 66 | private async void new_station(){ 67 | // reset tag data 68 | current_bitrate_tag = 0; 69 | current_title_tag = ""; 70 | 71 | state = Gst.State.NULL; 72 | 73 | App.settings.previous_station = int.parse(station.id); 74 | string address = yield station.get_stream_address(); 75 | 76 | if(station.is_broken){ 77 | status_message = "This station is broken."; 78 | address = ""; 79 | playbin.uri = address; 80 | return; 81 | } 82 | 83 | message("Connecting to: %s", address); 84 | 85 | playbin.uri = address; 86 | Gst.Bus bus = playbin.get_bus (); 87 | bus.add_watch (1, bus_callback); 88 | 89 | state = Gst.State.PLAYING; 90 | } 91 | 92 | private bool bus_callback (Gst.Bus bus, Gst.Message m) { 93 | switch (m.type) { 94 | case Gst.MessageType.ELEMENT: 95 | // TODO: Improve the handling of missing codecs. 96 | if(Gst.PbUtils.is_missing_plugin_message(m)) { 97 | state = Gst.State.NULL; 98 | status_message = "A required codec is missing."; 99 | codec.install_missing_codec(m); 100 | } 101 | 102 | break; 103 | case MessageType.ERROR: 104 | GLib.Error err; string debug; 105 | m.parse_error (out err, out debug); 106 | 107 | message(err.message); 108 | message(debug); 109 | 110 | state = Gst.State.NULL; 111 | status_message = err.message; 112 | reset_reconnect_timeout(); 113 | break; 114 | case MessageType.EOS: 115 | state = Gst.State.NULL; 116 | status_message = "End of stream"; 117 | reset_reconnect_timeout(); 118 | break; 119 | case MessageType.STATE_CHANGED: notify_property("state"); break; 120 | case MessageType.TAG: 121 | Gst.TagList tag_list = null; 122 | m.parse_tag(out tag_list); 123 | 124 | string current_title; 125 | uint current_bitrate; 126 | 127 | string test; 128 | 129 | tag_list.get_string("title", out current_title); 130 | current_title_tag = current_title; 131 | 132 | tag_list.get_uint("bitrate", out current_bitrate); 133 | current_bitrate_tag = current_bitrate/1000; 134 | 135 | tag_list.get_string("genre", out test); 136 | 137 | break; 138 | default: 139 | break; 140 | } 141 | return true; 142 | } 143 | 144 | public void toggle_play_stop(){ 145 | if(playbin.current_state == Gst.State.NULL) 146 | state = State.PLAYING; 147 | else 148 | state = State.NULL; 149 | } 150 | 151 | private void reset_reconnect_timeout(){ 152 | if(delayed_changed_id > 0) 153 | Source.remove(delayed_changed_id); 154 | delayed_changed_id = Timeout.add(reconnect_delay, reconnect); 155 | } 156 | 157 | private bool reconnect(){ 158 | new_station.begin(); 159 | 160 | delayed_changed_id = 0; 161 | return false; 162 | } 163 | 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /src/gradio-category-items.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | namespace Gradio{ 18 | 19 | public class CategoryItems{ 20 | public Gtk.ListStore languages_model; 21 | public Gtk.ListStore countries_model; 22 | public Gtk.ListStore states_model; 23 | public Gtk.ListStore tags_model; 24 | 25 | public CategoryItems(){ 26 | languages_model = new Gtk.ListStore(2, typeof(string), typeof(int)); 27 | countries_model = new Gtk.ListStore(2, typeof(string), typeof(int)); 28 | states_model = new Gtk.ListStore(2, typeof(string), typeof(int)); 29 | tags_model = new Gtk.ListStore(2, typeof(string), typeof(int)); 30 | load_lists.begin(); 31 | } 32 | 33 | private async void load_lists (){ 34 | Json.Parser parser = new Json.Parser (); 35 | Json.Node root = null; 36 | Json.Array items; 37 | string data = ""; 38 | int max_items = 0; 39 | 40 | try{ 41 | // Languages 42 | data = yield Util.get_string_from_uri(RadioBrowser.radio_station_languages); 43 | parser.load_from_data (data); 44 | root = parser.get_root (); 45 | items = root.get_array (); 46 | max_items = (int)items.get_length(); 47 | Gtk.TreeIter language_iter; 48 | for(int a = 0; a < max_items; a++){ 49 | var item = items.get_element(a); 50 | var item_data = item.get_object (); 51 | languages_model.append(out language_iter); 52 | languages_model.set(language_iter, 0, item_data.get_string_member("value"), 1, item_data.get_int_member("stationcount")); 53 | } 54 | 55 | // Countries 56 | data = yield Util.get_string_from_uri(RadioBrowser.radio_station_countries); 57 | parser.load_from_data (data); 58 | root = parser.get_root (); 59 | items = root.get_array (); 60 | max_items = (int)items.get_length(); 61 | Gtk.TreeIter country_iter; 62 | for(int a = 0; a < max_items; a++){ 63 | var item = items.get_element(a); 64 | var item_data = item.get_object (); 65 | countries_model.append(out country_iter); 66 | countries_model.set(country_iter, 0, item_data.get_string_member("value"), 1, item_data.get_int_member("stationcount")); 67 | } 68 | 69 | // States 70 | data = yield Util.get_string_from_uri(RadioBrowser.radio_station_states); 71 | parser.load_from_data (data); 72 | root = parser.get_root (); 73 | items = root.get_array (); 74 | max_items = (int)items.get_length(); 75 | Gtk.TreeIter state_iter; 76 | for(int a = 0; a < max_items; a++){ 77 | var item = items.get_element(a); 78 | var item_data = item.get_object (); 79 | states_model.append(out state_iter); 80 | states_model.set(state_iter, 0, item_data.get_string_member("value"), 1, item_data.get_int_member("stationcount")); 81 | } 82 | 83 | // Tags 84 | data = yield Util.get_string_from_uri(RadioBrowser.radio_station_tags); 85 | parser.load_from_data (data); 86 | root = parser.get_root (); 87 | items = root.get_array (); 88 | max_items = (int)items.get_length(); 89 | Gtk.TreeIter tag_iter; 90 | for(int a = 0; a < max_items; a++){ 91 | var item = items.get_element(a); 92 | var item_data = item.get_object (); 93 | tags_model.append(out tag_iter); 94 | tags_model.set(tag_iter, 0, item_data.get_string_member("value"), 1, item_data.get_int_member("stationcount")); 95 | } 96 | 97 | message("Loaded all category items."); 98 | }catch (Error e){ 99 | critical("Could not load category items: %s", e.message); 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/gradio-codec-installer.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gst.PbUtils; 18 | 19 | namespace Gradio{ 20 | 21 | public class CodecInstaller{ 22 | 23 | public CodecInstaller(){ 24 | init(); 25 | } 26 | 27 | public void install_missing_codec(Gst.Message m){ 28 | string description = Gst.PbUtils.missing_plugin_message_get_description (m); 29 | string missingcodec = Gst.PbUtils.missing_plugin_message_get_installer_detail(m); 30 | string[] installer_detail = {Gst.PbUtils.missing_plugin_message_get_installer_detail (m)}; 31 | 32 | message("Try to install %s", description); 33 | 34 | if(Gst.PbUtils.install_plugins_supported()){ 35 | var context = new Gst.PbUtils.InstallPluginsContext(); 36 | Gst.PbUtils.install_plugins_async(installer_detail, context, install_callback); 37 | }else{ 38 | warning("Installation failed. Codec installation is not supported by your distribution. Please install the missin codec by yourself."); 39 | App.window.show_notification("Automatic codec installation isn't supported by your distribution.\nPlease install \""+missingcodec+"\" manually."); 40 | } 41 | } 42 | 43 | private void install_callback(Gst.PbUtils.InstallPluginsReturn result){ 44 | message("resulted"); 45 | switch(result){ 46 | case Gst.PbUtils.InstallPluginsReturn.SUCCESS: close(); break; 47 | case Gst.PbUtils.InstallPluginsReturn.PARTIAL_SUCCESS: close(); break; 48 | default: App.window.show_notification("Could not install new codec."); break; 49 | } 50 | } 51 | 52 | private void close(){ 53 | message("Successfully installed new codec."); 54 | } 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/gradio-collection.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gdk; 18 | 19 | namespace Gradio{ 20 | public class Collection : GLib.Object, Gd.MainBoxItem{ 21 | private string _name; 22 | private string _id; 23 | private string _uri; 24 | private bool _pulse; 25 | private int64 _mtime; 26 | private string _secondary_text; 27 | 28 | private Cairo.Surface _icon; 29 | private Thumbnail _thumbnail; 30 | 31 | public StationModel station_model; 32 | 33 | public string id { 34 | get{return _id;} 35 | } 36 | 37 | public string name { 38 | get{return _name;} 39 | } 40 | 41 | public string uri { 42 | get{return _uri;} 43 | } 44 | 45 | public string primary_text { 46 | get{ 47 | return _name; 48 | } 49 | } 50 | 51 | public string secondary_text { 52 | get{ 53 | return _secondary_text; 54 | } 55 | } 56 | 57 | public bool pulse { 58 | get{return _pulse;} 59 | } 60 | 61 | public int64 mtime { 62 | get{return _mtime;} 63 | } 64 | 65 | public Cairo.Surface icon { 66 | get{ 67 | if(_thumbnail == null){ 68 | _thumbnail = new Thumbnail.for_collection(App.settings.icon_zoom, this); 69 | _thumbnail.updated.connect(() => { 70 | _icon = _thumbnail.surface; 71 | notify_property("icon"); 72 | }); 73 | _thumbnail.show_empty_box(); 74 | return _icon; 75 | } 76 | return _icon; 77 | } 78 | } 79 | 80 | public Collection(string n, string i){ 81 | _name = n; 82 | _id = i; 83 | 84 | station_model = new StationModel(); 85 | 86 | App.settings.notify["icon-zoom"].connect(() => { 87 | update_thumbnail(); 88 | }); 89 | } 90 | 91 | private void update_thumbnail(){ 92 | if(_thumbnail != null && this != null){ 93 | _thumbnail.set_zoom(App.settings.icon_zoom); 94 | } 95 | } 96 | 97 | public void add_station(RadioStation station){ 98 | station_model.add_item(station); 99 | _secondary_text = station_model.get_n_items().to_string() + " Items"; 100 | notify_property("secondary-text"); 101 | } 102 | 103 | public void remove_station(RadioStation station){ 104 | station_model.add_item(station); 105 | _secondary_text = station_model.get_n_items().to_string() + " Items"; 106 | notify_property("secondary-text"); 107 | } 108 | 109 | public void rename(string name){ 110 | _name = name; 111 | notify_property("primary-text"); 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/gradio-details-box.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gtk; 18 | 19 | namespace Gradio{ 20 | 21 | [GtkTemplate (ui = "/de/haecker-felix/gradio/ui/details-box.ui")] 22 | public class DetailsBox : Box { 23 | 24 | [GtkChild] private Box StationBox; 25 | [GtkChild] private Box CollectionBox; 26 | [GtkChild] private Box ActionBox; 27 | 28 | [GtkChild] private Label NameLabel; 29 | [GtkChild] private Label TypeLabel; 30 | 31 | [GtkChild] private Label ItemsLabel; 32 | 33 | [GtkChild] private Label TagsLabel; 34 | [GtkChild] private Label CodecLabel; 35 | [GtkChild] private Label LocationLabel; 36 | [GtkChild] private Label VotesLabel; 37 | 38 | [GtkChild] private Button OpenHomepageButton; 39 | [GtkChild] private Button EditButton; 40 | 41 | [GtkChild] private Image DetailImage; 42 | 43 | private RadioStation station; 44 | private Collection collection; 45 | 46 | public void set_station(RadioStation s){ 47 | station = s; 48 | CollectionBox.set_visible(false); 49 | StationBox.set_visible(true); 50 | 51 | NameLabel.set_text(station.title); 52 | TypeLabel.set_text("Radio station"); 53 | TagsLabel.set_text(station.tags); 54 | CodecLabel.set_text(station.techinfo); 55 | LocationLabel.set_text(station.country + " " + station.state); 56 | VotesLabel.set_text(station.votes.to_string()); 57 | 58 | OpenHomepageButton.set_visible(true); 59 | EditButton.set_visible(true); 60 | 61 | StationBox.set_visible(true); 62 | 63 | Thumbnail _thumbnail = new Thumbnail.for_station(100, station); 64 | _thumbnail.updated.connect(() => { 65 | DetailImage.set_from_surface(_thumbnail.surface); 66 | }); 67 | _thumbnail.show_empty_box(); 68 | 69 | ActionBox.set_visible(true); 70 | } 71 | 72 | public void set_collection(Collection c){ 73 | collection = c; 74 | StationBox.set_visible(false); 75 | CollectionBox.set_visible(true); 76 | 77 | NameLabel.set_text(collection.name); 78 | TypeLabel.set_text("Collection"); 79 | ItemsLabel.set_text(collection.station_model.get_n_items().to_string()); 80 | 81 | CollectionBox.set_visible(true); 82 | 83 | Thumbnail _thumbnail = new Thumbnail.for_collection(100, collection); 84 | _thumbnail.updated.connect(() => { 85 | DetailImage.set_from_surface(_thumbnail.surface); 86 | }); 87 | _thumbnail.show_empty_box(); 88 | 89 | ActionBox.set_visible(false); 90 | } 91 | 92 | [GtkCallback] 93 | private void OpenHomepageButton_clicked(Button button){ 94 | try{ 95 | Gtk.show_uri(null, station.homepage, 0); 96 | }catch(Error e){ 97 | warning(e.message); 98 | } 99 | } 100 | 101 | [GtkCallback] 102 | private void EditButton_clicked(Button button){ 103 | StationEditorDialog editor_dialog = new StationEditorDialog.edit(station); 104 | editor_dialog.set_transient_for(App.window); 105 | editor_dialog.set_modal(true); 106 | editor_dialog.set_visible(true); 107 | } 108 | 109 | [GtkCallback] 110 | private void CloseButton_clicked(Button button){ 111 | this.set_visible(false); 112 | } 113 | 114 | [GtkCallback] 115 | private void PlayButton_clicked(Button button){ 116 | App.player.station = station; 117 | if (App.player.state != Gst.State.PLAYING) { 118 | App.player.toggle_play_stop(); 119 | } 120 | } 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/gradio-headerbar.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gtk; 18 | 19 | namespace Gradio{ 20 | 21 | [GtkTemplate (ui = "/de/haecker-felix/gradio/ui/headerbar.ui")] 22 | public class Headerbar : Gtk.Stack{ 23 | 24 | public signal void selection_canceled(); 25 | public signal void selection_started(); 26 | 27 | public signal void select_all(); 28 | public signal void select_none(); 29 | 30 | // 31 | // Default 32 | // 33 | [GtkChild] public Gtk.Button SelectButton; 34 | [GtkChild] public Gtk.Button BackButton; 35 | [GtkChild] public Gtk.ToggleButton SearchToggleButton; 36 | [GtkChild] public Gtk.Box MenuBox; 37 | [GtkChild] private Gtk.HeaderBar DefaultHeaderbar; 38 | public Gradio.MenuButton mbutton; 39 | 40 | // 41 | // Selection 42 | // 43 | [GtkChild] private Gtk.MenuButton SelectionMenuButton; 44 | [GtkChild] private Gtk.Label SelectionMenuButtonLabel; 45 | 46 | public Headerbar(){ 47 | var builder = new Gtk.Builder.from_resource ("/de/haecker-felix/gradio/ui/selection-menu.ui"); 48 | var selection_menu = builder.get_object ("selection-menu") as GLib.MenuModel; 49 | 50 | mbutton = new Gradio.MenuButton(); 51 | MenuBox.add(mbutton); 52 | 53 | SelectionMenuButtonLabel.set_text(_("Click on items to select them")); 54 | SelectionMenuButton.set_menu_model(selection_menu); 55 | } 56 | 57 | public void set_selected_items(int i){ 58 | if(i == 0){ 59 | SelectionMenuButtonLabel.set_text(_("Click on items to select them")); 60 | }else{ 61 | SelectionMenuButtonLabel.set_text(_("%i selected").printf(i)); 62 | } 63 | } 64 | 65 | public void set_title(string title){ 66 | DefaultHeaderbar.set_title(title); 67 | } 68 | 69 | public void set_subtitle(string subtitle){ 70 | DefaultHeaderbar.set_subtitle(subtitle); 71 | } 72 | 73 | public void show_default_buttons(){ 74 | SelectButton.set_visible(true); 75 | SearchToggleButton.set_visible(true); 76 | MenuBox.set_visible(true); 77 | } 78 | 79 | public void show_selection_bar(bool b){ 80 | if(b) 81 | this.set_visible_child_name("selection"); 82 | else 83 | this.set_visible_child_name("default"); 84 | } 85 | 86 | [GtkCallback] 87 | private void CancelSelectionButton_clicked(Gtk.Button button){ 88 | selection_canceled(); 89 | show_selection_bar(false); 90 | } 91 | 92 | [GtkCallback] 93 | private void SelectButton_clicked(Gtk.Button button){ 94 | selection_started(); 95 | show_selection_bar(true); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/gradio-image-cache.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | * 16 | * Original source file: https://github.com/needle-and-thread/vocal/blob/master/src/Services/ImageCache.vala 17 | * Additional contributors/authors: Akshay Shekher 18 | */ 19 | 20 | namespace Gradio { 21 | 22 | public class ImageCache : GLib.Object { 23 | 24 | private static Soup.Session session; 25 | 26 | public ImageCache() { 27 | session = new Soup.Session(); 28 | session.user_agent = "gradio/"+ Config.VERSION; 29 | } 30 | 31 | public async Gdk.Pixbuf get_image(string url) { 32 | uint url_hash = url.hash(); 33 | Gdk.Pixbuf pixbuf = null; 34 | 35 | if(is_image_cached(url_hash)){ 36 | pixbuf = get_cached_image(url_hash); 37 | }else{ 38 | pixbuf = yield get_image_from_url(url); 39 | 40 | if(App.settings.enable_caching) 41 | cache_image.begin(pixbuf, url_hash); 42 | } 43 | 44 | return pixbuf; 45 | } 46 | 47 | public async bool clear_cache(){ 48 | try{ 49 | File cache_location = File.new_for_path(GLib.Environment.get_user_cache_dir()+"/gradio/"); 50 | FileEnumerator enumerator = yield 51 | cache_location.enumerate_children_async("standard::*", FileQueryInfoFlags.NONE, Priority.DEFAULT, null); 52 | List infos; 53 | while((infos = yield enumerator.next_files_async(10)) != null) { 54 | foreach(var info in infos) { 55 | var name = info.get_name(); 56 | var file = File.new_for_path("%s/%s".printf(GLib.Environment.get_user_cache_dir()+"/gradio", name)); 57 | file.delete(); 58 | } 59 | } 60 | 61 | return true; 62 | }catch (Error e){ 63 | critical("Could not clear icon cache: %s", e.message); 64 | return false; 65 | } 66 | 67 | } 68 | 69 | private bool is_image_cached(uint hash){ 70 | return FileUtils.test (GLib.Environment.get_user_cache_dir()+"/gradio/"+hash.to_string()+".png", FileTest.EXISTS); 71 | } 72 | 73 | private Gdk.Pixbuf get_cached_image(uint hash){ 74 | Gdk.Pixbuf pixbuf = null; 75 | try{ 76 | pixbuf = new Gdk.Pixbuf.from_file(GLib.Environment.get_user_cache_dir()+"/gradio/"+hash.to_string()+".png"); 77 | }catch (GLib.Error e){ 78 | warning("Could not get cached image: %s", e.message); 79 | } 80 | 81 | return pixbuf; 82 | } 83 | 84 | private async void cache_image(Gdk.Pixbuf pixbuf, uint hash){ 85 | var file_location = "%s/%u.png".printf(GLib.Environment.get_user_cache_dir()+"/gradio/", hash); 86 | var cfile = File.new_for_path(file_location); 87 | FileIOStream fiostream = null; 88 | 89 | File dir = File.new_for_path (GLib.Environment.get_user_cache_dir()+"/gradio/"); 90 | if(!dir.query_exists()){ 91 | try{ 92 | dir.make_directory_with_parents(); 93 | }catch (Error e){ 94 | critical("Could not create new cache directory: " + e.message); 95 | } 96 | 97 | message("Created a cache folder."); 98 | } 99 | 100 | try{ 101 | if (cfile.query_exists()) { 102 | fiostream = yield cfile.replace_readwrite_async(null, false, FileCreateFlags.NONE); 103 | } else { 104 | fiostream = yield cfile.create_readwrite_async(FileCreateFlags.NONE); 105 | } 106 | pixbuf.save_to_stream(fiostream.get_output_stream(), "png"); 107 | }catch (Error e){ 108 | warning("Could not cache image: %s", e.message); 109 | } 110 | } 111 | 112 | private async Gdk.Pixbuf get_image_from_url(string url){ 113 | Gdk.Pixbuf pixbuf = null; 114 | InputStream image_stream = null; 115 | Soup.Request req = null; 116 | 117 | try{ 118 | req = session.request(url); 119 | image_stream = yield req.send_async(null); 120 | pixbuf = yield new Gdk.Pixbuf.from_stream_async(image_stream, null); 121 | }catch (Error e){ 122 | warning("Could not load image for \"%s\" (%s)", url, e.message); 123 | 124 | try { 125 | pixbuf = new Gdk.Pixbuf.from_resource("/de/haecker-felix/gradio/icons/hicolor/48x48/apps/de.haeckerfelix.gradio.png"); 126 | }catch (Error e) { 127 | error("Could not load resource image (%s)", e.message); 128 | } 129 | } 130 | 131 | return pixbuf; 132 | } 133 | } 134 | 135 | } 136 | -------------------------------------------------------------------------------- /src/gradio-mainbox.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gtk; 18 | 19 | namespace Gradio{ 20 | 21 | public class MainBox : Gd.MainBox{ 22 | 23 | public signal void collection_clicked(Collection collection); 24 | 25 | public MainBox(){ 26 | Object(box_type: Gd.MainBoxType.ICON); 27 | 28 | this.set_show_primary_text(true); 29 | this.set_show_secondary_text(true); 30 | this.set_vexpand(true); 31 | this.show_all(); 32 | 33 | (((Frame)this.get_child()).get_child()).margin_top = 12; 34 | (((Frame)this.get_child()).get_child()).margin_bottom = 12; 35 | Frame frame = (Frame)this.get_child(); 36 | frame.set_shadow_type(ShadowType.NONE); 37 | 38 | connect_signals(); 39 | } 40 | 41 | private void connect_signals(){ 42 | this.selection_mode_request.connect(() => { 43 | this.set_selection_mode(true); 44 | }); 45 | 46 | this.item_activated.connect((t,a) => { 47 | Gd.MainBoxItem item = (Gd.MainBoxItem)a; 48 | if(!Util.is_collection_item(int.parse(item.id))){ 49 | App.window.details_box.set_station((RadioStation)item); 50 | if(App.player.station == (RadioStation)item) 51 | App.player.toggle_play_stop(); 52 | else 53 | App.player.station = (RadioStation)item; 54 | }else{ 55 | App.window.details_box.set_collection((Collection)item); 56 | collection_clicked((Collection)item); 57 | } 58 | }); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/gradio-organize-collection-popover.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gtk; 18 | using Gd; 19 | 20 | namespace Gradio{ 21 | 22 | [GtkTemplate (ui = "/de/haecker-felix/gradio/ui/collection-row.ui")] 23 | public class CollectionRow : ListBoxRow{ 24 | 25 | [GtkChild] private Label CollectionLabel; 26 | [GtkChild] private Image AddedImage; 27 | 28 | public bool selected = false; 29 | public Collection collection; 30 | 31 | public CollectionRow (Collection coll){ 32 | CollectionLabel.set_text(coll.name); 33 | collection = coll; 34 | 35 | if(App.window != null && App.window.current_selection != null){ 36 | StationModel model = App.window.current_selection; 37 | if(model.get_n_items() != 0){ 38 | RadioStation station = (RadioStation)model.get_item(0); 39 | Collection c = App.library.get_collection_by_station(station); 40 | if(c != null && c.name == coll.name) { 41 | selected = true; 42 | AddedImage.set_visible(selected); 43 | } 44 | } 45 | } 46 | 47 | this.show_all(); 48 | } 49 | 50 | public void set_selected(bool b){ 51 | selected = b; 52 | AddedImage.set_visible(selected); 53 | } 54 | } 55 | 56 | 57 | 58 | [GtkTemplate (ui = "/de/haecker-felix/gradio/ui/organize-collection-popover.ui")] 59 | public class OrganizeCollectionPopover : Gtk.Popover{ 60 | 61 | [GtkChild] private Entry CreateEntry; 62 | [GtkChild] private Button CreateButton; 63 | 64 | [GtkChild] private ListBox CollectionsListBox; 65 | 66 | public OrganizeCollectionPopover(){ 67 | CreateEntry.notify["text"].connect(() => { 68 | string text = CreateEntry.get_text(); 69 | 70 | if(text.length > 2) 71 | CreateButton.set_sensitive(true); 72 | else 73 | CreateButton.set_sensitive(false); 74 | }); 75 | 76 | CollectionsListBox.row_activated.connect((t,r) => { 77 | CollectionRow clicked_row = (CollectionRow)r; 78 | 79 | CollectionsListBox.forall((element) => { // deactivate other rows, except the clicked one 80 | if(((CollectionRow)element) != clicked_row) 81 | ((CollectionRow)element).set_selected(false); 82 | }); 83 | 84 | clicked_row.set_selected(!(clicked_row.selected)); // toggle the clicked one 85 | 86 | string destination_id = "0"; // remove it from a collection 87 | if(clicked_row.selected) destination_id = clicked_row.collection.id; // move it into a collection 88 | 89 | StationModel model = App.window.current_selection; 90 | foreach(Gd.MainBoxItem item in model){ 91 | RadioStation station = (RadioStation)item; 92 | App.library.station_set_collection_id(station, destination_id); 93 | } 94 | }); 95 | 96 | update_collections(); 97 | } 98 | 99 | public void update_collections(){ 100 | CollectionsListBox.forall((element) => CollectionsListBox.remove(element)); 101 | 102 | StationModel collections = App.library.get_collections(); 103 | foreach(Gd.MainBoxItem item in collections){ 104 | Collection coll = (Collection) item; 105 | CollectionRow row = new CollectionRow(coll); 106 | CollectionsListBox.insert(row,0); 107 | } 108 | } 109 | 110 | [GtkCallback] 111 | private void CreateButton_clicked(Button button){ 112 | Collection c = new Collection(CreateEntry.get_text(), Random.int_range(1000000, 9999999).to_string()); 113 | App.library.add_collection(c); 114 | CreateEntry.set_text(""); 115 | update_collections(); 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /src/gradio-player-toolbar.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gtk; 18 | 19 | namespace Gradio{ 20 | 21 | [GtkTemplate (ui = "/de/haecker-felix/gradio/ui/player-toolbar.ui")] 22 | public class PlayerToolbar : Gtk.ActionBar{ 23 | 24 | [GtkChild] private Label StationTitleLabel; 25 | [GtkChild] private Label StationMetadataLabel; 26 | [GtkChild] private Image StationLogo; 27 | 28 | 29 | [GtkChild] private Box StationLogoBox; 30 | [GtkChild] private Box MediaControlBox; 31 | [GtkChild] private Box InfoBox; 32 | [GtkChild] private Box StatusBox; 33 | [GtkChild] private Box VolumeBox; 34 | 35 | [GtkChild] private VolumeButton VolumeButton; 36 | 37 | [GtkChild] private Image PlayImage; 38 | [GtkChild] private Image StopImage; 39 | 40 | private StatusIcon status_icon; 41 | 42 | public PlayerToolbar(){ 43 | setup_view(); 44 | 45 | App.player.notify["state"].connect(station_state_changed); 46 | App.player.notify["current-title-tag"].connect (() => { 47 | if(!(App.player.current_title_tag == "" || App.player.current_title_tag == null)){ 48 | StationMetadataLabel.set_text(App.player.current_title_tag); 49 | Util.send_notification(App.player.station.title, App.player.current_title_tag); 50 | } 51 | 52 | }); 53 | App.player.notify["status-message"].connect (() => { 54 | if(App.player.current_title_tag == "" || App.player.current_title_tag == null) 55 | StationMetadataLabel.set_markup(""+App.player.status_message+""); 56 | }); 57 | App.player.notify["station"].connect(() => { 58 | Idle.add(() => { 59 | station_changed(); 60 | return false; 61 | }); 62 | }); 63 | 64 | if(App.player.station != null) 65 | station_changed(); 66 | } 67 | 68 | private void setup_view(){ 69 | this.pack_start(MediaControlBox); 70 | this.pack_start(StationLogoBox); 71 | this.pack_start(InfoBox); 72 | this.pack_end(VolumeBox); 73 | 74 | status_icon = new StatusIcon(); 75 | StatusBox.pack_start(status_icon); 76 | this.show_all(); 77 | 78 | VolumeButton.set_value(App.settings.volume_position); 79 | } 80 | 81 | private void station_changed (){ 82 | // Title 83 | StationTitleLabel.set_text(App.player.station.title); 84 | 85 | Thumbnail _thumbnail = new Thumbnail.for_address(42, App.player.station.icon_address); 86 | _thumbnail.updated.connect(() => { 87 | StationLogo.set_from_surface(_thumbnail.surface); 88 | }); 89 | _thumbnail.show_empty_box(); 90 | StationLogo.set_tooltip_text(App.player.station.techinfo); 91 | 92 | this.set_visible(true); 93 | } 94 | 95 | private void station_state_changed(){ 96 | if(App.player.state != Gst.State.NULL){ 97 | StopImage.set_visible(true); 98 | PlayImage.set_visible(false); 99 | }else{ 100 | StopImage.set_visible(false); 101 | PlayImage.set_visible(true); 102 | } 103 | } 104 | 105 | [GtkCallback] 106 | private void VolumeButton_value_changed (double value) { 107 | App.player.volume = value; 108 | App.settings.volume_position = value; 109 | } 110 | 111 | [GtkCallback] 112 | private void PlayStopButton_clicked (Button button) { 113 | App.player.toggle_play_stop(); 114 | } 115 | 116 | [GtkCallback] 117 | private bool StationLogo_clicked(){ 118 | App.window.details_box.set_station(App.player.station); 119 | App.window.details_box.set_visible(true); 120 | return false; 121 | } 122 | } 123 | } 124 | 125 | -------------------------------------------------------------------------------- /src/gradio-radio-browser.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | namespace Gradio{ 18 | 19 | public class RadioBrowser{ 20 | private const string radio_browser = "https://www.radio-browser.info/webservice/json"; 21 | 22 | public const string radio_stations_by_name = radio_browser + "/stations/byname/"; 23 | public const string radio_stations_by_codec = radio_browser + "/stations/bycodec/"; 24 | public const string radio_stations_by_country = radio_browser + "/stations/bycountry/"; 25 | public const string radio_stations_by_state = radio_browser + "/stations/bystate/"; 26 | public const string radio_stations_by_language = radio_browser + "/stations/bylanguage/"; 27 | public const string radio_stations_by_tag = radio_browser + "/stations/bytag/"; 28 | public const string radio_stations_by_id = radio_browser + "/stations/byid/"; 29 | 30 | public const string radio_station_vote = radio_browser + "/vote/"; 31 | public const string radio_station_stream_url = "https://www.radio-browser.info/webservice/v2/json/url/"; 32 | public const string radio_station_search = radio_browser + "/stations/search"; 33 | public const string radio_station_languages = radio_browser + "/languages"; 34 | public const string radio_station_countries = radio_browser + "/countries"; 35 | public const string radio_station_codecs = radio_browser + "/codecs"; 36 | public const string radio_station_states = radio_browser + "/states"; 37 | public const string radio_station_tags = radio_browser + "/tags"; 38 | 39 | public static string most_votes(int count){ 40 | return radio_browser + "/stations/topvote/" + count.to_string(); 41 | } 42 | 43 | public static string recently_clicked(int count){ 44 | return radio_browser + "/stations/lastclick/" + count.to_string(); 45 | } 46 | 47 | public static string most_clicks(int count){ 48 | return radio_browser + "/stations/topclick/" + count.to_string(); 49 | } 50 | } 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/gradio-search-provider.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | namespace Gradio{ 18 | 19 | [DBus (name = "org.gnome.Shell.SearchProvider2")] 20 | public class SearchProvider : Object { 21 | 22 | [DBus (visible = false)] public signal void activate (uint32 timestamp, string station_id); 23 | [DBus (visible = false)] public signal void start_search (uint32 timestamp, string searchterm); 24 | 25 | private StationProvider station_provider; 26 | private StationModel station_model; 27 | 28 | public SearchProvider(){ 29 | station_model = new StationModel(); 30 | station_provider = new StationProvider(ref station_model); 31 | } 32 | 33 | private string array_to_string (string[] array){ 34 | string result = ""; 35 | 36 | foreach (string term in array) { 37 | string tmp = term + " "; 38 | result = result + tmp; 39 | } 40 | 41 | if(result.substring(result.length - 1) == " "){ 42 | result = result.substring(0, result.length - 1); 43 | } 44 | 45 | return result; 46 | } 47 | 48 | private async string[] search_for_stations(string[] terms){ 49 | station_model.clear(); 50 | string searchterm = array_to_string(terms); 51 | message("Searching for \"%s\"", searchterm); 52 | 53 | HashTable filter_table = new HashTable (str_hash, str_equal); 54 | filter_table.insert("limit", App.settings.max_search_results.to_string()); 55 | filter_table.insert("name", searchterm); 56 | filter_table.insert("order", "votes"); 57 | filter_table.insert("reverse", "true"); 58 | yield station_provider.get_stations("http://www.radio-browser.info/webservice/json/stations/search", filter_table); 59 | 60 | string[] results = {}; 61 | for(int i = 0; i < station_model.get_n_items(); i++){ 62 | RadioStation station = (RadioStation)station_model.get_item(i); 63 | results += station.id; 64 | } 65 | 66 | return results; 67 | } 68 | 69 | public async string[] get_initial_result_set (string[] terms) { 70 | return yield search_for_stations(terms); 71 | } 72 | 73 | public async string[] get_subsearch_result_set (string[] previous_results, string[] terms) { 74 | return yield search_for_stations(terms); 75 | } 76 | 77 | public HashTable[] get_result_metas (string[] results) { 78 | var result = new GenericArray> (); 79 | 80 | foreach (var str in results) { 81 | RadioStation station = null; 82 | for(int i = 0; i < station_model.get_n_items(); i++){ 83 | RadioStation tmp = (RadioStation)station_model.get_item(i); 84 | if(tmp.id == str){ 85 | station = tmp; 86 | break; 87 | } 88 | } 89 | 90 | if(station == null) continue; 91 | 92 | var meta = new HashTable (str_hash, str_equal); 93 | meta.insert ("id", str); 94 | meta.insert ("name", station.title); 95 | meta.insert ("icon", station.icon_address); 96 | meta.insert ("description", (station.country + " " + station.state)); 97 | result.add (meta); 98 | } 99 | return result.data; 100 | } 101 | 102 | public void activate_result (string identifier, string[] terms, uint32 timestamp) { 103 | activate (timestamp, identifier); 104 | } 105 | 106 | public void launch_search (string[] terms, uint32 timestamp) { 107 | message("Launch search..."); 108 | start_search(timestamp, array_to_string(terms)); 109 | } 110 | } 111 | 112 | } 113 | -------------------------------------------------------------------------------- /src/gradio-station-compare.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | namespace Gradio{ 18 | 19 | public enum Compare { 20 | VOTES, 21 | NAME, 22 | LANGUAGE, 23 | COUNTRY, 24 | BITRATE, 25 | CLICKS, 26 | STATE, 27 | DATE 28 | } 29 | 30 | public class StationCompare{ 31 | public CompareDataFunc compare = (a, b) => { 32 | int result = 0; 33 | RadioStation stationA; 34 | RadioStation stationB; 35 | 36 | if(Util.is_collection_item(int.parse(a.id.to_string())) || Util.is_collection_item(int.parse(b.id.to_string()))){ 37 | return result; 38 | }else{ 39 | stationA = (RadioStation)a; 40 | stationB = (RadioStation)b; 41 | } 42 | 43 | switch(App.settings.station_sorting){ 44 | case Compare.VOTES: { 45 | int avotes = int.parse(stationA.votes); 46 | int bvotes = int.parse(stationB.votes); 47 | 48 | if(avotes > bvotes) result = 1; 49 | if(avotes == bvotes) result = 0; 50 | if(avotes < bvotes) result = -1; 51 | break; 52 | } 53 | case Compare.NAME: { 54 | result = (strcmp(stationA.title, stationB.title)*-1); 55 | break; 56 | } 57 | case Compare.LANGUAGE: { 58 | result = (strcmp(stationA.language, stationB.language) * -1); 59 | break; 60 | } 61 | case Compare.COUNTRY: { 62 | result = (strcmp(stationA.country, stationB.country) * -1); 63 | break; 64 | } 65 | case Compare.BITRATE: { 66 | int abitrate = int.parse(stationA.bitrate); 67 | int bbitrate = int.parse(stationB.bitrate); 68 | 69 | if(abitrate > bbitrate) result = 1; 70 | if(abitrate == bbitrate) result = 0; 71 | if(abitrate < bbitrate) result = -1; 72 | break; 73 | } 74 | case Compare.CLICKS: { 75 | int aclicks = int.parse(stationA.clickcount); 76 | int bclicks = int.parse(stationB.clickcount); 77 | 78 | if(aclicks > bclicks) result = 1; 79 | if(aclicks == bclicks) result = 0; 80 | if(aclicks < bclicks) result = -1; 81 | break; 82 | } 83 | case Compare.STATE: { 84 | result = (strcmp(stationA.state, stationB.state) * -1); 85 | break; 86 | } 87 | case Compare.DATE: { 88 | result = (strcmp(stationA.clicktimestamp, stationB.clicktimestamp)); 89 | break; 90 | } 91 | } 92 | 93 | if(!App.settings.sort_ascending){ 94 | result = result * -1; 95 | } 96 | 97 | return result; 98 | }; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/gradio-station-provider.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | 18 | 19 | namespace Gradio{ 20 | public class StationProvider{ 21 | 22 | private Soup.Session soup_session; 23 | private Json.Parser parser = new Json.Parser(); 24 | 25 | private StationModel model = null; 26 | public signal void ready(); 27 | 28 | public StationProvider(ref StationModel m) { 29 | model = m; 30 | 31 | soup_session = new Soup.Session(); 32 | soup_session.user_agent = "gradio/"+ Config.VERSION; 33 | } 34 | 35 | public async void get_stations (string address, HashTable filter_table){ 36 | // clear old search model 37 | model.clear(); 38 | 39 | Soup.Message message = null; 40 | 41 | message = Soup.Form.request_new_from_hash("POST", address, filter_table); 42 | 43 | soup_session.queue_message (message, (session, msg) => { 44 | get_stations.callback (); 45 | }); 46 | yield; 47 | 48 | yield parse_result((string)message.response_body.data); 49 | return; 50 | } 51 | 52 | private async void parse_result(string data){ 53 | try{ 54 | parser.load_from_data(data); 55 | 56 | var root = parser.get_root (); 57 | var radio_stations = root.get_array (); 58 | 59 | int items = (int)radio_stations.get_length(); 60 | message("Search results found: %i", items); 61 | 62 | for(int i = 0; i < items; i++){ 63 | var radio_station = radio_stations.get_element(i); 64 | var radio_station_data = radio_station.get_object (); 65 | 66 | var station = new RadioStation.from_json_data(radio_station_data); 67 | model.add_item(station); 68 | } 69 | 70 | ready(); 71 | 72 | }catch(GLib.Error e){ 73 | warning ("Aborted parsing search results! " + e.message); 74 | } 75 | } 76 | } 77 | 78 | } 79 | 80 | -------------------------------------------------------------------------------- /src/gradio-status-icon.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gtk; 18 | 19 | namespace Gradio{ 20 | 21 | [GtkTemplate (ui = "/de/haecker-felix/gradio/ui/status-icon.ui")] 22 | public class StatusIcon : Gtk.Box{ 23 | 24 | [GtkChild] private Stack StatusStack; 25 | [GtkChild] private Stack PopoverStack; 26 | [GtkChild] private Popover InfoPopover; 27 | 28 | [GtkChild] private Label BitrateLabel; 29 | [GtkChild] private Label MessageLabel; 30 | 31 | public StatusIcon(){ 32 | this.show_all(); 33 | connect_signals(); 34 | } 35 | 36 | private void connect_signals(){ 37 | App.player.notify["state"].connect(() => { 38 | switch(App.player.state){ 39 | case Gst.State.PLAYING: StatusStack.set_visible_child_name("connected"); PopoverStack.set_visible_child_name("connected"); break; 40 | default: StatusStack.set_visible_child_name("no-connection"); PopoverStack.set_visible_child_name("no-connection"); break; 41 | } 42 | 43 | }); 44 | 45 | App.player.notify["current-bitrate-tag"].connect(() => {BitrateLabel.set_label(App.player.current_bitrate_tag.to_string() + " kBit/s");}); 46 | App.player.notify["status-message"].connect(() => {MessageLabel.set_label(App.player.status_message);}); 47 | } 48 | 49 | [GtkCallback] 50 | private bool status_clicked (Gdk.EventButton button){ 51 | InfoPopover.set_relative_to(this); 52 | InfoPopover.show_all(); 53 | 54 | return false; 55 | } 56 | 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/groupbox/gradio-groupbox-button.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gtk; 18 | 19 | namespace Gradio{ 20 | 21 | [GtkTemplate (ui = "/de/haecker-felix/gradio/ui/item/button-item.ui")] 22 | public class ButtonItem : Gtk.ListBoxRow, GroupBoxItem{ 23 | 24 | [GtkChild] private Label Title; 25 | [GtkChild] private Label Subtitle; 26 | 27 | public signal void btn_clicked (); 28 | 29 | public ButtonItem(string title, string subtitle = ""){ 30 | Title.set_text(title); 31 | Subtitle.set_text(subtitle); 32 | } 33 | 34 | private void clicked(){ 35 | btn_clicked(); 36 | } 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/groupbox/gradio-groupbox-item.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gtk; 18 | 19 | namespace Gradio{ 20 | 21 | public interface GroupBoxItem:GLib.Object{ 22 | public abstract void clicked(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/groupbox/gradio-groupbox-switch-item.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gtk; 18 | 19 | namespace Gradio{ 20 | 21 | [GtkTemplate (ui = "/de/haecker-felix/gradio/ui/item/switch-item.ui")] 22 | public class SwitchItem : Gtk.ListBoxRow, GroupBoxItem{ 23 | 24 | [GtkChild] private Label Title; 25 | [GtkChild] private Label Subtitle; 26 | [GtkChild] private Switch switchbutton; 27 | 28 | public signal void toggled (); 29 | 30 | public SwitchItem(string title, string subtitle = ""){ 31 | Title.set_text(title); 32 | Subtitle.set_text(subtitle); 33 | 34 | switchbutton.notify["active"].connect(() => { 35 | toggled(); 36 | }); 37 | } 38 | 39 | public new bool get_state(){ 40 | return switchbutton.get_state(); 41 | } 42 | 43 | public new void set_state(bool b){ 44 | switchbutton.set_state(b); 45 | } 46 | 47 | private void clicked(){ 48 | switchbutton.set_state(!switchbutton.get_state()); 49 | toggled(); 50 | } 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /src/groupbox/gradio-groupbox-widget-item.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gtk; 18 | 19 | namespace Gradio{ 20 | 21 | public class WidgetItem : Gtk.ListBoxRow, GroupBoxItem{ 22 | 23 | public WidgetItem(Gtk.Widget w){ 24 | this.add(w); 25 | } 26 | 27 | private void clicked(){} 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /src/groupbox/gradio-groupbox.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gtk; 18 | 19 | namespace Gradio{ 20 | 21 | [GtkTemplate (ui = "/de/haecker-felix/gradio/ui/groupbox.ui")] 22 | public class GroupBox : Gtk.Box{ 23 | 24 | [GtkChild] 25 | private Label Title; 26 | 27 | [GtkChild] 28 | private ListBox Items; 29 | 30 | 31 | public GroupBox(string title){ 32 | Title.set_text(title); 33 | Items.set_header_func(header_func); 34 | 35 | Label placeholder = new Label("No items available"); 36 | Items.set_placeholder(placeholder); 37 | placeholder.set_visible(true); 38 | 39 | Items.row_activated.connect((t,a) => { 40 | GroupBoxItem row = (GroupBoxItem)a; 41 | row.clicked(); 42 | }); 43 | } 44 | 45 | private void header_func(ListBoxRow row, ListBoxRow? row_before){ 46 | if(row_before == null){ 47 | row.set_header(null); 48 | return; 49 | } 50 | 51 | Gtk.Widget current = row.get_header(); 52 | 53 | if(current == null){ 54 | current = new Gtk.Separator(Gtk.Orientation.HORIZONTAL); 55 | current.show(); 56 | row.set_header(current); 57 | } 58 | } 59 | 60 | public void add_widget(Gtk.Widget widget){ 61 | WidgetItem row = new WidgetItem(widget); 62 | row.set_size_request(1,40); 63 | 64 | Items.add(row); 65 | } 66 | 67 | public void add_listbox_row(Gtk.ListBoxRow row){ 68 | row.set_size_request(1,40); 69 | Items.add(row); 70 | } 71 | 72 | public void set_title(string t){ 73 | Title.set_text(t); 74 | } 75 | } 76 | } 77 | 78 | -------------------------------------------------------------------------------- /src/meson.build: -------------------------------------------------------------------------------- 1 | vala_sources = [ 2 | 'gradio-app.vala', 3 | 'page/gradio-library-page.vala', 4 | 'page/gradio-search-page.vala', 5 | 'page/gradio-page.vala', 6 | 'page/gradio-collection-items-page.vala', 7 | 'page/gradio-settings-page.vala', 8 | 'groupbox/gradio-groupbox-switch-item.vala', 9 | 'groupbox/gradio-groupbox-item.vala', 10 | 'groupbox/gradio-groupbox.vala', 11 | 'groupbox/gradio-groupbox-widget-item.vala', 12 | 'groupbox/gradio-groupbox-button.vala', 13 | 'model/gradio-station-model.vala', 14 | 'model/gradio-generic-model.vala', 15 | 'gradio-details-box.vala', 16 | 'gradio-station-editor-dialog.vala', 17 | 'gradio-radio-station.vala', 18 | 'gradio-collection.vala', 19 | 'gradio-category-items.vala', 20 | 'gradio-mainbox.vala', 21 | 'gradio-audio-player.vala', 22 | 'gradio-codec-installer.vala', 23 | 'gradio-library.vala', 24 | 'gradio-main-window.vala', 25 | 'gradio-mpris.vala', 26 | 'gradio-player-toolbar.vala', 27 | 'gradio-radio-browser.vala', 28 | 'gradio-station-provider.vala', 29 | 'gradio-search-provider.vala', 30 | 'gradio-settings.vala', 31 | 'gradio-status-icon.vala', 32 | 'gradio-utils.vala', 33 | 'gradio-headerbar.vala', 34 | 'gradio-selection-toolbar.vala', 35 | 'gradio-image-cache.vala', 36 | 'gradio-organize-collection-popover.vala', 37 | 'gradio-searchbar.vala', 38 | 'gradio-station-compare.vala', 39 | 'gradio-menubutton.vala', 40 | 'gradio-thumbnail.vala'] 41 | 42 | vala_args = [ 43 | '--target-glib=2.38', 44 | '--pkg=config', 45 | '--pkg=gd-1.0', 46 | '--pkg=posix', 47 | '--vapidir=' + meson.current_source_dir() + '/vapis'] 48 | 49 | executable('gradio', 50 | vala_sources, 51 | resources, 52 | c_args : [ '-DVERSION="' + meson.project_version() + '"', '-DGETTEXT_PACKAGE="gradio"', '-DGNOMELOCALEDIR="' + get_option('prefix') + '/' + get_option('localedir') + '"' ], 53 | vala_args: vala_args, 54 | install : true, 55 | dependencies : [glib, gobject, gio, gtk, gd, libsoup, json_glib, gstreamer, gstreamer_pbutils, sqlite3]) 56 | -------------------------------------------------------------------------------- /src/model/gradio-generic-model.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | namespace Gradio{ 18 | public class GenericItem : GLib.Object { 19 | 20 | public string text; 21 | 22 | public GenericItem (string t) { 23 | text = t; 24 | } 25 | } 26 | 27 | public class GenericModel : GLib.Object, GLib.ListModel { 28 | private ListStore items; 29 | 30 | public GenericModel(){ 31 | items = new ListStore (typeof (GenericItem)); 32 | 33 | items.items_changed.connect((position, removed, added) => { 34 | items_changed (position, removed, added); 35 | }); 36 | } 37 | 38 | public GLib.Object? get_item (uint index) { 39 | return items.get_item (index); 40 | } 41 | 42 | public GLib.Type get_item_type () { 43 | return typeof (GenericItem); 44 | } 45 | 46 | public uint get_n_items () { 47 | return items.get_n_items(); 48 | } 49 | 50 | public void add_item(GenericItem item) { 51 | items.append (item); 52 | } 53 | 54 | public void remove_item (GenericItem item) { 55 | for (int i = 0; i < items.get_n_items(); i ++) { 56 | GenericItem fitem = (GenericItem)items.get_item (i); 57 | if (fitem.text == item.text) { 58 | items.remove (i); 59 | break; 60 | } 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/model/gradio-station-model.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | namespace Gradio{ 18 | 19 | public class StationModel : GLib.Object, GLib.ListModel { 20 | private ListStore items; 21 | 22 | // items got cleared (ALL ITEMS) 23 | public signal void cleared(); 24 | 25 | public StationModel(){ 26 | items = new ListStore (typeof (Gd.MainBoxItem)); 27 | App.settings.notify["station-sorting"].connect(sort); 28 | App.settings.notify["sort-ascending"].connect(sort); 29 | 30 | items.items_changed.connect((position, removed, added) => { 31 | items_changed (position, removed, added); 32 | }); 33 | } 34 | 35 | public GLib.Object? get_item (uint index) { 36 | return items.get_item (index); 37 | } 38 | 39 | public GLib.Type get_item_type () { 40 | return typeof (Gd.MainBoxItem); 41 | } 42 | 43 | public uint get_n_items () { 44 | return items.get_n_items(); 45 | } 46 | 47 | public void add_item(Gd.MainBoxItem item) { 48 | StationCompare scompare = new StationCompare(); 49 | items.insert_sorted(item, scompare.compare); 50 | } 51 | 52 | public void remove_item (Gd.MainBoxItem item) { 53 | for (int i = 0; i < items.get_n_items(); i ++) { 54 | Gd.MainBoxItem fitem = (Gd.MainBoxItem)items.get_item (i); 55 | if (fitem.id == item.id) { 56 | items.remove (i); 57 | break; 58 | } 59 | } 60 | } 61 | 62 | public void clear () { 63 | items.remove_all(); 64 | cleared(); 65 | } 66 | 67 | private void sort(){ 68 | // TODO: Port the sorting system to the new model. Collection items are currently not sortable 69 | StationCompare scompare = new StationCompare(); 70 | items.sort(scompare.compare); 71 | } 72 | 73 | public string get_id_by_name (string name){ 74 | for (int i = 0; i < get_n_items(); i ++) { 75 | Gd.MainBoxItem item = (Gd.MainBoxItem)get_item(i); 76 | 77 | if(Util.is_collection_item(int.parse(item.id))){ 78 | if(name == ((Collection)item).name) return item.id; 79 | }else{ 80 | if(name == ((RadioStation)item).title) return item.id; 81 | } 82 | } 83 | return ""; 84 | } 85 | 86 | public Gd.MainBoxItem get_item_by_id(string id){ 87 | for (int i = 0; i < get_n_items(); i ++) { 88 | Gd.MainBoxItem fitem = (Gd.MainBoxItem)get_item (i); 89 | if (id == fitem.id) return fitem; 90 | } 91 | 92 | return null; 93 | } 94 | 95 | public bool contains_radio_station_item(){ 96 | for (int i = 0; i < get_n_items(); i ++) { 97 | Gd.MainBoxItem fitem = (Gd.MainBoxItem)get_item (i); 98 | if (!Util.is_collection_item(int.parse(fitem.id))) return true; 99 | } 100 | return false; 101 | } 102 | 103 | public bool contains_collection_item(){ 104 | for (int i = 0; i < get_n_items(); i ++) { 105 | Gd.MainBoxItem fitem = (Gd.MainBoxItem)get_item (i); 106 | if (Util.is_collection_item(int.parse(fitem.id))) return true; 107 | } 108 | return false; 109 | } 110 | 111 | public bool contains_item_with_id(string id){ 112 | for (int i = 0; i < get_n_items(); i ++) { 113 | Gd.MainBoxItem fitem = (Gd.MainBoxItem)get_item (i); 114 | if (fitem.id == id) return true; 115 | } 116 | return false; 117 | } 118 | 119 | public Iterator iterator() { 120 | return new Iterator(this); 121 | } 122 | 123 | public class Iterator { 124 | private int index; 125 | private StationModel model; 126 | 127 | public Iterator(StationModel model) { 128 | this.model = model; 129 | } 130 | 131 | public bool next() { 132 | if(index < model.get_n_items()) 133 | return true; 134 | else 135 | return false; 136 | } 137 | 138 | public Gd.MainBoxItem get() { 139 | this.index++; 140 | return (Gd.MainBoxItem)this.model.get_item(this.index - 1); 141 | } 142 | } 143 | } 144 | } 145 | 146 | -------------------------------------------------------------------------------- /src/page/gradio-collection-items-page.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gtk; 18 | 19 | namespace Gradio{ 20 | 21 | [GtkTemplate (ui = "/de/haecker-felix/gradio/ui/page/collection-items-page.ui")] 22 | public class CollectionItemsPage : Gtk.Box, Page{ 23 | 24 | [GtkChild] Viewport ScrollViewport; 25 | 26 | private MainBox mainbox; 27 | private Collection collection; 28 | 29 | public CollectionItemsPage(){ 30 | mainbox = new MainBox(); 31 | collection = new Collection("", ""); 32 | 33 | ScrollViewport.add(mainbox); 34 | collection.station_model.items_changed.connect(() => {title_changed();}); 35 | mainbox.selection_changed.connect(() => {selection_changed();}); 36 | mainbox.selection_mode_request.connect(() => {selection_mode_enabled();}); 37 | } 38 | 39 | public void set_collection(Collection coll){ 40 | collection = coll; 41 | mainbox.set_model(collection.station_model); 42 | } 43 | 44 | public StationModel get_model(){ 45 | return collection.station_model; 46 | } 47 | 48 | public void set_selection_mode(bool b){ 49 | mainbox.set_selection_mode(b); 50 | } 51 | 52 | public void select_all(){ 53 | mainbox.select_all(); 54 | } 55 | 56 | public void select_none(){ 57 | mainbox.unselect_all(); 58 | } 59 | 60 | public StationModel get_selection(){ 61 | List selection = mainbox.get_selection(); 62 | StationModel model = new StationModel(); 63 | 64 | foreach(Gd.MainBoxItem item in selection){ 65 | model.add_item(item); 66 | } 67 | return model; 68 | } 69 | 70 | public string get_title(){ 71 | return collection.name; 72 | } 73 | 74 | public string get_subtitle(){ 75 | return _("Items: ") + collection.station_model.get_n_items().to_string(); 76 | } 77 | } 78 | } 79 | 80 | 81 | -------------------------------------------------------------------------------- /src/page/gradio-library-page.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gtk; 18 | 19 | namespace Gradio{ 20 | 21 | [GtkTemplate (ui = "/de/haecker-felix/gradio/ui/page/library-page.ui")] 22 | public class LibraryPage : Gtk.Box, Page{ 23 | 24 | [GtkChild] Viewport ScrollViewport; 25 | [GtkChild] Stack LibraryStack; 26 | 27 | private MainBox mainbox; 28 | 29 | public Collection selected_collection; 30 | 31 | public LibraryPage(){ 32 | mainbox = new MainBox(); 33 | mainbox.set_model(Library.station_model); 34 | mainbox.selection_changed.connect(() => {selection_changed();}); 35 | mainbox.selection_mode_request.connect(() => {selection_mode_enabled();}); 36 | ScrollViewport.add(mainbox); 37 | 38 | mainbox.collection_clicked.connect((collection) => { 39 | selected_collection = collection; 40 | App.window.set_mode(WindowMode.COLLECTION_ITEMS); 41 | }); 42 | 43 | Library.station_model.items_changed.connect(() => {title_changed();}); 44 | Library.station_model.items_changed.connect(update_page); 45 | App.library.notify["busy"].connect(() => {title_changed();}); 46 | title_changed(); 47 | update_page(); 48 | } 49 | 50 | private void update_page(){ 51 | if(Library.station_model.get_n_items() == 0) 52 | LibraryStack.set_visible_child_name("empty"); 53 | else 54 | LibraryStack.set_visible_child_name("items"); 55 | } 56 | 57 | public void set_selection_mode(bool b){ 58 | mainbox.set_selection_mode(b); 59 | } 60 | 61 | public void select_all(){ 62 | mainbox.select_all(); 63 | } 64 | 65 | public void select_none(){ 66 | mainbox.unselect_all(); 67 | } 68 | 69 | public StationModel get_selection(){ 70 | List selection = mainbox.get_selection(); 71 | StationModel model = new StationModel(); 72 | 73 | foreach(Gd.MainBoxItem item in selection){ 74 | model.add_item(item); 75 | } 76 | return model; 77 | } 78 | 79 | public string get_title(){ 80 | return _("Library"); 81 | } 82 | 83 | public string get_subtitle(){ 84 | if(App.library.busy) 85 | return _("Fetching station data…"); 86 | else 87 | return _("Items: ") + Library.station_model.get_n_items().to_string(); 88 | } 89 | 90 | [GtkCallback] 91 | private void SearchButton_clicked(Gtk.Button button){ 92 | App.window.set_mode(WindowMode.SEARCH); 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/page/gradio-page.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gtk; 18 | 19 | namespace Gradio{ 20 | 21 | public interface Page : Gtk.Box{ 22 | 23 | public virtual void set_selection_mode(bool b){} 24 | public virtual void select_all(){} 25 | public virtual void select_none(){} 26 | public signal void selection_mode_enabled(); 27 | public signal void selection_changed(); 28 | public virtual StationModel get_selection(){return null;} 29 | 30 | public signal void title_changed(); 31 | public virtual string get_title(){return "";} 32 | public virtual string get_subtitle(){return "";} 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/page/gradio-settings-page.vala: -------------------------------------------------------------------------------- 1 | /* This file is part of Gradio. 2 | * 3 | * Gradio is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * Gradio is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with Gradio. If not, see . 15 | */ 16 | 17 | using Gtk; 18 | namespace Gradio{ 19 | 20 | [GtkTemplate (ui = "/de/haecker-felix/gradio/ui/page/settings-page.ui")] 21 | public class SettingsPage : Gtk.Box, Page { 22 | 23 | [GtkChild] private Box SettingsBox; 24 | 25 | private GroupBox appearance_group; 26 | private GroupBox playback_group; 27 | private GroupBox features_group; 28 | private GroupBox cache_group; 29 | 30 | public SettingsPage () { 31 | setup_groups(); 32 | setup_items(); 33 | this.show_all(); 34 | } 35 | 36 | private void setup_groups(){ 37 | features_group = new GroupBox(_("Features")); 38 | SettingsBox.add(features_group); 39 | 40 | playback_group = new GroupBox(_("Playback")); 41 | SettingsBox.add(playback_group); 42 | 43 | appearance_group = new GroupBox(_("Appearance")); 44 | SettingsBox.add(appearance_group); 45 | 46 | cache_group = new GroupBox(_("Cache")); 47 | SettingsBox.add(cache_group); 48 | } 49 | 50 | private void setup_items(){ 51 | // APPEARANCE 52 | 53 | // Dark design 54 | SwitchItem use_dark_design_switch = new SwitchItem(_("Prefer dark theme"), _("Use a dark theme, if possible")); 55 | use_dark_design_switch.set_state(App.settings.enable_dark_theme); 56 | use_dark_design_switch.toggled.connect(() => {App.settings.enable_dark_theme = use_dark_design_switch.get_state();}); 57 | appearance_group.add_listbox_row(use_dark_design_switch); 58 | 59 | // Show technical station information. 60 | SwitchItem show_technical_info = new SwitchItem(_("Show technical information"), _("Display additional information such as bitrate and codec")); 61 | show_technical_info.set_state(App.settings.show_technical_info); 62 | show_technical_info.toggled.connect(() => {App.settings.show_technical_info = show_technical_info.get_state();}); 63 | appearance_group.add_listbox_row(show_technical_info); 64 | 65 | // PLAYBACK 66 | 67 | // enable background playback 68 | SwitchItem enable_background_playback_switch = new SwitchItem(_("Background Playback"), _("Continue the playback if you close the Gradio window")); 69 | enable_background_playback_switch.set_state(App.settings.enable_background_playback); 70 | enable_background_playback_switch.toggled.connect(() => {App.settings.enable_background_playback = enable_background_playback_switch.get_state();}); 71 | playback_group.add_listbox_row(enable_background_playback_switch); 72 | 73 | // resume playback on startup 74 | SwitchItem resume_playback_on_startup_switch = new SwitchItem(_("Resume playback on startup"), _("Play the latest station if you start Gradio")); 75 | resume_playback_on_startup_switch.set_state(App.settings.resume_playback_on_startup); 76 | resume_playback_on_startup_switch.toggled.connect(() => {App.settings.resume_playback_on_startup = resume_playback_on_startup_switch.get_state();}); 77 | playback_group.add_listbox_row(resume_playback_on_startup_switch); 78 | 79 | 80 | // FEATURES 81 | 82 | // mpris 83 | SwitchItem enable_mpris_switch = new SwitchItem(_("MPRIS"), _("Integrate Gradio as media player in your desktop environment")); 84 | enable_mpris_switch.set_state(App.settings.enable_mpris); 85 | enable_mpris_switch.toggled.connect(() => {App.settings.enable_mpris = enable_mpris_switch.get_state();}); 86 | features_group.add_listbox_row(enable_mpris_switch); 87 | 88 | // enable notifications 89 | SwitchItem enable_notifications_switch = new SwitchItem(_("Notifications"), _("Show desktop notifications")); 90 | enable_notifications_switch.set_state(App.settings.enable_notifications); 91 | enable_notifications_switch.toggled.connect(() => {App.settings.enable_notifications = enable_notifications_switch.get_state();}); 92 | features_group.add_listbox_row(enable_notifications_switch); 93 | 94 | // enable tray icon 95 | SwitchItem enable_tray_icon_switch = new SwitchItem(_("Tray icon"), _("Show a tray icon, to restore the main window")); 96 | enable_tray_icon_switch.set_state(App.settings.enable_tray_icon); 97 | enable_tray_icon_switch.toggled.connect(() => {App.settings.enable_tray_icon = enable_tray_icon_switch.get_state();}); 98 | features_group.add_listbox_row(enable_tray_icon_switch); 99 | 100 | 101 | // CACHE 102 | 103 | // cache station images 104 | SwitchItem cache_stations_switch = new SwitchItem(_("Cache station icons"), _("Saves the images locally.")); 105 | cache_stations_switch.set_state(App.settings.enable_caching); 106 | cache_stations_switch.toggled.connect(() => {App.settings.enable_caching = cache_stations_switch.get_state();}); 107 | cache_group.add_listbox_row(cache_stations_switch); 108 | 109 | ButtonItem clear_cache_button = new ButtonItem(_("Clear Cache"), _("Clear all cached station icons")); 110 | clear_cache_button.btn_clicked.connect(() => { 111 | App.image_cache.clear_cache.begin((obj,res) => { 112 | Util.show_info_dialog("Successfully cleared cache data", App.window); 113 | }); 114 | }); 115 | cache_group.add_listbox_row(clear_cache_button); 116 | 117 | } 118 | 119 | public string get_title(){ 120 | return _("Settings"); 121 | } 122 | 123 | } 124 | } 125 | 126 | -------------------------------------------------------------------------------- /src/vapis/config.vapi: -------------------------------------------------------------------------------- 1 | [CCode (cprefix = "", lower_case_cprefix = "")] 2 | namespace Config { 3 | public const string VERSION; 4 | public const string GETTEXT_PACKAGE; 5 | public const string GNOMELOCALEDIR; 6 | } 7 | --------------------------------------------------------------------------------