[Rhythmbox-devel] new source interface



Hello,

So now that netRhythmbox 0.4.5 is out, I'd like to start working on a
codebase merge, to implement our agreed-upon new UI:
http://nl.linux.org/~jorn/Files/f.png

We need a middle-ground between the current library-only Rhythmbox HEAD
and the views of netrb.  What I am envisioning right now is an abstract
RBSource class.  This would contain a main RBNodeView, and also the
other node views (like Artist/Album/Genre).  

Now, each different source (library/iradio/CD), would derive from
RBSource, and override/implement what it needs.  

Then the shell would just have a list of different sources; we'd merge
rb-shell.c and rb-shell-player.c, and drop menu merging and all that
stuff.

I've hacked up an rb-source.h file to demonstrate what I'm thinking the
interface would look like.

Any opinions?

/*
 *  Copyright (C) 2002 Jorn Baayen <jorn@nl.linux.org>
 *  Copyright (C) 2003 Colin Walters <walters@gnu.org>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 *  $Id: rb-view.h,v 1.8 2002/09/07 13:55:47 jbaayen Exp $
 */

#ifndef __RB_SOURCE_H
#define __RB_SOURCE_H

#include <gtk/gtkhbox.h>

#include "monkey-media.h"

G_BEGIN_DECLS

#define RB_TYPE_SOURCE         (rb_source_get_type ())
#define RB_SOURCE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_SOURCE, RBSource))
#define RB_SOURCE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), RB_TYPE_SOURCE, RBSourceClass))
#define RB_IS_SOURCE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), RB_TYPE_SOURCE))
#define RB_IS_SOURCE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_SOURCE))
#define RB_SOURCE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_SOURCE, RBSourceClass))

typedef struct RBSourcePrivate RBSourcePrivate;

typedef struct
{
	GtkHBox parent;

	RBSourcePrivate *priv;
} RBSource;

typedef struct
{
	GtkHBoxClass parent;
	
	/* signals */
	void		(*status_changed)	(RBSource *source);

	/* methods */
	const char *(*impl_get_description)	(RBSource *source);

	GList      *(*impl_get_selection)	(RBSource *source);

	const char *(*impl_get_status)		(RBSource *status);

	gboolean    (*impl_can_pause)		(RBSource *source);
	gboolean    (*impl_handle_eos)		(RBSource *player);
	void	    (*impl_got_streaminfo)	(RBViewPlayer *player,
						 MonkeyMediaStreamInfoField field,
						 GValue *value);
	const char *(*impl_get_title)		(RBViewPlayer *player);

	gboolean    (*impl_have_artist_album)	(RBViewPlayer *player);
	const char *(*impl_get_artist)		(RBViewPlayer *player);
	const char *(*impl_get_album)		(RBViewPlayer *player);
	gboolean    (*impl_have_url)		(RBViewPlayer *player);
	void	    (*impl_get_url)		(RBViewPlayer *player, char **text, char **url);
	const char *(*impl_get_song)		(RBViewPlayer *player);

} RBSourceClass;

GType		 rb_source_get_type		(void);

const char	*rb_source_get_description	(RBSource *source);

void		 rb_source_deleted		(RBSource *source);

GList		*rb_source_get_selection	(RBSource *source);

const char 	*rb_source_get_status		(RBSource *source);

gboolean	 rb_source_can_pause		(RBSource *source);
gboolean	 rb_source_handle_eos		(RBSource *player);
void		 rb_source_got_streaminfo	(RBViewPlayer *player,
						 MonkeyMediaStreamInfoField field,
						 GValue *value);
const char 	*rb_source_get_title		(RBViewPlayer *player);

gboolean	 rb_source_have_artist_album	(RBViewPlayer *player);
const char      *rb_source_get_artist		(RBViewPlayer *player);
const char 	*rb_source_get_album		(RBViewPlayer *player);
gboolean	 rb_source_have_url		(RBViewPlayer *player);
void		 rb_source_get_url		(RBViewPlayer *player, char **text, char **url);
const char 	*rb_source_get_song		(RBViewPlayer *player);

void		 rb_source_notify_changed	(RBSource *source);

RBNodeView	*rb_source_get_node_view	(RBSource *source);

G_END_DECLS

#endif /* __RB_SOURCE_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]