Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

Commit

Permalink
New image provider class. Improved logo visibility. Fixed #41
Browse files Browse the repository at this point in the history
  • Loading branch information
haecker-felix committed Sep 17, 2016
1 parent cf00c5a commit 4788ea3
Show file tree
Hide file tree
Showing 17 changed files with 1,198 additions and 94 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ set (SOURCE_LIST
src/Data/StationProvider.vala
src/Data/RadioBrowser.vala
src/Data/CategoryItemProvider.vala
src/Data/ImageProvider.vala
src/Widgets/DiscoverBox/DiscoverBox.vala
src/Widgets/DiscoverBox/DiscoverSidebar.vala
src/Widgets/DiscoverBox/CategoriesRow.vala
Expand Down
18 changes: 18 additions & 0 deletions Ungesichertes Dokument 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
sub scale_pixbuf {
my ($pixbuf, $parent) = @_;
my $max_w = $parent->get_allocation()->{width};
my $max_h = $parent->get_allocation()->{height};
my $pixb_w = $pixbuf->get_width();
my $pixb_h = $pixbuf->get_height();
if (($pixb_w > $max_w) || ($pixb_h > $max_h)) {
my $sc_factor_w = $max_w / $pixb_w;
my $sc_factor_h = $max_h / $pixb_h;
my $sc_factor = min $sc_factor_w, $sc_factor_h;
my $sc_w = int($pixb_w * $sc_factor);
my $sc_h = int($pixb_h * $sc_factor);
my $scaled
= $pixbuf->scale_simple($sc_w, $sc_h, 'GDK_INTERP_HYPER');
return $scaled;
}
return $pixbuf;
}
12 changes: 11 additions & 1 deletion data/style/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

.grid-item:backdrop {
box-shadow: none;
border-color: @unfocused_borders;
border-color: @un3ocused_borders;
}

.stations-view{
Expand All @@ -37,6 +37,16 @@
color: @theme_selected_fg_color;
}

.round-border{
border-radius: 3px;
}

.border{
border-width: 1px 1px 1px 1px;
border-style: solid;
border-color: @borders;
}

.border-top{
border-width: 1px 0px 0px 0px;
border-style: solid;
Expand Down
37 changes: 28 additions & 9 deletions data/ui/grid-item.ui
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,33 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImage" id="ChannelLogoImage">
<property name="width_request">64</property>
<property name="height_request">64</property>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">7</property>
<property name="margin_right">7</property>
<property name="margin_top">7</property>
<property name="margin_bottom">7</property>
<property name="icon_name">application-rss+xml-symbolic</property>
<property name="icon_size">6</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkImage" id="ChannelLogoImage">
<property name="width_request">64</property>
<property name="height_request">64</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">7</property>
<property name="margin_right">7</property>
<property name="margin_top">7</property>
<property name="margin_bottom">7</property>
<property name="icon_name">application-rss+xml-symbolic</property>
<property name="icon_size">6</property>
<style>
<class name="border"/>
<class name="round-border"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
Expand Down Expand Up @@ -104,6 +120,9 @@
</packing>
</child>
</object>
<packing>
<property name="index">-1</property>
</packing>
</child>
<child type="overlay">
<object class="GtkEventBox">
Expand Down
245 changes: 245 additions & 0 deletions data/ui/grid-item.ui~
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.14"/>
<template class="GradioGridItem" parent="GtkFlowBoxChild">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">2</property>
<property name="margin_right">2</property>
<property name="margin_top">2</property>
<property name="margin_bottom">2</property>
<child>
<object class="GtkButton" id="button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="GradioGridItem_clicked" swapped="no"/>
<child>
<object class="GtkOverlay">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkImage" id="ChannelLogoImage">
<property name="width_request">64</property>
<property name="height_request">64</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">7</property>
<property name="margin_right">7</property>
<property name="margin_top">7</property>
<property name="margin_bottom">7</property>
<property name="icon_name">application-rss+xml-symbolic</property>
<property name="icon_size">6</property>
<style>
<class name="border"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="margin_top">7</property>
<property name="margin_bottom">7</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="ChannelNameLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">label</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="ChannelLocationLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="ChannelTagsLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">label</property>
<attributes>
<attribute name="style" value="oblique"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="index">-1</property>
</packing>
</child>
<child type="overlay">
<object class="GtkEventBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="above_child">True</property>
<child>
<object class="GtkBox">
<property name="width_request">30</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">2</property>
<property name="margin_right">2</property>
<property name="margin_top">2</property>
<property name="margin_bottom">2</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">2</property>
<property name="orientation">vertical</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkImage" id="InLibraryImage">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="icon_name">starred-symbolic</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="NotInLibraryImage">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="icon_name">non-starred-symbolic</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">emote-love-symbolic</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="LikesLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">999</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<style>
<class name="grid-overlay-box"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
<style>
<class name="grid-item"/>
</style>
</object>
</child>
</template>
</interface>
26 changes: 21 additions & 5 deletions data/ui/list-item.ui
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,33 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImage" id="ChannelLogoImage">
<property name="width_request">32</property>
<property name="height_request">32</property>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="icon_name">application-rss+xml-symbolic</property>
<property name="icon_size">5</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkImage" id="ChannelLogoImage">
<property name="width_request">32</property>
<property name="height_request">32</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">application-rss+xml-symbolic</property>
<property name="icon_size">5</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<style>
<class name="border"/>
<class name="round-border"/>
</style>
</object>
<packing>
<property name="expand">False</property>
Expand Down
Loading

0 comments on commit 4788ea3

Please sign in to comment.