Callback cleverness in window-main.c or just old cruft?

Robert Graham Merkel rgmerk@mira.net
Wed, 29 Nov 2000 15:17:09 +1100


Is there something incredibly clever going on here that I'm not
understanding, or is this code just crufty:

src/gnome/window-main.c:

static void
gnc_account_cb(GNCMainWinAccountList *tree, Account *account, gpointer
data)
/* why the extra argument */
{
  gboolean sensitive;

  account = gnc_mainwin_account_list_get_current_account(tree);
  sensitive = account != NULL;

  gnc_account_set_sensititives(gnc_get_main_info(), sensitive);
}

void 
mainWindow()
{
 . . . 
gtk_signal_connect(GTK_OBJECT(main_info->account_tree), "unselect_account",
                     GTK_SIGNAL_FUNC(gnc_account_cb), NULL);
/* cast required here because of it */
. . . 
}


src/gnome/account-tree.c (gnc_account_tree_init):


account_tree_signals[ACTIVATE_ACCOUNT] =
    gtk_signal_new("activate_account",
		   GTK_RUN_FIRST,
		   object_class->type,
		   GTK_SIGNAL_OFFSET(GNCAccountTreeClass,
				     activate_account),
		   gtk_marshal_NONE__POINTER,
		   GTK_TYPE_NONE, 1,
		   GTK_TYPE_POINTER);

------------------------------------------------------------
Robert Merkel	                           rgmerk@mira.net

"We are excited and optimistic about its usage going 
forward and, yes, we can teach penguins the military 
close-order drill", Mark Norton, US Department of Defense. 
------------------------------------------------------------