changeset 2799:48550fe6723c

added user/password entryboxes
author Andrew O. Shadoura <bugzilla@tut.by>
date Sat, 05 Jul 2008 23:00:33 +0300
parents 5a10f297b7d0
children ea4e97a98914
files src/icecast/icecast.c
diffstat 1 files changed, 39 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/icecast/icecast.c	Sat Jul 05 21:34:32 2008 +0300
+++ b/src/icecast/icecast.c	Sat Jul 05 23:00:33 2008 +0300
@@ -28,6 +28,7 @@
 
 static GtkWidget *configure_win = NULL, *configure_vbox;
 static GtkWidget *addr_entry, *port_spin, *timeout_spin, *buffersize_spin, *bufferflush_spin;
+static GtkWidget *user_entry, *password_entry;
 static GtkWidget *configure_bbox, *configure_ok, *configure_cancel;
 static guint ice_tid=0;
 
@@ -69,6 +70,9 @@
 static gchar *server_address = NULL;
 static gint server_port=8000;
 
+static gchar *server_user = NULL;
+static gchar *server_password = NULL;
+
 VFSFile *output_file = NULL;
 guint64 written = 0;
 guint64 offset = 0;
@@ -160,6 +164,8 @@
     if (!bufferflushperc) bufferflushperc=80.0;
     bufferflush=(gint)(buffersize*bufferflushperc);
     bufferflush_new=bufferflush;
+    aud_cfg_db_get_string(db, "icecast", "server_user", &server_user);
+    aud_cfg_db_get_string(db, "icecast", "server_password", &server_password);
     aud_cfg_db_close(db);
 
     outputbuffer=g_try_malloc(buffersize);
@@ -491,6 +497,12 @@
     g_free(server_address);
     server_address = g_strdup(gtk_entry_get_text(GTK_ENTRY(addr_entry)));
 
+    g_free(server_user);
+    server_user = g_strdup(gtk_entry_get_text(GTK_ENTRY(user_entry)));
+
+    g_free(server_password);
+    server_password = g_strdup(gtk_entry_get_text(GTK_ENTRY(password_entry)));
+
     server_port = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(port_spin));
 
     ice_close_timeout = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(timeout_spin));
@@ -503,6 +515,8 @@
     db = aud_cfg_db_open();
     aud_cfg_db_set_int(db, "icecast", "streamformat", streamformat);
     aud_cfg_db_set_string(db, "icecast", "server_address", server_address);
+    aud_cfg_db_set_string(db, "icecast", "server_user", server_user);
+    aud_cfg_db_set_string(db, "icecast", "server_password", server_password);
     aud_cfg_db_set_int(db, "icecast", "server_port", server_port);
     aud_cfg_db_set_int(db, "icecast", "timeout", ice_close_timeout);
     aud_cfg_db_set_int(db, "icecast", "buffersize", buffersize_new);
@@ -609,6 +623,31 @@
         hbox = gtk_hbox_new(FALSE, 5);
         gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0);
 
+        label = gtk_label_new(_("User name:"));
+        gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+        user_entry = gtk_entry_new();
+
+	gtk_entry_set_text(GTK_ENTRY(user_entry), server_user);
+
+        gtk_box_pack_start(GTK_BOX(hbox), user_entry, TRUE, TRUE, 0);
+
+        label = gtk_label_new(_("Password:"));
+        gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+        password_entry = gtk_entry_new();
+
+	gtk_entry_set_text(GTK_ENTRY(password_entry), server_password);
+
+        gtk_entry_set_visibility(GTK_ENTRY(password_entry), FALSE);
+
+        gtk_box_pack_start(GTK_BOX(hbox), password_entry, TRUE, TRUE, 0);
+
+        gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
+
+        hbox = gtk_hbox_new(FALSE, 5);
+        gtk_box_pack_start(GTK_BOX(configure_vbox), hbox, FALSE, FALSE, 0);
+
         label = gtk_label_new(_("Connection timeout (seconds):"));
         gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);