[Pidgin] #3553: Code duplication reduction in gtkblist.c

Pidgin trac at pidgin.im
Sun Oct 14 19:15:42 EDT 2007


#3553: Code duplication reduction in gtkblist.c
--------------------------+-------------------------------------------------
 Reporter:  nix_nix       |       Type:  patch
   Status:  new           |   Priority:  minor
Component:  pidgin (gtk)  |    Version:  2.2.1
 Keywords:                |    Pending:  0    
--------------------------+-------------------------------------------------
 In the spirit of code duplication reduction, here's a patch that removes
 275 lines from gtkblist.c. There was a lot of copy-and-paste stuff in the
 implementation of "Add Buddy", "Add Chat", and "Join a Chat". I removed a
 lot of that.

 For example, I added a function called add_conf_row_to_vbox() which takes
 a vbox, a label, a size group, and a widget, produces an hbox with the
 label whose size is controlled by the size box and whose mnemonic
 activates the given widget, and appends it to the vbox. This has been the
 source of most of the duplication.

 I've also eliminated the difference between joinchat_rebuild_entries() and
 addchat_rebuild_entries(), leaving the new chat_rebuild_entries(). I've
 also unified joinchat_set_sensitive_if_input_cb() and
 addchat_set_sensitive_if_input_cb() which differed only in the type of
 data structure passed into them. I was able to do this by distilling a
 PidginChatData structure common to both "Add Chat" and "Join a Chat".

 The branch containing these changes is derived from im.pidgin.pidgin and
 is called org.maemo.garage.pidgin.pidgin.gtkblist-request-code-dup,
 available from the mtn server at idefix.go-nix.ca. I have added
 *@pidgin.im to the read-permissions file.

-- 
Ticket URL: <http://developer.pidgin.im/ticket/3553>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list