[svn r771] * Mencoder doesnt work well with "Transfer-Encoding: chunked".
* Put this method just for gmencoder
10 #include "mmyth_uisettings.h"
12 #include <gmyth/gmyth_backendinfo.h>
14 static GtkWidget *settings_dialog;
15 static GtkWidget *entry_hostname;
16 static GtkWidget *entry_dbname;
17 static GtkWidget *entry_username;
18 static GtkWidget *entry_passwd;
19 static GtkWidget *entry_port;
21 static void settings_dialog_update_data(void);
22 static GtkWidget *add_entry_to_table(GtkWidget * table,
23 const gchar * init_str,
24 guint pos_left, guint pos_right,
25 guint pos_top, guint pos_bottom);
26 static GtkWidget *add_label_to_table(GtkWidget * table, const gchar * str,
27 guint pos_left, guint pos_right,
28 guint pos_top, guint pos_bottom);
30 static GMythBackendInfo *backend_info = NULL;
33 mmyth_uisettings_run(GtkWindow * main_window)
36 GtkWidget *settings_table;
37 GtkWidget *label_hostname,
39 GtkWidget *label_username,
43 backend_info = gmyth_backend_info_new_full("localhost", "mythtv",
44 "mythtv", "mythconverg",
47 settings_dialog = gtk_dialog_new_with_buttons("Settings",
49 GTK_DIALOG_DESTROY_WITH_PARENT,
56 gtk_widget_set_size_request(settings_dialog, 400, 244);
59 * scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
60 * gtk_widget_show (scrolledwindow1); gtk_container_add (GTK_CONTAINER
61 * (window1), scrolledwindow1); gtk_scrolled_window_set_policy
62 * (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC,
65 * viewport1 = gtk_viewport_new (NULL, NULL); gtk_widget_show
66 * (viewport1); gtk_container_add (GTK_CONTAINER (scrolledwindow1),
67 * viewport1); gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport1),
71 // Creates the table and attach it to the settings dialog
72 settings_table = gtk_table_new(5, 2, FALSE);
73 gtk_widget_show(settings_table);
74 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(settings_dialog)->vbox),
75 settings_table, FALSE, TRUE, 0);
76 gtk_container_set_border_width(GTK_CONTAINER(settings_table), 3);
77 gtk_table_set_row_spacings(GTK_TABLE(settings_table), 5);
78 gtk_table_set_col_spacings(GTK_TABLE(settings_table), 10);
81 add_label_to_table(settings_table, "Host Name:", 0, 1, 0, 1);
83 add_label_to_table(settings_table, "Database Name:", 0, 1, 1, 2);
85 add_label_to_table(settings_table, "Username:", 0, 1, 2, 3);
87 add_label_to_table(settings_table, "Password:", 0, 1, 3, 4);
89 add_label_to_table(settings_table, "Server port:", 0, 1, 4, 5);
91 entry_hostname = add_entry_to_table(settings_table,
92 gmyth_backend_info_get_hostname
93 (backend_info), 1, 2, 0, 1);
95 add_entry_to_table(settings_table,
96 gmyth_backend_info_get_db_name(backend_info), 1,
99 add_entry_to_table(settings_table,
100 gmyth_backend_info_get_username(backend_info),
103 add_entry_to_table(settings_table,
104 gmyth_backend_info_get_password(backend_info),
108 add_entry_to_table(settings_table,
109 g_strdup_printf("%d",
110 gmyth_backend_info_get_port
111 (backend_info)), 1, 2, 4, 5);
113 if (gtk_dialog_run(GTK_DIALOG(settings_dialog)) == GTK_RESPONSE_ACCEPT) {
114 settings_dialog_update_data();
115 gtk_widget_destroy(settings_dialog);
119 gtk_widget_destroy(settings_dialog);
126 add_label_to_table(GtkWidget * table, const gchar * str, guint pos_left,
127 guint pos_right, guint pos_top, guint pos_bottom)
129 GtkWidget *tmp_label = gtk_label_new(str);
131 gtk_widget_show(tmp_label);
132 gtk_table_attach(GTK_TABLE(table), tmp_label,
133 pos_left, pos_right, pos_top, pos_bottom,
134 (GtkAttachOptions) (GTK_FILL),
135 (GtkAttachOptions) (0), 0, 0);
136 gtk_misc_set_alignment(GTK_MISC(tmp_label), 0, 0.5);
142 add_entry_to_table(GtkWidget * table, const gchar * init_str,
143 guint pos_left, guint pos_right, guint pos_top,
146 GtkWidget *tmp_entry = gtk_entry_new();
147 gtk_widget_show(tmp_entry);
148 gtk_table_attach(GTK_TABLE(table), tmp_entry,
149 pos_left, pos_right, pos_top, pos_bottom,
150 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
151 (GtkAttachOptions) (0), 0, 0);
153 gtk_entry_set_text(GTK_ENTRY(tmp_entry), init_str);
155 // gtk_entry_set_invisible_char (GTK_ENTRY (entry_port), 9679);
161 settings_dialog_update_data(void)
163 // GMythSettings *backend_info = gmyth_context_get_settings();
167 ("[%s] Could not get GMythSettings instance from context\n",
172 gmyth_backend_info_set_hostname(backend_info,
173 gtk_entry_get_text(GTK_ENTRY
176 gmyth_backend_info_set_db_name(backend_info,
177 gtk_entry_get_text(GTK_ENTRY
180 gmyth_backend_info_set_username(backend_info,
181 gtk_entry_get_text(GTK_ENTRY
184 gmyth_backend_info_set_password(backend_info,
185 gtk_entry_get_text(GTK_ENTRY
188 gmyth_backend_info_set_port(backend_info,
190 g_ascii_strtoull(gtk_entry_get_text
191 (GTK_ENTRY(entry_port)),
194 // gmyth_backend_info_save (backend_info);