1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*****************************************************************************
4 * $Id: preferences.c,v 1.1 2005/02/19 21:03:03 nedko Exp $
12 *****************************************************************************/
16 #include "../result.h"
17 #include "../libdb/libdb.h"
18 #include "../libfrontend/db.h"
19 #include "../libfrontend/disk.h"
20 #include "../libfrontend/conf.h"
24 on_preferences_window_button_cancel_activate(
28 gtk_widget_destroy(window
);
32 on_preferences_window_button_ok_activate(
39 r
= db_set_mysql_host(
41 GTK_ENTRY(get_glade_widget_child(window
, "preferences_window_notebook_mysql_host_entry"))));
43 r
= db_set_mysql_user(
45 GTK_ENTRY(get_glade_widget_child(window
, "preferences_window_notebook_mysql_user_entry"))));
47 r
= db_set_mysql_pass(
49 GTK_ENTRY(get_glade_widget_child(window
, "preferences_window_notebook_mysql_pass_entry"))));
51 r
= db_set_mysql_database(
53 GTK_ENTRY(get_glade_widget_child(window
, "preferences_window_notebook_mysql_db_entry"))));
55 r
= db_set_sqlite_database(
57 GTK_ENTRY(get_glade_widget_child(window
, "preferences_window_notebook_sqlite_dbfile_entry"))));
59 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(get_glade_widget_child(window
, "radiobutton_mysql"))))
64 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(get_glade_widget_child(window
, "radiobutton_sqlite"))))
69 disk_set_mount_command(
71 GTK_ENTRY(get_glade_widget_child(window
, "mount_cmd_entry"))));
73 disk_set_unmount_command(
75 GTK_ENTRY(get_glade_widget_child(window
, "unmount_cmd_entry"))));
79 GTK_ENTRY(get_glade_widget_child(window
, "mountdir_entry"))));
83 dialog
= gtk_message_dialog_new(
88 "Backend related settings changes will take effect when program is restarted.");
90 gtk_dialog_run(GTK_DIALOG(dialog
));
91 gtk_widget_destroy(dialog
);
93 gtk_widget_destroy(window
);
97 on_preferences_activate(
102 unsigned int nDBType
;
104 pref
= construct_glade_widget("preferences_window");
107 get_glade_widget_child(pref
, "preferences_window_button_cancel"),
109 G_CALLBACK(on_preferences_window_button_cancel_activate
), pref
);
112 get_glade_widget_child(pref
, "preferences_window_button_cancel"),
114 G_CALLBACK(on_preferences_window_button_cancel_activate
), pref
);
117 get_glade_widget_child(pref
, "preferences_window_button_ok"),
119 G_CALLBACK(on_preferences_window_button_ok_activate
), pref
);
122 get_glade_widget_child(pref
, "preferences_window_button_ok"),
124 G_CALLBACK(on_preferences_window_button_ok_activate
), pref
);
126 nDBType
= db_get_type();
127 if (nDBType
== MEDIADB_DBTYPE_MYSQL
)
129 gtk_toggle_button_set_active(
130 GTK_TOGGLE_BUTTON(get_glade_widget_child(pref
, "radiobutton_mysql")),
133 else if (nDBType
== MEDIADB_DBTYPE_SQLITE
)
135 gtk_toggle_button_set_active(
136 GTK_TOGGLE_BUTTON(get_glade_widget_child(pref
, "radiobutton_sqlite")),
141 GTK_ENTRY(get_glade_widget_child(pref
, "mount_cmd_entry")),
142 disk_get_mount_command());
145 GTK_ENTRY(get_glade_widget_child(pref
, "unmount_cmd_entry")),
146 disk_get_unmount_command());
149 GTK_ENTRY(get_glade_widget_child(pref
, "mountdir_entry")),
153 GTK_ENTRY(get_glade_widget_child(pref
, "preferences_window_notebook_mysql_host_entry")),
154 db_get_mysql_host());
157 GTK_ENTRY(get_glade_widget_child(pref
, "preferences_window_notebook_mysql_user_entry")),
158 db_get_mysql_user());
161 GTK_ENTRY(get_glade_widget_child(pref
, "preferences_window_notebook_mysql_pass_entry")),
162 db_get_mysql_pass());
165 GTK_ENTRY(get_glade_widget_child(pref
, "preferences_window_notebook_mysql_db_entry")),
166 db_get_mysql_database());
169 GTK_ENTRY(get_glade_widget_child(pref
, "preferences_window_notebook_sqlite_dbfile_entry")),
170 db_get_sqlite_database());
174 gtk_window_set_transient_for(
180 /*****************************************************************************
184 * !!! WARNING !!! Following lines are automatically updated by the CVS system.
186 * $Log: preferences.c,v $
187 * Revision 1.1 2005/02/19 21:03:03 nedko
188 * Implement preferences window.
190 *****************************************************************************/