[girl] GIRL 8.4.0



commit cfa12f1a3c70766a36fda18c8746255163cad4f3
Author: Ole Aamot <oka oka no>
Date:   Sat Apr 2 22:54:50 2016 +0200

    GIRL 8.4.0

 LETTER             |   29 +++-----
 NEWS               |   13 +++
 README             |   18 +++++
 configure          |   20 +++---
 configure.ac       |    2 +-
 girl.spec.in       |    3 +
 src/Makefile.am    |    2 +-
 src/Makefile.in    |    2 +-
 src/girl-gui.c     |  206 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 src/girl-gui.h     |    3 +
 src/girl-station.c |   46 ++++++++++++
 src/girl-station.h |    2 +
 src/girl.c         |  121 ++++++++++++++++++++++++++++++-
 src/girl.h         |    2 +
 14 files changed, 433 insertions(+), 36 deletions(-)
---
diff --git a/LETTER b/LETTER
index 3414a78..b2f5ec0 100644
--- a/LETTER
+++ b/LETTER
@@ -50,17 +50,11 @@ plays in promoting artists and their music on the Internet. I listen
 to Internet radio and I want to see the current diversity of
 programming provided by Internet radio preserved.
 
-On July 26, 2002, Representatives Jay Inslee (D-WA), George Nethercutt
-(R-WA) and Rick Boucher (D-VA) introduced legislation called the
-Internet Radio Fairness Act (HR 5285) in the US House of
-Representatives. This vital bill would protect a large number of
-Internet radio stations from being forced out of business by unfair
-and unaffordable performance copyright royalties. Please act
-immediately in seeing that this effort is carried through the House
-and Senate and made law before it is too late to save Internet
-radio. Immediate action is required. The enforcement of retroactive
-royalties based on the currently unaffordable rates is set to commence
-no later than October 20, 2002.
+This would protect a large number of Internet radio stations from
+being forced out of business by unfair and unaffordable performance
+copyright royalties. Please act immediately in seeing that this effort
+is carried through the House and Senate and made law before it is too
+late to save Internet radio. Immediate action is required.
 
 We want you to understand that this legislative action does not seek
 to eliminate royalties paid to artists by Internet radio stations. It
@@ -71,13 +65,10 @@ will be ensuring that artists will receive fair compensation from
 these stations and retain this valuable resource to promote their
 music.
 
-This bipartisan effort is already supported by several important
-members of the US House of Representatives, including Representative
-Donald Manzullo (R-IL), Chairman of the House Committee on Small
-Business. We need your help to ensure that this action is passed by
-the US House of Representatives and joined by similar action in the US
-Senate. Please act now, there isn't much time left to save Internet
-radio.
+We need your help to ensure that this action is passed by the US House
+of Representatives and joined by similar action in the US Senate.
+
+Please act now, there isn't much time left to save Internet radio.
 
 Sincerely,
-Your Name
+Your Name
\ No newline at end of file
diff --git a/NEWS b/NEWS
index 996bed0..acb55d2 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,16 @@
+=============
+Version 8.4.0
+=============
+
+Documentation
+
+       * LETTER: Update text to reflect the current situation regarding IRFA.
+
+GUI
+       * girl-gui.c: Add "New" Button to update $HOME/.girl/girl.xml from GUI.
+       * girl-gui.c: Add on_location_matches() for autocompletion of locations
+       * girl-gui.c: Add girl_station_update() to update $HOME/.girl/girl.xml
+
 ==============
 Version 8.3.16
 ==============
diff --git a/README b/README
index 9b50c5c..0a58889 100644
--- a/README
+++ b/README
@@ -1,3 +1,21 @@
+================
+GIRL 8.4.0 notes
+================
+
+GIRL 8.4.0 is released on April 2nd, 2016.
+
+This release is dedicated to a very special girl, allthough she's not
+that kind of a girl, she enjoys freedom and Free Software as much as
+you do.
+
+She contributed to the Norwegian documentary "Fri programvare (2015)"
+on Free Software which is available in Norwegian and she is an
+independent documentary film maker and her movie "Evolution after
+Obama" will be available on the Internet.
+
+The new feature in this GIRL release is a New station function with a
+GUI entry interface.
+
 =================
 GIRL 8.3.16 notes
 =================
