static GtkWidget *
impl_get_config_widget (RBDisplayPage *page, RBShellPreferences *prefs)
{
	RBPodcastMainSource *source = RB_PODCAST_MAIN_SOURCE (page);
	RBPodcastManager *podcast_mgr;
	GtkBuilder *builder;
	GtkWidget *update_interval;
	GtkWidget *btn_file;
	GSettings *settings;
	char *download_dir;

	if (source->priv->config_widget)
		return source->priv->config_widget;

	builder = rb_builder_load ("podcast-prefs.ui", source);
	source->priv->config_widget = GTK_WIDGET (gtk_builder_get_object (builder, "podcast_vbox"));

	btn_file = GTK_WIDGET (gtk_builder_get_object (builder, "location_chooser"));
	gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (btn_file),
					      rb_music_dir (),
					      NULL);

	g_object_get (source,
		      "podcast-manager", &podcast_mgr,
		      NULL);
	download_dir = rb_podcast_manager_get_podcast_dir (podcast_mgr);

	gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (btn_file),
						 download_dir);
	g_object_unref (podcast_mgr);
	g_free (download_dir);

	g_signal_connect_object (btn_file,
				 "selection-changed",
				 G_CALLBACK (rb_podcast_main_source_btn_file_change_cb),
				 source, 0);

	update_interval = GTK_WIDGET (gtk_builder_get_object (builder, "update_interval"));
	g_object_set (update_interval, "id-column", 1, NULL);

	settings = g_settings_new (PODCAST_SETTINGS_SCHEMA);
	g_settings_bind (settings, PODCAST_DOWNLOAD_INTERVAL,
			 update_interval, "active-id",
			 G_SETTINGS_BIND_DEFAULT);
	g_object_unref (settings);

	return source->priv->config_widget;
}
Ejemplo n.º 2
0
static GtkWidget *
impl_get_config_widget (RBSource *asource, RBShellPreferences *prefs)
{
	RBPodcastMainSource *source = RB_PODCAST_MAIN_SOURCE (asource);
	RBPodcastManager *podcast_mgr;
	GtkBuilder *builder;
	GtkWidget *cb_update_interval;
	GtkWidget *btn_file;
	char *download_dir;

	if (source->priv->config_widget)
		return source->priv->config_widget;

	builder = rb_builder_load ("podcast-prefs.ui", source);
	source->priv->config_widget = GTK_WIDGET (gtk_builder_get_object (builder, "podcast_vbox"));

	btn_file = GTK_WIDGET (gtk_builder_get_object (builder, "location_chooser"));
	gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (btn_file),
					      rb_music_dir (),
					      NULL);

	g_object_get (source, "podcast-manager", &podcast_mgr, NULL);
	download_dir = rb_podcast_manager_get_podcast_dir (podcast_mgr);
	g_object_unref (podcast_mgr);

	gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (btn_file),
						 download_dir);
	g_free (download_dir);

	g_signal_connect (btn_file,
			  "selection-changed",
			  G_CALLBACK (rb_podcast_main_source_btn_file_change_cb),
			  CONF_STATE_PODCAST_DOWNLOAD_DIR);

	cb_update_interval = GTK_WIDGET (gtk_builder_get_object (builder, "cb_update_interval"));
	gtk_combo_box_set_active (GTK_COMBO_BOX (cb_update_interval),
				  eel_gconf_get_integer (CONF_STATE_PODCAST_DOWNLOAD_INTERVAL));
	g_signal_connect (cb_update_interval,
			  "changed",
			  G_CALLBACK (rb_podcast_main_source_cb_interval_changed_cb),
			  source);

	return source->priv->config_widget;
}