Skip to content

Commit

Permalink
Drop enclosure list view in favour of embedded HTML <audio> and <vide…
Browse files Browse the repository at this point in the history
…o> tags.
  • Loading branch information
lwindolf committed Jun 19, 2024
1 parent ce60a54 commit ad4068b
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 292 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ To be released
* Add Sec-GPC header support via new preference to prevent user data selling.
(Lars Windolf)

* Drop enclosure list view in favour of embedded HTML5 <audio> and <video> elements
(Lars Windolf)


2024-03-14 Lars Windolf <[email protected]>

Expand Down
9 changes: 9 additions & 0 deletions css/liferea.css
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,15 @@ div.photoheader {
fill: #ddd;
}

div.enclosureVideo video {
background: black;
min-width: 640px;
min-height: 480px;
max-width: 100%;
height: auto;
display: block;
}

// dark mode image glaring #1303
@media (prefers-color-scheme: dark) {
img {
Expand Down
165 changes: 16 additions & 149 deletions glade/prefs.ui
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.22"/>
<object class="GtkAdjustment" id="adjustment2">
Expand Down Expand Up @@ -1193,6 +1193,12 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">4</property>
Expand Down Expand Up @@ -1805,6 +1811,12 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">6</property>
Expand All @@ -1822,7 +1834,7 @@
</packing>
</child>
<child>
<!-- n-columns=3 n-rows=3 -->
<!-- n-columns=1 n-rows=1 -->
<object class="GtkGrid" id="enclosuresPage">
<property name="visible">True</property>
<property name="can-focus">False</property>
Expand All @@ -1839,7 +1851,7 @@
<object class="GtkLabel" id="downloadingEnclosuresLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Downloading Enclosures</property>
<property name="label" translatable="yes">Downloading Content</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
Expand Down Expand Up @@ -1967,151 +1979,6 @@
<property name="top-attach">0</property>
</packing>
</child>
<child>
<!-- n-columns=3 n-rows=3 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="row-spacing">6</property>
<property name="column-spacing">12</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Opening Enclosures</property>
<property name="use-underline">True</property>
<property name="mnemonic-widget">enc_action_view</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="margin-start">12</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView" id="enc_action_view">
<property name="height-request">100</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="vexpand">True</property>
<property name="rules-hint">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-start">12</property>
<property name="spacing">12</property>
<property name="layout-style">start</property>
<child>
<object class="GtkButton" id="enc_action_change_btn">
<property name="label">gtk-properties</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="halign">start</property>
<property name="use-stock">True</property>
<signal name="clicked" handler="on_enc_action_change_btn_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="enc_action_remove_btn">
<property name="label">gtk-delete</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="halign">start</property>
<property name="use-stock">True</property>
<signal name="clicked" handler="on_enc_action_remove_btn_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">7</property>
Expand All @@ -2121,7 +1988,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Enclosures</property>
<property name="label" translatable="yes">Download</property>
</object>
<packing>
<property name="position">7</property>
Expand Down
1 change: 0 additions & 1 deletion src/enclosure.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ static gboolean typesLoaded = FALSE;
"enc:1:x-application/pdf::https://secret.site.us/defense-plan.pdf"
*/


enclosurePtr
enclosure_from_string (const gchar *str)
{
Expand Down
21 changes: 18 additions & 3 deletions src/item.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "date.h"
#include "db.h"
#include "debug.h"
#include "enclosure.h"
#include "feedlist.h"
#include "metadata.h"
#include "render.h"
Expand Down Expand Up @@ -258,9 +259,10 @@ void
item_to_xml (LifereaItem *item, gpointer xmlNode)
{
xmlNodePtr parentNode = (xmlNodePtr)xmlNode;
xmlNodePtr duplicatesNode;
xmlNodePtr groupNode;
xmlNodePtr itemNode;
gchar *tmp;
GSList *list;

itemNode = xmlNewChild (parentNode, NULL, BAD_CAST "item", NULL);
g_return_if_fail (itemNode);
Expand Down Expand Up @@ -310,22 +312,35 @@ item_to_xml (LifereaItem *item, gpointer xmlNode)
if (item->validGuid) {
GSList *iter, *duplicates;

duplicatesNode = xmlNewChild(itemNode, NULL, BAD_CAST "duplicates", NULL);
groupNode = xmlNewChild(itemNode, NULL, BAD_CAST "duplicates", NULL);
duplicates = iter = db_item_get_duplicates(item->sourceId);
while (iter) {
gulong id = GPOINTER_TO_UINT (iter->data);
LifereaItem * duplicate = item_load (id);
if (duplicate) {
nodePtr duplicateNode = node_from_id (duplicate->nodeId);
if (duplicateNode && (item->id != duplicate->id))
xmlNewTextChild (duplicatesNode, NULL, BAD_CAST "duplicateNode", BAD_CAST node_get_title (duplicateNode));
xmlNewTextChild (groupNode, NULL, BAD_CAST "duplicateNode", BAD_CAST node_get_title (duplicateNode));
item_unload (duplicate);
}
iter = g_slist_next (iter);
}
g_slist_free (duplicates);
}

groupNode = xmlNewChild(itemNode, NULL, BAD_CAST "enclosures", NULL);
list = metadata_list_get_values (item->metadata, "enclosure");
while (list) {
enclosurePtr enclosure = enclosure_from_string (list->data);
if (enclosure) {
xmlNodePtr enclosureNode = xmlNewChild (groupNode, NULL, BAD_CAST "enclosure", NULL);
xmlNewProp (enclosureNode, BAD_CAST "url", BAD_CAST enclosure->url);
xmlNewProp (enclosureNode, BAD_CAST "mime", BAD_CAST enclosure->mime);
}

list = g_slist_next (list);
}

xmlNewTextChild (itemNode, NULL, BAD_CAST "sourceId", BAD_CAST item->nodeId);

tmp = g_strdup_printf ("%ld", item->id);
Expand Down
1 change: 0 additions & 1 deletion src/ui/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ libliui_a_CFLAGS = $(PACKAGE_CFLAGS) $(LIBINDICATE_CFLAGS)
libliui_a_SOURCES = \
auth_dialog.c auth_dialog.h \
browser_tabs.c browser_tabs.h \
enclosure_list_view.c enclosure_list_view.h \
feed_list_view.c feed_list_view.h \
gedit-close-button.c gedit-close-button.h \
icons.c icons.h \
Expand Down
Loading

0 comments on commit ad4068b

Please sign in to comment.