Re: [gedit-list] Custom toolbar icons



Sam K. Raju wrote:
> Hi All,
>
> How can I add custom toolbar icons to the gEdit window in my gedit plugin?
>
> I defined the following string array for menu items and toolbar
> buttons in my plugin.
>
> const gchar submenu_macro[] =
> "<ui>"
> "  <menubar name='MenuBar'>"
> "    <menu name='ToolsMenu' action='Tools'>"
> "      <placeholder name='ToolsOps_3'>"
> "        <menu action='Macro'>"
> "          <menuitem action='StartRecordMacro'/>"
> "          <menuitem action='StopRecordMacro'/>"
> "          <menuitem action='PlaybackMacro'/>"
> "        </menu>"
> "      </placeholder>"
> "    </menu>"
> "  </menubar>"
> "  <toolbar name='ToolBar'>"
> "    <separator/>"
> "    <toolitem action='StartRecordMacro' icon='record-macro.png'/>"
> "    <toolitem action='StopRecordMacro' icon='stop-macro.png'/>"
> "    <toolitem action='PlaybackMacro' icon='play-macro.png'/>"
> "    <separator/>"
> "  </toolbar>"
> "</ui>";
>
> After compilation, the toolbar buttons are added but there is no icon
> on the buttons. How should I specify the icons for the toolbar buttons
> and where the icons files should be placed during the installation?
>   
You specify the icons when you define the actions (see the stock-id
property of the GtkAction). This way you can specify stock icons or
named theme icons. In addition, you can set the 'gicon' property of the
GtkAction after it's constructed.

What might be worth mentioning (looking at the names of the actions), is
that we're planning official support for macro's as a plugin in the
gedit core or gedit-plugins package. It would be cool to avoid double
work, maybe you're interested in some collaboration?


Jesse



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