Re: db.entry_get changes for plugins

Pablo Carranza <[email protected]>
Newsgroups gmane.comp.gnome.apps.rhythmbox.devel
Message-ID <CAD+9R3QWfqeu7cwAKQ95OaoRwv_3JoSxnTiZ9=u7yz6Fwy_3sw@mail.gmail.com>
This is the way i've found, I'm facing the same problem:

    def some_method()
        return self.get_value(entry, RB.RhythmDBPropType.ENTRY_ID)


    def get_value(self, entry, property_type):

        t = self.db.get_property_type(property_type)
        value = GObject.Value()
        value.init(t)

        self.db.entry_get(entry, property_type, value)

        if t.name == 'gulong':
            return value.get_ulong()

        elif t.name == 'gchararray':
            return value.get_string()

        elif t.name == 'gboolean':
            return value.get_boolean()

        elif t.name == 'gboxed':
            return value.get_boxed()

        elif t.name == 'gchar':
            return value.get_char()

        elif t.name == 'gdouble':
            return value.get_double()

        elif t.name == 'genum':
            return value.get_enum()

        elif t.name == 'gflags':
            return value.get_flags()

        elif t.name == 'gfloat':
            return value.get_float()

        elif t.name == 'gint':
            return value.get_int()

        elif t.name == 'gint64':
            return value.get_int64()

        elif t.name == 'glong':
            return value.get_long()

        elif t.name == 'gobject':
            return value.get_object()

        elif t.name == 'gparam':
            return value.get_param()

        elif t.name == 'gpointer':
            return value.get_pointer()

        elif t.name == 'gstring':
            return value.get_string()

        elif t.name == 'guchar':
            return value.get_uchar()

        elif t.name == 'guint':
            return value.get_uint()

        elif t.name == 'guint64':
            return value.get_uint64()

        elif t.name == 'gvariant':
            return value.get_variant()

        else:
            self.warning('Unknown type %s' % t.name)
            return None


There sure is a better way to do it, but this one is working right now

https://bitbucket.org/jimcerberus/rhythmweb/src/1aecaaf32892/rbhandle/entry.py



On Thu, Nov 24, 2011 at 9:03 AM, Lachlan <[email protected]> wrote:

> So now that Debian testing is running git versions of Rhythmbox I've
> been updating my plugin.
>
> So far i have it activating and the menu items are populating which is
> awesome, now i just have to work out functionality
>
> from what i've found on the net it should be changing from one line to
> the next one:
> self.db.entry_get(db_entry, rhythmdb.PROP_ALBUM)
> self.db.entry_get(db_entry, RB.RhythmDBPropType.ALBUM)
>
> When i run this though i get told that entry_get() takes 4 arguments (3
> given)
>
> I think this has to do with self.db but i'm unsure about where to check.
>
> Lachlan
> _______________________________________________
> rhythmbox-devel mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/rhythmbox-devel
>



-- 
Pablo Carranza

_______________________________________________
rhythmbox-devel mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/rhythmbox-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.