I want to add arbitrary item to Pidgin menu. Let it be Buddies → Show → Groups. I want it to be checkbutton (like Buddies → Show → Empty Groups) with custom function associated. How can I do this?
相关问题
- Multiple sockets for clients to connect to
- What is the best way to do a search in a large fil
- glDrawElements only draws half a quad
- Index of single bit in long integer (in C) [duplic
- Equivalent of std::pair in C
Pidgin-3.0.0
There are some changes in the way which Pidgin generates menu in 3.0.0 version. First, there is new array
GtkToggleActionEntry blist_menu_toggle_entries[]
. You need to add thereafter
And, there is
static const char *blist_menu
. You need to addafter
Then follow the instructions from this answer skipping the very first.
The following example is for Pidgin version 2.10.9. I believe there are not many changes in 3.0.0 (current development branch) so it will be applicable there too with minimal modifications.
First of all, download Pidgin sources. In Ubuntu this is done simply by running
Which will fetch libpurple, pidgin and finch sources. Then go into
pidgin-2.10.9/pidgin/gtkblist.c
and find the lineThere you will see Gtk menu in text. Add the following line:
after
You can see that the line added is just the analog of after which it was added. The 3rd array member is the function responsible for updating menu item status.
Next, add the function you just specified,
pidgin_blist_show_groups_cb
. You can do it finding thepidgin_blist_show_empty_groups_cb
and copying it's contents.Also, you need to set item status on startup. Find the function
and add
after
The adding preference
"/blist/show_groups"
as well as adding callback to it is explained in How do I add custom preference into Pidgin?. To test your changes, compile and install pidgin: