Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic OwnCloud News support #378

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions glade/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ glade_DATA = liferea.ui \
inoreader_source.ui \
node_source.ui \
opml_source.ui \
owncloudnews_source.ui \
prefs.ui \
reedah_source.ui \
search.ui \
Expand Down
179 changes: 179 additions & 0 deletions glade/owncloudnews_source.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
<?xml version="1.0"?>
<!-- TODO -->
<interface>
<requires lib="gtk+" version="2.24"/>
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="owncloudnews_source_dialog">
<property name="visible">True</property>
<property name="title" translatable="yes">Add ownCloud News Account</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="border_width">12</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Please enter your ownCloud News account settings.</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkEntry" id="serverRootUrlEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkEntry" id="passwordEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="visibility">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkEntry" id="usernameEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Server Root URL</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">serverRootUrlEntry</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Password</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">passwordEntry</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Username</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">usernameEntry</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancelbutton1">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="okbutton1">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-6">cancelbutton1</action-widget>
<action-widget response="-5">okbutton1</action-widget>
</action-widgets>
</object>
</interface>

13 changes: 6 additions & 7 deletions src/feedlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,16 @@ feedlist_get_selected (void)

static nodePtr
feedlist_get_parent_node (void)
{

{
g_assert (NULL != ROOTNODE);

if (!SELECTED)
return ROOTNODE;
if (IS_FOLDER (SELECTED))

if (IS_FOLDER (SELECTED) || IS_NODE_SOURCE(SELECTED))
return SELECTED;
if (SELECTED->parent)

if (SELECTED->parent)
return SELECTED->parent;

return ROOTNODE;
Expand Down Expand Up @@ -394,7 +393,7 @@ feedlist_add_folder (const gchar *title)
parent = feedlist_get_parent_node ();

if(0 == (NODE_TYPE (parent->source->root)->capabilities & NODE_CAPABILITY_ADD_CHILDS))
return;
return;

node_source_add_folder (parent->source->root, title);
}
Expand Down
3 changes: 3 additions & 0 deletions src/fl_sources/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ libliflsources_a_SOURCES = node_source.c node_source.h \
inoreader_source_feed_list.c inoreader_source_feed_list.h \
json_api_mapper.c json_api_mapper.h \
opml_source.c opml_source.h \
owncloudnews_source.c owncloudnews_source.h \
owncloudnews_source_feed.c \
owncloudnews_source_feed_list.c owncloudnews_source_feed_list.h \
reedah_source.c reedah_source.h \
reedah_source_feed.c \
reedah_source_feed_list.c reedah_source_feed_list.h \
Expand Down
10 changes: 7 additions & 3 deletions src/fl_sources/node_source.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "fl_sources/google_source.h"
#include "fl_sources/inoreader_source.h"
#include "fl_sources/opml_source.h"
#include "fl_sources/owncloudnews_source.h"
#include "fl_sources/reedah_source.h"
#include "fl_sources/theoldreader_source.h"
#include "fl_sources/ttrss_source.h"
Expand Down Expand Up @@ -124,6 +125,7 @@ node_source_setup_root (void)
node_source_type_register (reedah_source_get_type ());
node_source_type_register (ttrss_source_get_type ());
node_source_type_register (theoldreader_source_get_type ());
node_source_type_register (owncloudnews_source_get_type ());

extensions = peas_extension_set_new (PEAS_ENGINE (liferea_plugins_engine_get_default ()),
LIFEREA_NODE_SOURCE_ACTIVATABLE_TYPE, NULL);
Expand Down Expand Up @@ -438,10 +440,12 @@ node_source_add_folder (nodePtr node, const gchar *title)
if (!node_source_is_logged_in (node))
return NULL;

if (NODE_SOURCE_TYPE (node)->add_folder)
if (NODE_SOURCE_TYPE (node)->add_folder) {
return NODE_SOURCE_TYPE (node)->add_folder (node, title);
else
g_warning ("node_source_add_folder(): called on node source type that doesn't implement me!");
} else {
g_warning (
"node_source_add_folder(): called on node source type that doesn't implement me!");
}

return NULL;
}
Expand Down
Loading