Hi,

I have written a plugin for rhythmbox which is working nicely however i
have need to add a button to the main toolbar ie next to the shuffle button
in the top icon bar.

I have tried shell.add_widget(button,RB.ShellUILocation.MAIN_TOP) which
adds a button but its displayed after the progress bar which is not ideal.

I have also tried using add_ui_from_string with code like below, however
with this method i am probably doing something wrong, ideally i would
prefer the first method as its much simpler to use standard gtk function,
but regardless anyone able to give me some pointers example code etc to
achieve what i am after ?

ui_definition = """
<ui>
    <toolbar name="ToolBar">
        <placeholder name="ToolBarPluginPlaceholder">
          <toolitem name="ToolBarWebRemote" action="ViewWebRemoteInfo"/>
        </placeholder>
    </toolbar>
</ui>"""


        uim = shell.props.ui_manager

        self.__ui_id = uim.add_ui_from_string(ui_definition)
        uim.ensure_update()

button=uim.get_widget('/ToolBar/ToolBarPluginPlaceholder/ToolBarWebRemote')
        action = Gtk.Action('ViewWebRemoteInfo','test','test','')
        #button=Gtk.Button('test')
        #button.show()

#self.object.add_widget(button,RB.ShellUILocation.MAIN_TOP,expand=False,
fill=False)

        self.__action_group = Gtk.ActionGroup(name='ViewWebRemoteInfo')
        self.__action_group.add_action(action)
        uim.insert_action_group(self.__action_group, -1)
_______________________________________________
rhythmbox-devel mailing list
rhythmbox-devel@gnome.org
https://mail.gnome.org/mailman/listinfo/rhythmbox-devel

Reply via email to