From 571790ba31a48c108e42c4ae10f8e63ae734c376 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Sun, 30 Dec 2012 20:33:58 +0100 Subject: setup: Introduce location section and reorganize More and more we need to know local and public locations for various features. Let's introduce general keys once and for all. --- src/atom-writer.c | 2 +- src/cgg.c | 6 +++--- src/setup.c | 8 ++++++-- src/setup.h | 5 ++++- 4 files changed, 14 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/atom-writer.c b/src/atom-writer.c index 8fa1ec8..51609bb 100644 --- a/src/atom-writer.c +++ b/src/atom-writer.c @@ -187,7 +187,7 @@ atom_writer_write_to_file (TAtomFeed *feed, const gchar *filename, TGallerySetup else { fprintf (f, " \n"); fprintf (f, " %s\n", item->title); - s = g_build_path ("/", setup->feed_base_url, item->path, "/", NULL); + s = g_build_path ("/", setup->location_base_url, item->path, "/", NULL); fprintf (f, " \n", s); g_free (s); diff --git a/src/cgg.c b/src/cgg.c index 07e981d..55691bf 100644 --- a/src/cgg.c +++ b/src/cgg.c @@ -192,14 +192,14 @@ main (int argc, char* argv[]) if (news_feed) { if (verbose) printf ("Writing Atom feed: %s\n", setup->feed_filename); - if (setup->feed_base_url == NULL || strlen (setup->feed_base_url) == 0) + if (setup->location_base_url == NULL || strlen (setup->location_base_url) == 0) log_error ("Error: feed base URL not defined!\n"); else if (setup->feed_filename == NULL || strlen (setup->feed_filename) == 0) log_error ("Error: feed file name not defined!\n"); else { - atom_writer_set_base_url (news_feed, setup->feed_base_url); - s = g_build_filename (setup->feed_base_url, setup->feed_filename, NULL); + atom_writer_set_base_url (news_feed, setup->location_base_url); + s = g_build_filename (setup->location_base_url, setup->feed_filename, NULL); atom_writer_set_feed_url (news_feed, s); g_free (s); diff --git a/src/setup.c b/src/setup.c index f053555..c78b15f 100644 --- a/src/setup.c +++ b/src/setup.c @@ -122,7 +122,10 @@ parse_setup_xml (const gchar *filename) setup->feed_enabled = xml_file_get_node_attribute_boolean (xml, "/gallery_setup/feed", "enable", FALSE); setup->feed_filename = xml_file_get_node_value (xml, "/gallery_setup/feed/filename/text()"); setup->feed_title = xml_file_get_node_value (xml, "/gallery_setup/feed/title/text()"); - setup->feed_base_url = xml_file_get_node_value (xml, "/gallery_setup/feed/base_url/text()"); + + /* location section */ + setup->location_base_url = xml_file_get_node_value (xml, "/gallery_setup/location/base_url/text()"); + setup->location_local_path = xml_file_get_node_value (xml, "/gallery_setup/location/local_path/text()"); /* footer section */ setup->footer = xml_file_get_node_value (xml, "/gallery_setup/footer/text()"); @@ -379,7 +382,8 @@ free_setup_data (TGallerySetup *setup) g_free (setup->favicon_type); g_free (setup->feed_filename); g_free (setup->feed_title); - g_free (setup->feed_base_url); + g_free (setup->location_base_url); + g_free (setup->location_local_path); g_free (setup->footer); free_design_setup_data (setup->design); g_free (setup); diff --git a/src/setup.h b/src/setup.h index 7e4ce1e..c34d861 100644 --- a/src/setup.h +++ b/src/setup.h @@ -78,7 +78,10 @@ typedef struct { gboolean feed_enabled; gchar *feed_filename; gchar *feed_title; - gchar *feed_base_url; + + /* location section */ + gchar *location_base_url; + gchar *location_local_path; /* footer section */ gchar *footer; -- cgit v1.2.3