diff -r 7174e23f7617 -r 9612496070ae maemo-ui/src/mmyth_uisettings.c --- a/maemo-ui/src/mmyth_uisettings.c Thu Sep 28 16:02:14 2006 +0100 +++ b/maemo-ui/src/mmyth_uisettings.c Thu Jan 04 21:16:44 2007 +0000 @@ -9,7 +9,7 @@ #include "mmyth_uisettings.h" -#include "gmyth_context.h" +#include static GtkWidget *settings_dialog; static GtkWidget *entry_hostname; @@ -19,12 +19,13 @@ static GtkWidget *entry_port; static void settings_dialog_update_data (void); -static GtkWidget* add_entry_to_table (GtkWidget *table, GString *init_str, +static GtkWidget* add_entry_to_table (GtkWidget *table, const gchar *init_str, guint pos_left, guint pos_right, guint pos_top, guint pos_bottom); static GtkWidget* add_label_to_table (GtkWidget *table, const gchar *str, guint pos_left, guint pos_right, guint pos_top, guint pos_bottom); - +static GMythBackendInfo *backend_info = NULL; + gboolean mmyth_uisettings_run (GtkWindow *main_window) { @@ -33,7 +34,8 @@ GtkWidget *label_hostname, *label_dbname; GtkWidget *label_username, *label_passwd, *label_port; - GMythSettings *msettings = gmyth_context_get_settings(); + backend_info = gmyth_backend_info_new_full( "192.168.1.109", "mythtv", + "mythtv", "mythconverg", 6543 ); settings_dialog = gtk_dialog_new_with_buttons ("Settings", main_window, @@ -72,24 +74,20 @@ label_port = add_label_to_table (settings_table, "Server port:", 0, 1, 4, 5); entry_hostname = add_entry_to_table (settings_table, - gmyth_settings_get_backend_hostname (msettings), + gmyth_backend_info_get_hostname (backend_info), 1, 2, 0, 1); entry_dbname = add_entry_to_table (settings_table, - gmyth_settings_get_dbname (msettings), + gmyth_backend_info_get_db_name (backend_info), 1, 2, 1, 2 ); entry_username = add_entry_to_table (settings_table, - gmyth_settings_get_username (msettings), + gmyth_backend_info_get_username (backend_info), 1, 2, 2, 3 ); entry_passwd = add_entry_to_table (settings_table, - gmyth_settings_get_password (msettings), + gmyth_backend_info_get_password (backend_info), 1, 2, 3, 4 ); - GString *str_port = g_string_new (""); - g_string_printf (str_port, "%d", - gmyth_settings_get_backend_port (msettings)); - entry_port = add_entry_to_table (settings_table, str_port, + entry_port = add_entry_to_table (settings_table, g_strdup_printf( "%d", gmyth_backend_info_get_port (backend_info) ), 1, 2, 4, 5 ); - g_string_free (str_port, TRUE); if (gtk_dialog_run (GTK_DIALOG (settings_dialog)) == GTK_RESPONSE_ACCEPT) { settings_dialog_update_data (); @@ -120,7 +118,7 @@ } static GtkWidget* -add_entry_to_table (GtkWidget *table, GString *init_str, guint pos_left, guint pos_right, +add_entry_to_table (GtkWidget *table, const gchar *init_str, guint pos_left, guint pos_right, guint pos_top, guint pos_bottom) { GtkWidget *tmp_entry = gtk_entry_new (); @@ -130,7 +128,7 @@ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); if (init_str) - gtk_entry_set_text (GTK_ENTRY (tmp_entry), (init_str->str)); + gtk_entry_set_text (GTK_ENTRY (tmp_entry), init_str); //gtk_entry_set_invisible_char (GTK_ENTRY (entry_port), 9679); @@ -141,29 +139,24 @@ settings_dialog_update_data (void) { GString *tmp_entry_text; - GMythSettings *msettings = gmyth_context_get_settings(); + //GMythSettings *backend_info = gmyth_context_get_settings(); - if (!msettings) { + if (!backend_info) { g_warning ("[%s] Could not get GMythSettings instance from context\n", __FUNCTION__); return; } - tmp_entry_text = g_string_new(""); - g_string_printf(tmp_entry_text, "%s", gtk_entry_get_text( GTK_ENTRY(entry_hostname))); - gmyth_settings_set_backend_hostname(msettings, tmp_entry_text); + gmyth_backend_info_set_hostname(backend_info, gtk_entry_get_text( GTK_ENTRY(entry_hostname) )); - g_string_printf(tmp_entry_text, "%s", gtk_entry_get_text( GTK_ENTRY(entry_dbname))); - gmyth_settings_set_dbname(msettings, tmp_entry_text); + gmyth_backend_info_set_db_name(backend_info, gtk_entry_get_text( GTK_ENTRY(entry_dbname))); - g_string_printf(tmp_entry_text, "%s", gtk_entry_get_text( GTK_ENTRY(entry_username))); - gmyth_settings_set_username(msettings, tmp_entry_text); + gmyth_backend_info_set_username(backend_info, gtk_entry_get_text( GTK_ENTRY(entry_username))); + + gmyth_backend_info_set_password(backend_info, gtk_entry_get_text( GTK_ENTRY(entry_passwd))); - g_string_printf(tmp_entry_text, "%s", gtk_entry_get_text( GTK_ENTRY(entry_passwd))); - gmyth_settings_set_password(msettings, tmp_entry_text); + gmyth_backend_info_set_port(backend_info, (gint)g_ascii_strtoull( gtk_entry_get_text( GTK_ENTRY(entry_port) ), + NULL, 10) ); - g_string_printf(tmp_entry_text, "%s", gtk_entry_get_text( GTK_ENTRY(entry_port))); - gmyth_settings_set_backend_port(msettings, atoi(tmp_entry_text->str)); - - gmyth_settings_save (msettings); + //gmyth_backend_info_save (backend_info); }