[telegnome] Fix some bits and pieces of subpage handling



commit 0db85657d271df4bb98c2a3d2bdd21456e30d1ac
Author: Colin Watson <cjwatson debian org>
Date:   Sat Jan 30 13:29:49 2016 +0000

    Fix some bits and pieces of subpage handling
    
    * src/http.c (tg_http_get_query): Only try to fetch a subpage if the
    current channel has a subpage-url.
    * src/view.c (tg_view_update_page): Save the old subpage number
    correctly (from the subpage number, not the page number).

 src/http.c |   10 ++++++----
 src/view.c |    4 ++--
 2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/http.c b/src/http.c
index 5953567..c82617c 100644
--- a/src/http.c
+++ b/src/http.c
@@ -127,12 +127,14 @@ out:
 int
 tg_http_get_query (gchar* buffer, gint page_nr, gint subpage_nr)
 {
-    gchar *url;
+    gchar *url = NULL;
 
-    if ( subpage_nr>0 ) {    /* do we have a subpage? */
+    if (subpage_nr > 0) {    /* do we have a subpage? */
        g_object_get(currentview->channel, "subpage-url", &url, NULL);
-       sprintf(buffer, url, page_nr, subpage_nr);
-    } else {
+       if (url && *url)
+           sprintf(buffer, url, page_nr, subpage_nr);
+    }
+    if (!url || !*url) {
        g_object_get(currentview->channel, "page-url", &url, NULL);
        sprintf(buffer, url, page_nr);
     }
diff --git a/src/view.c b/src/view.c
index b8b362d..45e9fc0 100644
--- a/src/view.c
+++ b/src/view.c
@@ -92,9 +92,9 @@ tg_view_update_page(TgView *view, int *major_nr, int *minor_nr)
        GdkPixbuf *pixbuf;
        GError *error = NULL;
 
-       /* save these the restore the, if necessary */
+       /* save these and restore them, if necessary */
        gint old_page= *major_nr;
-       gint old_subpage= *major_nr;
+       gint old_subpage= *minor_nr;
 
        /* make http-request, returns the file of the saved thing */
        retval = tg_http_get_image(&pixbuf);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]