mkdir_p = /bin/mkdir -p
oldincludedir = /usr/include
pdfdir = ${docdir}
-prefix = /tmp/p
+prefix = /tmp
program_transform_name = s,x,x,
psdir = ${docdir}
sbindir = ${exec_prefix}/sbin
Report bugs to <jeanfi@gmail.com>.
prss home page: <http://wpitchoune.net/prss>."
-ac_cs_config="'--prefix=/tmp/p'"
+ac_cs_config="'--prefix=/tmp'"
ac_cs_version="\
prss config.status 0.0.x
configured by ./configure, generated by GNU Autoconf 2.69,
fi
if $ac_cs_recheck; then
- set X /bin/bash './configure' '--prefix=/tmp/p' $ac_configure_extra_args --no-create --no-recursion
+ set X /bin/bash './configure' '--prefix=/tmp' $ac_configure_extra_args --no-create --no-recursion
shift
$as_echo "running CONFIG_SHELL=/bin/bash $*" >&6
CONFIG_SHELL='/bin/bash'
S["sbindir"]="${exec_prefix}/sbin"
S["bindir"]="${exec_prefix}/bin"
S["program_transform_name"]="s,x,x,"
-S["prefix"]="/tmp/p"
+S["prefix"]="/tmp"
S["exec_prefix"]="${prefix}"
S["PACKAGE_URL"]="http://wpitchoune.net/prss"
S["PACKAGE_BUGREPORT"]="jeanfi@gmail.com"
top_srcdir = ..
-prefix = /tmp/p
+prefix = /tmp
exec_prefix = ${prefix}
datarootdir = ${prefix}/share
datadir = ${datarootdir}
top_srcdir = ..
-prefix = /tmp/p
+prefix = /tmp
exec_prefix = ${prefix}
datarootdir = ${prefix}/share
datadir = ${datarootdir}
http.h \
ttrss.c \
ttrss.h \
+ ttrss_model.c \
+ ttrss_model.h \
url.c \
url.h \
webbrowser.c \
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
PROGRAMS = $(bin_PROGRAMS)
am_prss_OBJECTS = main.$(OBJEXT) http.$(OBJEXT) ttrss.$(OBJEXT) \
- url.$(OBJEXT) webbrowser.$(OBJEXT)
+ ttrss_model.$(OBJEXT) url.$(OBJEXT) webbrowser.$(OBJEXT)
prss_OBJECTS = $(am_prss_OBJECTS)
prss_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I.@am__isrc@
http.h \
ttrss.c \
ttrss.h \
+ ttrss_model.c \
+ ttrss_model.h \
url.c \
url.h \
webbrowser.c \
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttrss.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ttrss_model.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/webbrowser.Po@am__quote@
GtkTreeIter iter;
char *title;
- ws_init(g_settings_get_string(settings, "url"),
- g_settings_get_string(settings, "user"),
- g_settings_get_string(settings, "password"));
+ ttrss_set_config(g_settings_get_string(settings, "url"),
+ g_settings_get_string(settings, "user"),
+ g_settings_get_string(settings, "password"));
ws_open_session();
model = gtk_tree_view_get_model(GTK_TREE_VIEW(w_treeview));
static char *session_user;
static char *session_pwd;
-static int list_length(void **list)
-{
- int n;
-
- if (!list)
- return 0;
-
- n = 0;
- while (*list) {
- n++;
- list++;
- }
-
- return n;
-}
-
-static void **list_add(void **list, void *item)
-{
- int n;
- void **result;
-
- n = list_length(list);
-
- result = malloc((n + 1 + 1) * sizeof(void *));
-
- if (list)
- memcpy(result, list, n * sizeof(void *));
-
- result[n] = item;
- result[n + 1] = NULL;
-
- return result;
-}
-
-struct headline **
-headlines_add(struct headline **list, struct headline *h)
-{
- return (struct headline **)list_add((void **)list, (void *)h);
-}
-
-struct headline *feed_get_headline(struct feed *feed, int id)
-{
- struct headline **headlines;
-
- headlines = feed->headlines;
- if (headlines)
- while (*headlines) {
- if ((*headlines)->id == id)
- return *headlines;
- headlines++;
- }
-
- return NULL;
-}
+static struct feed **data;
void ws_request_add_att_str(json_object *rq, const char *k, const char *str)
{
feed->headlines = NULL;
- tmp = (struct feed **)list_add((void **)feeds, feed);
+ tmp = feeds_add(feeds, feed);
free(feeds);
feeds = tmp;
}
json_object_put(rq);
json_object_put(rp);
}
+
+void ttrss_set_config(const char *url, const char *user, const char *pwd)
+{
+ feeds_free(data);
+ data = NULL;
+ ws_init(url, user, pwd);
+}
#ifndef _TTRSS_H_
#define _TTRSS_H_
-struct headline {
- int id;
-
- char *url;
- char *title;
- char *excerpt;
- char *content;
- int unread;
-};
-
-struct feed {
- char *title;
- char *url;
- int id;
- int unread;
-
- struct headline **headlines;
-};
+#include "ttrss_model.h"
+void ttrss_set_config(const char *url, const char *user, const char *pwd);
struct feed **ttrss_get_feeds();
struct headline **ttrss_get_headlines(struct feed *);
const char *ttrss_get_headline_content(struct headline *);
void ttrss_set_article_unread(int id, int unread);
-void ws_init(const char *url, const char *user, const char *pwd);
+void ttrs_set_config(const char *url, const char *user, const char *pwd);
int ws_open_session();
-
#endif
--- /dev/null
+/*
+ * Copyright (C) 2010-2013 jeanfi@gmail.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "ttrss_model.h"
+
+static int list_length(void **list)
+{
+ int n;
+
+ if (!list)
+ return 0;
+
+ n = 0;
+ while (*list) {
+ n++;
+ list++;
+ }
+
+ return n;
+}
+
+static void **list_add(void **list, void *item)
+{
+ int n;
+ void **result;
+
+ n = list_length(list);
+
+ result = malloc((n + 1 + 1) * sizeof(void *));
+
+ if (list)
+ memcpy(result, list, n * sizeof(void *));
+
+ result[n] = item;
+ result[n + 1] = NULL;
+
+ return result;
+}
+
+struct headline **headlines_add(struct headline **list, struct headline *h)
+{
+ return (struct headline **)list_add((void **)list, (void *)h);
+}
+
+struct feed **feeds_add(struct feed **list, struct feed *f)
+{
+ return (struct feed **)list_add((void **)list, (void *)f);
+}
+
+struct headline *feed_get_headline(struct feed *feed, int id)
+{
+ struct headline **headlines;
+
+ headlines = feed->headlines;
+ if (headlines)
+ while (*headlines) {
+ if ((*headlines)->id == id)
+ return *headlines;
+ headlines++;
+ }
+
+ return NULL;
+}
+
+void headlines_free(struct headline **headlines)
+{
+}
+
+void feed_free(struct feed *feed)
+{
+ if (feed) {
+ if (feed->title)
+ free(feed->title);
+ if (feed->url)
+ free(feed->url);
+ headlines_free(feed->headlines);
+ free(feed);
+ }
+}
+
+void feeds_free(struct feed **feeds)
+{
+ struct feed **cur;
+
+ if (feeds) {
+ cur = feeds;
+ while (*cur) {
+ feed_free(*cur);
+ cur++;
+ }
+ free(feeds);
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2010-2013 jeanfi@gmail.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef _TTRSS_MODEL_H_
+#define _TTRSS_MODEL_H_
+
+struct headline {
+ int id;
+
+ char *url;
+ char *title;
+ char *excerpt;
+ char *content;
+ int unread;
+};
+
+struct feed {
+ char *title;
+ char *url;
+ int id;
+ int unread;
+
+ struct headline **headlines;
+};
+
+void feed_free(struct feed *feed);
+void feeds_free(struct feed **feed);
+struct headline **headlines_add(struct headline **list, struct headline *h);
+
+struct feed **feeds_add(struct feed **list, struct feed *f);
+struct headline *feed_get_headline(struct feed *feed, int id);
+
+#endif