Whoops, I forgot to include the two repeat-one play order files in the
diff...

On Sat, Jul 11, 2009 at 2:36 AM, giopas <[email protected]> wrote:

> Hi Brian,
>
> On Sat, Jul 11, 2009 at 9:22 AM, Brian Nguyen <[email protected]> wrote:
>
>> I've always been somewhat annoyed that Rhythmbox didn't come with a repeat
>> one feature built into the GUI, so I went ahead and patched the current
>> source from git (0.12.3) to provide one. This patch replaces the Repeat
>> toggle action with a Repeat action that switches between Repeat Off, Repeat
>> All, and Repeat One. It uses modified code from the previous Repeat One
>> patch in order to actually implement the repeat one play order: 
>> http://www.mail-archive.cBrian
>> Nguyen 
>> <[email protected]>om/[email protected]/msg01669.html<http://www.mail-archive.com/[email protected]/msg01669.html>
>
>
> Even if usually the way to repeat a single song in loop is just to create a
> new playlist or filter by artist, album and song, personally I think it's a
> good idea implement this multi-button, because it makes Rb more
> user-friendly.
>
> What Jonathan, Christophe and others  think about it?
>
> enjoy, ;)
> giopas
>
> _______________________________________________
> rhythmbox-devel mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/rhythmbox-devel
>
>


-- 
Brian Nguyen
[email protected]
/* 
 *  arch-tag: Implementation of loop one navigation method
 *
 *  Copyright (C) 2003 Jeffrey Yasskin <[email protected]>
 *
 *  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.
 *
 */

#include "rb-play-order-linear-loop-one.h"

#include "rb-debug.h"
#include "rb-preferences.h"
#include "eel-gconf-extensions.h"

static void rb_linear_play_order_loop_one_class_init (RBLinearPlayOrderLoopOneClass *klass);

static RhythmDBEntry* rb_linear_play_order_loop_one_get_next (RBPlayOrder* method);
static RhythmDBEntry* rb_linear_play_order_loop_one_get_previous (RBPlayOrder* method);

GType
rb_linear_play_order_loop_one_get_type (void)
{
	static GType rb_linear_play_order_loop_one_type = 0;

	if (rb_linear_play_order_loop_one_type == 0)
	{
		static const GTypeInfo our_info =
		{
			sizeof (RBLinearPlayOrderLoopOneClass),
			NULL,
			NULL,
			(GClassInitFunc) rb_linear_play_order_loop_one_class_init,
			NULL,
			NULL,
			sizeof (RBLinearPlayOrderLoopOne),
			0,
			NULL
		};

		rb_linear_play_order_loop_one_type = g_type_register_static (RB_TYPE_PLAY_ORDER,
				"RBLinearPlayOrderLoopOne",
				&our_info, 0);
	}

	return rb_linear_play_order_loop_one_type;
}

RBPlayOrder *
rb_linear_play_order_loop_one_new (RBShellPlayer *player)
{
	RBLinearPlayOrderLoopOne *lorder;

	lorder = g_object_new (RB_TYPE_LINEAR_PLAY_ORDER_LOOP_ONE,
			       "player", player,
			       NULL);

	return RB_PLAY_ORDER (lorder);
}

static void
rb_linear_play_order_loop_one_class_init (RBLinearPlayOrderLoopOneClass *klass)
{
	RBPlayOrderClass *porder = RB_PLAY_ORDER_CLASS (klass);
	porder->get_next = rb_linear_play_order_loop_one_get_next;
	porder->get_previous = rb_linear_play_order_loop_one_get_previous;
}

static RhythmDBEntry* 
rb_linear_play_order_loop_one_get_next (RBPlayOrder* porder)
{
    RhythmDBQueryModel *model;
	RhythmDBEntry *entry;

	g_return_val_if_fail (porder != NULL, NULL);
	g_return_val_if_fail (RB_IS_LINEAR_PLAY_ORDER_LOOP_ONE (porder), NULL);

	model = rb_play_order_get_query_model(porder);
	/* Does this interfere with starting from not playing? */
	if (model == NULL)
		return NULL;

    g_object_get( porder, "playing-entry", &entry, NULL);

	if (entry == NULL) {
        /* loop back to (or start from) the first entry */
        GtkTreeIter iter;
        if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter))
            return NULL;
        return rhythmdb_query_model_iter_to_entry (model, &iter);
	}

	return entry;
}

static RhythmDBEntry*
rb_linear_play_order_loop_one_get_previous (RBPlayOrder* porder)
{
        return rb_linear_play_order_loop_one_get_next (porder);
}
/* 
 *  arch-tag: Header for loop one navigation method
 *
 *  Copyright (C) 2003 Jeffrey Yasskin <[email protected]>
 *
 *  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.
 *
 */

#ifndef __RB_PLAY_ORDER_LINEAR_LOOP_ONE_H
#define __RB_PLAY_ORDER_LINEAR_LOOP_ONE_H

#include "rb-play-order.h"

#include "rb-shell-player.h"

G_BEGIN_DECLS

#define RB_TYPE_LINEAR_PLAY_ORDER_LOOP_ONE         (rb_linear_play_order_loop_one_get_type ())
#define RB_LINEAR_PLAY_ORDER_LOOP_ONE(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_LINEAR_PLAY_ORDER_LOOP_ONE, RBLinearPlayOrderLoopOne))
#define RB_LINEAR_PLAY_ORDER_LOOP_ONE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), RB_TYPE_LINEAR_PLAY_ORDER_LOOP_ONE, RBLinearPlayOrderLoopOneClass))
#define RB_IS_LINEAR_PLAY_ORDER_LOOP_ONE(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), RB_TYPE_LINEAR_PLAY_ORDER_LOOP_ONE))
#define RB_IS_LINEAR_PLAY_ORDER_LOOP_ONE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_LINEAR_PLAY_ORDER_LOOP_ONE))
#define RB_LINEAR_PLAY_ORDER_LOOP_ONE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_LINEAR_PLAY_ORDER_LOOP_ONE, RBLinearPlayOrderLoopOneClass))

typedef struct
{
	RBPlayOrder parent;
} RBLinearPlayOrderLoopOne;

typedef struct
{
	RBPlayOrderClass parent_class;
} RBLinearPlayOrderLoopOneClass;

GType			rb_linear_play_order_loop_one_get_type	(void);

RBPlayOrder *		rb_linear_play_order_loop_one_new	(RBShellPlayer *player);

G_END_DECLS

#endif /* __RB_PLAY_ORDER_LINEAR_LOOP_ONE_H */
_______________________________________________
rhythmbox-devel mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/rhythmbox-devel

Reply via email to