diff --git a/configure b/configure
index cf8d9f0..24c9b1b 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for girl 8.3.16.
+# Generated by GNU Autoconf 2.69 for girl 8.4.0.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -577,8 +577,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='girl'
 PACKAGE_TARNAME='girl'
-PACKAGE_VERSION='8.3.16'
-PACKAGE_STRING='girl 8.3.16'
+PACKAGE_VERSION='8.4.0'
+PACKAGE_STRING='girl 8.4.0'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1364,7 +1364,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures girl 8.3.16 to adapt to many kinds of systems.
+\`configure' configures girl 8.4.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1430,7 +1430,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of girl 8.3.16:";;
+     short | recursive ) echo "Configuration of girl 8.4.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1545,7 +1545,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-girl configure 8.3.16
+girl configure 8.4.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1910,7 +1910,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by girl $as_me 8.3.16, which was
+It was created by girl $as_me 8.4.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2773,7 +2773,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='girl'
- VERSION='8.3.16'
+ VERSION='8.4.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -7457,7 +7457,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by girl $as_me 8.3.16, which was
+This file was extended by girl $as_me 8.4.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -7523,7 +7523,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-girl config.status 8.3.16
+girl config.status 8.4.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index 5b95654..2743145 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT(girl, 8.3.16)
+AC_INIT(girl, 8.4.0)
 AM_INIT_AUTOMAKE([no-dist-gzip dist-xz])
 AC_CONFIG_SRCDIR([src/girl.c])
 AC_CONFIG_HEADER([config.h])
diff --git a/girl.spec.in b/girl.spec.in
index faa07a7..3da2ccc 100644
--- a/girl.spec.in
+++ b/girl.spec.in
@@ -70,6 +70,9 @@ fi
 %{_datadir}/help/*/%{name}
 
 %changelog
+* Tue Mar 08 2016 Ole Aamot - 8.4.0-1.fc23
+- Girl 8.4.0 build on Fedora Linux 23
+
 * Tue Mar 08 2016 Ole Aamot - 8.3.16-1.fc23
 - Girl 8.3.16 build on Fedora Linux 23
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 23cdd00..fc13bad 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -36,7 +36,7 @@ girl_SOURCES = \
 girl_CFLAGS  = $(GIRL_CFLAGS) \
               -DGIRL_DATADIR=\"$(datadir)/girl\" \
               -DDATADIR=\"$(datadir)\" \
-              -DGIRL_DEBUG=1 \
+              -DGIRL_DEBUG=0 \
               -DGIRL_CFG \
               -DGIRL_HELPER_PLAYER=\"$(GIRL_HELPER_PLAYER)\" \
               -DGIRL_HELPER_RECORD=\"$(GIRL_HELPER_RECORD)\" \
diff --git a/src/Makefile.in b/src/Makefile.in
index 762a076..9bce41f 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -392,7 +392,7 @@ girl_SOURCES = \
 girl_CFLAGS = $(GIRL_CFLAGS) \
               -DGIRL_DATADIR=\"$(datadir)/girl\" \
               -DDATADIR=\"$(datadir)\" \
-              -DGIRL_DEBUG=1 \
+              -DGIRL_DEBUG=0 \
               -DGIRL_CFG \
               -DGIRL_HELPER_PLAYER=\"$(GIRL_HELPER_PLAYER)\" \
               -DGIRL_HELPER_RECORD=\"$(GIRL_HELPER_RECORD)\" \
diff --git a/src/girl-gui.c b/src/girl-gui.c
index 38b1114..8e8bc7c 100644
--- a/src/girl-gui.c
+++ b/src/girl-gui.c
@@ -46,10 +46,14 @@
 #include "girl-program.h"
 #include "girl-station.h"
 #include "girl-streams.h"
+#include "girl-tz.h"
 
 extern GtkWidget *girl_app;
 
 GnomeUIInfo toolbar[] = {
+       GNOMEUIINFO_ITEM_STOCK(N_("New"), N_("Add a new radio station"),
+                              on_new_station_clicked, GTK_STOCK_NEW),
+       GNOMEUIINFO_SEPARATOR,
        GNOMEUIINFO_ITEM_STOCK(N_("Search"), N_("Search by location for radio stations"),
                               on_search_button_clicked,
                               GTK_STOCK_FIND),
@@ -75,11 +79,11 @@ GnomeUIInfo toolbar[] = {
        GNOMEUIINFO_ITEM_STOCK(N_("Next"), N_("Proceed to the next radio station"),
                               on_next_station_click, GTK_STOCK_GO_FORWARD),
        GNOMEUIINFO_SEPARATOR,
-       GNOMEUIINFO_ITEM_STOCK(N_("About Station"),
+       GNOMEUIINFO_ITEM_STOCK(N_("Station"),
                               N_("About the current Station"),
                               about_station, GNOME_STOCK_ABOUT),
        GNOMEUIINFO_SEPARATOR,
-       GNOMEUIINFO_ITEM_STOCK(N_("About Program"),
+       GNOMEUIINFO_ITEM_STOCK(N_("Program"),
                               N_("About the GNOME Internet Radio Locator"),
                               about_app, GNOME_STOCK_ABOUT),
 
@@ -737,6 +741,204 @@ GtkWidget *create_stations_selector(char *selected_station_uri,
        return stations_selector;
 }
 
+static gboolean
+on_location_matches(GtkEntryCompletion *widget,
+                   GtkTreeModel *model,
+                   GtkTreeIter *iter,
+                   gpointer user_data)
+{
+       GValue value = {0, };
+
+       gtk_tree_model_get_value(model, iter, STATION_LOCATION, &value);
+       girl->selected_station_location = g_strdup(g_value_get_string(&value));
+       g_value_unset(&value);
+
+       appbar_send_msg(_("Found location %s"),
+                       girl->selected_station_location);
+       /* girl_helper_run(girl->selected_station_uri, */
+       /*              girl->selected_station_name, */
+       /*              GIRL_STREAM_SHOUTCAST, */
+       /*              GIRL_STREAM_PLAYER); */
+       return FALSE;
+}
+
+GtkWidget *create_new_station_selector(void) {
+
+       GirlStationInfo *stationinfo, *localstation;
+       GtkWidget *station_selector, *content_area, *item;
+       GtkWidget *align;
+       GtkWidget *bandentry, *descriptionentry, *nameentry, *locationentry, *urientry, *websiteentry;
+       GtkEntryCompletion *completion;
+       GtkListStore *location_model;
+       GtkTreeIter iter;
+
+       TzDB *db;
+       GPtrArray *locs;
+       guint i;
+       char *pixmap_dir;
+       int retval = 0;
+
+       setlocale (LC_ALL, "");
+
+       gchar *world_station_xml_filename, *local_station_xml_file;
+
+       /* int i = 0, search_selection = -1; */
+
+       GStatBuf stats;
+
+       memset(&stats, 0, sizeof(stats));
+
+       /* The Stations dialog */
+       station_selector = gtk_dialog_new_with_buttons(_("New radio station"), GTK_WINDOW(girl_app), 0, /* 
flags */
+                                                      GTK_STOCK_SAVE,
+                                                      GTK_RESPONSE_ACCEPT,
+                                                      NULL);
+       content_area = gtk_dialog_get_content_area (GTK_DIALOG (station_selector));
+       gtk_container_set_border_width
+           (GTK_CONTAINER(GTK_DIALOG(station_selector)->vbox), 6);
+
+       align = gtk_alignment_new(0.5, 0.5, 0, 0);
+       gtk_container_add(GTK_CONTAINER
+                         (GTK_DIALOG(station_selector)->vbox), align);
+       gtk_container_set_border_width(GTK_CONTAINER(align), 6);
+       gtk_widget_show(align);
+
+       nameentry = gtk_entry_new();
+       locationentry = gtk_entry_new();
+       urientry = gtk_entry_new();
+       bandentry = gtk_entry_new();
+       websiteentry = gtk_entry_new();
+       descriptionentry = gtk_entry_new();
+
+       gtk_entry_set_text(GTK_ENTRY(nameentry), "Station name");
+       gtk_entry_set_text(GTK_ENTRY(locationentry), "City name");
+       gtk_entry_set_text(GTK_ENTRY(urientry), "http://uri-to-stream/";);
+       gtk_entry_set_text(GTK_ENTRY(bandentry), "FM/AM bandwidth");
+       gtk_entry_set_text(GTK_ENTRY(websiteentry), "http://uri-to-website/";);
+       gtk_entry_set_text(GTK_ENTRY(descriptionentry), "Description");
+       completion = gtk_entry_completion_new();
+       gtk_entry_completion_set_text_column(completion, STATION_LOCATION);
+       gtk_entry_set_completion(GTK_ENTRY(locationentry), completion);
+       g_signal_connect(G_OBJECT(completion), "match-selected",
+                        G_CALLBACK(on_location_matches), NULL);
+       location_model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
+
+       world_station_xml_filename = g_strconcat(GIRL_DATADIR, "/girl.xml", NULL);
+       GIRL_DEBUG_MSG("world_station_xml_filename = %s\n",
+           world_station_xml_filename);
+
+       if (world_station_xml_filename == NULL) {
+               g_warning(("Failed to open %s.  Please install it.\n"),
+                         world_station_xml_filename);
+       }
+
+       local_station_xml_file =
+           g_strconcat(g_get_home_dir(), "/.girl/girl.xml", NULL);
+
+       if (!g_stat(local_station_xml_file, &stats)) {
+               localstation = girl_station_load_from_file(NULL, local_station_xml_file);
+       } else {
+               localstation = NULL;
+       }
+
+       if (localstation == NULL) {
+               g_warning(_("Failed to open %s.\n"), local_station_xml_file);
+       }
+
+/*   g_free (local_station_xml_file); */
+
+       stationinfo =
+           girl_station_load_from_file(localstation,
+                                       world_station_xml_filename);
+
+       // girl_stations = NULL;
+
+       /* while (stationinfo != NULL) { */
+       /* Timezone map */
+       db = tz_load_db ();
+       locs = tz_get_locations (db);
+       for (i = 0; i < locs->len ; i++) {
+               TzLocation *loc = locs->pdata[i];
+               TzInfo *info;
+               char *filename, *path;
+               gdouble selected_offset;
+               char buf[16];
+               info = tz_info_from_location (loc);
+               selected_offset = tz_location_get_utc_offset (loc)
+                       / (60.0*60.0) + ((info->daylight) ? -1.0 : 0.0);
+               filename = g_strdup_printf ("timezone_%s.png",
+                                           g_ascii_formatd (buf, sizeof (buf),
+                                                            "%g", selected_offset));
+               path = g_build_filename (pixmap_dir, filename, NULL);
+               /* g_printf("Name is %s\n", tz_info_get_clean_name(db, loc->zone)); */
+               /* GIRL_DEBUG_MSG("%s\n", loc->zone); */
+               /* if (g_file_test (path, G_FILE_TEST_IS_REGULAR) == FALSE) { */
+               /*      g_message ("File '%s' missing for zone '%s'", filename, loc->zone); */
+               gtk_list_store_append(location_model, &iter);
+               /* g_print("%s %s", stationinfo->location, loc->zone); */
+               /* if (g_strcmp0(stationinfo->location, loc->zone)==0) { */
+               gtk_list_store_set(location_model,
+                                  &iter,
+                                  STATION_LOCATION,
+                                  loc->zone,
+                                  -1);
+               /* } */
+               retval = 1;
+       }
+       /*      stationinfo = stationinfo->next; */
+       /* }  */
+       gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(location_model));
+       gtk_widget_show(nameentry);
+       gtk_widget_show(locationentry);
+       gtk_widget_show(urientry);
+       gtk_widget_show(bandentry);
+       gtk_widget_show(descriptionentry);
+       gtk_widget_show(websiteentry);
+       gtk_container_add(GTK_CONTAINER(content_area), nameentry);
+       gtk_container_add(GTK_CONTAINER(content_area), locationentry);
+       gtk_container_add(GTK_CONTAINER(content_area), urientry);
+       gtk_container_add(GTK_CONTAINER(content_area), bandentry);
+       gtk_container_add(GTK_CONTAINER(content_area), descriptionentry);
+       gtk_container_add(GTK_CONTAINER(content_area), websiteentry);
+       /* g_signal_connect(G_OBJECT(station_selector), GTK_RESPONSE_ACCEPT, */
+       /*               G_CALLBACK(on_new_station_selector_changed), */
+       /*               NULL); */
+       g_object_set_data(G_OBJECT(station_selector), "station_location",
+                         (gpointer) gtk_entry_get_text(GTK_ENTRY(locationentry)));
+       g_object_set_data(G_OBJECT(station_selector), "station_name",
+                         (gpointer) gtk_entry_get_text(GTK_ENTRY(nameentry)));
+       g_object_set_data(G_OBJECT(station_selector), "station_uri",
+                         (gpointer) gtk_entry_get_text(GTK_ENTRY(urientry)));
+       g_object_set_data(G_OBJECT(station_selector), "station_band",
+                         (gpointer) gtk_entry_get_text(GTK_ENTRY(bandentry)));
+       g_object_set_data(G_OBJECT(station_selector), "station_description",
+                         (gpointer) gtk_entry_get_text(GTK_ENTRY(descriptionentry)));
+       g_object_set_data(G_OBJECT(station_selector), "station_website",
+                         (gpointer) gtk_entry_get_text(GTK_ENTRY(websiteentry)));
+
+#if 0 /* FIXME: Add input fields */
+       g_object_set_data(G_OBJECT(station_selector), "station_band",
+                         (gpointer) station_band);
+       g_object_set_data(G_OBJECT(station_selector), "station_description",
+                         (gpointer) station_description);
+       g_object_set_data(G_OBJECT(station_selector), "station_website",
+                         (gpointer) station_website);
+#endif
+       // gtk_widget_show(station_selector);
+       // g_free(label);
+       g_signal_connect(G_OBJECT(station_selector), "response",
+                        G_CALLBACK(gtk_widget_hide),
+                        (gpointer) station_selector);
+       g_signal_connect(G_OBJECT(station_selector), "delete-event",
+                        G_CALLBACK(gtk_widget_hide),
+                        (gpointer) station_selector);
+       tz_db_free (db);
+       g_free (pixmap_dir);
+       /* g_free (filename); */
+       /* g_free (path); */
+       return station_selector;
+}
+
 GtkWidget *create_streams_selector(char *selected_streams_uri,
                                    char *filename)
 {
diff --git a/src/girl-gui.h b/src/girl-gui.h
index 15494fc..d9cd708 100644
--- a/src/girl-gui.h
+++ b/src/girl-gui.h
@@ -6,6 +6,7 @@
 #include <libgnome/libgnome.h>
 
 GtkWidget *create_girl_app(void);
+
 GtkWidget *create_listeners_selector(char *selected_listener_uri,
                                     char *filename);
 GtkWidget *create_stations_selector(char *selected_station_uri,
@@ -14,4 +15,6 @@ GtkWidget *create_streams_selector(char *selected_streams_uri,
                                   char *filename);
 GtkWidget *create_search_selector(void);
 
+GtkWidget *create_new_station_selector(void);
+
 #endif /* GIRL_GUI_H */
diff --git a/src/girl-station.c b/src/girl-station.c
index 63ff08f..1ab2fe0 100644
--- a/src/girl-station.c
+++ b/src/girl-station.c
@@ -30,6 +30,7 @@
 #include <errno.h>
 #include <sys/resource.h>
 #include <glib.h>
+#include <glib/gstdio.h>
 #include <gtk/gtk.h>
 #include <libxml/xmlmemory.h>
 #include <libxml/parser.h>
@@ -611,3 +612,48 @@ GirlStationInfo *girl_station_load_from_file(GirlStationInfo * head,
 
        return curr;
 }
+
+gint girl_station_update (GirlStationInfo *head, gchar *station_band, gchar *station_description, gchar 
*station_name, gchar *station_location, gchar *station_uri, gchar *station_website) {
+
+       /* Open ~/.girl/girl.xml.  Parse structure.  Insert new item.  Save structure. */
+       GirlStationInfo *new_station;
+       GirlStationInfo *stationinfo;
+       GList *girl_local_stations = NULL;
+       gchar *local_station_uri, *local_station_name, *local_station_location, *local_station_band, 
*local_station_description, *local_station_website;
+       gchar *label, *world_station_xml_filename, *local_station_xml_file;
+       gchar *stations = g_strconcat(g_get_home_dir(), "/.girl/girl.xml", NULL);
+       GList *l = NULL;
+
+       stationinfo = girl_station_load_from_file(NULL, stations);
+
+       new_station = g_new0(GirlStationInfo, 1);
+       new_station->name = g_strdup(station_name);
+       new_station->band = g_strdup(station_band);
+       new_station->description = g_strdup(station_description);
+       new_station->location = g_strdup(station_location);
+       new_station->stream = g_new0(GirlStreamInfo, 1);
+       new_station->stream->uri = g_strdup(station_uri);
+       new_station->uri = g_strdup(station_website);
+       FILE *fp = g_fopen(stations, "w+");
+       g_fprintf(fp, "<?xml version='1.0' encoding='UTF-8'?>\n<!DOCTYPE girl SYSTEM 'girl-7.0.dtd'>\n<girl 
version='7.0'>\n");
+       // stationinfo-> = l->data;
+       while (stationinfo != NULL) {
+               local_station_uri = g_strdup(stationinfo->stream->uri);
+               local_station_name = g_strdup(stationinfo->name);
+               local_station_location = g_strdup(stationinfo->location);
+               local_station_band = g_strdup(stationinfo->band);
+               local_station_description = g_strdup(stationinfo->description);
+               local_station_website = g_strdup(stationinfo->uri);
+               /* FIXME: Save mime='audio/mp3' uri='%s' codec='MPEG 1 Audio, Layer 3 (MP3)' 
samplerate='24000 Hz' channels='Mono' bitrate='32 kbps' */
+               g_fprintf(fp, "  <station band=\"%s\" id=\"%s\" lang=\"en\" name=\"%s\" rank=\"1.0\" 
type=\"org\">\n    <frequency uri=\"%s\">%s in %s</frequency>\n    <location>%s</location>\n    <description 
lang=\"en\">%s</description>\n    <stream uri=\"%s\" />\n    <uri>%s</uri>\n  </station>\n", 
local_station_band, local_station_name, local_station_name, local_station_website, local_station_band, 
local_station_location, local_station_location, local_station_description, local_station_uri, 
local_station_website);
+               stationinfo = stationinfo->next;
+
+       }
+       g_fprintf(fp, "  <station band=\"%s\" id=\"%s\" lang=\"en\" name=\"%s\" rank=\"1.0\" type=\"org\">\n  
  <frequency uri=\"%s\">%s in %s</frequency>\n    <location>%s</location>\n    <description 
lang=\"en\">%s</description>\n    <stream uri=\"%s\" />\n    <uri>%s</uri>\n  </station>\n", 
new_station->band, new_station->name, new_station->name, new_station->uri, new_station->band, 
new_station->location, new_station->location, new_station->description, new_station->uri, new_station->uri);
+       g_fprintf(fp, "</girl>\n");
+       fclose(fp);
+       girl_stations = g_list_append(girl_stations, (GirlStationInfo *)new_station);
+       g_free(stations);
+       g_free(new_station);
+       g_free(stationinfo);
+}
diff --git a/src/girl-station.h b/src/girl-station.h
index 32ef72d..a8b3a71 100644
--- a/src/girl-station.h
+++ b/src/girl-station.h
@@ -83,4 +83,6 @@ GirlStationInfo *girl_station_load_from_http(GirlStationInfo * head,
                                             gpointer data);
 void girl_helper_run(char *url, char *name, GirlStreamType type, GirlHelperType girl);
 
+gint girl_station_update (GirlStationInfo *head, gchar *station_band, gchar *station_description, gchar 
*station_name, gchar *station_location, gchar *station_uri, gchar *station_website);
+
 #endif /* GIRL_STATION_H */
diff --git a/src/girl.c b/src/girl.c
index 5580a0e..d91e4fe 100644
--- a/src/girl.c
+++ b/src/girl.c
@@ -260,6 +260,65 @@ void on_next_station_click(GtkWidget * a, gpointer user_data)
        }
 }
 
+void on_new_station_clicked(GtkWidget *a,
+                           gpointer user_data)
+{
+       GtkWidget *station;
+       GirlStationInfo *stationinfo;
+       GList *l = g_list_first(girl_stations);
+
+       /* stationinfo = l->data; */
+       gint result;
+       // appbar_send_msg(_("New radio station"));
+       station = create_new_station_selector();
+       result = gtk_dialog_run (GTK_DIALOG(station));
+       switch (result)  {
+       case GTK_RESPONSE_ACCEPT:
+
+               g_print ("Squeak!\n\n");
+
+               girl->selected_station_uri =
+                       g_strdup(g_object_get_data(G_OBJECT(station), "station_uri"));
+               GIRL_DEBUG_MSG("on_new_station_select_changed: %s\n", girl->selected_station_uri);
+               girl->selected_station_description =
+                       g_strdup(g_object_get_data(G_OBJECT(station), "station_description"));
+               GIRL_DEBUG_MSG("on_new_station_select_changed: %s\n", girl->selected_station_description);
+
+                               girl->selected_station_band =
+                       g_strdup(g_object_get_data(G_OBJECT(station), "station_band"));
+               GIRL_DEBUG_MSG("on_new_station_select_changed: %s\n", girl->selected_station_band);
+
+                               girl->selected_station_website =
+                       g_strdup(g_object_get_data(G_OBJECT(station), "station_website"));
+               GIRL_DEBUG_MSG("on_new_station_select_changed: %s\n", girl->selected_station_website);
+               girl->selected_station_name =
+                       g_strdup(g_object_get_data(G_OBJECT(station), "station_name"));
+               GIRL_DEBUG_MSG("on_new_station_select_changed: %s\n",
+                              girl->selected_station_name);
+
+               girl->selected_station_location =
+                       g_strdup(g_object_get_data(G_OBJECT(station), "station_location"));
+               GIRL_DEBUG_MSG("on_new_station_select_changed: %s\n",
+                              girl->selected_station_location);
+
+               girl_station_update (stationinfo, girl->selected_station_band, 
girl->selected_station_description, girl->selected_station_name, girl->selected_station_location, 
girl->selected_station_uri, girl->selected_station_website);
+               break;
+       default:
+               g_print ("Nothing\n\n");
+               break;
+       }
+       gtk_widget_destroy(station);
+       /* gtk_widget_show(station); */
+
+}
+
+void on_new_station_selector_changed(GtkWidget *a,
+                                    gpointer user_data)
+{
+       GtkWidget *station;
+
+}
+
 void on_listeners_selector_button_clicked(GtkWidget * a,
                                          gpointer user_data)
 {
@@ -404,6 +463,55 @@ void on_stations_selector_changed(GtkWidget * a, gpointer user_data)
                        GIRL_STREAM_PLAYER);
 }
 
+void on_new_station_changed(GtkWidget * a, gpointer user_data)
+{
+       GirlStationInfo *stationinfo;
+       GList *l = g_list_first(girl_stations);
+       /* stationinfo = l->data; */
+
+       if (girl->selected_station_uri != NULL)
+               g_free(girl->selected_station_uri);
+
+       girl->selected_station_uri =
+           g_strdup(g_object_get_data(G_OBJECT(a), "station_uri"));
+       GIRL_DEBUG_MSG("on_new_station_changed: %s\n", girl->selected_station_uri);
+
+       girl->selected_station_name =
+           g_strdup(g_object_get_data(G_OBJECT(a), "station_name"));
+       GIRL_DEBUG_MSG("on_new_station_changed: %s\n",
+           girl->selected_station_name);
+
+       girl->selected_station_location =
+           g_strdup(g_object_get_data(G_OBJECT(a), "station_location"));
+       GIRL_DEBUG_MSG("on_new_station_changed: %s\n",
+           girl->selected_station_location);
+
+       girl->selected_station_band =
+           g_strdup(g_object_get_data(G_OBJECT(a), "station_band"));
+       GIRL_DEBUG_MSG("on_new_station_changed: %s\n",
+           girl->selected_station_band);
+
+       girl->selected_station_description =
+           g_strdup(g_object_get_data(G_OBJECT(a), "station_description"));
+       GIRL_DEBUG_MSG("on_new_station_changed: %s\n",
+           girl->selected_station_description);
+
+       appbar_send_msg(_("Selected the radio station %s in %s: %s"),
+                       girl->selected_station_name,
+                       girl->selected_station_location,
+                       girl->selected_station_uri,
+                       girl->selected_station_band);
+
+       girl_station_update(stationinfo, girl->selected_station_band, girl->selected_station_description, 
girl->selected_station_name,
+                         girl->selected_station_location,
+                         girl->selected_station_uri, girl->selected_station_website);
+
+       girl_helper_run(girl->selected_streams_uri,
+                       girl->selected_streams_mime,
+                       GIRL_STREAM_SHOUTCAST,
+                       GIRL_STREAM_PLAYER);
+}
+
 void on_streams_selector_button_clicked(GtkWidget * a, gpointer user_data)
 {
        gtk_widget_show(streams_selector);
@@ -452,6 +560,9 @@ void on_streams_selector_changed(GtkWidget * a, gpointer user_data)
 
 void quit_app(GtkWidget * a, gpointer user_data)
 {
+       /* GirlStationInfo *stationinfo; */
+       /* GList *l = g_list_first(girl_stations); */
+
        gnome_config_push_prefix("/girl/General/");
        gnome_config_set_string("selected_listener_uri",
                                girl->selected_listener_uri);
@@ -493,7 +604,8 @@ void quit_app(GtkWidget * a, gpointer user_data)
        if (GTK_IS_WIDGET(streams_selector)) {
                gtk_widget_destroy(streams_selector);
        }
-
+       // stationinfo = l->data;
+       // girl_station_save(stationinfo, NULL, NULL, NULL, NULL, NULL, NULL);
        gtk_main_quit();
 }
 
@@ -520,7 +632,12 @@ void about_app(GtkWidget * a, gpointer user_data)
                                        "Sveinn í Felli <sv1 fellsnet is> (Icelandic translation)\n"
                                        "Josef Andersson <josef andersson gmail com> (Swedish translation)\n"
                                        "Pedro Albuquerque <palbuquerque73 gmail com> (Portuguese 
translation)\n"
-                                       "Mario Blättermann <mario blaettermann gmail com> (German 
translation)\n"));
+                                       "Mario Blättermann <mario blaettermann gmail com> (German 
translation)\n"
+                                       "Necdet Yücel <necdetyucel gmail com> (Turkish translation)\n"
+                                       "Rafael Fontenelle <rffontenelle gmail com> (Brazilian Portuguese 
translation)\n"
+                                       "Andy Daniel Cruz Campos <god_of_war_2 hotmail com> (Spanish 
translation)\n"
+                                       "Mирослав Николић <miroslavnikolic rocketmail com> (Serbian 
translation)\n"
+                                             ));
        gchar* artists[] = { "Wiki Graphic Designer",
                             "Aly Raj",
                             "Mathilde Agostini",
diff --git a/src/girl.h b/src/girl.h
index 7de1653..627f543 100644
--- a/src/girl.h
+++ b/src/girl.h
@@ -81,6 +81,8 @@ void on_listen_button_clicked(GtkWidget * button, gpointer user_data);
 void on_record_button_clicked(GtkWidget * button, gpointer user_data);
 void on_stop_button_clicked(GtkWidget *a, gpointer user_data);
 void on_next_station_click(GtkWidget *, gpointer user_data);
+void on_new_station_clicked(GtkWidget *a, gpointer user_data);
+void on_new_station_selector_changed(GtkWidget *a, gpointer user_data);
 void on_previous_station_click(GtkWidget *, gpointer user_data);
 void on_listeners_selector_button_clicked(GtkWidget *, gpointer user_data);
 void on_listeners_selector_changed(GtkWidget * a, gpointer user_data);


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